@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use \EventEspresso\core\exceptions\SendMessageException; |
3 | 3 | |
4 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
5 | 5 | exit('NO direct script access allowed'); |
6 | 6 | |
7 | 7 | /** |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @return void |
280 | 280 | */ |
281 | 281 | public function enqueue_scripts_styles() { |
282 | - do_action( 'AHEE__EE_messenger__enqueue_scripts_styles'); |
|
282 | + do_action('AHEE__EE_messenger__enqueue_scripts_styles'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | |
350 | 350 | $this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure. Usually these affect things like font style, color, borders etc. In some cases the styles will also make minor layout changes.'); |
351 | 351 | |
352 | - $this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this ); |
|
352 | + $this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | * @return stdClass |
365 | 365 | */ |
366 | 366 | public function get_supports_labels() { |
367 | - if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) { |
|
367 | + if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) { |
|
368 | 368 | $this->_set_supports_labels_defaults(); |
369 | 369 | } |
370 | - return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this ); |
|
370 | + return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -387,10 +387,10 @@ discard block |
||
387 | 387 | * |
388 | 388 | * @return string path or url for the requested variation. |
389 | 389 | */ |
390 | - public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) { |
|
390 | + public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) { |
|
391 | 391 | $this->_tmp_pack = $pack; |
392 | - $variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters ); |
|
393 | - $variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path; |
|
392 | + $variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters); |
|
393 | + $variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path; |
|
394 | 394 | return $variation_path; |
395 | 395 | |
396 | 396 | } |
@@ -408,13 +408,13 @@ discard block |
||
408 | 408 | * @return array |
409 | 409 | */ |
410 | 410 | public function get_default_message_types() { |
411 | - $class = get_class( $this ); |
|
411 | + $class = get_class($this); |
|
412 | 412 | |
413 | 413 | //messenger specific filter |
414 | - $default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this ); |
|
414 | + $default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this); |
|
415 | 415 | |
416 | 416 | //all messengers filter |
417 | - $default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this ); |
|
417 | + $default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this); |
|
418 | 418 | return $default_types; |
419 | 419 | } |
420 | 420 | |
@@ -429,14 +429,14 @@ discard block |
||
429 | 429 | * @return array |
430 | 430 | */ |
431 | 431 | public function get_valid_message_types() { |
432 | - $class = get_class( $this ); |
|
432 | + $class = get_class($this); |
|
433 | 433 | |
434 | 434 | //messenger specific filter |
435 | 435 | //messenger specific filter |
436 | - $valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this ); |
|
436 | + $valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this); |
|
437 | 437 | |
438 | 438 | //all messengers filter |
439 | - $valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this ); |
|
439 | + $valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this); |
|
440 | 440 | return $valid_types; |
441 | 441 | } |
442 | 442 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * @access public |
451 | 451 | * @param array $new_config Whatever is put in here will reset the _validator_config property |
452 | 452 | */ |
453 | - public function set_validator_config( $new_config ) { |
|
453 | + public function set_validator_config($new_config) { |
|
454 | 454 | $this->_validator_config = $new_config; |
455 | 455 | } |
456 | 456 | |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | public function get_validator_config() { |
467 | 467 | $class = get_class($this); |
468 | 468 | |
469 | - $config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this ); |
|
470 | - $config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this ); |
|
469 | + $config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this); |
|
470 | + $config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this); |
|
471 | 471 | return $config; |
472 | 472 | } |
473 | 473 | |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | * @access public |
485 | 485 | * @return string content for page |
486 | 486 | */ |
487 | - public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) { |
|
488 | - return $this->_get_admin_page_content( $page, $action, $extra, $message_types ); |
|
487 | + public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) { |
|
488 | + return $this->_get_admin_page_content($page, $action, $extra, $message_types); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -495,20 +495,20 @@ discard block |
||
495 | 495 | * @param array $extra |
496 | 496 | * @return mixed|string |
497 | 497 | */ |
498 | - protected function _get_admin_content_events_edit( $message_types, $extra ) { |
|
498 | + protected function _get_admin_content_events_edit($message_types, $extra) { |
|
499 | 499 | //defaults |
500 | 500 | $template_args = array(); |
501 | 501 | $selector_rows = ''; |
502 | 502 | |
503 | 503 | //we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event. |
504 | - $event_id = isset( $extra['event'] ) ? $extra['event'] : NULL; |
|
504 | + $event_id = isset($extra['event']) ? $extra['event'] : NULL; |
|
505 | 505 | |
506 | - $template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php'; |
|
507 | - $template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php'; |
|
506 | + $template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php'; |
|
507 | + $template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php'; |
|
508 | 508 | |
509 | 509 | //array of template objects for global and custom (non-trashed) (but remember just for this messenger!) |
510 | 510 | $global_templates = EEM_Message_Template_Group::instance()->get_all( |
511 | - array( array( 'MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true ) ) |
|
511 | + array(array('MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true)) |
|
512 | 512 | ); |
513 | 513 | $templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event( |
514 | 514 | $event_id, |
@@ -517,55 +517,55 @@ discard block |
||
517 | 517 | 'MTP_is_active' => true |
518 | 518 | ) |
519 | 519 | ); |
520 | - $templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array(); |
|
520 | + $templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array(); |
|
521 | 521 | |
522 | 522 | //so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups) |
523 | - foreach ( $global_templates as $mtpgID => $mtpg ) { |
|
524 | - if ( $mtpg instanceof EE_Message_Template_Group ) { |
|
523 | + foreach ($global_templates as $mtpgID => $mtpg) { |
|
524 | + if ($mtpg instanceof EE_Message_Template_Group) { |
|
525 | 525 | //verify this message type is supposed to show on this page |
526 | 526 | $mtp_obj = $mtpg->message_type_obj(); |
527 | - if ( ! $mtp_obj instanceof EE_message_type ) { |
|
527 | + if ( ! $mtp_obj instanceof EE_message_type) { |
|
528 | 528 | continue; |
529 | 529 | } |
530 | - $mtp_obj->admin_registered_pages = (array)$mtp_obj->admin_registered_pages; |
|
531 | - if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) { |
|
530 | + $mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages; |
|
531 | + if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages)) { |
|
532 | 532 | continue; |
533 | 533 | } |
534 | 534 | $select_values = array(); |
535 | - $select_values[ $mtpgID ] = __( 'Global', 'event_espresso' ); |
|
536 | - $default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get( 'MTP_is_override' ) ? $mtpgID : null; |
|
535 | + $select_values[$mtpgID] = __('Global', 'event_espresso'); |
|
536 | + $default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : null; |
|
537 | 537 | //if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override. |
538 | - if ( ! $mtpg->get( 'MTP_is_override' ) ) { |
|
538 | + if ( ! $mtpg->get('MTP_is_override')) { |
|
539 | 539 | //any custom templates for this message type? |
540 | - $custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() ); |
|
541 | - foreach ( $custom_templates as $cmtpgID => $cmtpg ) { |
|
542 | - $select_values[ $cmtpgID ] = $cmtpg->name(); |
|
543 | - $default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value; |
|
540 | + $custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type()); |
|
541 | + foreach ($custom_templates as $cmtpgID => $cmtpg) { |
|
542 | + $select_values[$cmtpgID] = $cmtpg->name(); |
|
543 | + $default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value; |
|
544 | 544 | } |
545 | 545 | } |
546 | 546 | //if there is no $default_value then we set it as the global |
547 | - $default_value = empty( $default_value ) ? $mtpgID : $default_value; |
|
548 | - $edit_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value ), admin_url( 'admin.php' ) ); |
|
549 | - $create_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) ); |
|
550 | - $st_args[ 'mt_name' ] = ucwords( $mtp_obj->label[ 'singular' ] ); |
|
551 | - $st_args[ 'mt_slug' ] = $mtpg->message_type(); |
|
552 | - $st_args[ 'messenger_slug' ] = $this->name; |
|
553 | - $st_args[ 'selector' ] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' ); |
|
547 | + $default_value = empty($default_value) ? $mtpgID : $default_value; |
|
548 | + $edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php')); |
|
549 | + $create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php')); |
|
550 | + $st_args['mt_name'] = ucwords($mtp_obj->label['singular']); |
|
551 | + $st_args['mt_slug'] = $mtpg->message_type(); |
|
552 | + $st_args['messenger_slug'] = $this->name; |
|
553 | + $st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector'); |
|
554 | 554 | //note that message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates). |
555 | - $st_args[ 'create_button' ] = $mtpg->get( 'MTP_is_override' ) ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __( 'Create New Custom', 'event_espresso' ) . '</a>'; |
|
556 | - $st_args[ 'create_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ? $st_args[ 'create_button' ] : ''; |
|
557 | - $st_args[ 'edit_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ? '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __( 'Edit', 'event_espresso' ) . '</a>' : ''; |
|
558 | - $selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, true ); |
|
555 | + $st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>'; |
|
556 | + $st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template') ? $st_args['create_button'] : ''; |
|
557 | + $st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : ''; |
|
558 | + $selector_rows .= EEH_Template::display_template($template_row_path, $st_args, true); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | 562 | //if no selectors present then get out. |
563 | - if ( empty( $selector_rows ) ) { |
|
563 | + if (empty($selector_rows)) { |
|
564 | 564 | return ''; |
565 | 565 | } |
566 | 566 | |
567 | 567 | $template_args['selector_rows'] = $selector_rows; |
568 | - return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE ); |
|
568 | + return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | * @return array $this->_template_fields |
581 | 581 | */ |
582 | 582 | public function get_template_fields() { |
583 | - $template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this ); |
|
584 | - $template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this ); |
|
583 | + $template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this); |
|
584 | + $template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this); |
|
585 | 585 | return $template_fields; |
586 | 586 | } |
587 | 587 | |
@@ -595,9 +595,9 @@ discard block |
||
595 | 595 | * @param mixed $value |
596 | 596 | */ |
597 | 597 | protected function _set_template_value($item, $value) { |
598 | - if ( array_key_exists($item, $this->_template_fields) ) { |
|
599 | - $prop = '_' . $item; |
|
600 | - $this->{$prop}= $value; |
|
598 | + if (array_key_exists($item, $this->_template_fields)) { |
|
599 | + $prop = '_'.$item; |
|
600 | + $this->{$prop} = $value; |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
@@ -615,18 +615,18 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @throws SendMessageException |
617 | 617 | */ |
618 | - final public function send_message( $message, EE_message_type $message_type ) { |
|
618 | + final public function send_message($message, EE_message_type $message_type) { |
|
619 | 619 | try { |
620 | - $this->_validate_and_setup( $message ); |
|
620 | + $this->_validate_and_setup($message); |
|
621 | 621 | $this->_incoming_message_type = $message_type; |
622 | 622 | $response = $this->_send_message(); |
623 | - if ( $response instanceof WP_Error ) { |
|
624 | - EE_Error::add_error( $response->get_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
623 | + if ($response instanceof WP_Error) { |
|
624 | + EE_Error::add_error($response->get_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
625 | 625 | $response = false; |
626 | 626 | } |
627 | - } catch ( \Exception $e ) { |
|
627 | + } catch (\Exception $e) { |
|
628 | 628 | //convert to an instance of SendMessageException |
629 | - throw new SendMessageException( $e->getMessage() ); |
|
629 | + throw new SendMessageException($e->getMessage()); |
|
630 | 630 | } |
631 | 631 | return $response; |
632 | 632 | } |
@@ -640,28 +640,28 @@ discard block |
||
640 | 640 | * @param bool $send true we will actually use the _send method (for test sends). FALSE we just return preview |
641 | 641 | * @return string return the message html content |
642 | 642 | */ |
643 | - public function get_preview( EE_Message $message, EE_message_type $message_type, $send = false ) { |
|
644 | - $this->_validate_and_setup( $message ); |
|
643 | + public function get_preview(EE_Message $message, EE_message_type $message_type, $send = false) { |
|
644 | + $this->_validate_and_setup($message); |
|
645 | 645 | |
646 | 646 | $this->_incoming_message_type = $message_type; |
647 | 647 | |
648 | - if ( $send ) { |
|
648 | + if ($send) { |
|
649 | 649 | //are we overriding any existing template fields? |
650 | 650 | $settings = $this->get_existing_test_settings(); |
651 | - if ( ! empty( $settings ) ) { |
|
652 | - foreach ( $settings as $field => $value ) { |
|
653 | - $this->_set_template_value( $field, $value ); |
|
651 | + if ( ! empty($settings)) { |
|
652 | + foreach ($settings as $field => $value) { |
|
653 | + $this->_set_template_value($field, $value); |
|
654 | 654 | } |
655 | 655 | } |
656 | 656 | } |
657 | 657 | |
658 | 658 | //enqueue preview js so that any links/buttons on the page are disabled. |
659 | - if ( ! $send ) { |
|
659 | + if ( ! $send) { |
|
660 | 660 | // the below may seem like duplication. However, typically if a messenger enqueues scripts/styles, |
661 | 661 | // it deregisters all existing wp scripts and styles first. So the second hook ensures our previewer still gets setup. |
662 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 ); |
|
663 | - add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 ); |
|
664 | - add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 ); |
|
662 | + add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10); |
|
663 | + add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10); |
|
664 | + add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10); |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | return $send ? $this->_send_message() : $this->_preview(); |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | */ |
680 | 680 | public function add_preview_script() { |
681 | 681 | //error message |
682 | - EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup. To test generated links, you must trigger an actual message notification.', 'event_espresso' ); |
|
683 | - wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true ); |
|
684 | - wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
685 | - wp_enqueue_script( 'ee-messages-preview-js' ); |
|
682 | + EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup. To test generated links, you must trigger an actual message notification.', 'event_espresso'); |
|
683 | + wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true); |
|
684 | + wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings); |
|
685 | + wp_enqueue_script('ee-messages-preview-js'); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | * @param EE_Message $message |
694 | 694 | * @throws EE_Error |
695 | 695 | */ |
696 | - protected function _validate_and_setup( EE_Message $message ) { |
|
696 | + protected function _validate_and_setup(EE_Message $message) { |
|
697 | 697 | $template_pack = $message->get_template_pack(); |
698 | 698 | $variation = $message->get_template_pack_variation(); |
699 | 699 | |
700 | 700 | //verify we have the required template pack value on the $message object. |
701 | - if ( ! $template_pack instanceof EE_Messages_Template_Pack ) { |
|
702 | - throw new EE_Error( __('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso' ) ); |
|
701 | + if ( ! $template_pack instanceof EE_Messages_Template_Pack) { |
|
702 | + throw new EE_Error(__('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso')); |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | $this->_tmp_pack = $template_pack; |
@@ -708,11 +708,11 @@ discard block |
||
708 | 708 | |
709 | 709 | $template_fields = $this->get_template_fields(); |
710 | 710 | |
711 | - foreach ( $template_fields as $template => $value ) { |
|
712 | - if ( $template !== 'extra' ) { |
|
713 | - $column_value = $message->get_field_or_extra_meta( 'MSG_' . $template ); |
|
711 | + foreach ($template_fields as $template => $value) { |
|
712 | + if ($template !== 'extra') { |
|
713 | + $column_value = $message->get_field_or_extra_meta('MSG_'.$template); |
|
714 | 714 | $message_template_value = $column_value ? $column_value : null; |
715 | - $this->_set_template_value( $template, $message_template_value ); |
|
715 | + $this->_set_template_value($template, $message_template_value); |
|
716 | 716 | } |
717 | 717 | } |
718 | 718 | } |
@@ -727,19 +727,19 @@ discard block |
||
727 | 727 | * @return string |
728 | 728 | * @throws \EE_Error |
729 | 729 | */ |
730 | - protected function _get_main_template( $preview = FALSE ) { |
|
730 | + protected function _get_main_template($preview = FALSE) { |
|
731 | 731 | $type = $preview ? 'preview' : 'main'; |
732 | 732 | |
733 | - $wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type ); |
|
733 | + $wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type); |
|
734 | 734 | |
735 | 735 | //check file exists and is readable |
736 | - if ( !is_readable( $wrapper_template ) ) |
|
737 | - throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper. The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) ); |
|
736 | + if ( ! is_readable($wrapper_template)) |
|
737 | + throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper. The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template)); |
|
738 | 738 | |
739 | 739 | //add message type to template args |
740 | 740 | $this->_template_args['message_type'] = $this->_incoming_message_type; |
741 | 741 | |
742 | - return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE ); |
|
742 | + return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | |
@@ -775,9 +775,9 @@ discard block |
||
775 | 775 | */ |
776 | 776 | public function get_existing_test_settings() { |
777 | 777 | /** @var EE_Message_Resource_Manager $Message_Resource_Manager */ |
778 | - $Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
778 | + $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
779 | 779 | $settings = $Message_Resource_Manager->get_active_messengers_option(); |
780 | - return isset( $settings[ $this->name ]['test_settings'] ) ? $settings[ $this->name ]['test_settings'] : array(); |
|
780 | + return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array(); |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | |
@@ -789,12 +789,12 @@ discard block |
||
789 | 789 | * @param $settings |
790 | 790 | * @return bool success/fail |
791 | 791 | */ |
792 | - public function set_existing_test_settings( $settings ) { |
|
792 | + public function set_existing_test_settings($settings) { |
|
793 | 793 | /** @var EE_Message_Resource_Manager $Message_Resource_Manager */ |
794 | - $Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
794 | + $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
795 | 795 | $existing = $Message_Resource_Manager->get_active_messengers_option(); |
796 | - $existing[ $this->name ]['test_settings'] = $settings; |
|
797 | - return $Message_Resource_Manager->update_active_messengers_option( $existing ); |
|
796 | + $existing[$this->name]['test_settings'] = $settings; |
|
797 | + return $Message_Resource_Manager->update_active_messengers_option($existing); |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | |
@@ -807,21 +807,21 @@ discard block |
||
807 | 807 | * @param string $field The field to retrieve the label for |
808 | 808 | * @return string The label |
809 | 809 | */ |
810 | - public function get_field_label( $field ) { |
|
810 | + public function get_field_label($field) { |
|
811 | 811 | //first let's see if the field requests is in the top level array. |
812 | - if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) ) |
|
812 | + if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label'])) |
|
813 | 813 | return $this->_template[$field]['label']; |
814 | 814 | |
815 | 815 | //nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index. |
816 | - if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] ) ) |
|
816 | + if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label'])) |
|
817 | 817 | return $this->_template_fields['extra'][$field]['main']['label']; |
818 | 818 | |
819 | 819 | //now it's possible this field may just be existing in any of the extra array items. |
820 | - if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) { |
|
821 | - foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) { |
|
822 | - if ( !is_array( $subfields ) ) |
|
820 | + if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) { |
|
821 | + foreach ($this->_template_fields['extra'] as $main_field => $subfields) { |
|
822 | + if ( ! is_array($subfields)) |
|
823 | 823 | continue; |
824 | - if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) ) |
|
824 | + if (isset($subfields[$field]) && ! empty($subfields[$field]['label'])) |
|
825 | 825 | return $subfields[$field]['label']; |
826 | 826 | } |
827 | 827 | } |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | * |
843 | 843 | * @return void |
844 | 844 | */ |
845 | - public function do_secondary_messenger_hooks( $sending_messenger_name ) { |
|
845 | + public function do_secondary_messenger_hooks($sending_messenger_name) { |
|
846 | 846 | return; |
847 | 847 | } |
848 | 848 |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | * This just returns whatever is set as the _event object property |
1322 | 1322 | * |
1323 | 1323 | * //todo this will become obsolete once the models are in place |
1324 | - * @return object |
|
1324 | + * @return EE_Event |
|
1325 | 1325 | */ |
1326 | 1326 | public function get_event_object() { |
1327 | 1327 | return $this->_cpt_model_obj; |
@@ -2198,7 +2198,7 @@ discard block |
||
2198 | 2198 | |
2199 | 2199 | |
2200 | 2200 | /** |
2201 | - * @return mixed |
|
2201 | + * @return string |
|
2202 | 2202 | */ |
2203 | 2203 | protected function _category_details_content() { |
2204 | 2204 | $editor_args['category_desc'] = array( |
@@ -829,11 +829,11 @@ discard block |
||
829 | 829 | if ( ! empty( $id ) ) { |
830 | 830 | $post = get_post( $id ); |
831 | 831 | $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' |
832 | - . esc_html__( 'Shortcode', 'event_espresso' ) |
|
833 | - . '</a> '; |
|
832 | + . esc_html__( 'Shortcode', 'event_espresso' ) |
|
833 | + . '</a> '; |
|
834 | 834 | $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' |
835 | - . $post->ID |
|
836 | - . ']">'; |
|
835 | + . $post->ID |
|
836 | + . ']">'; |
|
837 | 837 | } |
838 | 838 | return $return; |
839 | 839 | } |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
1046 | 1046 | if ( ! empty( $dtt['DTT_ID'] ) ) { |
1047 | 1047 | $DTM = EE_Registry::instance() |
1048 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1048 | + ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | + ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1050 | 1050 | $DTM->set_date_format( $incoming_date_formats[0] ); |
1051 | 1051 | $DTM->set_time_format( $incoming_date_formats[1] ); |
1052 | 1052 | foreach ( $datetime_values as $field => $value ) { |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | ) > 0 ? true : false; |
1145 | 1145 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1146 | 1146 | $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
1147 | - && ! $TKT->get( |
|
1147 | + && ! $TKT->get( |
|
1148 | 1148 | 'TKT_deleted' |
1149 | 1149 | ) ? true : false; |
1150 | 1150 | $TKT->set_date_format( $incoming_date_formats[0] ); |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | $first_datetime = reset( $times ); |
1455 | 1455 | //do we get related tickets? |
1456 | 1456 | if ( $first_datetime instanceof EE_Datetime |
1457 | - && $first_datetime->ID() !== 0 |
|
1457 | + && $first_datetime->ID() !== 0 |
|
1458 | 1458 | ) { |
1459 | 1459 | $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
1460 | 1460 | $template_args['time'] = $first_datetime; |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1530 | 1530 | 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
1531 | 1531 | 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
1532 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1532 | + && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1533 | 1533 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1534 | 1534 | 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
1535 | 1535 | : ' disabled=disabled', |
@@ -1695,8 +1695,8 @@ discard block |
||
1695 | 1695 | $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
1696 | 1696 | $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
1697 | 1697 | $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
1698 | - ->setTime( 23, 59, 59 ) |
|
1699 | - ->format( implode( ' ', $start_formats ) ); |
|
1698 | + ->setTime( 23, 59, 59 ) |
|
1699 | + ->format( implode( ' ', $start_formats ) ); |
|
1700 | 1700 | $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
1701 | 1701 | } |
1702 | 1702 | if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | } |
1717 | 1717 | if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
1718 | 1718 | if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
1719 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1719 | + && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1720 | 1720 | ) { |
1721 | 1721 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1722 | 1722 | } |
@@ -2213,13 +2213,13 @@ discard block |
||
2213 | 2213 | protected function _template_settings() { |
2214 | 2214 | $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
2215 | 2215 | $this->_template_args['preview_img'] = '<img src="' |
2216 | - . EVENTS_ASSETS_URL |
|
2217 | - . DS |
|
2218 | - . 'images' |
|
2219 | - . DS |
|
2220 | - . 'caffeinated_template_features.jpg" alt="' |
|
2221 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2222 | - . '" />'; |
|
2216 | + . EVENTS_ASSETS_URL |
|
2217 | + . DS |
|
2218 | + . 'images' |
|
2219 | + . DS |
|
2220 | + . 'caffeinated_template_features.jpg" alt="' |
|
2221 | + . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2222 | + . '" />'; |
|
2223 | 2223 | $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
2224 | 2224 | 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', |
2225 | 2225 | 'event_espresso' |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ); |
64 | 64 | add_action( |
65 | 65 | 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', |
66 | - array( $this, 'verify_event_edit' ) |
|
66 | + array($this, 'verify_event_edit') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
@@ -79,22 +79,22 @@ discard block |
||
79 | 79 | $this->_admin_page_title = EVENTS_LABEL; |
80 | 80 | $this->_labels = array( |
81 | 81 | 'buttons' => array( |
82 | - 'add' => esc_html__( 'Add New Event', 'event_espresso' ), |
|
83 | - 'edit' => esc_html__( 'Edit Event', 'event_espresso' ), |
|
84 | - 'delete' => esc_html__( 'Delete Event', 'event_espresso' ), |
|
85 | - 'add_category' => esc_html__( 'Add New Category', 'event_espresso' ), |
|
86 | - 'edit_category' => esc_html__( 'Edit Category', 'event_espresso' ), |
|
87 | - 'delete_category' => esc_html__( 'Delete Category', 'event_espresso' ), |
|
82 | + 'add' => esc_html__('Add New Event', 'event_espresso'), |
|
83 | + 'edit' => esc_html__('Edit Event', 'event_espresso'), |
|
84 | + 'delete' => esc_html__('Delete Event', 'event_espresso'), |
|
85 | + 'add_category' => esc_html__('Add New Category', 'event_espresso'), |
|
86 | + 'edit_category' => esc_html__('Edit Category', 'event_espresso'), |
|
87 | + 'delete_category' => esc_html__('Delete Category', 'event_espresso'), |
|
88 | 88 | ), |
89 | 89 | 'editor_title' => array( |
90 | - 'espresso_events' => esc_html__( 'Enter event title here', 'event_espresso' ), |
|
90 | + 'espresso_events' => esc_html__('Enter event title here', 'event_espresso'), |
|
91 | 91 | ), |
92 | 92 | 'publishbox' => array( |
93 | - 'create_new' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
94 | - 'edit' => esc_html__( 'Update Event', 'event_espresso' ), |
|
95 | - 'add_category' => esc_html__( 'Save New Category', 'event_espresso' ), |
|
96 | - 'edit_category' => esc_html__( 'Update Category', 'event_espresso' ), |
|
97 | - 'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ), |
|
93 | + 'create_new' => esc_html__('Save New Event', 'event_espresso'), |
|
94 | + 'edit' => esc_html__('Update Event', 'event_espresso'), |
|
95 | + 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
|
96 | + 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
|
97 | + 'template_settings' => esc_html__('Update Settings', 'event_espresso'), |
|
98 | 98 | ), |
99 | 99 | ); |
100 | 100 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | //load formatter helper |
106 | 106 | //load field generator helper |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
109 | 109 | ? $this->_req_data['EVT_ID'] : 0; |
110 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
110 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
111 | 111 | $this->_page_routes = array( |
112 | 112 | 'default' => array( |
113 | 113 | 'func' => '_events_overview_list_table', |
@@ -130,27 +130,27 @@ discard block |
||
130 | 130 | ), |
131 | 131 | 'trash_event' => array( |
132 | 132 | 'func' => '_trash_or_restore_event', |
133 | - 'args' => array( 'event_status' => 'trash' ), |
|
133 | + 'args' => array('event_status' => 'trash'), |
|
134 | 134 | 'capability' => 'ee_delete_event', |
135 | 135 | 'obj_id' => $evt_id, |
136 | 136 | 'noheader' => true, |
137 | 137 | ), |
138 | 138 | 'trash_events' => array( |
139 | 139 | 'func' => '_trash_or_restore_events', |
140 | - 'args' => array( 'event_status' => 'trash' ), |
|
140 | + 'args' => array('event_status' => 'trash'), |
|
141 | 141 | 'capability' => 'ee_delete_events', |
142 | 142 | 'noheader' => true, |
143 | 143 | ), |
144 | 144 | 'restore_event' => array( |
145 | 145 | 'func' => '_trash_or_restore_event', |
146 | - 'args' => array( 'event_status' => 'draft' ), |
|
146 | + 'args' => array('event_status' => 'draft'), |
|
147 | 147 | 'capability' => 'ee_delete_event', |
148 | 148 | 'obj_id' => $evt_id, |
149 | 149 | 'noheader' => true, |
150 | 150 | ), |
151 | 151 | 'restore_events' => array( |
152 | 152 | 'func' => '_trash_or_restore_events', |
153 | - 'args' => array( 'event_status' => 'draft' ), |
|
153 | + 'args' => array('event_status' => 'draft'), |
|
154 | 154 | 'capability' => 'ee_delete_events', |
155 | 155 | 'noheader' => true, |
156 | 156 | ), |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | 'add_category' => array( |
187 | 187 | 'func' => '_category_details', |
188 | 188 | 'capability' => 'ee_edit_event_category', |
189 | - 'args' => array( 'add' ), |
|
189 | + 'args' => array('add'), |
|
190 | 190 | ), |
191 | 191 | 'edit_category' => array( |
192 | 192 | 'func' => '_category_details', |
193 | 193 | 'capability' => 'ee_edit_event_category', |
194 | - 'args' => array( 'edit' ), |
|
194 | + 'args' => array('edit'), |
|
195 | 195 | ), |
196 | 196 | 'delete_categories' => array( |
197 | 197 | 'func' => '_delete_categories', |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | ), |
206 | 206 | 'insert_category' => array( |
207 | 207 | 'func' => '_insert_or_update_category', |
208 | - 'args' => array( 'new_category' => true ), |
|
208 | + 'args' => array('new_category' => true), |
|
209 | 209 | 'capability' => 'ee_edit_event_category', |
210 | 210 | 'noheader' => true, |
211 | 211 | ), |
212 | 212 | 'update_category' => array( |
213 | 213 | 'func' => '_insert_or_update_category', |
214 | - 'args' => array( 'new_category' => false ), |
|
214 | + 'args' => array('new_category' => false), |
|
215 | 215 | 'capability' => 'ee_edit_event_category', |
216 | 216 | 'noheader' => true, |
217 | 217 | ), |
@@ -228,29 +228,29 @@ discard block |
||
228 | 228 | $this->_page_config = array( |
229 | 229 | 'default' => array( |
230 | 230 | 'nav' => array( |
231 | - 'label' => esc_html__( 'Overview', 'event_espresso' ), |
|
231 | + 'label' => esc_html__('Overview', 'event_espresso'), |
|
232 | 232 | 'order' => 10, |
233 | 233 | ), |
234 | 234 | 'list_table' => 'Events_Admin_List_Table', |
235 | 235 | 'help_tabs' => array( |
236 | 236 | 'events_overview_help_tab' => array( |
237 | - 'title' => esc_html__( 'Events Overview', 'event_espresso' ), |
|
237 | + 'title' => esc_html__('Events Overview', 'event_espresso'), |
|
238 | 238 | 'filename' => 'events_overview', |
239 | 239 | ), |
240 | 240 | 'events_overview_table_column_headings_help_tab' => array( |
241 | - 'title' => esc_html__( 'Events Overview Table Column Headings', 'event_espresso' ), |
|
241 | + 'title' => esc_html__('Events Overview Table Column Headings', 'event_espresso'), |
|
242 | 242 | 'filename' => 'events_overview_table_column_headings', |
243 | 243 | ), |
244 | 244 | 'events_overview_filters_help_tab' => array( |
245 | - 'title' => esc_html__( 'Events Overview Filters', 'event_espresso' ), |
|
245 | + 'title' => esc_html__('Events Overview Filters', 'event_espresso'), |
|
246 | 246 | 'filename' => 'events_overview_filters', |
247 | 247 | ), |
248 | 248 | 'events_overview_view_help_tab' => array( |
249 | - 'title' => esc_html__( 'Events Overview Views', 'event_espresso' ), |
|
249 | + 'title' => esc_html__('Events Overview Views', 'event_espresso'), |
|
250 | 250 | 'filename' => 'events_overview_views', |
251 | 251 | ), |
252 | 252 | 'events_overview_other_help_tab' => array( |
253 | - 'title' => esc_html__( 'Events Overview Other', 'event_espresso' ), |
|
253 | + 'title' => esc_html__('Events Overview Other', 'event_espresso'), |
|
254 | 254 | 'filename' => 'events_overview_other', |
255 | 255 | ), |
256 | 256 | ), |
@@ -265,218 +265,218 @@ discard block |
||
265 | 265 | ), |
266 | 266 | 'create_new' => array( |
267 | 267 | 'nav' => array( |
268 | - 'label' => esc_html__( 'Add Event', 'event_espresso' ), |
|
268 | + 'label' => esc_html__('Add Event', 'event_espresso'), |
|
269 | 269 | 'order' => 5, |
270 | 270 | 'persistent' => false, |
271 | 271 | ), |
272 | - 'metaboxes' => array( '_register_event_editor_meta_boxes' ), |
|
272 | + 'metaboxes' => array('_register_event_editor_meta_boxes'), |
|
273 | 273 | 'help_tabs' => array( |
274 | 274 | 'event_editor_help_tab' => array( |
275 | - 'title' => esc_html__( 'Event Editor', 'event_espresso' ), |
|
275 | + 'title' => esc_html__('Event Editor', 'event_espresso'), |
|
276 | 276 | 'filename' => 'event_editor', |
277 | 277 | ), |
278 | 278 | 'event_editor_title_richtexteditor_help_tab' => array( |
279 | - 'title' => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ), |
|
279 | + 'title' => esc_html__('Event Title & Rich Text Editor', 'event_espresso'), |
|
280 | 280 | 'filename' => 'event_editor_title_richtexteditor', |
281 | 281 | ), |
282 | 282 | 'event_editor_venue_details_help_tab' => array( |
283 | - 'title' => esc_html__( 'Event Venue Details', 'event_espresso' ), |
|
283 | + 'title' => esc_html__('Event Venue Details', 'event_espresso'), |
|
284 | 284 | 'filename' => 'event_editor_venue_details', |
285 | 285 | ), |
286 | 286 | 'event_editor_event_datetimes_help_tab' => array( |
287 | - 'title' => esc_html__( 'Event Datetimes', 'event_espresso' ), |
|
287 | + 'title' => esc_html__('Event Datetimes', 'event_espresso'), |
|
288 | 288 | 'filename' => 'event_editor_event_datetimes', |
289 | 289 | ), |
290 | 290 | 'event_editor_event_tickets_help_tab' => array( |
291 | - 'title' => esc_html__( 'Event Tickets', 'event_espresso' ), |
|
291 | + 'title' => esc_html__('Event Tickets', 'event_espresso'), |
|
292 | 292 | 'filename' => 'event_editor_event_tickets', |
293 | 293 | ), |
294 | 294 | 'event_editor_event_registration_options_help_tab' => array( |
295 | - 'title' => esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
295 | + 'title' => esc_html__('Event Registration Options', 'event_espresso'), |
|
296 | 296 | 'filename' => 'event_editor_event_registration_options', |
297 | 297 | ), |
298 | 298 | 'event_editor_tags_categories_help_tab' => array( |
299 | - 'title' => esc_html__( 'Event Tags & Categories', 'event_espresso' ), |
|
299 | + 'title' => esc_html__('Event Tags & Categories', 'event_espresso'), |
|
300 | 300 | 'filename' => 'event_editor_tags_categories', |
301 | 301 | ), |
302 | 302 | 'event_editor_questions_registrants_help_tab' => array( |
303 | - 'title' => esc_html__( 'Questions for Registrants', 'event_espresso' ), |
|
303 | + 'title' => esc_html__('Questions for Registrants', 'event_espresso'), |
|
304 | 304 | 'filename' => 'event_editor_questions_registrants', |
305 | 305 | ), |
306 | 306 | 'event_editor_save_new_event_help_tab' => array( |
307 | - 'title' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
307 | + 'title' => esc_html__('Save New Event', 'event_espresso'), |
|
308 | 308 | 'filename' => 'event_editor_save_new_event', |
309 | 309 | ), |
310 | 310 | 'event_editor_other_help_tab' => array( |
311 | - 'title' => esc_html__( 'Event Other', 'event_espresso' ), |
|
311 | + 'title' => esc_html__('Event Other', 'event_espresso'), |
|
312 | 312 | 'filename' => 'event_editor_other', |
313 | 313 | ), |
314 | 314 | ), |
315 | 315 | 'help_tour' => array( |
316 | 316 | 'Event_Editor_Help_Tour', |
317 | 317 | ), |
318 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
318 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
319 | 319 | 'require_nonce' => false, |
320 | 320 | ), |
321 | 321 | 'edit' => array( |
322 | 322 | 'nav' => array( |
323 | - 'label' => esc_html__( 'Edit Event', 'event_espresso' ), |
|
323 | + 'label' => esc_html__('Edit Event', 'event_espresso'), |
|
324 | 324 | 'order' => 5, |
325 | 325 | 'persistent' => false, |
326 | - 'url' => isset( $this->_req_data['post'] ) |
|
326 | + 'url' => isset($this->_req_data['post']) |
|
327 | 327 | ? EE_Admin_Page::add_query_args_and_nonce( |
328 | - array( 'post' => $this->_req_data['post'], 'action' => 'edit' ), |
|
328 | + array('post' => $this->_req_data['post'], 'action' => 'edit'), |
|
329 | 329 | $this->_current_page_view_url |
330 | 330 | ) |
331 | 331 | : $this->_admin_base_url, |
332 | 332 | ), |
333 | - 'metaboxes' => array( '_register_event_editor_meta_boxes' ), |
|
333 | + 'metaboxes' => array('_register_event_editor_meta_boxes'), |
|
334 | 334 | 'help_tabs' => array( |
335 | 335 | 'event_editor_help_tab' => array( |
336 | - 'title' => esc_html__( 'Event Editor', 'event_espresso' ), |
|
336 | + 'title' => esc_html__('Event Editor', 'event_espresso'), |
|
337 | 337 | 'filename' => 'event_editor', |
338 | 338 | ), |
339 | 339 | 'event_editor_title_richtexteditor_help_tab' => array( |
340 | - 'title' => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ), |
|
340 | + 'title' => esc_html__('Event Title & Rich Text Editor', 'event_espresso'), |
|
341 | 341 | 'filename' => 'event_editor_title_richtexteditor', |
342 | 342 | ), |
343 | 343 | 'event_editor_venue_details_help_tab' => array( |
344 | - 'title' => esc_html__( 'Event Venue Details', 'event_espresso' ), |
|
344 | + 'title' => esc_html__('Event Venue Details', 'event_espresso'), |
|
345 | 345 | 'filename' => 'event_editor_venue_details', |
346 | 346 | ), |
347 | 347 | 'event_editor_event_datetimes_help_tab' => array( |
348 | - 'title' => esc_html__( 'Event Datetimes', 'event_espresso' ), |
|
348 | + 'title' => esc_html__('Event Datetimes', 'event_espresso'), |
|
349 | 349 | 'filename' => 'event_editor_event_datetimes', |
350 | 350 | ), |
351 | 351 | 'event_editor_event_tickets_help_tab' => array( |
352 | - 'title' => esc_html__( 'Event Tickets', 'event_espresso' ), |
|
352 | + 'title' => esc_html__('Event Tickets', 'event_espresso'), |
|
353 | 353 | 'filename' => 'event_editor_event_tickets', |
354 | 354 | ), |
355 | 355 | 'event_editor_event_registration_options_help_tab' => array( |
356 | - 'title' => esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
356 | + 'title' => esc_html__('Event Registration Options', 'event_espresso'), |
|
357 | 357 | 'filename' => 'event_editor_event_registration_options', |
358 | 358 | ), |
359 | 359 | 'event_editor_tags_categories_help_tab' => array( |
360 | - 'title' => esc_html__( 'Event Tags & Categories', 'event_espresso' ), |
|
360 | + 'title' => esc_html__('Event Tags & Categories', 'event_espresso'), |
|
361 | 361 | 'filename' => 'event_editor_tags_categories', |
362 | 362 | ), |
363 | 363 | 'event_editor_questions_registrants_help_tab' => array( |
364 | - 'title' => esc_html__( 'Questions for Registrants', 'event_espresso' ), |
|
364 | + 'title' => esc_html__('Questions for Registrants', 'event_espresso'), |
|
365 | 365 | 'filename' => 'event_editor_questions_registrants', |
366 | 366 | ), |
367 | 367 | 'event_editor_save_new_event_help_tab' => array( |
368 | - 'title' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
368 | + 'title' => esc_html__('Save New Event', 'event_espresso'), |
|
369 | 369 | 'filename' => 'event_editor_save_new_event', |
370 | 370 | ), |
371 | 371 | 'event_editor_other_help_tab' => array( |
372 | - 'title' => esc_html__( 'Event Other', 'event_espresso' ), |
|
372 | + 'title' => esc_html__('Event Other', 'event_espresso'), |
|
373 | 373 | 'filename' => 'event_editor_other', |
374 | 374 | ), |
375 | 375 | ), |
376 | 376 | /*'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ),*/ |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => false, |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
383 | 383 | 'nav' => array( |
384 | - 'label' => esc_html__( 'Default Settings', 'event_espresso' ), |
|
384 | + 'label' => esc_html__('Default Settings', 'event_espresso'), |
|
385 | 385 | 'order' => 40, |
386 | 386 | ), |
387 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
387 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
388 | 388 | 'labels' => array( |
389 | - 'publishbox' => esc_html__( 'Update Settings', 'event_espresso' ), |
|
389 | + 'publishbox' => esc_html__('Update Settings', 'event_espresso'), |
|
390 | 390 | ), |
391 | 391 | 'help_tabs' => array( |
392 | 392 | 'default_settings_help_tab' => array( |
393 | - 'title' => esc_html__( 'Default Event Settings', 'event_espresso' ), |
|
393 | + 'title' => esc_html__('Default Event Settings', 'event_espresso'), |
|
394 | 394 | 'filename' => 'events_default_settings', |
395 | 395 | ), |
396 | 396 | 'default_settings_status_help_tab' => array( |
397 | - 'title' => esc_html__( 'Default Registration Status', 'event_espresso' ), |
|
397 | + 'title' => esc_html__('Default Registration Status', 'event_espresso'), |
|
398 | 398 | 'filename' => 'events_default_settings_status', |
399 | 399 | ), |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour' ), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => false, |
403 | 403 | ), |
404 | 404 | //template settings |
405 | 405 | 'template_settings' => array( |
406 | 406 | 'nav' => array( |
407 | - 'label' => esc_html__( 'Templates', 'event_espresso' ), |
|
407 | + 'label' => esc_html__('Templates', 'event_espresso'), |
|
408 | 408 | 'order' => 30, |
409 | 409 | ), |
410 | 410 | 'metaboxes' => $this->_default_espresso_metaboxes, |
411 | 411 | 'help_tabs' => array( |
412 | 412 | 'general_settings_templates_help_tab' => array( |
413 | - 'title' => esc_html__( 'Templates', 'event_espresso' ), |
|
413 | + 'title' => esc_html__('Templates', 'event_espresso'), |
|
414 | 414 | 'filename' => 'general_settings_templates', |
415 | 415 | ), |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => false, |
419 | 419 | ), |
420 | 420 | //event category stuff |
421 | 421 | 'add_category' => array( |
422 | 422 | 'nav' => array( |
423 | - 'label' => esc_html__( 'Add Category', 'event_espresso' ), |
|
423 | + 'label' => esc_html__('Add Category', 'event_espresso'), |
|
424 | 424 | 'order' => 15, |
425 | 425 | 'persistent' => false, |
426 | 426 | ), |
427 | 427 | 'help_tabs' => array( |
428 | 428 | 'add_category_help_tab' => array( |
429 | - 'title' => esc_html__( 'Add New Event Category', 'event_espresso' ), |
|
429 | + 'title' => esc_html__('Add New Event Category', 'event_espresso'), |
|
430 | 430 | 'filename' => 'events_add_category', |
431 | 431 | ), |
432 | 432 | ), |
433 | - 'help_tour' => array( 'Event_Add_Category_Help_Tour' ), |
|
434 | - 'metaboxes' => array( '_publish_post_box' ), |
|
433 | + 'help_tour' => array('Event_Add_Category_Help_Tour'), |
|
434 | + 'metaboxes' => array('_publish_post_box'), |
|
435 | 435 | 'require_nonce' => false, |
436 | 436 | ), |
437 | 437 | 'edit_category' => array( |
438 | 438 | 'nav' => array( |
439 | - 'label' => esc_html__( 'Edit Category', 'event_espresso' ), |
|
439 | + 'label' => esc_html__('Edit Category', 'event_espresso'), |
|
440 | 440 | 'order' => 15, |
441 | 441 | 'persistent' => false, |
442 | - 'url' => isset( $this->_req_data['EVT_CAT_ID'] ) |
|
442 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) |
|
443 | 443 | ? add_query_arg( |
444 | - array( 'EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), |
|
444 | + array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
445 | 445 | $this->_current_page_view_url |
446 | 446 | ) |
447 | 447 | : $this->_admin_base_url, |
448 | 448 | ), |
449 | 449 | 'help_tabs' => array( |
450 | 450 | 'edit_category_help_tab' => array( |
451 | - 'title' => esc_html__( 'Edit Event Category', 'event_espresso' ), |
|
451 | + 'title' => esc_html__('Edit Event Category', 'event_espresso'), |
|
452 | 452 | 'filename' => 'events_edit_category', |
453 | 453 | ), |
454 | 454 | ), |
455 | 455 | /*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/ |
456 | - 'metaboxes' => array( '_publish_post_box' ), |
|
456 | + 'metaboxes' => array('_publish_post_box'), |
|
457 | 457 | 'require_nonce' => false, |
458 | 458 | ), |
459 | 459 | 'category_list' => array( |
460 | 460 | 'nav' => array( |
461 | - 'label' => esc_html__( 'Categories', 'event_espresso' ), |
|
461 | + 'label' => esc_html__('Categories', 'event_espresso'), |
|
462 | 462 | 'order' => 20, |
463 | 463 | ), |
464 | 464 | 'list_table' => 'Event_Categories_Admin_List_Table', |
465 | 465 | 'help_tabs' => array( |
466 | 466 | 'events_categories_help_tab' => array( |
467 | - 'title' => esc_html__( 'Event Categories', 'event_espresso' ), |
|
467 | + 'title' => esc_html__('Event Categories', 'event_espresso'), |
|
468 | 468 | 'filename' => 'events_categories', |
469 | 469 | ), |
470 | 470 | 'events_categories_table_column_headings_help_tab' => array( |
471 | - 'title' => esc_html__( 'Event Categories Table Column Headings', 'event_espresso' ), |
|
471 | + 'title' => esc_html__('Event Categories Table Column Headings', 'event_espresso'), |
|
472 | 472 | 'filename' => 'events_categories_table_column_headings', |
473 | 473 | ), |
474 | 474 | 'events_categories_view_help_tab' => array( |
475 | - 'title' => esc_html__( 'Event Categories Views', 'event_espresso' ), |
|
475 | + 'title' => esc_html__('Event Categories Views', 'event_espresso'), |
|
476 | 476 | 'filename' => 'events_categories_views', |
477 | 477 | ), |
478 | 478 | 'events_categories_other_help_tab' => array( |
479 | - 'title' => esc_html__( 'Event Categories Other', 'event_espresso' ), |
|
479 | + 'title' => esc_html__('Event Categories Other', 'event_espresso'), |
|
480 | 480 | 'filename' => 'events_categories_other', |
481 | 481 | ), |
482 | 482 | ), |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | protected function _add_screen_options_category_list() { |
507 | 507 | $page_title = $this->_admin_page_title; |
508 | - $this->_admin_page_title = esc_html__( 'Categories', 'event_espresso' ); |
|
508 | + $this->_admin_page_title = esc_html__('Categories', 'event_espresso'); |
|
509 | 509 | $this->_per_page_screen_option(); |
510 | 510 | $this->_admin_page_title = $page_title; |
511 | 511 | } |
@@ -521,20 +521,20 @@ discard block |
||
521 | 521 | public function load_scripts_styles() { |
522 | 522 | wp_register_style( |
523 | 523 | 'events-admin-css', |
524 | - EVENTS_ASSETS_URL . 'events-admin-page.css', |
|
524 | + EVENTS_ASSETS_URL.'events-admin-page.css', |
|
525 | 525 | array(), |
526 | 526 | EVENT_ESPRESSO_VERSION |
527 | 527 | ); |
528 | - wp_register_style( 'ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
529 | - wp_enqueue_style( 'events-admin-css' ); |
|
530 | - wp_enqueue_style( 'ee-cat-admin' ); |
|
528 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
529 | + wp_enqueue_style('events-admin-css'); |
|
530 | + wp_enqueue_style('ee-cat-admin'); |
|
531 | 531 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
532 | 532 | //registers for all views |
533 | 533 | //scripts |
534 | 534 | wp_register_script( |
535 | 535 | 'event_editor_js', |
536 | - EVENTS_ASSETS_URL . 'event_editor.js', |
|
537 | - array( 'ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon' ), |
|
536 | + EVENTS_ASSETS_URL.'event_editor.js', |
|
537 | + array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), |
|
538 | 538 | EVENT_ESPRESSO_VERSION, |
539 | 539 | true |
540 | 540 | ); |
@@ -560,22 +560,22 @@ discard block |
||
560 | 560 | */ |
561 | 561 | public function load_scripts_styles_edit() { |
562 | 562 | //styles |
563 | - wp_enqueue_style( 'espresso-ui-theme' ); |
|
563 | + wp_enqueue_style('espresso-ui-theme'); |
|
564 | 564 | wp_register_style( |
565 | 565 | 'event-editor-css', |
566 | - EVENTS_ASSETS_URL . 'event-editor.css', |
|
567 | - array( 'ee-admin-css' ), |
|
566 | + EVENTS_ASSETS_URL.'event-editor.css', |
|
567 | + array('ee-admin-css'), |
|
568 | 568 | EVENT_ESPRESSO_VERSION |
569 | 569 | ); |
570 | - wp_enqueue_style( 'event-editor-css' ); |
|
570 | + wp_enqueue_style('event-editor-css'); |
|
571 | 571 | //scripts |
572 | 572 | wp_register_script( |
573 | 573 | 'event-datetime-metabox', |
574 | - EVENTS_ASSETS_URL . 'event-datetime-metabox.js', |
|
575 | - array( 'event_editor_js', 'ee-datepicker' ), |
|
574 | + EVENTS_ASSETS_URL.'event-datetime-metabox.js', |
|
575 | + array('event_editor_js', 'ee-datepicker'), |
|
576 | 576 | EVENT_ESPRESSO_VERSION |
577 | 577 | ); |
578 | - wp_enqueue_script( 'event-datetime-metabox' ); |
|
578 | + wp_enqueue_script('event-datetime-metabox'); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | $this->_views = array( |
596 | 596 | 'all' => array( |
597 | 597 | 'slug' => 'all', |
598 | - 'label' => esc_html__( 'All', 'event_espresso' ), |
|
598 | + 'label' => esc_html__('All', 'event_espresso'), |
|
599 | 599 | 'count' => 0, |
600 | 600 | 'bulk_action' => array( |
601 | - 'delete_categories' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
601 | + 'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'), |
|
602 | 602 | ), |
603 | 603 | ), |
604 | 604 | ); |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | * @access public |
635 | 635 | * @return void |
636 | 636 | */ |
637 | - public function verify_event_edit( $event = null ) { |
|
637 | + public function verify_event_edit($event = null) { |
|
638 | 638 | // no event? |
639 | - if ( empty( $event ) ) { |
|
639 | + if (empty($event)) { |
|
640 | 640 | // set event |
641 | 641 | $event = $this->_cpt_model_obj; |
642 | 642 | } |
643 | 643 | // STILL no event? |
644 | - if ( empty ( $event ) ) { |
|
644 | + if (empty ($event)) { |
|
645 | 645 | return; |
646 | 646 | } |
647 | 647 | $orig_status = $event->status(); |
@@ -655,32 +655,32 @@ discard block |
||
655 | 655 | return; |
656 | 656 | } |
657 | 657 | //made it here so it IS active... next check that any of the tickets are sold. |
658 | - if ( $event->is_sold_out( true ) ) { |
|
659 | - if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) { |
|
658 | + if ($event->is_sold_out(true)) { |
|
659 | + if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) { |
|
660 | 660 | EE_Error::add_attention( |
661 | 661 | sprintf( |
662 | 662 | esc_html__( |
663 | 663 | 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', |
664 | 664 | 'event_espresso' |
665 | 665 | ), |
666 | - EEH_Template::pretty_status( EEM_Event::sold_out, false, 'sentence' ) |
|
666 | + EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence') |
|
667 | 667 | ) |
668 | 668 | ); |
669 | 669 | } |
670 | 670 | return; |
671 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
671 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
672 | 672 | EE_Error::add_attention( |
673 | 673 | sprintf( |
674 | 674 | esc_html__( |
675 | 675 | 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
676 | 676 | 'event_espresso' |
677 | 677 | ), |
678 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
678 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
679 | 679 | ) |
680 | 680 | ); |
681 | 681 | } |
682 | 682 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
683 | - if ( ! $event->tickets_on_sale() ) { |
|
683 | + if ( ! $event->tickets_on_sale()) { |
|
684 | 684 | return; |
685 | 685 | } |
686 | 686 | //made it here so show warning |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | */ |
699 | 699 | protected function _edit_event_warning() { |
700 | 700 | // we don't want to add warnings during these requests |
701 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) { |
|
701 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') { |
|
702 | 702 | return; |
703 | 703 | } |
704 | 704 | EE_Error::add_attention( |
@@ -715,29 +715,29 @@ discard block |
||
715 | 715 | $this->_views = array( |
716 | 716 | 'all' => array( |
717 | 717 | 'slug' => 'all', |
718 | - 'label' => esc_html__( 'View All Events', 'event_espresso' ), |
|
718 | + 'label' => esc_html__('View All Events', 'event_espresso'), |
|
719 | 719 | 'count' => 0, |
720 | 720 | 'bulk_action' => array( |
721 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
721 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
722 | 722 | ), |
723 | 723 | ), |
724 | 724 | 'draft' => array( |
725 | 725 | 'slug' => 'draft', |
726 | - 'label' => esc_html__( 'Draft', 'event_espresso' ), |
|
726 | + 'label' => esc_html__('Draft', 'event_espresso'), |
|
727 | 727 | 'count' => 0, |
728 | 728 | 'bulk_action' => array( |
729 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
729 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
730 | 730 | ), |
731 | 731 | ), |
732 | 732 | ); |
733 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
733 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
734 | 734 | $this->_views['trash'] = array( |
735 | 735 | 'slug' => 'trash', |
736 | - 'label' => esc_html__( 'Trash', 'event_espresso' ), |
|
736 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
737 | 737 | 'count' => 0, |
738 | 738 | 'bulk_action' => array( |
739 | - 'restore_events' => esc_html__( 'Restore From Trash', 'event_espresso' ), |
|
740 | - 'delete_events' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
739 | + 'restore_events' => esc_html__('Restore From Trash', 'event_espresso'), |
|
740 | + 'delete_events' => esc_html__('Delete Permanently', 'event_espresso'), |
|
741 | 741 | ), |
742 | 742 | ); |
743 | 743 | } |
@@ -752,50 +752,50 @@ discard block |
||
752 | 752 | $items = array( |
753 | 753 | 'view_details' => array( |
754 | 754 | 'class' => 'dashicons dashicons-search', |
755 | - 'desc' => esc_html__( 'View Event', 'event_espresso' ), |
|
755 | + 'desc' => esc_html__('View Event', 'event_espresso'), |
|
756 | 756 | ), |
757 | 757 | 'edit_event' => array( |
758 | 758 | 'class' => 'ee-icon ee-icon-calendar-edit', |
759 | - 'desc' => esc_html__( 'Edit Event Details', 'event_espresso' ), |
|
759 | + 'desc' => esc_html__('Edit Event Details', 'event_espresso'), |
|
760 | 760 | ), |
761 | 761 | 'view_attendees' => array( |
762 | 762 | 'class' => 'dashicons dashicons-groups', |
763 | - 'desc' => esc_html__( 'View Registrations for Event', 'event_espresso' ), |
|
763 | + 'desc' => esc_html__('View Registrations for Event', 'event_espresso'), |
|
764 | 764 | ), |
765 | 765 | ); |
766 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
766 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
767 | 767 | $statuses = array( |
768 | 768 | 'sold_out_status' => array( |
769 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
770 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, false, 'sentence' ), |
|
769 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
770 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'), |
|
771 | 771 | ), |
772 | 772 | 'active_status' => array( |
773 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
774 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, false, 'sentence' ), |
|
773 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
774 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'), |
|
775 | 775 | ), |
776 | 776 | 'upcoming_status' => array( |
777 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
778 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, false, 'sentence' ), |
|
777 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
778 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'), |
|
779 | 779 | ), |
780 | 780 | 'postponed_status' => array( |
781 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
782 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, false, 'sentence' ), |
|
781 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
782 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'), |
|
783 | 783 | ), |
784 | 784 | 'cancelled_status' => array( |
785 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
786 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, false, 'sentence' ), |
|
785 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
786 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'), |
|
787 | 787 | ), |
788 | 788 | 'expired_status' => array( |
789 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
790 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, false, 'sentence' ), |
|
789 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
790 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'), |
|
791 | 791 | ), |
792 | 792 | 'inactive_status' => array( |
793 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
794 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, false, 'sentence' ), |
|
793 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
794 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'), |
|
795 | 795 | ), |
796 | 796 | ); |
797 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
798 | - return array_merge( $items, $statuses ); |
|
797 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
798 | + return array_merge($items, $statuses); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | * @return EEM_Event |
807 | 807 | */ |
808 | 808 | private function _event_model() { |
809 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
810 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
809 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
810 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
811 | 811 | } |
812 | 812 | return $this->_event_model; |
813 | 813 | } |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | * @param string $new_slug what the slug is |
825 | 825 | * @return string The new html string for the permalink area |
826 | 826 | */ |
827 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
827 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
828 | 828 | //make sure this is only when editing |
829 | - if ( ! empty( $id ) ) { |
|
830 | - $post = get_post( $id ); |
|
829 | + if ( ! empty($id)) { |
|
830 | + $post = get_post($id); |
|
831 | 831 | $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' |
832 | - . esc_html__( 'Shortcode', 'event_espresso' ) |
|
832 | + . esc_html__('Shortcode', 'event_espresso') |
|
833 | 833 | . '</a> '; |
834 | 834 | $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' |
835 | 835 | . $post->ID |
@@ -848,14 +848,14 @@ discard block |
||
848 | 848 | * @return void |
849 | 849 | */ |
850 | 850 | protected function _events_overview_list_table() { |
851 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
851 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
852 | 852 | $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
853 | - get_post_type_archive_link( 'espresso_events' ), |
|
854 | - esc_html__( "View Event Archive Page", "event_espresso" ), |
|
853 | + get_post_type_archive_link('espresso_events'), |
|
854 | + esc_html__("View Event Archive Page", "event_espresso"), |
|
855 | 855 | 'button' |
856 | 856 | ); |
857 | - $this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() ); |
|
858 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
857 | + $this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items()); |
|
858 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
859 | 859 | 'create_new', |
860 | 860 | 'add', |
861 | 861 | array(), |
@@ -881,48 +881,48 @@ discard block |
||
881 | 881 | * @param string $post_id |
882 | 882 | * @param object $post |
883 | 883 | */ |
884 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
885 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
884 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
885 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
886 | 886 | //get out we're not processing an event save. |
887 | 887 | return; |
888 | 888 | } |
889 | 889 | $event_values = array( |
890 | - 'EVT_display_desc' => ! empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
891 | - 'EVT_display_ticket_selector' => ! empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
890 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
891 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
892 | 892 | 'EVT_additional_limit' => min( |
893 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
894 | - ! empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : null |
|
893 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
894 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : null |
|
895 | 895 | ), |
896 | - 'EVT_default_registration_status' => ! empty( $this->_req_data['EVT_default_registration_status'] ) |
|
896 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) |
|
897 | 897 | ? $this->_req_data['EVT_default_registration_status'] |
898 | 898 | : EE_Registry::instance()->CFG->registration->default_STS_ID, |
899 | - 'EVT_member_only' => ! empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
900 | - 'EVT_allow_overflow' => ! empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
901 | - 'EVT_timezone_string' => ! empty( $this->_req_data['timezone_string'] ) |
|
899 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
900 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
901 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) |
|
902 | 902 | ? $this->_req_data['timezone_string'] : null, |
903 | - 'EVT_external_URL' => ! empty( $this->_req_data['externalURL'] ) |
|
903 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) |
|
904 | 904 | ? $this->_req_data['externalURL'] : null, |
905 | - 'EVT_phone' => ! empty( $this->_req_data['event_phone'] ) |
|
905 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) |
|
906 | 906 | ? $this->_req_data['event_phone'] : null, |
907 | 907 | ); |
908 | 908 | //update event |
909 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
909 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
910 | 910 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
911 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
912 | - $event = $this->_event_model()->get_one( array( $get_one_where ) ); |
|
911 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
912 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
913 | 913 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
914 | 914 | $event_update_callbacks = apply_filters( |
915 | 915 | 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
916 | - array( array( $this, '_default_venue_update' ), array( $this, '_default_tickets_update' ) ) |
|
916 | + array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')) |
|
917 | 917 | ); |
918 | 918 | $att_success = true; |
919 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
920 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
919 | + foreach ($event_update_callbacks as $e_callback) { |
|
920 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
921 | 921 | $att_success = ! $att_success ? $att_success |
922 | 922 | : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
923 | 923 | } |
924 | 924 | //any errors? |
925 | - if ( $success && false === $att_success ) { |
|
925 | + if ($success && false === $att_success) { |
|
926 | 926 | EE_Error::add_error( |
927 | 927 | esc_html__( |
928 | 928 | 'Event Details saved successfully but something went wrong with saving attachments.', |
@@ -932,9 +932,9 @@ discard block |
||
932 | 932 | __FUNCTION__, |
933 | 933 | __LINE__ |
934 | 934 | ); |
935 | - } else if ( $success === false ) { |
|
935 | + } else if ($success === false) { |
|
936 | 936 | EE_Error::add_error( |
937 | - esc_html__( 'Event Details did not save successfully.', 'event_espresso' ), |
|
937 | + esc_html__('Event Details did not save successfully.', 'event_espresso'), |
|
938 | 938 | __FILE__, |
939 | 939 | __FUNCTION__, |
940 | 940 | __LINE__ |
@@ -949,14 +949,14 @@ discard block |
||
949 | 949 | * @param int $post_id |
950 | 950 | * @param int $revision_id |
951 | 951 | */ |
952 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
952 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
953 | 953 | //copy existing event meta to new post |
954 | - $post_evt = $this->_event_model()->get_one_by_ID( $post_id ); |
|
955 | - if ( $post_evt instanceof EE_Event ) { |
|
954 | + $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
|
955 | + if ($post_evt instanceof EE_Event) { |
|
956 | 956 | //meta revision restore |
957 | - $post_evt->restore_revision( $revision_id ); |
|
957 | + $post_evt->restore_revision($revision_id); |
|
958 | 958 | //related objs restore |
959 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
959 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
960 | 960 | } |
961 | 961 | } |
962 | 962 | |
@@ -969,49 +969,49 @@ discard block |
||
969 | 969 | * @param array $data The request data from the form |
970 | 970 | * @return bool Success or fail. |
971 | 971 | */ |
972 | - protected function _default_venue_update( \EE_Event $evtobj, $data ) { |
|
973 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
974 | - $venue_model = EE_Registry::instance()->load_model( 'Venue' ); |
|
972 | + protected function _default_venue_update(\EE_Event $evtobj, $data) { |
|
973 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
974 | + $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
975 | 975 | $rows_affected = null; |
976 | - $venue_id = ! empty( $data['venue_id'] ) ? $data['venue_id'] : null; |
|
976 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
977 | 977 | // very important. If we don't have a venue name... |
978 | 978 | // then we'll get out because not necessary to create empty venue |
979 | - if ( empty( $data['venue_title'] ) ) { |
|
979 | + if (empty($data['venue_title'])) { |
|
980 | 980 | return false; |
981 | 981 | } |
982 | 982 | $venue_array = array( |
983 | - 'VNU_wp_user' => $evtobj->get( 'EVT_wp_user' ), |
|
984 | - 'VNU_name' => ! empty( $data['venue_title'] ) ? $data['venue_title'] : null, |
|
985 | - 'VNU_desc' => ! empty( $data['venue_description'] ) ? $data['venue_description'] : null, |
|
986 | - 'VNU_identifier' => ! empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : null, |
|
987 | - 'VNU_short_desc' => ! empty( $data['venue_short_description'] ) ? $data['venue_short_description'] |
|
983 | + 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
|
984 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : null, |
|
985 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : null, |
|
986 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null, |
|
987 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] |
|
988 | 988 | : null, |
989 | - 'VNU_address' => ! empty( $data['address'] ) ? $data['address'] : null, |
|
990 | - 'VNU_address2' => ! empty( $data['address2'] ) ? $data['address2'] : null, |
|
991 | - 'VNU_city' => ! empty( $data['city'] ) ? $data['city'] : null, |
|
992 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : null, |
|
993 | - 'CNT_ISO' => ! empty( $data['countries'] ) ? $data['countries'] : null, |
|
994 | - 'VNU_zip' => ! empty( $data['zip'] ) ? $data['zip'] : null, |
|
995 | - 'VNU_phone' => ! empty( $data['venue_phone'] ) ? $data['venue_phone'] : null, |
|
996 | - 'VNU_capacity' => ! empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : null, |
|
997 | - 'VNU_url' => ! empty( $data['venue_url'] ) ? $data['venue_url'] : null, |
|
998 | - 'VNU_virtual_phone' => ! empty( $data['virtual_phone'] ) ? $data['virtual_phone'] : null, |
|
999 | - 'VNU_virtual_url' => ! empty( $data['virtual_url'] ) ? $data['virtual_url'] : null, |
|
1000 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
989 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : null, |
|
990 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : null, |
|
991 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : null, |
|
992 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : null, |
|
993 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : null, |
|
994 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : null, |
|
995 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : null, |
|
996 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null, |
|
997 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : null, |
|
998 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null, |
|
999 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : null, |
|
1000 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
1001 | 1001 | 'status' => 'publish', |
1002 | 1002 | ); |
1003 | 1003 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
1004 | - if ( ! empty( $venue_id ) ) { |
|
1005 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
1006 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
1004 | + if ( ! empty($venue_id)) { |
|
1005 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
1006 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
1007 | 1007 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
1008 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1008 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1009 | 1009 | return $rows_affected > 0 ? true : false; |
1010 | 1010 | } else { |
1011 | 1011 | //we insert the venue |
1012 | - $venue_id = $venue_model->insert( $venue_array ); |
|
1013 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1014 | - return ! empty( $venue_id ) ? true : false; |
|
1012 | + $venue_id = $venue_model->insert($venue_array); |
|
1013 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1014 | + return ! empty($venue_id) ? true : false; |
|
1015 | 1015 | } |
1016 | 1016 | //when we have the ancestor come in it's already been handled by the revision save. |
1017 | 1017 | } |
@@ -1025,51 +1025,51 @@ discard block |
||
1025 | 1025 | * @param array $data The request data from the form |
1026 | 1026 | * @return array |
1027 | 1027 | */ |
1028 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
1028 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
1029 | 1029 | $success = true; |
1030 | 1030 | $saved_dtt = null; |
1031 | 1031 | $saved_tickets = array(); |
1032 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1033 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
1032 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1033 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
1034 | 1034 | //trim all values to ensure any excess whitespace is removed. |
1035 | - $dtt = array_map( 'trim', $dtt ); |
|
1036 | - $dtt['DTT_EVT_end'] = isset( $dtt['DTT_EVT_end'] ) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] |
|
1035 | + $dtt = array_map('trim', $dtt); |
|
1036 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] |
|
1037 | 1037 | : $dtt['DTT_EVT_start']; |
1038 | 1038 | $datetime_values = array( |
1039 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : null, |
|
1039 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null, |
|
1040 | 1040 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
1041 | 1041 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
1042 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1042 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1043 | 1043 | 'DTT_order' => $row, |
1044 | 1044 | ); |
1045 | 1045 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
1046 | - if ( ! empty( $dtt['DTT_ID'] ) ) { |
|
1046 | + if ( ! empty($dtt['DTT_ID'])) { |
|
1047 | 1047 | $DTM = EE_Registry::instance() |
1048 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1050 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1051 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1052 | - foreach ( $datetime_values as $field => $value ) { |
|
1053 | - $DTM->set( $field, $value ); |
|
1048 | + ->load_model('Datetime', array($evtobj->get_timezone())) |
|
1049 | + ->get_one_by_ID($dtt['DTT_ID']); |
|
1050 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1051 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1052 | + foreach ($datetime_values as $field => $value) { |
|
1053 | + $DTM->set($field, $value); |
|
1054 | 1054 | } |
1055 | 1055 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
1056 | - $saved_dtts[ $DTM->ID() ] = $DTM; |
|
1056 | + $saved_dtts[$DTM->ID()] = $DTM; |
|
1057 | 1057 | } else { |
1058 | - $DTM = EE_Registry::instance()->load_class( 'Datetime', array( $datetime_values ), false, false ); |
|
1059 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1060 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1061 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
1062 | - foreach ( $datetime_values as $field => $value ) { |
|
1063 | - $DTM->set( $field, $value ); |
|
1058 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), false, false); |
|
1059 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1060 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1061 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
1062 | + foreach ($datetime_values as $field => $value) { |
|
1063 | + $DTM->set($field, $value); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | $DTM->save(); |
1067 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
1067 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
1068 | 1068 | //load DTT helper |
1069 | 1069 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1070 | - if ( $DTT->get_raw( 'DTT_EVT_start' ) > $DTT->get_raw( 'DTT_EVT_end' ) ) { |
|
1071 | - $DTT->set( 'DTT_EVT_end', $DTT->get( 'DTT_EVT_start' ) ); |
|
1072 | - $DTT = EEH_DTT_Helper::date_time_add( $DTT, 'DTT_EVT_end', 'days' ); |
|
1070 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
1071 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
1072 | + $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
|
1073 | 1073 | $DTT->save(); |
1074 | 1074 | } |
1075 | 1075 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
@@ -1080,20 +1080,20 @@ discard block |
||
1080 | 1080 | } |
1081 | 1081 | //no dtts get deleted so we don't do any of that logic here. |
1082 | 1082 | //update tickets next |
1083 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode( ',', $data['ticket_IDs'] ) : array(); |
|
1084 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1085 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1083 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1084 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1085 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1086 | 1086 | $update_prices = false; |
1087 | - $ticket_price = isset( $data['edit_prices'][ $row ][1]['PRC_amount'] ) |
|
1088 | - ? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0; |
|
1087 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) |
|
1088 | + ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1089 | 1089 | // trim inputs to ensure any excess whitespace is removed. |
1090 | - $tkt = array_map( 'trim', $tkt ); |
|
1091 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1090 | + $tkt = array_map('trim', $tkt); |
|
1091 | + if (empty($tkt['TKT_start_date'])) { |
|
1092 | 1092 | //let's use now in the set timezone. |
1093 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1094 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1093 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1094 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1095 | 1095 | } |
1096 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1096 | + if (empty($tkt['TKT_end_date'])) { |
|
1097 | 1097 | //use the start date of the first datetime |
1098 | 1098 | $dtt = $evtobj->first_datetime(); |
1099 | 1099 | $tkt['TKT_end_date'] = $dtt->start_date_and_time( |
@@ -1102,22 +1102,22 @@ discard block |
||
1102 | 1102 | ); |
1103 | 1103 | } |
1104 | 1104 | $TKT_values = array( |
1105 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : null, |
|
1106 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1107 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1108 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1105 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null, |
|
1106 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1107 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1108 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1109 | 1109 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1110 | 1110 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1111 | - 'TKT_qty' => ! isset( $tkt['TKT_qty'] ) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1112 | - 'TKT_uses' => ! isset( $tkt['TKT_uses'] ) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1113 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1114 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1111 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1112 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1113 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1114 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1115 | 1115 | 'TKT_row' => $row, |
1116 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1116 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1117 | 1117 | 'TKT_price' => $ticket_price, |
1118 | 1118 | ); |
1119 | 1119 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1120 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1120 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1121 | 1121 | $TKT_values['TKT_ID'] = 0; |
1122 | 1122 | $TKT_values['TKT_is_default'] = 0; |
1123 | 1123 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1126,110 +1126,110 @@ discard block |
||
1126 | 1126 | //if we have a TKT_ID then we need to get that existing TKT_obj and update it |
1127 | 1127 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1128 | 1128 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1129 | - if ( ! empty( $tkt['TKT_ID'] ) ) { |
|
1129 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1130 | 1130 | $TKT = EE_Registry::instance() |
1131 | - ->load_model( 'Ticket', array( $evtobj->get_timezone() ) ) |
|
1132 | - ->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1133 | - if ( $TKT instanceof EE_Ticket ) { |
|
1131 | + ->load_model('Ticket', array($evtobj->get_timezone())) |
|
1132 | + ->get_one_by_ID($tkt['TKT_ID']); |
|
1133 | + if ($TKT instanceof EE_Ticket) { |
|
1134 | 1134 | $ticket_sold = $TKT->count_related( |
1135 | 1135 | 'Registration', |
1136 | 1136 | array( |
1137 | 1137 | array( |
1138 | 1138 | 'STS_ID' => array( |
1139 | 1139 | 'NOT IN', |
1140 | - array( EEM_Registration::status_id_incomplete ), |
|
1140 | + array(EEM_Registration::status_id_incomplete), |
|
1141 | 1141 | ), |
1142 | 1142 | ), |
1143 | 1143 | ) |
1144 | 1144 | ) > 0 ? true : false; |
1145 | 1145 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1146 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
|
1146 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') |
|
1147 | 1147 | && ! $TKT->get( |
1148 | 1148 | 'TKT_deleted' |
1149 | 1149 | ) ? true : false; |
1150 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1151 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1150 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1151 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1152 | 1152 | //set new values |
1153 | - foreach ( $TKT_values as $field => $value ) { |
|
1154 | - if ( $field == 'TKT_qty' ) { |
|
1155 | - $TKT->set_qty( $value ); |
|
1153 | + foreach ($TKT_values as $field => $value) { |
|
1154 | + if ($field == 'TKT_qty') { |
|
1155 | + $TKT->set_qty($value); |
|
1156 | 1156 | } else { |
1157 | - $TKT->set( $field, $value ); |
|
1157 | + $TKT->set($field, $value); |
|
1158 | 1158 | } |
1159 | 1159 | } |
1160 | 1160 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1161 | - if ( $create_new_TKT ) { |
|
1161 | + if ($create_new_TKT) { |
|
1162 | 1162 | //archive the old ticket first |
1163 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1163 | + $TKT->set('TKT_deleted', 1); |
|
1164 | 1164 | $TKT->save(); |
1165 | 1165 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1166 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1166 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1167 | 1167 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1168 | 1168 | $TKT = clone $TKT; |
1169 | - $TKT->set( 'TKT_ID', 0 ); |
|
1170 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1171 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1172 | - $TKT->set( 'TKT_sold', 0 ); |
|
1169 | + $TKT->set('TKT_ID', 0); |
|
1170 | + $TKT->set('TKT_deleted', 0); |
|
1171 | + $TKT->set('TKT_price', $ticket_price); |
|
1172 | + $TKT->set('TKT_sold', 0); |
|
1173 | 1173 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1174 | 1174 | $update_prices = true; |
1175 | 1175 | } |
1176 | 1176 | //make sure price is set if it hasn't been already |
1177 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1177 | + $TKT->set('TKT_price', $ticket_price); |
|
1178 | 1178 | } |
1179 | 1179 | } else { |
1180 | 1180 | //no TKT_id so a new TKT |
1181 | 1181 | $TKT_values['TKT_price'] = $ticket_price; |
1182 | - $TKT = EE_Registry::instance()->load_class( 'Ticket', array( $TKT_values ), false, false ); |
|
1183 | - if ( $TKT instanceof EE_Ticket ) { |
|
1182 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), false, false); |
|
1183 | + if ($TKT instanceof EE_Ticket) { |
|
1184 | 1184 | //need to reset values to properly account for the date formats |
1185 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1186 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1187 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1185 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1186 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1187 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1188 | 1188 | //set new values |
1189 | - foreach ( $TKT_values as $field => $value ) { |
|
1190 | - if ( $field == 'TKT_qty' ) { |
|
1191 | - $TKT->set_qty( $value ); |
|
1189 | + foreach ($TKT_values as $field => $value) { |
|
1190 | + if ($field == 'TKT_qty') { |
|
1191 | + $TKT->set_qty($value); |
|
1192 | 1192 | } else { |
1193 | - $TKT->set( $field, $value ); |
|
1193 | + $TKT->set($field, $value); |
|
1194 | 1194 | } |
1195 | 1195 | } |
1196 | 1196 | $update_prices = true; |
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | // cap ticket qty by datetime reg limits |
1200 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1200 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1201 | 1201 | //update ticket. |
1202 | 1202 | $TKT->save(); |
1203 | 1203 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1204 | - if ( $TKT->get_raw( 'TKT_start_date' ) > $TKT->get_raw( 'TKT_end_date' ) ) { |
|
1205 | - $TKT->set( 'TKT_end_date', $TKT->get( 'TKT_start_date' ) ); |
|
1206 | - $TKT = EEH_DTT_Helper::date_time_add( $TKT, 'TKT_end_date', 'days' ); |
|
1204 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1205 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1206 | + $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
|
1207 | 1207 | $TKT->save(); |
1208 | 1208 | } |
1209 | 1209 | //initially let's add the ticket to the dtt |
1210 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1211 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1210 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1211 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1212 | 1212 | //add prices to ticket |
1213 | - $this->_add_prices_to_ticket( $data['edit_prices'][ $row ], $TKT, $update_prices ); |
|
1213 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1214 | 1214 | } |
1215 | 1215 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1216 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1217 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1218 | - foreach ( $tickets_removed as $id ) { |
|
1219 | - $id = absint( $id ); |
|
1216 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1217 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1218 | + foreach ($tickets_removed as $id) { |
|
1219 | + $id = absint($id); |
|
1220 | 1220 | //get the ticket for this id |
1221 | - $tkt_to_remove = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $id ); |
|
1221 | + $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
|
1222 | 1222 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1223 | - $dtts = $tkt_to_remove->get_many_related( 'Datetime' ); |
|
1224 | - foreach ( $dtts as $dtt ) { |
|
1225 | - $tkt_to_remove->_remove_relation_to( $dtt, 'Datetime' ); |
|
1223 | + $dtts = $tkt_to_remove->get_many_related('Datetime'); |
|
1224 | + foreach ($dtts as $dtt) { |
|
1225 | + $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
|
1226 | 1226 | } |
1227 | 1227 | //need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
1228 | - $tkt_to_remove->delete_related_permanently( 'Price' ); |
|
1228 | + $tkt_to_remove->delete_related_permanently('Price'); |
|
1229 | 1229 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1230 | 1230 | $tkt_to_remove->delete_permanently(); |
1231 | 1231 | } |
1232 | - return array( $saved_dtt, $saved_tickets ); |
|
1232 | + return array($saved_dtt, $saved_tickets); |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | |
@@ -1246,29 +1246,29 @@ discard block |
||
1246 | 1246 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1247 | 1247 | * @return void |
1248 | 1248 | */ |
1249 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = false ) { |
|
1250 | - foreach ( $prices as $row => $prc ) { |
|
1249 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false) { |
|
1250 | + foreach ($prices as $row => $prc) { |
|
1251 | 1251 | $PRC_values = array( |
1252 | - 'PRC_ID' => ! empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : null, |
|
1253 | - 'PRT_ID' => ! empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : null, |
|
1254 | - 'PRC_amount' => ! empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1255 | - 'PRC_name' => ! empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1256 | - 'PRC_desc' => ! empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1252 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null, |
|
1253 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null, |
|
1254 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1255 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1256 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1257 | 1257 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1258 | 1258 | 'PRC_order' => $row, |
1259 | 1259 | ); |
1260 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1260 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1261 | 1261 | $PRC_values['PRC_ID'] = 0; |
1262 | - $PRC = EE_Registry::instance()->load_class( 'Price', array( $PRC_values ), false, false ); |
|
1262 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false); |
|
1263 | 1263 | } else { |
1264 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1264 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1265 | 1265 | //update this price with new values |
1266 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1267 | - $PRC->set( $field, $newprc ); |
|
1266 | + foreach ($PRC_values as $field => $newprc) { |
|
1267 | + $PRC->set($field, $newprc); |
|
1268 | 1268 | } |
1269 | 1269 | $PRC->save(); |
1270 | 1270 | } |
1271 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1271 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1272 | 1272 | } |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | private function _generate_publish_box_extra_content() { |
1301 | 1301 | //load formatter helper |
1302 | 1302 | //args for getting related registrations |
1303 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1303 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1304 | 1304 | $not_approved_query_args = array( |
1305 | 1305 | array( |
1306 | 1306 | 'REG_deleted' => 0, |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
1372 | 1372 | // load template |
1373 | 1373 | EEH_Template::display_template( |
1374 | - EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', |
|
1374 | + EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', |
|
1375 | 1375 | $publish_box_extra_args |
1376 | 1376 | ); |
1377 | 1377 | } |
@@ -1405,16 +1405,16 @@ discard block |
||
1405 | 1405 | $this->verify_cpt_object(); |
1406 | 1406 | add_meta_box( |
1407 | 1407 | 'espresso_event_editor_tickets', |
1408 | - esc_html__( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1409 | - array( $this, 'ticket_metabox' ), |
|
1408 | + esc_html__('Event Datetime & Ticket', 'event_espresso'), |
|
1409 | + array($this, 'ticket_metabox'), |
|
1410 | 1410 | $this->page_slug, |
1411 | 1411 | 'normal', |
1412 | 1412 | 'high' |
1413 | 1413 | ); |
1414 | 1414 | add_meta_box( |
1415 | 1415 | 'espresso_event_editor_event_options', |
1416 | - esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
1417 | - array( $this, 'registration_options_meta_box' ), |
|
1416 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
1417 | + array($this, 'registration_options_meta_box'), |
|
1418 | 1418 | $this->page_slug, |
1419 | 1419 | 'side', |
1420 | 1420 | 'default' |
@@ -1442,65 +1442,65 @@ discard block |
||
1442 | 1442 | 'trash_icon' => 'ee-lock-icon', |
1443 | 1443 | 'disabled' => '', |
1444 | 1444 | ); |
1445 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : null; |
|
1446 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1445 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null; |
|
1446 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1447 | 1447 | /** |
1448 | 1448 | * 1. Start with retrieving Datetimes |
1449 | 1449 | * 2. Fore each datetime get related tickets |
1450 | 1450 | * 3. For each ticket get related prices |
1451 | 1451 | */ |
1452 | - $times = EE_Registry::instance()->load_model( 'Datetime' )->get_all_event_dates( $event_id ); |
|
1452 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1453 | 1453 | /** @type EE_Datetime $first_datetime */ |
1454 | - $first_datetime = reset( $times ); |
|
1454 | + $first_datetime = reset($times); |
|
1455 | 1455 | //do we get related tickets? |
1456 | - if ( $first_datetime instanceof EE_Datetime |
|
1456 | + if ($first_datetime instanceof EE_Datetime |
|
1457 | 1457 | && $first_datetime->ID() !== 0 |
1458 | 1458 | ) { |
1459 | - $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
|
1459 | + $existing_datetime_ids[] = $first_datetime->get('DTT_ID'); |
|
1460 | 1460 | $template_args['time'] = $first_datetime; |
1461 | 1461 | $related_tickets = $first_datetime->tickets( |
1462 | 1462 | array( |
1463 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1463 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1464 | 1464 | 'default_where_conditions' => 'none', |
1465 | 1465 | ) |
1466 | 1466 | ); |
1467 | - if ( ! empty( $related_tickets ) ) { |
|
1468 | - $template_args['total_ticket_rows'] = count( $related_tickets ); |
|
1467 | + if ( ! empty($related_tickets)) { |
|
1468 | + $template_args['total_ticket_rows'] = count($related_tickets); |
|
1469 | 1469 | $row = 0; |
1470 | - foreach ( $related_tickets as $ticket ) { |
|
1471 | - $existing_ticket_ids[] = $ticket->get( 'TKT_ID' ); |
|
1472 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket, false, $row ); |
|
1470 | + foreach ($related_tickets as $ticket) { |
|
1471 | + $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
|
1472 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row); |
|
1473 | 1473 | $row++; |
1474 | 1474 | } |
1475 | 1475 | } else { |
1476 | 1476 | $template_args['total_ticket_rows'] = 1; |
1477 | 1477 | /** @type EE_Ticket $ticket */ |
1478 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(); |
|
1479 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1478 | + $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
|
1479 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1480 | 1480 | } |
1481 | 1481 | } else { |
1482 | 1482 | $template_args['time'] = $times[0]; |
1483 | 1483 | /** @type EE_Ticket $ticket */ |
1484 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->get_all_default_tickets(); |
|
1485 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1484 | + $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
|
1485 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1486 | 1486 | // NOTE: we're just sending the first default row |
1487 | 1487 | // (decaf can't manage default tickets so this should be sufficient); |
1488 | 1488 | } |
1489 | 1489 | $template_args['event_datetime_help_link'] = $this->_get_help_tab_link( |
1490 | 1490 | 'event_editor_event_datetimes_help_tab' |
1491 | 1491 | ); |
1492 | - $template_args['ticket_options_help_link'] = $this->_get_help_tab_link( 'ticket_options_info' ); |
|
1493 | - $template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
1494 | - $template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
1492 | + $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
|
1493 | + $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
1494 | + $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
1495 | 1495 | $template_args['ticket_js_structure'] = $this->_get_ticket_row( |
1496 | - EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(), |
|
1496 | + EE_Registry::instance()->load_model('Ticket')->create_default_object(), |
|
1497 | 1497 | true |
1498 | 1498 | ); |
1499 | 1499 | $template = apply_filters( |
1500 | 1500 | 'FHEE__Events_Admin_Page__ticket_metabox__template', |
1501 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' |
|
1501 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php' |
|
1502 | 1502 | ); |
1503 | - EEH_Template::display_template( $template, $template_args ); |
|
1503 | + EEH_Template::display_template($template, $template_args); |
|
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | |
@@ -1514,74 +1514,74 @@ discard block |
||
1514 | 1514 | * @param int $row |
1515 | 1515 | * @return string generated html for the ticket row. |
1516 | 1516 | */ |
1517 | - private function _get_ticket_row( $ticket, $skeleton = false, $row = 0 ) { |
|
1517 | + private function _get_ticket_row($ticket, $skeleton = false, $row = 0) { |
|
1518 | 1518 | $template_args = array( |
1519 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1519 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1520 | 1520 | 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' |
1521 | 1521 | : '', |
1522 | 1522 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1523 | - 'TKT_ID' => $ticket->get( 'TKT_ID' ), |
|
1524 | - 'TKT_name' => $ticket->get( 'TKT_name' ), |
|
1525 | - 'TKT_start_date' => $skeleton ? '' : $ticket->get_date( 'TKT_start_date', 'Y-m-d h:i a' ), |
|
1526 | - 'TKT_end_date' => $skeleton ? '' : $ticket->get_date( 'TKT_end_date', 'Y-m-d h:i a' ), |
|
1527 | - 'TKT_is_default' => $ticket->get( 'TKT_is_default' ), |
|
1528 | - 'TKT_qty' => $ticket->get_pretty( 'TKT_qty', 'input' ), |
|
1523 | + 'TKT_ID' => $ticket->get('TKT_ID'), |
|
1524 | + 'TKT_name' => $ticket->get('TKT_name'), |
|
1525 | + 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
|
1526 | + 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
|
1527 | + 'TKT_is_default' => $ticket->get('TKT_is_default'), |
|
1528 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1529 | 1529 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1530 | - 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
|
1531 | - 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
|
1532 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1530 | + 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
|
1531 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) |
|
1532 | + && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) |
|
1533 | 1533 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1534 | - 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
|
1534 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' |
|
1535 | 1535 | : ' disabled=disabled', |
1536 | 1536 | ); |
1537 | 1537 | $price = $ticket->ID() !== 0 |
1538 | - ? $ticket->get_first_related( 'Price', array( 'default_where_conditions' => 'none' ) ) |
|
1539 | - : EE_Registry::instance()->load_model( 'Price' )->create_default_object(); |
|
1538 | + ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) |
|
1539 | + : EE_Registry::instance()->load_model('Price')->create_default_object(); |
|
1540 | 1540 | $price_args = array( |
1541 | 1541 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1542 | - 'PRC_amount' => $price->get( 'PRC_amount' ), |
|
1543 | - 'PRT_ID' => $price->get( 'PRT_ID' ), |
|
1544 | - 'PRC_ID' => $price->get( 'PRC_ID' ), |
|
1545 | - 'PRC_is_default' => $price->get( 'PRC_is_default' ), |
|
1542 | + 'PRC_amount' => $price->get('PRC_amount'), |
|
1543 | + 'PRT_ID' => $price->get('PRT_ID'), |
|
1544 | + 'PRC_ID' => $price->get('PRC_ID'), |
|
1545 | + 'PRC_is_default' => $price->get('PRC_is_default'), |
|
1546 | 1546 | ); |
1547 | 1547 | //make sure we have default start and end dates if skeleton |
1548 | 1548 | //handle rows that should NOT be empty |
1549 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1549 | + if (empty($template_args['TKT_start_date'])) { |
|
1550 | 1550 | //if empty then the start date will be now. |
1551 | - $template_args['TKT_start_date'] = date( 'Y-m-d h:i a', current_time( 'timestamp' ) ); |
|
1551 | + $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
|
1552 | 1552 | } |
1553 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1553 | + if (empty($template_args['TKT_end_date'])) { |
|
1554 | 1554 | //get the earliest datetime (if present); |
1555 | 1555 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 |
1556 | 1556 | ? $this->_cpt_model_obj->get_first_related( |
1557 | 1557 | 'Datetime', |
1558 | - array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) |
|
1558 | + array('order_by' => array('DTT_EVT_start' => 'ASC')) |
|
1559 | 1559 | ) |
1560 | 1560 | : null; |
1561 | - if ( ! empty( $earliest_dtt ) ) { |
|
1562 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime( 'DTT_EVT_start', 'Y-m-d', 'h:i a' ); |
|
1561 | + if ( ! empty($earliest_dtt)) { |
|
1562 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1563 | 1563 | } else { |
1564 | 1564 | $template_args['TKT_end_date'] = date( |
1565 | 1565 | 'Y-m-d h:i a', |
1566 | - mktime( 0, 0, 0, date( "m" ), date( "d" ) + 7, date( "Y" ) ) |
|
1566 | + mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")) |
|
1567 | 1567 | ); |
1568 | 1568 | } |
1569 | 1569 | } |
1570 | - $template_args = array_merge( $template_args, $price_args ); |
|
1570 | + $template_args = array_merge($template_args, $price_args); |
|
1571 | 1571 | $template = apply_filters( |
1572 | 1572 | 'FHEE__Events_Admin_Page__get_ticket_row__template', |
1573 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', |
|
1573 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', |
|
1574 | 1574 | $ticket |
1575 | 1575 | ); |
1576 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
1576 | + return EEH_Template::display_template($template, $template_args, true); |
|
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | |
1580 | 1580 | |
1581 | 1581 | public function registration_options_meta_box() { |
1582 | 1582 | $yes_no_values = array( |
1583 | - array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ), |
|
1584 | - array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ), |
|
1583 | + array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')), |
|
1584 | + array('id' => false, 'text' => esc_html__('No', 'event_espresso')), |
|
1585 | 1585 | ); |
1586 | 1586 | $default_reg_status_values = EEM_Registration::reg_status_array( |
1587 | 1587 | array( |
@@ -1593,7 +1593,7 @@ discard block |
||
1593 | 1593 | ); |
1594 | 1594 | //$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active()); |
1595 | 1595 | $template_args['_event'] = $this->_cpt_model_obj; |
1596 | - $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false ); |
|
1596 | + $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
1597 | 1597 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
1598 | 1598 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
1599 | 1599 | 'default_reg_status', |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | $default_reg_status_values |
1622 | 1622 | ); |
1623 | 1623 | EEH_Template::display_template( |
1624 | - EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
1624 | + EVENTS_TEMPLATE_PATH.'event_registration_options.template.php', |
|
1625 | 1625 | $template_args |
1626 | 1626 | ); |
1627 | 1627 | } |
@@ -1640,97 +1640,97 @@ discard block |
||
1640 | 1640 | * that match the given _view and paging parameters. |
1641 | 1641 | * @return array an array of event objects. |
1642 | 1642 | */ |
1643 | - public function get_events( $per_page = 10, $current_page = 1, $count = false ) { |
|
1643 | + public function get_events($per_page = 10, $current_page = 1, $count = false) { |
|
1644 | 1644 | $EEME = $this->_event_model(); |
1645 | - $offset = ( $current_page - 1 ) * $per_page; |
|
1646 | - $limit = $count ? null : $offset . ',' . $per_page; |
|
1647 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1648 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : "DESC"; |
|
1649 | - if ( isset( $this->_req_data['month_range'] ) ) { |
|
1650 | - $pieces = explode( ' ', $this->_req_data['month_range'], 3 ); |
|
1651 | - $month_r = ! empty( $pieces[0] ) ? date( 'm', strtotime( $pieces[0] ) ) : ''; |
|
1652 | - $year_r = ! empty( $pieces[1] ) ? $pieces[1] : ''; |
|
1645 | + $offset = ($current_page - 1) * $per_page; |
|
1646 | + $limit = $count ? null : $offset.','.$per_page; |
|
1647 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1648 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
|
1649 | + if (isset($this->_req_data['month_range'])) { |
|
1650 | + $pieces = explode(' ', $this->_req_data['month_range'], 3); |
|
1651 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1652 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1653 | 1653 | } |
1654 | 1654 | $where = array(); |
1655 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null; |
|
1655 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1656 | 1656 | //determine what post_status our condition will have for the query. |
1657 | - switch ( $status ) { |
|
1657 | + switch ($status) { |
|
1658 | 1658 | case 'month' : |
1659 | 1659 | case 'today' : |
1660 | 1660 | case null : |
1661 | 1661 | case 'all' : |
1662 | 1662 | break; |
1663 | 1663 | case 'draft' : |
1664 | - $where['status'] = array( 'IN', array( 'draft', 'auto-draft' ) ); |
|
1664 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1665 | 1665 | break; |
1666 | 1666 | default : |
1667 | 1667 | $where['status'] = $status; |
1668 | 1668 | } |
1669 | 1669 | //categories? |
1670 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 |
|
1670 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
1671 | 1671 | ? $this->_req_data['EVT_CAT'] : null; |
1672 | - if ( ! empty ( $category ) ) { |
|
1672 | + if ( ! empty ($category)) { |
|
1673 | 1673 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1674 | 1674 | $where['Term_Taxonomy.term_id'] = $category; |
1675 | 1675 | } |
1676 | 1676 | //date where conditions |
1677 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1678 | - if ( isset( $this->_req_data['month_range'] ) && $this->_req_data['month_range'] != '' ) { |
|
1677 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1678 | + if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
|
1679 | 1679 | $DateTime = new DateTime( |
1680 | - $year_r . '-' . $month_r . '-01 00:00:00', |
|
1681 | - new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) |
|
1680 | + $year_r.'-'.$month_r.'-01 00:00:00', |
|
1681 | + new DateTimeZone(EEM_Datetime::instance()->get_timezone()) |
|
1682 | 1682 | ); |
1683 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1684 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format( 't' ) )->setTime( 23, 59, 59 )->format( |
|
1685 | - implode( ' ', $start_formats ) |
|
1683 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1684 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format( |
|
1685 | + implode(' ', $start_formats) |
|
1686 | 1686 | ); |
1687 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1688 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ) { |
|
1689 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1690 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1691 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1692 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1693 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ) { |
|
1694 | - $now = date( 'Y-m-01' ); |
|
1695 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1696 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1697 | - $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
|
1698 | - ->setTime( 23, 59, 59 ) |
|
1699 | - ->format( implode( ' ', $start_formats ) ); |
|
1700 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1687 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1688 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
|
1689 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1690 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1691 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1692 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1693 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1694 | + $now = date('Y-m-01'); |
|
1695 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1696 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1697 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t')) |
|
1698 | + ->setTime(23, 59, 59) |
|
1699 | + ->format(implode(' ', $start_formats)); |
|
1700 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1701 | 1701 | } |
1702 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1702 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1703 | 1703 | $where['EVT_wp_user'] = get_current_user_id(); |
1704 | 1704 | } else { |
1705 | - if ( ! isset( $where['status'] ) ) { |
|
1706 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1705 | + if ( ! isset($where['status'])) { |
|
1706 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1707 | 1707 | $where['OR'] = array( |
1708 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1708 | + 'status*restrict_private' => array('!=', 'private'), |
|
1709 | 1709 | 'AND' => array( |
1710 | - 'status*inclusive' => array( '=', 'private' ), |
|
1710 | + 'status*inclusive' => array('=', 'private'), |
|
1711 | 1711 | 'EVT_wp_user' => get_current_user_id(), |
1712 | 1712 | ), |
1713 | 1713 | ); |
1714 | 1714 | } |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1718 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1719 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1717 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1718 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1719 | + && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events') |
|
1720 | 1720 | ) { |
1721 | 1721 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1722 | 1722 | } |
1723 | 1723 | } |
1724 | 1724 | //search query handling |
1725 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1726 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1725 | + if (isset($this->_req_data['s'])) { |
|
1726 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1727 | 1727 | $where['OR'] = array( |
1728 | - 'EVT_name' => array( 'LIKE', $search_string ), |
|
1729 | - 'EVT_desc' => array( 'LIKE', $search_string ), |
|
1730 | - 'EVT_short_desc' => array( 'LIKE', $search_string ), |
|
1728 | + 'EVT_name' => array('LIKE', $search_string), |
|
1729 | + 'EVT_desc' => array('LIKE', $search_string), |
|
1730 | + 'EVT_short_desc' => array('LIKE', $search_string), |
|
1731 | 1731 | ); |
1732 | 1732 | } |
1733 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1733 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1734 | 1734 | $query_params = apply_filters( |
1735 | 1735 | 'FHEE__Events_Admin_Page__get_events__query_params', |
1736 | 1736 | array( |
@@ -1743,23 +1743,23 @@ discard block |
||
1743 | 1743 | $this->_req_data |
1744 | 1744 | ); |
1745 | 1745 | //let's first check if we have special requests coming in. |
1746 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1747 | - switch ( $this->_req_data['active_status'] ) { |
|
1746 | + if (isset($this->_req_data['active_status'])) { |
|
1747 | + switch ($this->_req_data['active_status']) { |
|
1748 | 1748 | case 'upcoming' : |
1749 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1749 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1750 | 1750 | break; |
1751 | 1751 | case 'expired' : |
1752 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1752 | + return $EEME->get_expired_events($query_params, $count); |
|
1753 | 1753 | break; |
1754 | 1754 | case 'active' : |
1755 | - return $EEME->get_active_events( $query_params, $count ); |
|
1755 | + return $EEME->get_active_events($query_params, $count); |
|
1756 | 1756 | break; |
1757 | 1757 | case 'inactive' : |
1758 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1758 | + return $EEME->get_inactive_events($query_params, $count); |
|
1759 | 1759 | break; |
1760 | 1760 | } |
1761 | 1761 | } |
1762 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1762 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1763 | 1763 | return $events; |
1764 | 1764 | } |
1765 | 1765 | |
@@ -1770,9 +1770,9 @@ discard block |
||
1770 | 1770 | * |
1771 | 1771 | * @param string $post_id |
1772 | 1772 | */ |
1773 | - public function trash_cpt_item( $post_id ) { |
|
1773 | + public function trash_cpt_item($post_id) { |
|
1774 | 1774 | $this->_req_data['EVT_ID'] = $post_id; |
1775 | - $this->_trash_or_restore_event( 'trash', false ); |
|
1775 | + $this->_trash_or_restore_event('trash', false); |
|
1776 | 1776 | } |
1777 | 1777 | |
1778 | 1778 | |
@@ -1780,9 +1780,9 @@ discard block |
||
1780 | 1780 | /** |
1781 | 1781 | * @param string $post_id |
1782 | 1782 | */ |
1783 | - public function restore_cpt_item( $post_id ) { |
|
1783 | + public function restore_cpt_item($post_id) { |
|
1784 | 1784 | $this->_req_data['EVT_ID'] = $post_id; |
1785 | - $this->_trash_or_restore_event( 'draft', false ); |
|
1785 | + $this->_trash_or_restore_event('draft', false); |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | |
@@ -1790,9 +1790,9 @@ discard block |
||
1790 | 1790 | /** |
1791 | 1791 | * @param string $post_id |
1792 | 1792 | */ |
1793 | - public function delete_cpt_item( $post_id ) { |
|
1793 | + public function delete_cpt_item($post_id) { |
|
1794 | 1794 | $this->_req_data['EVT_ID'] = $post_id; |
1795 | - $this->_delete_event( false ); |
|
1795 | + $this->_delete_event(false); |
|
1796 | 1796 | } |
1797 | 1797 | |
1798 | 1798 | |
@@ -1804,23 +1804,23 @@ discard block |
||
1804 | 1804 | * @param string $event_status |
1805 | 1805 | * @param bool $redirect_after |
1806 | 1806 | */ |
1807 | - protected function _trash_or_restore_event( $event_status = 'trash', $redirect_after = true ) { |
|
1807 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true) { |
|
1808 | 1808 | //determine the event id and set to array. |
1809 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : false; |
|
1809 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false; |
|
1810 | 1810 | // loop thru events |
1811 | - if ( $EVT_ID ) { |
|
1811 | + if ($EVT_ID) { |
|
1812 | 1812 | // clean status |
1813 | - $event_status = sanitize_key( $event_status ); |
|
1813 | + $event_status = sanitize_key($event_status); |
|
1814 | 1814 | // grab status |
1815 | - if ( ! empty( $event_status ) ) { |
|
1816 | - $success = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1815 | + if ( ! empty($event_status)) { |
|
1816 | + $success = $this->_change_event_status($EVT_ID, $event_status); |
|
1817 | 1817 | } else { |
1818 | 1818 | $success = false; |
1819 | 1819 | $msg = esc_html__( |
1820 | 1820 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1821 | 1821 | 'event_espresso' |
1822 | 1822 | ); |
1823 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1823 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1824 | 1824 | } |
1825 | 1825 | } else { |
1826 | 1826 | $success = false; |
@@ -1828,11 +1828,11 @@ discard block |
||
1828 | 1828 | 'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.', |
1829 | 1829 | 'event_espresso' |
1830 | 1830 | ); |
1831 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1831 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1832 | 1832 | } |
1833 | 1833 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1834 | - if ( $redirect_after ) { |
|
1835 | - $this->_redirect_after_action( $success, 'Event', $action, array( 'action' => 'default' ) ); |
|
1834 | + if ($redirect_after) { |
|
1835 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1836 | 1836 | } |
1837 | 1837 | } |
1838 | 1838 | |
@@ -1845,18 +1845,18 @@ discard block |
||
1845 | 1845 | * @param string $event_status |
1846 | 1846 | * @return void |
1847 | 1847 | */ |
1848 | - protected function _trash_or_restore_events( $event_status = 'trash' ) { |
|
1848 | + protected function _trash_or_restore_events($event_status = 'trash') { |
|
1849 | 1849 | // clean status |
1850 | - $event_status = sanitize_key( $event_status ); |
|
1850 | + $event_status = sanitize_key($event_status); |
|
1851 | 1851 | // grab status |
1852 | - if ( ! empty( $event_status ) ) { |
|
1852 | + if ( ! empty($event_status)) { |
|
1853 | 1853 | $success = true; |
1854 | 1854 | //determine the event id and set to array. |
1855 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1855 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1856 | 1856 | // loop thru events |
1857 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
1858 | - if ( $EVT_ID = absint( $EVT_ID ) ) { |
|
1859 | - $results = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1857 | + foreach ($EVT_IDs as $EVT_ID) { |
|
1858 | + if ($EVT_ID = absint($EVT_ID)) { |
|
1859 | + $results = $this->_change_event_status($EVT_ID, $event_status); |
|
1860 | 1860 | $success = $results !== false ? $success : false; |
1861 | 1861 | } else { |
1862 | 1862 | $msg = sprintf( |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | ), |
1867 | 1867 | $EVT_ID |
1868 | 1868 | ); |
1869 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1869 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1870 | 1870 | $success = false; |
1871 | 1871 | } |
1872 | 1872 | } |
@@ -1876,12 +1876,12 @@ discard block |
||
1876 | 1876 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1877 | 1877 | 'event_espresso' |
1878 | 1878 | ); |
1879 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1879 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1880 | 1880 | } |
1881 | 1881 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
1882 | 1882 | $success = $success ? 2 : false; |
1883 | 1883 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1884 | - $this->_redirect_after_action( $success, 'Events', $action, array( 'action' => 'default' ) ); |
|
1884 | + $this->_redirect_after_action($success, 'Events', $action, array('action' => 'default')); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | |
@@ -1894,30 +1894,30 @@ discard block |
||
1894 | 1894 | * @param string $event_status |
1895 | 1895 | * @return bool |
1896 | 1896 | */ |
1897 | - private function _change_event_status( $EVT_ID = 0, $event_status = '' ) { |
|
1897 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1898 | 1898 | // grab event id |
1899 | - if ( ! $EVT_ID ) { |
|
1899 | + if ( ! $EVT_ID) { |
|
1900 | 1900 | $msg = esc_html__( |
1901 | 1901 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
1902 | 1902 | 'event_espresso' |
1903 | 1903 | ); |
1904 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1904 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1905 | 1905 | return false; |
1906 | 1906 | } |
1907 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1907 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1908 | 1908 | // clean status |
1909 | - $event_status = sanitize_key( $event_status ); |
|
1909 | + $event_status = sanitize_key($event_status); |
|
1910 | 1910 | // grab status |
1911 | - if ( empty( $event_status ) ) { |
|
1911 | + if (empty($event_status)) { |
|
1912 | 1912 | $msg = esc_html__( |
1913 | 1913 | 'An error occurred. No Event Status or an invalid Event Status was received.', |
1914 | 1914 | 'event_espresso' |
1915 | 1915 | ); |
1916 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1916 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1917 | 1917 | return false; |
1918 | 1918 | } |
1919 | 1919 | // was event trashed or restored ? |
1920 | - switch ( $event_status ) { |
|
1920 | + switch ($event_status) { |
|
1921 | 1921 | case 'draft' : |
1922 | 1922 | $action = 'restored from the trash'; |
1923 | 1923 | $hook = 'AHEE_event_restored_from_trash'; |
@@ -1931,15 +1931,15 @@ discard block |
||
1931 | 1931 | $hook = false; |
1932 | 1932 | } |
1933 | 1933 | //use class to change status |
1934 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1934 | + $this->_cpt_model_obj->set_status($event_status); |
|
1935 | 1935 | $success = $this->_cpt_model_obj->save(); |
1936 | - if ( $success === false ) { |
|
1937 | - $msg = sprintf( esc_html__( 'An error occurred. The event could not be %s.', 'event_espresso' ), $action ); |
|
1938 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1936 | + if ($success === false) { |
|
1937 | + $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1938 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1939 | 1939 | return false; |
1940 | 1940 | } |
1941 | - if ( $hook ) { |
|
1942 | - do_action( $hook ); |
|
1941 | + if ($hook) { |
|
1942 | + do_action($hook); |
|
1943 | 1943 | } |
1944 | 1944 | return true; |
1945 | 1945 | } |
@@ -1952,34 +1952,34 @@ discard block |
||
1952 | 1952 | * @access protected |
1953 | 1953 | * @param bool $redirect_after |
1954 | 1954 | */ |
1955 | - protected function _delete_event( $redirect_after = true ) { |
|
1955 | + protected function _delete_event($redirect_after = true) { |
|
1956 | 1956 | //determine the event id and set to array. |
1957 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : null; |
|
1958 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1957 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null; |
|
1958 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1959 | 1959 | // loop thru events |
1960 | - if ( $EVT_ID ) { |
|
1961 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1960 | + if ($EVT_ID) { |
|
1961 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1962 | 1962 | // get list of events with no prices |
1963 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
1963 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
1964 | 1964 | // remove this event from the list of events with no prices |
1965 | - if ( isset( $espresso_no_ticket_prices[ $EVT_ID ] ) ) { |
|
1966 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1965 | + if (isset($espresso_no_ticket_prices[$EVT_ID])) { |
|
1966 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1967 | 1967 | } |
1968 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
1968 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
1969 | 1969 | } else { |
1970 | 1970 | $success = false; |
1971 | 1971 | $msg = esc_html__( |
1972 | 1972 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
1973 | 1973 | 'event_espresso' |
1974 | 1974 | ); |
1975 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1975 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1976 | 1976 | } |
1977 | - if ( $redirect_after ) { |
|
1977 | + if ($redirect_after) { |
|
1978 | 1978 | $this->_redirect_after_action( |
1979 | 1979 | $success, |
1980 | 1980 | 'Event', |
1981 | 1981 | 'deleted', |
1982 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
1982 | + array('action' => 'default', 'status' => 'trash') |
|
1983 | 1983 | ); |
1984 | 1984 | } |
1985 | 1985 | } |
@@ -1995,30 +1995,30 @@ discard block |
||
1995 | 1995 | protected function _delete_events() { |
1996 | 1996 | $success = true; |
1997 | 1997 | // get list of events with no prices |
1998 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
1998 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
1999 | 1999 | //determine the event id and set to array. |
2000 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2000 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2001 | 2001 | // loop thru events |
2002 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
2003 | - $EVT_ID = absint( $EVT_ID ); |
|
2004 | - if ( $EVT_ID ) { |
|
2005 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
2002 | + foreach ($EVT_IDs as $EVT_ID) { |
|
2003 | + $EVT_ID = absint($EVT_ID); |
|
2004 | + if ($EVT_ID) { |
|
2005 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
2006 | 2006 | $success = $results !== false ? $success : false; |
2007 | 2007 | // remove this event from the list of events with no prices |
2008 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
2008 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
2009 | 2009 | } else { |
2010 | 2010 | $success = false; |
2011 | 2011 | $msg = esc_html__( |
2012 | 2012 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
2013 | 2013 | 'event_espresso' |
2014 | 2014 | ); |
2015 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2015 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2016 | 2016 | } |
2017 | 2017 | } |
2018 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
2018 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
2019 | 2019 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
2020 | 2020 | $success = $success ? 2 : false; |
2021 | - $this->_redirect_after_action( $success, 'Events', 'deleted', array( 'action' => 'default' ) ); |
|
2021 | + $this->_redirect_after_action($success, 'Events', 'deleted', array('action' => 'default')); |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | |
@@ -2030,70 +2030,70 @@ discard block |
||
2030 | 2030 | * @param int $EVT_ID |
2031 | 2031 | * @return bool |
2032 | 2032 | */ |
2033 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
2033 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
2034 | 2034 | // grab event id |
2035 | - if ( ! $EVT_ID ) { |
|
2035 | + if ( ! $EVT_ID) { |
|
2036 | 2036 | $msg = esc_html__( |
2037 | 2037 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
2038 | 2038 | 'event_espresso' |
2039 | 2039 | ); |
2040 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2040 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2041 | 2041 | return false; |
2042 | 2042 | } |
2043 | 2043 | if ( |
2044 | 2044 | ! $this->_cpt_model_obj instanceof EE_Event |
2045 | 2045 | || $this->_cpt_model_obj->ID() !== $EVT_ID |
2046 | 2046 | ) { |
2047 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
2047 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
2048 | 2048 | } |
2049 | - if ( ! $this->_cpt_model_obj instanceof EE_Event ) { |
|
2049 | + if ( ! $this->_cpt_model_obj instanceof EE_Event) { |
|
2050 | 2050 | return false; |
2051 | 2051 | } |
2052 | 2052 | //need to delete related tickets and prices first. |
2053 | - $datetimes = $this->_cpt_model_obj->get_many_related( 'Datetime' ); |
|
2054 | - foreach ( $datetimes as $datetime ) { |
|
2055 | - $this->_cpt_model_obj->_remove_relation_to( $datetime, 'Datetime' ); |
|
2056 | - $tickets = $datetime->get_many_related( 'Ticket' ); |
|
2057 | - foreach ( $tickets as $ticket ) { |
|
2058 | - $ticket->_remove_relation_to( $datetime, 'Datetime' ); |
|
2059 | - $ticket->delete_related_permanently( 'Price' ); |
|
2053 | + $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
|
2054 | + foreach ($datetimes as $datetime) { |
|
2055 | + $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
|
2056 | + $tickets = $datetime->get_many_related('Ticket'); |
|
2057 | + foreach ($tickets as $ticket) { |
|
2058 | + $ticket->_remove_relation_to($datetime, 'Datetime'); |
|
2059 | + $ticket->delete_related_permanently('Price'); |
|
2060 | 2060 | $ticket->delete_permanently(); |
2061 | 2061 | } |
2062 | 2062 | $datetime->delete(); |
2063 | 2063 | } |
2064 | 2064 | //what about related venues or terms? |
2065 | - $venues = $this->_cpt_model_obj->get_many_related( 'Venue' ); |
|
2066 | - foreach ( $venues as $venue ) { |
|
2067 | - $this->_cpt_model_obj->_remove_relation_to( $venue, 'Venue' ); |
|
2065 | + $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
|
2066 | + foreach ($venues as $venue) { |
|
2067 | + $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
|
2068 | 2068 | } |
2069 | 2069 | //any attached question groups? |
2070 | - $question_groups = $this->_cpt_model_obj->get_many_related( 'Question_Group' ); |
|
2071 | - if ( ! empty( $question_groups ) ) { |
|
2072 | - foreach ( $question_groups as $question_group ) { |
|
2073 | - $this->_cpt_model_obj->_remove_relation_to( $question_group, 'Question_Group' ); |
|
2070 | + $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
|
2071 | + if ( ! empty($question_groups)) { |
|
2072 | + foreach ($question_groups as $question_group) { |
|
2073 | + $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
|
2074 | 2074 | } |
2075 | 2075 | } |
2076 | 2076 | //Message Template Groups |
2077 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
2077 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
2078 | 2078 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
2079 | 2079 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
2080 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
2081 | - $this->_cpt_model_obj->remove_relation_to_term_taxonomy( $term_taxonomy ); |
|
2080 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
2081 | + $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
|
2082 | 2082 | } |
2083 | 2083 | $success = $this->_cpt_model_obj->delete_permanently(); |
2084 | 2084 | // did it all go as planned ? |
2085 | - if ( $success ) { |
|
2086 | - $msg = sprintf( esc_html__( 'Event ID # %d has been deleted.', 'event_espresso' ), $EVT_ID ); |
|
2087 | - EE_Error::add_success( $msg ); |
|
2085 | + if ($success) { |
|
2086 | + $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
2087 | + EE_Error::add_success($msg); |
|
2088 | 2088 | } else { |
2089 | 2089 | $msg = sprintf( |
2090 | - esc_html__( 'An error occurred. Event ID # %d could not be deleted.', 'event_espresso' ), |
|
2090 | + esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), |
|
2091 | 2091 | $EVT_ID |
2092 | 2092 | ); |
2093 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2093 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2094 | 2094 | return false; |
2095 | 2095 | } |
2096 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
2096 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
2097 | 2097 | return true; |
2098 | 2098 | } |
2099 | 2099 | |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | * @return int |
2107 | 2107 | */ |
2108 | 2108 | public function total_events() { |
2109 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2109 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
2110 | 2110 | return $count; |
2111 | 2111 | } |
2112 | 2112 | |
@@ -2120,9 +2120,9 @@ discard block |
||
2120 | 2120 | */ |
2121 | 2121 | public function total_events_draft() { |
2122 | 2122 | $where = array( |
2123 | - 'status' => array( 'IN', array( 'draft', 'auto-draft' ) ), |
|
2123 | + 'status' => array('IN', array('draft', 'auto-draft')), |
|
2124 | 2124 | ); |
2125 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2125 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2126 | 2126 | return $count; |
2127 | 2127 | } |
2128 | 2128 | |
@@ -2138,7 +2138,7 @@ discard block |
||
2138 | 2138 | $where = array( |
2139 | 2139 | 'status' => 'trash', |
2140 | 2140 | ); |
2141 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2141 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2142 | 2142 | return $count; |
2143 | 2143 | } |
2144 | 2144 | |
@@ -2169,12 +2169,12 @@ discard block |
||
2169 | 2169 | EE_Registry::instance()->CFG->registration->default_STS_ID, |
2170 | 2170 | $this->_template_args['reg_status_array'] |
2171 | 2171 | ) |
2172 | - ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) |
|
2172 | + ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) |
|
2173 | 2173 | : EEM_Registration::status_id_pending_payment; |
2174 | - $this->_set_add_edit_form_tags( 'update_default_event_settings' ); |
|
2175 | - $this->_set_publish_post_box_vars( null, false, false, null, false ); |
|
2174 | + $this->_set_add_edit_form_tags('update_default_event_settings'); |
|
2175 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
2176 | 2176 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2177 | - EVENTS_TEMPLATE_PATH . 'event_settings.template.php', |
|
2177 | + EVENTS_TEMPLATE_PATH.'event_settings.template.php', |
|
2178 | 2178 | $this->_template_args, |
2179 | 2179 | true |
2180 | 2180 | ); |
@@ -2190,8 +2190,8 @@ discard block |
||
2190 | 2190 | * @return void |
2191 | 2191 | */ |
2192 | 2192 | protected function _update_default_event_settings() { |
2193 | - EE_Config::instance()->registration->default_STS_ID = isset( $this->_req_data['default_reg_status'] ) |
|
2194 | - ? sanitize_text_field( $this->_req_data['default_reg_status'] ) |
|
2193 | + EE_Config::instance()->registration->default_STS_ID = isset($this->_req_data['default_reg_status']) |
|
2194 | + ? sanitize_text_field($this->_req_data['default_reg_status']) |
|
2195 | 2195 | : EEM_Registration::status_id_pending_payment; |
2196 | 2196 | $what = 'Default Event Settings'; |
2197 | 2197 | $success = $this->_update_espresso_configuration( |
@@ -2201,7 +2201,7 @@ discard block |
||
2201 | 2201 | __FUNCTION__, |
2202 | 2202 | __LINE__ |
2203 | 2203 | ); |
2204 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default_event_settings' ) ); |
|
2204 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default_event_settings')); |
|
2205 | 2205 | } |
2206 | 2206 | |
2207 | 2207 | |
@@ -2211,20 +2211,20 @@ discard block |
||
2211 | 2211 | |
2212 | 2212 | |
2213 | 2213 | protected function _template_settings() { |
2214 | - $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
|
2214 | + $this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso'); |
|
2215 | 2215 | $this->_template_args['preview_img'] = '<img src="' |
2216 | 2216 | . EVENTS_ASSETS_URL |
2217 | 2217 | . DS |
2218 | 2218 | . 'images' |
2219 | 2219 | . DS |
2220 | 2220 | . 'caffeinated_template_features.jpg" alt="' |
2221 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2221 | + . esc_attr__('Template Settings Preview screenshot', 'event_espresso') |
|
2222 | 2222 | . '" />'; |
2223 | - $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
|
2223 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__( |
|
2224 | 2224 | 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', |
2225 | 2225 | 'event_espresso' |
2226 | - ) . '</strong>'; |
|
2227 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2226 | + ).'</strong>'; |
|
2227 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2228 | 2228 | } |
2229 | 2229 | |
2230 | 2230 | |
@@ -2236,18 +2236,18 @@ discard block |
||
2236 | 2236 | * @return void |
2237 | 2237 | */ |
2238 | 2238 | private function _set_category_object() { |
2239 | - if ( isset( $this->_category->id ) && ! empty( $this->_category->id ) ) { |
|
2239 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
2240 | 2240 | return; |
2241 | 2241 | } //already have the category object so get out. |
2242 | 2242 | //set default category object |
2243 | 2243 | $this->_set_empty_category_object(); |
2244 | 2244 | //only set if we've got an id |
2245 | - if ( ! isset( $this->_req_data['EVT_CAT_ID'] ) ) { |
|
2245 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2246 | 2246 | return; |
2247 | 2247 | } |
2248 | - $category_id = absint( $this->_req_data['EVT_CAT_ID'] ); |
|
2249 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2250 | - if ( ! empty( $term ) ) { |
|
2248 | + $category_id = absint($this->_req_data['EVT_CAT_ID']); |
|
2249 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2250 | + if ( ! empty($term)) { |
|
2251 | 2251 | $this->_category->category_name = $term->name; |
2252 | 2252 | $this->_category->category_identifier = $term->slug; |
2253 | 2253 | $this->_category->category_desc = $term->description; |
@@ -2267,9 +2267,9 @@ discard block |
||
2267 | 2267 | |
2268 | 2268 | |
2269 | 2269 | protected function _category_list_table() { |
2270 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2271 | - $this->_search_btn_label = esc_html__( 'Categories', 'event_espresso' ); |
|
2272 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
2270 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2271 | + $this->_search_btn_label = esc_html__('Categories', 'event_espresso'); |
|
2272 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
2273 | 2273 | 'add_category', |
2274 | 2274 | 'add_category', |
2275 | 2275 | array(), |
@@ -2283,20 +2283,20 @@ discard block |
||
2283 | 2283 | /** |
2284 | 2284 | * @param $view |
2285 | 2285 | */ |
2286 | - protected function _category_details( $view ) { |
|
2286 | + protected function _category_details($view) { |
|
2287 | 2287 | //load formatter helper |
2288 | 2288 | //load field generator helper |
2289 | 2289 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2290 | - $this->_set_add_edit_form_tags( $route ); |
|
2290 | + $this->_set_add_edit_form_tags($route); |
|
2291 | 2291 | $this->_set_category_object(); |
2292 | - $id = ! empty( $this->_category->id ) ? $this->_category->id : ''; |
|
2292 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2293 | 2293 | $delete_action = 'delete_category'; |
2294 | 2294 | //custom redirect |
2295 | 2295 | $redirect = EE_Admin_Page::add_query_args_and_nonce( |
2296 | - array( 'action' => 'category_list' ), |
|
2296 | + array('action' => 'category_list'), |
|
2297 | 2297 | $this->_admin_base_url |
2298 | 2298 | ); |
2299 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2299 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2300 | 2300 | //take care of contents |
2301 | 2301 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
2302 | 2302 | $this->display_admin_page_with_sidebar(); |
@@ -2310,21 +2310,21 @@ discard block |
||
2310 | 2310 | protected function _category_details_content() { |
2311 | 2311 | $editor_args['category_desc'] = array( |
2312 | 2312 | 'type' => 'wp_editor', |
2313 | - 'value' => EEH_Formatter::admin_format_content( $this->_category->category_desc ), |
|
2313 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
2314 | 2314 | 'class' => 'my_editor_custom', |
2315 | - 'wpeditor_args' => array( 'media_buttons' => false ), |
|
2315 | + 'wpeditor_args' => array('media_buttons' => false), |
|
2316 | 2316 | ); |
2317 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2317 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2318 | 2318 | $all_terms = get_terms( |
2319 | - array( 'espresso_event_categories' ), |
|
2320 | - array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) |
|
2319 | + array('espresso_event_categories'), |
|
2320 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
2321 | 2321 | ); |
2322 | 2322 | //setup category select for term parents. |
2323 | 2323 | $category_select_values[] = array( |
2324 | - 'text' => esc_html__( 'No Parent', 'event_espresso' ), |
|
2324 | + 'text' => esc_html__('No Parent', 'event_espresso'), |
|
2325 | 2325 | 'id' => 0, |
2326 | 2326 | ); |
2327 | - foreach ( $all_terms as $term ) { |
|
2327 | + foreach ($all_terms as $term) { |
|
2328 | 2328 | $category_select_values[] = array( |
2329 | 2329 | 'text' => $term->name, |
2330 | 2330 | 'id' => $term->term_id, |
@@ -2338,28 +2338,28 @@ discard block |
||
2338 | 2338 | $template_args = array( |
2339 | 2339 | 'category' => $this->_category, |
2340 | 2340 | 'category_select' => $category_select, |
2341 | - 'unique_id_info_help_link' => $this->_get_help_tab_link( 'unique_id_info' ), |
|
2341 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
2342 | 2342 | 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
2343 | 2343 | 'disable' => '', |
2344 | 2344 | 'disabled_message' => false, |
2345 | 2345 | ); |
2346 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2347 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
2346 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2347 | + return EEH_Template::display_template($template, $template_args, true); |
|
2348 | 2348 | } |
2349 | 2349 | |
2350 | 2350 | |
2351 | 2351 | |
2352 | 2352 | protected function _delete_categories() { |
2353 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2353 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2354 | 2354 | : (array) $this->_req_data['category_id']; |
2355 | - foreach ( $cat_ids as $cat_id ) { |
|
2356 | - $this->_delete_category( $cat_id ); |
|
2355 | + foreach ($cat_ids as $cat_id) { |
|
2356 | + $this->_delete_category($cat_id); |
|
2357 | 2357 | } |
2358 | 2358 | //doesn't matter what page we're coming from... we're going to the same place after delete. |
2359 | 2359 | $query_args = array( |
2360 | 2360 | 'action' => 'category_list', |
2361 | 2361 | ); |
2362 | - $this->_redirect_after_action( 0, '', '', $query_args ); |
|
2362 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2363 | 2363 | } |
2364 | 2364 | |
2365 | 2365 | |
@@ -2367,9 +2367,9 @@ discard block |
||
2367 | 2367 | /** |
2368 | 2368 | * @param $cat_id |
2369 | 2369 | */ |
2370 | - protected function _delete_category( $cat_id ) { |
|
2371 | - $cat_id = absint( $cat_id ); |
|
2372 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2370 | + protected function _delete_category($cat_id) { |
|
2371 | + $cat_id = absint($cat_id); |
|
2372 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2373 | 2373 | } |
2374 | 2374 | |
2375 | 2375 | |
@@ -2377,18 +2377,18 @@ discard block |
||
2377 | 2377 | /** |
2378 | 2378 | * @param $new_category |
2379 | 2379 | */ |
2380 | - protected function _insert_or_update_category( $new_category ) { |
|
2381 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( true ); |
|
2380 | + protected function _insert_or_update_category($new_category) { |
|
2381 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
2382 | 2382 | $success = 0; //we already have a success message so lets not send another. |
2383 | - if ( $cat_id ) { |
|
2383 | + if ($cat_id) { |
|
2384 | 2384 | $query_args = array( |
2385 | 2385 | 'action' => 'edit_category', |
2386 | 2386 | 'EVT_CAT_ID' => $cat_id, |
2387 | 2387 | ); |
2388 | 2388 | } else { |
2389 | - $query_args = array( 'action' => 'add_category' ); |
|
2389 | + $query_args = array('action' => 'add_category'); |
|
2390 | 2390 | } |
2391 | - $this->_redirect_after_action( $success, '', '', $query_args, true ); |
|
2391 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
2392 | 2392 | } |
2393 | 2393 | |
2394 | 2394 | |
@@ -2397,14 +2397,14 @@ discard block |
||
2397 | 2397 | * @param bool $update |
2398 | 2398 | * @return bool|mixed|string |
2399 | 2399 | */ |
2400 | - private function _insert_category( $update = false ) { |
|
2400 | + private function _insert_category($update = false) { |
|
2401 | 2401 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2402 | - $category_name = isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2403 | - $category_desc = isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2404 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2405 | - if ( empty( $category_name ) ) { |
|
2406 | - $msg = esc_html__( 'You must add a name for the category.', 'event_espresso' ); |
|
2407 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2402 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2403 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2404 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2405 | + if (empty($category_name)) { |
|
2406 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
2407 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2408 | 2408 | return false; |
2409 | 2409 | } |
2410 | 2410 | $term_args = array( |
@@ -2413,22 +2413,22 @@ discard block |
||
2413 | 2413 | 'parent' => $category_parent, |
2414 | 2414 | ); |
2415 | 2415 | //was the category_identifier input disabled? |
2416 | - if ( isset( $this->_req_data['category_identifier'] ) ) { |
|
2416 | + if (isset($this->_req_data['category_identifier'])) { |
|
2417 | 2417 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2418 | 2418 | } |
2419 | 2419 | $insert_ids = $update |
2420 | - ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) |
|
2421 | - : wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2422 | - if ( ! is_array( $insert_ids ) ) { |
|
2420 | + ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) |
|
2421 | + : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2422 | + if ( ! is_array($insert_ids)) { |
|
2423 | 2423 | $msg = esc_html__( |
2424 | 2424 | 'An error occurred and the category has not been saved to the database.', |
2425 | 2425 | 'event_espresso' |
2426 | 2426 | ); |
2427 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2427 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2428 | 2428 | } else { |
2429 | 2429 | $cat_id = $insert_ids['term_id']; |
2430 | - $msg = sprintf( esc_html__( 'The category %s was successfully saved', 'event_espresso' ), $category_name ); |
|
2431 | - EE_Error::add_success( $msg ); |
|
2430 | + $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name); |
|
2431 | + EE_Error::add_success($msg); |
|
2432 | 2432 | } |
2433 | 2433 | return $cat_id; |
2434 | 2434 | } |
@@ -2441,28 +2441,28 @@ discard block |
||
2441 | 2441 | * @param bool $count |
2442 | 2442 | * @return \EE_Base_Class[]|int |
2443 | 2443 | */ |
2444 | - public function get_categories( $per_page = 10, $current_page = 1, $count = false ) { |
|
2444 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) { |
|
2445 | 2445 | //testing term stuff |
2446 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2447 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2448 | - $limit = ( $current_page - 1 ) * $per_page; |
|
2449 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2450 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2451 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2446 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2447 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2448 | + $limit = ($current_page - 1) * $per_page; |
|
2449 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2450 | + if (isset($this->_req_data['s'])) { |
|
2451 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2452 | 2452 | $where['OR'] = array( |
2453 | - 'Term.name' => array( 'LIKE', $sstr ), |
|
2454 | - 'description' => array( 'LIKE', $sstr ), |
|
2453 | + 'Term.name' => array('LIKE', $sstr), |
|
2454 | + 'description' => array('LIKE', $sstr), |
|
2455 | 2455 | ); |
2456 | 2456 | } |
2457 | 2457 | $query_params = array( |
2458 | 2458 | $where, |
2459 | - 'order_by' => array( $orderby => $order ), |
|
2460 | - 'limit' => $limit . ',' . $per_page, |
|
2461 | - 'force_join' => array( 'Term' ), |
|
2459 | + 'order_by' => array($orderby => $order), |
|
2460 | + 'limit' => $limit.','.$per_page, |
|
2461 | + 'force_join' => array('Term'), |
|
2462 | 2462 | ); |
2463 | 2463 | $categories = $count |
2464 | - ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) |
|
2465 | - : EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2464 | + ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
2465 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2466 | 2466 | return $categories; |
2467 | 2467 | } |
2468 | 2468 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @param EE_Line_Item $line_item |
57 | 57 | * @param array $options |
58 | - * @return mixed |
|
58 | + * @return string |
|
59 | 59 | */ |
60 | 60 | public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
61 | 61 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param EE_Line_Item $line_item |
137 | 137 | * @param array $options |
138 | - * @return mixed |
|
138 | + * @return string |
|
139 | 139 | */ |
140 | 140 | private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
141 | 141 | // start of row |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param EE_Line_Item $line_item |
180 | 180 | * @param array $options |
181 | - * @return mixed |
|
181 | + * @return string |
|
182 | 182 | */ |
183 | 183 | private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
184 | 184 | // start of row |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | ); |
285 | 285 | $title = esc_attr__( 'Duplicate Event', 'event_espresso' ); |
286 | 286 | $return .= '<a href="' |
287 | - . $href |
|
288 | - . '" title="' |
|
289 | - . $title |
|
290 | - . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' |
|
291 | - . $title |
|
292 | - . '</button>'; |
|
287 | + . $href |
|
288 | + . '" title="' |
|
289 | + . $title |
|
290 | + . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' |
|
291 | + . $title |
|
292 | + . '</button>'; |
|
293 | 293 | } |
294 | 294 | return $return; |
295 | 295 | } |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | ); |
451 | 451 | $reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL ); |
452 | 452 | $action_links[] = '<a href="' |
453 | - . $reports_link |
|
454 | - . '" title="' |
|
455 | - . esc_attr__( 'View Report', 'event_espresso' ) |
|
456 | - . '"><div class="dashicons dashicons-chart-bar"></div></a>' |
|
457 | - . "\n\t"; |
|
453 | + . $reports_link |
|
454 | + . '" title="' |
|
455 | + . esc_attr__( 'View Report', 'event_espresso' ) |
|
456 | + . '"><div class="dashicons dashicons-chart-bar"></div></a>' |
|
457 | + . "\n\t"; |
|
458 | 458 | } |
459 | 459 | if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
460 | 460 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -21,26 +21,26 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param bool $routing |
23 | 23 | */ |
24 | - public function __construct( $routing = true ) { |
|
25 | - parent::__construct( $routing ); |
|
26 | - if ( ! defined( 'EVENTS_CAF_TEMPLATE_PATH' ) ) { |
|
27 | - define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/' ); |
|
28 | - define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/' ); |
|
29 | - define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/' ); |
|
24 | + public function __construct($routing = true) { |
|
25 | + parent::__construct($routing); |
|
26 | + if ( ! defined('EVENTS_CAF_TEMPLATE_PATH')) { |
|
27 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/'); |
|
28 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/'); |
|
29 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function _extend_page_config() { |
36 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
36 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events'; |
|
37 | 37 | //is there a evt_id in the request? |
38 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) |
|
38 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
39 | 39 | ? $this->_req_data['EVT_ID'] |
40 | 40 | : 0; |
41 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
41 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
42 | 42 | //tkt_id? |
43 | - $tkt_id = ! empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) |
|
43 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
44 | 44 | ? $this->_req_data['TKT_ID'] |
45 | 45 | : 0; |
46 | 46 | $new_page_routes = array( |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | 'capability' => 'ee_delete_default_ticket', |
60 | 60 | 'obj_id' => $tkt_id, |
61 | 61 | 'noheader' => true, |
62 | - 'args' => array( 'trash' => true ), |
|
62 | + 'args' => array('trash' => true), |
|
63 | 63 | ), |
64 | 64 | 'trash_tickets' => array( |
65 | 65 | 'func' => '_trash_or_restore_ticket', |
66 | 66 | 'capability' => 'ee_delete_default_tickets', |
67 | 67 | 'noheader' => true, |
68 | - 'args' => array( 'trash' => true ), |
|
68 | + 'args' => array('trash' => true), |
|
69 | 69 | ), |
70 | 70 | 'restore_ticket' => array( |
71 | 71 | 'func' => '_trash_or_restore_ticket', |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'noheader' => true, |
125 | 125 | ), |
126 | 126 | ); |
127 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
127 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
128 | 128 | //partial route/config override |
129 | 129 | $this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes; |
130 | 130 | $this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes'; |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
135 | 135 | //add tickets tab but only if there are more than one default ticket! |
136 | 136 | $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted( |
137 | - array( array( 'TKT_is_default' => 1 ) ), |
|
137 | + array(array('TKT_is_default' => 1)), |
|
138 | 138 | 'TKT_ID', |
139 | 139 | true |
140 | 140 | ); |
141 | - if ( $tkt_count > 1 ) { |
|
141 | + if ($tkt_count > 1) { |
|
142 | 142 | $new_page_config = array( |
143 | 143 | 'ticket_list_table' => array( |
144 | 144 | 'nav' => array( |
145 | - 'label' => esc_html__( 'Default Tickets', 'event_espresso' ), |
|
145 | + 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
146 | 146 | 'order' => 60, |
147 | 147 | ), |
148 | 148 | 'list_table' => 'Tickets_List_Table', |
@@ -153,53 +153,53 @@ discard block |
||
153 | 153 | //template settings |
154 | 154 | $new_page_config['template_settings'] = array( |
155 | 155 | 'nav' => array( |
156 | - 'label' => esc_html__( 'Templates', 'event_espresso' ), |
|
156 | + 'label' => esc_html__('Templates', 'event_espresso'), |
|
157 | 157 | 'order' => 30, |
158 | 158 | ), |
159 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
159 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
160 | 160 | 'help_tabs' => array( |
161 | 161 | 'general_settings_templates_help_tab' => array( |
162 | - 'title' => esc_html__( 'Templates', 'event_espresso' ), |
|
162 | + 'title' => esc_html__('Templates', 'event_espresso'), |
|
163 | 163 | 'filename' => 'general_settings_templates', |
164 | 164 | ), |
165 | 165 | ), |
166 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
166 | + 'help_tour' => array('Templates_Help_Tour'), |
|
167 | 167 | 'require_nonce' => false, |
168 | 168 | ); |
169 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
169 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
170 | 170 | //add filters and actions |
171 | 171 | //modifying _views |
172 | 172 | add_filter( |
173 | 173 | 'FHEE_event_datetime_metabox_add_additional_date_time_template', |
174 | - array( $this, 'add_additional_datetime_button' ), |
|
174 | + array($this, 'add_additional_datetime_button'), |
|
175 | 175 | 10, |
176 | 176 | 2 |
177 | 177 | ); |
178 | 178 | add_filter( |
179 | 179 | 'FHEE_event_datetime_metabox_clone_button_template', |
180 | - array( $this, 'add_datetime_clone_button' ), |
|
180 | + array($this, 'add_datetime_clone_button'), |
|
181 | 181 | 10, |
182 | 182 | 2 |
183 | 183 | ); |
184 | 184 | add_filter( |
185 | 185 | 'FHEE_event_datetime_metabox_timezones_template', |
186 | - array( $this, 'datetime_timezones_template' ), |
|
186 | + array($this, 'datetime_timezones_template'), |
|
187 | 187 | 10, |
188 | 188 | 2 |
189 | 189 | ); |
190 | 190 | //filters for event list table |
191 | - add_filter( 'FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters' ), 10, 2 ); |
|
191 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
192 | 192 | add_filter( |
193 | 193 | 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
194 | - array( $this, 'extra_list_table_actions' ), |
|
194 | + array($this, 'extra_list_table_actions'), |
|
195 | 195 | 10, |
196 | 196 | 2 |
197 | 197 | ); |
198 | 198 | //legend item |
199 | - add_filter( 'FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items' ) ); |
|
200 | - add_action( 'admin_init', array( $this, 'admin_init' ) ); |
|
199 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
200 | + add_action('admin_init', array($this, 'admin_init')); |
|
201 | 201 | //heartbeat stuff |
202 | - add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 ); |
|
202 | + add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | 'Do you really want to delete this image? Please remember to update your event to complete the removal.', |
216 | 216 | 'event_espresso' |
217 | 217 | ), |
218 | - 'event_starts_on' => esc_html__( 'Event Starts on', 'event_espresso' ), |
|
219 | - 'event_ends_on' => esc_html__( 'Event Ends on', 'event_espresso' ), |
|
220 | - 'event_datetime_actions' => esc_html__( 'Actions', 'event_espresso' ), |
|
221 | - 'event_clone_dt_msg' => esc_html__( 'Clone this Event Date and Time', 'event_espresso' ), |
|
222 | - 'remove_event_dt_msg' => esc_html__( 'Remove this Event Time', 'event_espresso' ), |
|
218 | + 'event_starts_on' => esc_html__('Event Starts on', 'event_espresso'), |
|
219 | + 'event_ends_on' => esc_html__('Event Ends on', 'event_espresso'), |
|
220 | + 'event_datetime_actions' => esc_html__('Actions', 'event_espresso'), |
|
221 | + 'event_clone_dt_msg' => esc_html__('Clone this Event Date and Time', 'event_espresso'), |
|
222 | + 'remove_event_dt_msg' => esc_html__('Remove this Event Time', 'event_espresso'), |
|
223 | 223 | ) |
224 | 224 | ); |
225 | 225 | } |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | * @param array $data The incoming data package. |
235 | 235 | * @return array possibly appended response. |
236 | 236 | */ |
237 | - public function heartbeat_response( $response, $data ) { |
|
237 | + public function heartbeat_response($response, $data) { |
|
238 | 238 | /** |
239 | 239 | * check whether count of tickets is approaching the potential |
240 | 240 | * limits for the server. |
241 | 241 | */ |
242 | - if ( ! empty( $data['input_count'] ) ) { |
|
242 | + if ( ! empty($data['input_count'])) { |
|
243 | 243 | $response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check( |
244 | 244 | $data['input_count'] |
245 | 245 | ); |
@@ -262,15 +262,15 @@ discard block |
||
262 | 262 | * @param string $new_slug |
263 | 263 | * @return string |
264 | 264 | */ |
265 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
266 | - $return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ); |
|
265 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
266 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
267 | 267 | //make sure this is only when editing |
268 | - if ( ! empty( $id ) ) { |
|
268 | + if ( ! empty($id)) { |
|
269 | 269 | $href = EE_Admin_Page::add_query_args_and_nonce( |
270 | - array( 'action' => 'duplicate_event', 'EVT_ID' => $id ), |
|
270 | + array('action' => 'duplicate_event', 'EVT_ID' => $id), |
|
271 | 271 | $this->_admin_base_url |
272 | 272 | ); |
273 | - $title = esc_attr__( 'Duplicate Event', 'event_espresso' ); |
|
273 | + $title = esc_attr__('Duplicate Event', 'event_espresso'); |
|
274 | 274 | $return .= '<a href="' |
275 | 275 | . $href |
276 | 276 | . '" title="' |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | $this->_views = array( |
289 | 289 | 'all' => array( |
290 | 290 | 'slug' => 'all', |
291 | - 'label' => esc_html__( 'All', 'event_espresso' ), |
|
291 | + 'label' => esc_html__('All', 'event_espresso'), |
|
292 | 292 | 'count' => 0, |
293 | 293 | 'bulk_action' => array( |
294 | - 'trash_tickets' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
294 | + 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
295 | 295 | ), |
296 | 296 | ), |
297 | 297 | 'trashed' => array( |
298 | 298 | 'slug' => 'trashed', |
299 | - 'label' => esc_html__( 'Trash', 'event_espresso' ), |
|
299 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
300 | 300 | 'count' => 0, |
301 | 301 | 'bulk_action' => array( |
302 | - 'restore_tickets' => esc_html__( 'Restore from Trash', 'event_espresso' ), |
|
303 | - 'delete_tickets' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
302 | + 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
303 | + 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
304 | 304 | ), |
305 | 305 | ), |
306 | 306 | ); |
@@ -311,19 +311,19 @@ discard block |
||
311 | 311 | public function load_scripts_styles_edit() { |
312 | 312 | wp_register_script( |
313 | 313 | 'ee-event-editor-heartbeat', |
314 | - EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', |
|
315 | - array( 'ee_admin_js', 'heartbeat' ), |
|
314 | + EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', |
|
315 | + array('ee_admin_js', 'heartbeat'), |
|
316 | 316 | EVENT_ESPRESSO_VERSION, |
317 | 317 | true |
318 | 318 | ); |
319 | 319 | /** |
320 | 320 | * load accounting js. |
321 | 321 | */ |
322 | - add_filter( 'FHEE_load_accounting_js', '__return_true' ); |
|
322 | + add_filter('FHEE_load_accounting_js', '__return_true'); |
|
323 | 323 | //styles |
324 | - wp_enqueue_style( 'espresso-ui-theme' ); |
|
325 | - wp_enqueue_script( 'event_editor_js' ); |
|
326 | - wp_enqueue_script( 'ee-event-editor-heartbeat' ); |
|
324 | + wp_enqueue_style('espresso-ui-theme'); |
|
325 | + wp_enqueue_script('event_editor_js'); |
|
326 | + wp_enqueue_script('ee-event-editor-heartbeat'); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | * @param $template_args |
334 | 334 | * @return mixed |
335 | 335 | */ |
336 | - public function add_additional_datetime_button( $template, $template_args ) { |
|
336 | + public function add_additional_datetime_button($template, $template_args) { |
|
337 | 337 | return EEH_Template::display_template( |
338 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', |
|
338 | + EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', |
|
339 | 339 | $template_args, |
340 | 340 | true |
341 | 341 | ); |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | * @param $template_args |
349 | 349 | * @return mixed |
350 | 350 | */ |
351 | - public function add_datetime_clone_button( $template, $template_args ) { |
|
351 | + public function add_datetime_clone_button($template, $template_args) { |
|
352 | 352 | return EEH_Template::display_template( |
353 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', |
|
353 | + EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', |
|
354 | 354 | $template_args, |
355 | 355 | true |
356 | 356 | ); |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | * @param $template_args |
364 | 364 | * @return mixed |
365 | 365 | */ |
366 | - public function datetime_timezones_template( $template, $template_args ) { |
|
366 | + public function datetime_timezones_template($template, $template_args) { |
|
367 | 367 | return EEH_Template::display_template( |
368 | - EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', |
|
368 | + EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', |
|
369 | 369 | $template_args, |
370 | 370 | true |
371 | 371 | ); |
@@ -378,22 +378,22 @@ discard block |
||
378 | 378 | $new_views = array( |
379 | 379 | 'today' => array( |
380 | 380 | 'slug' => 'today', |
381 | - 'label' => esc_html__( 'Today', 'event_espresso' ), |
|
381 | + 'label' => esc_html__('Today', 'event_espresso'), |
|
382 | 382 | 'count' => $this->total_events_today(), |
383 | 383 | 'bulk_action' => array( |
384 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
384 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
385 | 385 | ), |
386 | 386 | ), |
387 | 387 | 'month' => array( |
388 | 388 | 'slug' => 'month', |
389 | - 'label' => esc_html__( 'This Month', 'event_espresso' ), |
|
389 | + 'label' => esc_html__('This Month', 'event_espresso'), |
|
390 | 390 | 'count' => $this->total_events_this_month(), |
391 | 391 | 'bulk_action' => array( |
392 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
392 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
393 | 393 | ), |
394 | 394 | ), |
395 | 395 | ); |
396 | - $this->_views = array_merge( $this->_views, $new_views ); |
|
396 | + $this->_views = array_merge($this->_views, $new_views); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * @param \EE_Event $event |
404 | 404 | * @return array |
405 | 405 | */ |
406 | - public function extra_list_table_actions( array $action_links, \EE_Event $event ) { |
|
406 | + public function extra_list_table_actions(array $action_links, \EE_Event $event) { |
|
407 | 407 | if ( |
408 | 408 | EE_Registry::instance()->CAP->current_user_can( |
409 | 409 | 'ee_read_registrations', |
@@ -415,20 +415,20 @@ discard block |
||
415 | 415 | 'action' => 'reports', |
416 | 416 | 'EVT_ID' => $event->ID(), |
417 | 417 | ); |
418 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL ); |
|
418 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
419 | 419 | $action_links[] = '<a href="' |
420 | 420 | . $reports_link |
421 | 421 | . '" title="' |
422 | - . esc_attr__( 'View Report', 'event_espresso' ) |
|
422 | + . esc_attr__('View Report', 'event_espresso') |
|
423 | 423 | . '"><div class="dashicons dashicons-chart-bar"></div></a>' |
424 | 424 | . "\n\t"; |
425 | 425 | } |
426 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
427 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
426 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
427 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
428 | 428 | $action_links[] = EEH_MSG_Template::get_message_action_link( |
429 | 429 | 'see_notifications_for', |
430 | 430 | null, |
431 | - array( 'EVT_ID' => $event->ID() ) |
|
431 | + array('EVT_ID' => $event->ID()) |
|
432 | 432 | ); |
433 | 433 | } |
434 | 434 | return $action_links; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @param $items |
441 | 441 | * @return mixed |
442 | 442 | */ |
443 | - public function additional_legend_items( $items ) { |
|
443 | + public function additional_legend_items($items) { |
|
444 | 444 | if ( |
445 | 445 | EE_Registry::instance()->CAP->current_user_can( |
446 | 446 | 'ee_read_registrations', |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | ) { |
450 | 450 | $items['reports'] = array( |
451 | 451 | 'class' => 'dashicons dashicons-chart-bar', |
452 | - 'desc' => esc_html__( 'Event Reports', 'event_espresso' ), |
|
452 | + 'desc' => esc_html__('Event Reports', 'event_espresso'), |
|
453 | 453 | ); |
454 | 454 | } |
455 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
456 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
457 | - if ( isset( $related_for_icon['css_class'] ) && isset( $related_for_icon['label'] ) ) { |
|
455 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
456 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
457 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
458 | 458 | $items['view_related_messages'] = array( |
459 | 459 | 'class' => $related_for_icon['css_class'], |
460 | 460 | 'desc' => $related_for_icon['label'], |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | protected function _duplicate_event() { |
481 | 481 | // first make sure the ID for the event is in the request. |
482 | 482 | // If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?) |
483 | - if ( ! isset( $this->_req_data['EVT_ID'] ) ) { |
|
483 | + if ( ! isset($this->_req_data['EVT_ID'])) { |
|
484 | 484 | EE_Error::add_error( |
485 | 485 | esc_html__( |
486 | 486 | 'In order to duplicate an event an Event ID is required. None was given.', |
@@ -490,15 +490,15 @@ discard block |
||
490 | 490 | __FUNCTION__, |
491 | 491 | __LINE__ |
492 | 492 | ); |
493 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
493 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
494 | 494 | return; |
495 | 495 | } |
496 | 496 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
497 | - $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
|
498 | - if ( ! $orig_event instanceof EE_Event ) { |
|
497 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
498 | + if ( ! $orig_event instanceof EE_Event) { |
|
499 | 499 | throw new EE_Error( |
500 | 500 | sprintf( |
501 | - esc_html__( 'An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso' ), |
|
501 | + esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), |
|
502 | 502 | $this->_req_data['EVT_ID'] |
503 | 503 | ) |
504 | 504 | ); |
@@ -506,56 +506,56 @@ discard block |
||
506 | 506 | //k now let's clone the $orig_event before getting relations |
507 | 507 | $new_event = clone $orig_event; |
508 | 508 | //original datetimes |
509 | - $orig_datetimes = $orig_event->get_many_related( 'Datetime' ); |
|
509 | + $orig_datetimes = $orig_event->get_many_related('Datetime'); |
|
510 | 510 | //other original relations |
511 | - $orig_ven = $orig_event->get_many_related( 'Venue' ); |
|
511 | + $orig_ven = $orig_event->get_many_related('Venue'); |
|
512 | 512 | //reset the ID and modify other details to make it clear this is a dupe |
513 | - $new_event->set( 'EVT_ID', 0 ); |
|
514 | - $new_name = $new_event->name() . ' ' . esc_html__( '**DUPLICATE**', 'event_espresso' ); |
|
515 | - $new_event->set( 'EVT_name', $new_name ); |
|
513 | + $new_event->set('EVT_ID', 0); |
|
514 | + $new_name = $new_event->name().' '.esc_html__('**DUPLICATE**', 'event_espresso'); |
|
515 | + $new_event->set('EVT_name', $new_name); |
|
516 | 516 | $new_event->set( |
517 | 517 | 'EVT_slug', |
518 | 518 | wp_unique_post_slug( |
519 | - sanitize_title( $orig_event->name() ), |
|
519 | + sanitize_title($orig_event->name()), |
|
520 | 520 | 0, |
521 | 521 | 'publish', |
522 | 522 | 'espresso_events', |
523 | 523 | 0 |
524 | 524 | ) |
525 | 525 | ); |
526 | - $new_event->set( 'status', 'draft' ); |
|
526 | + $new_event->set('status', 'draft'); |
|
527 | 527 | //duplicate discussion settings |
528 | - $new_event->set( 'comment_status', $orig_event->get( 'comment_status' ) ); |
|
529 | - $new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) ); |
|
528 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
529 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
530 | 530 | //save the new event |
531 | 531 | $new_event->save(); |
532 | 532 | //venues |
533 | - foreach ( $orig_ven as $ven ) { |
|
534 | - $new_event->_add_relation_to( $ven, 'Venue' ); |
|
533 | + foreach ($orig_ven as $ven) { |
|
534 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
535 | 535 | } |
536 | 536 | $new_event->save(); |
537 | 537 | //now we need to get the question group relations and handle that |
538 | 538 | //first primary question groups |
539 | 539 | $orig_primary_qgs = $orig_event->get_many_related( |
540 | 540 | 'Question_Group', |
541 | - array( array( 'Event_Question_Group.EQG_primary' => 1 ) ) |
|
541 | + array(array('Event_Question_Group.EQG_primary' => 1)) |
|
542 | 542 | ); |
543 | - if ( ! empty( $orig_primary_qgs ) ) { |
|
544 | - foreach ( $orig_primary_qgs as $id => $obj ) { |
|
545 | - if ( $obj instanceof EE_Question_Group ) { |
|
546 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) ); |
|
543 | + if ( ! empty($orig_primary_qgs)) { |
|
544 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
545 | + if ($obj instanceof EE_Question_Group) { |
|
546 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1)); |
|
547 | 547 | } |
548 | 548 | } |
549 | 549 | } |
550 | 550 | //next additional attendee question groups |
551 | 551 | $orig_additional_qgs = $orig_event->get_many_related( |
552 | 552 | 'Question_Group', |
553 | - array( array( 'Event_Question_Group.EQG_primary' => 0 ) ) |
|
553 | + array(array('Event_Question_Group.EQG_primary' => 0)) |
|
554 | 554 | ); |
555 | - if ( ! empty( $orig_additional_qgs ) ) { |
|
556 | - foreach ( $orig_additional_qgs as $id => $obj ) { |
|
557 | - if ( $obj instanceof EE_Question_Group ) { |
|
558 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) ); |
|
555 | + if ( ! empty($orig_additional_qgs)) { |
|
556 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
557 | + if ($obj instanceof EE_Question_Group) { |
|
558 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0)); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | } |
@@ -563,32 +563,32 @@ discard block |
||
563 | 563 | $new_event->save(); |
564 | 564 | //k now that we have the new event saved we can loop through the datetimes and start adding relations. |
565 | 565 | $cloned_tickets = array(); |
566 | - foreach ( $orig_datetimes as $orig_dtt ) { |
|
567 | - if ( ! $orig_dtt instanceof EE_Datetime ) { |
|
566 | + foreach ($orig_datetimes as $orig_dtt) { |
|
567 | + if ( ! $orig_dtt instanceof EE_Datetime) { |
|
568 | 568 | continue; |
569 | 569 | } |
570 | 570 | $new_dtt = clone $orig_dtt; |
571 | 571 | $orig_tkts = $orig_dtt->tickets(); |
572 | 572 | //save new dtt then add to event |
573 | - $new_dtt->set( 'DTT_ID', 0 ); |
|
574 | - $new_dtt->set( 'DTT_sold', 0 ); |
|
573 | + $new_dtt->set('DTT_ID', 0); |
|
574 | + $new_dtt->set('DTT_sold', 0); |
|
575 | 575 | $new_dtt->save(); |
576 | - $new_event->_add_relation_to( $new_dtt, 'Datetime' ); |
|
576 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
577 | 577 | $new_event->save(); |
578 | 578 | //now let's get the ticket relations setup. |
579 | - foreach ( (array) $orig_tkts as $orig_tkt ) { |
|
579 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
580 | 580 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
581 | - if ( ! $orig_tkt instanceof EE_Ticket ) { |
|
581 | + if ( ! $orig_tkt instanceof EE_Ticket) { |
|
582 | 582 | continue; |
583 | 583 | } |
584 | 584 | //is this ticket archived? If it is then let's skip |
585 | - if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
|
585 | + if ($orig_tkt->get('TKT_deleted')) { |
|
586 | 586 | continue; |
587 | 587 | } |
588 | 588 | // does this original ticket already exist in the clone_tickets cache? |
589 | 589 | // If so we'll just use the new ticket from it. |
590 | - if ( isset( $cloned_tickets[ $orig_tkt->ID() ] ) ) { |
|
591 | - $new_tkt = $cloned_tickets[ $orig_tkt->ID() ]; |
|
590 | + if (isset($cloned_tickets[$orig_tkt->ID()])) { |
|
591 | + $new_tkt = $cloned_tickets[$orig_tkt->ID()]; |
|
592 | 592 | } else { |
593 | 593 | $new_tkt = clone $orig_tkt; |
594 | 594 | //get relations on the $orig_tkt that we need to setup. |
@@ -599,36 +599,36 @@ discard block |
||
599 | 599 | |
600 | 600 | $new_tkt->save(); //make sure new ticket has ID. |
601 | 601 | //price relations on new ticket need to be setup. |
602 | - foreach ( $orig_prices as $orig_price ) { |
|
602 | + foreach ($orig_prices as $orig_price) { |
|
603 | 603 | $new_price = clone $orig_price; |
604 | - $new_price->set( 'PRC_ID', 0 ); |
|
604 | + $new_price->set('PRC_ID', 0); |
|
605 | 605 | $new_price->save(); |
606 | - $new_tkt->_add_relation_to( $new_price, 'Price' ); |
|
606 | + $new_tkt->_add_relation_to($new_price, 'Price'); |
|
607 | 607 | $new_tkt->save(); |
608 | 608 | } |
609 | 609 | } |
610 | 610 | // k now we can add the new ticket as a relation to the new datetime |
611 | 611 | // and make sure its added to our cached $cloned_tickets array |
612 | 612 | // for use with later datetimes that have the same ticket. |
613 | - $new_dtt->_add_relation_to( $new_tkt, 'Ticket' ); |
|
613 | + $new_dtt->_add_relation_to($new_tkt, 'Ticket'); |
|
614 | 614 | $new_dtt->save(); |
615 | - $cloned_tickets[ $orig_tkt->ID() ] = $new_tkt; |
|
615 | + $cloned_tickets[$orig_tkt->ID()] = $new_tkt; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | //clone taxonomy information |
619 | 619 | $taxonomies_to_clone_with = apply_filters( |
620 | 620 | 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', |
621 | - array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) |
|
621 | + array('espresso_event_categories', 'espresso_event_type', 'post_tag') |
|
622 | 622 | ); |
623 | 623 | //get terms for original event (notice) |
624 | - $orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with ); |
|
624 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
625 | 625 | //loop through terms and add them to new event. |
626 | - foreach ( $orig_terms as $term ) { |
|
627 | - wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true ); |
|
626 | + foreach ($orig_terms as $term) { |
|
627 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
628 | 628 | } |
629 | - do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event ); |
|
629 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
630 | 630 | //now let's redirect to the edit page for this duplicated event if we have a new event id. |
631 | - if ( $new_event->ID() ) { |
|
631 | + if ($new_event->ID()) { |
|
632 | 632 | $redirect_args = array( |
633 | 633 | 'post' => $new_event->ID(), |
634 | 634 | 'action' => 'edit', |
@@ -644,19 +644,19 @@ discard block |
||
644 | 644 | 'action' => 'default', |
645 | 645 | ); |
646 | 646 | EE_Error::add_error( |
647 | - esc_html__( 'Not able to duplicate event. Something went wrong.', 'event_espresso' ), |
|
647 | + esc_html__('Not able to duplicate event. Something went wrong.', 'event_espresso'), |
|
648 | 648 | __FILE__, |
649 | 649 | __FUNCTION__, |
650 | 650 | __LINE__ |
651 | 651 | ); |
652 | 652 | } |
653 | - $this->_redirect_after_action( false, '', '', $redirect_args, true ); |
|
653 | + $this->_redirect_after_action(false, '', '', $redirect_args, true); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | |
657 | 657 | |
658 | 658 | protected function _import_page() { |
659 | - $title = esc_html__( 'Import', 'event_espresso' ); |
|
659 | + $title = esc_html__('Import', 'event_espresso'); |
|
660 | 660 | $intro = esc_html__( |
661 | 661 | 'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', |
662 | 662 | 'event_espresso' |
@@ -664,13 +664,13 @@ discard block |
||
664 | 664 | $form_url = EVENTS_ADMIN_URL; |
665 | 665 | $action = 'import_events'; |
666 | 666 | $type = 'csv'; |
667 | - $this->_template_args['form'] = EE_Import::instance()->upload_form( $title, $intro, $form_url, $action, $type ); |
|
667 | + $this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type); |
|
668 | 668 | $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce( |
669 | - array( 'action' => 'sample_export_file' ), |
|
669 | + array('action' => 'sample_export_file'), |
|
670 | 670 | $this->_admin_base_url |
671 | 671 | ); |
672 | 672 | $content = EEH_Template::display_template( |
673 | - EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php', |
|
673 | + EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', |
|
674 | 674 | $this->_template_args, |
675 | 675 | true |
676 | 676 | ); |
@@ -687,9 +687,9 @@ discard block |
||
687 | 687 | * @return void |
688 | 688 | */ |
689 | 689 | protected function _import_events() { |
690 | - require_once( EE_CLASSES . 'EE_Import.class.php' ); |
|
690 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
691 | 691 | $success = EE_Import::instance()->import(); |
692 | - $this->_redirect_after_action( $success, 'Import File', 'ran', array( 'action' => 'import_page' ), true ); |
|
692 | + $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | |
@@ -702,9 +702,9 @@ discard block |
||
702 | 702 | * @return void |
703 | 703 | */ |
704 | 704 | protected function _events_export() { |
705 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
705 | + if (isset($this->_req_data['EVT_ID'])) { |
|
706 | 706 | $event_ids = $this->_req_data['EVT_ID']; |
707 | - } elseif ( isset( $this->_req_data['EVT_IDs'] ) ) { |
|
707 | + } elseif (isset($this->_req_data['EVT_IDs'])) { |
|
708 | 708 | $event_ids = $this->_req_data['EVT_IDs']; |
709 | 709 | } else { |
710 | 710 | $event_ids = null; |
@@ -715,10 +715,10 @@ discard block |
||
715 | 715 | 'action' => 'all_event_data', |
716 | 716 | 'EVT_ID' => $event_ids, |
717 | 717 | ); |
718 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
719 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php' ) ) { |
|
720 | - require_once( EE_CLASSES . 'EE_Export.class.php' ); |
|
721 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
718 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
719 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
720 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
721 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
722 | 722 | $EE_Export->export(); |
723 | 723 | } |
724 | 724 | } |
@@ -737,10 +737,10 @@ discard block |
||
737 | 737 | 'action' => 'categories', |
738 | 738 | 'category_ids' => $this->_req_data['EVT_CAT_ID'], |
739 | 739 | ); |
740 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
741 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php' ) ) { |
|
742 | - require_once( EE_CLASSES . 'EE_Export.class.php' ); |
|
743 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
740 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
741 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
742 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
743 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
744 | 744 | $EE_Export->export(); |
745 | 745 | } |
746 | 746 | } |
@@ -768,10 +768,10 @@ discard block |
||
768 | 768 | 'FHEE__General_Settings_Admin_Page__template_settings__template_args', |
769 | 769 | $this->_template_args |
770 | 770 | ); |
771 | - $this->_set_add_edit_form_tags( 'update_template_settings' ); |
|
772 | - $this->_set_publish_post_box_vars( null, false, false, null, false ); |
|
771 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
772 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
773 | 773 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
774 | - EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', |
|
774 | + EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', |
|
775 | 775 | $this->_template_args, |
776 | 776 | true |
777 | 777 | ); |
@@ -792,9 +792,9 @@ discard block |
||
792 | 792 | ); |
793 | 793 | //update custom post type slugs and detect if we need to flush rewrite rules |
794 | 794 | $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
795 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) |
|
795 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) |
|
796 | 796 | ? EE_Registry::instance()->CFG->core->event_cpt_slug |
797 | - : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] ); |
|
797 | + : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']); |
|
798 | 798 | $what = 'Template Settings'; |
799 | 799 | $success = $this->_update_espresso_configuration( |
800 | 800 | $what, |
@@ -803,10 +803,10 @@ discard block |
||
803 | 803 | __FUNCTION__, |
804 | 804 | __LINE__ |
805 | 805 | ); |
806 | - if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) { |
|
807 | - update_option( 'ee_flush_rewrite_rules', true ); |
|
806 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) { |
|
807 | + update_option('ee_flush_rewrite_rules', true); |
|
808 | 808 | } |
809 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) ); |
|
809 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | |
@@ -822,8 +822,8 @@ discard block |
||
822 | 822 | $this->verify_cpt_object(); |
823 | 823 | add_meta_box( |
824 | 824 | 'espresso_event_editor_event_options', |
825 | - esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
826 | - array( $this, 'registration_options_meta_box' ), |
|
825 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
826 | + array($this, 'registration_options_meta_box'), |
|
827 | 827 | $this->page_slug, |
828 | 828 | 'side', |
829 | 829 | 'core' |
@@ -839,8 +839,8 @@ discard block |
||
839 | 839 | */ |
840 | 840 | public function registration_options_meta_box() { |
841 | 841 | $yes_no_values = array( |
842 | - array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ), |
|
843 | - array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ), |
|
842 | + array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')), |
|
843 | + array('id' => false, 'text' => esc_html__('No', 'event_espresso')), |
|
844 | 844 | ); |
845 | 845 | $default_reg_status_values = EEM_Registration::reg_status_array( |
846 | 846 | array( |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | ), |
852 | 852 | true |
853 | 853 | ); |
854 | - $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false ); |
|
854 | + $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
855 | 855 | $template_args['_event'] = $this->_cpt_model_obj; |
856 | 856 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
857 | 857 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | $default_reg_status_values |
886 | 886 | ); |
887 | 887 | EEH_Template::display_template( |
888 | - EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
888 | + EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php', |
|
889 | 889 | $template_args |
890 | 890 | ); |
891 | 891 | } |
@@ -903,20 +903,20 @@ discard block |
||
903 | 903 | * @param array $list_table_obj the list table object |
904 | 904 | * @return array new filters |
905 | 905 | */ |
906 | - public function list_table_filters( $old_filters, $list_table_obj ) { |
|
906 | + public function list_table_filters($old_filters, $list_table_obj) { |
|
907 | 907 | $filters = array(); |
908 | 908 | //first month/year filters |
909 | 909 | $filters[] = $this->espresso_event_months_dropdown(); |
910 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null; |
|
910 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
911 | 911 | //active status dropdown |
912 | - if ( $status !== 'draft' ) { |
|
912 | + if ($status !== 'draft') { |
|
913 | 913 | $filter[] = $this->active_status_dropdown( |
914 | - isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' |
|
914 | + isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : '' |
|
915 | 915 | ); |
916 | 916 | } |
917 | 917 | //category filter |
918 | 918 | $filters[] = $this->category_dropdown(); |
919 | - return array_merge( $old_filters, $filters ); |
|
919 | + return array_merge($old_filters, $filters); |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | |
@@ -930,15 +930,15 @@ discard block |
||
930 | 930 | public function espresso_event_months_dropdown() { |
931 | 931 | // what we need to do is get all PRIMARY datetimes for all events to filter on. |
932 | 932 | // Note we need to include any other filters that are set! |
933 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null; |
|
933 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
934 | 934 | //categories? |
935 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 |
|
935 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
936 | 936 | ? $this->_req_data['EVT_CAT'] |
937 | 937 | : null; |
938 | 938 | //active status? |
939 | - $active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : null; |
|
940 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
941 | - return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status ); |
|
939 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null; |
|
940 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
941 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | |
@@ -949,18 +949,18 @@ discard block |
||
949 | 949 | * @param string $current_value whatever the current active status is |
950 | 950 | * @return string |
951 | 951 | */ |
952 | - public function active_status_dropdown( $current_value = '' ) { |
|
952 | + public function active_status_dropdown($current_value = '') { |
|
953 | 953 | $select_name = 'active_status'; |
954 | 954 | $values = array( |
955 | - 'none' => esc_html__( 'Show Active/Inactive', 'event_espresso' ), |
|
956 | - 'active' => esc_html__( 'Active', 'event_espresso' ), |
|
957 | - 'upcoming' => esc_html__( 'Upcoming', 'event_espresso' ), |
|
958 | - 'expired' => esc_html__( 'Expired', 'event_espresso' ), |
|
959 | - 'inactive' => esc_html__( 'Inactive', 'event_espresso' ), |
|
955 | + 'none' => esc_html__('Show Active/Inactive', 'event_espresso'), |
|
956 | + 'active' => esc_html__('Active', 'event_espresso'), |
|
957 | + 'upcoming' => esc_html__('Upcoming', 'event_espresso'), |
|
958 | + 'expired' => esc_html__('Expired', 'event_espresso'), |
|
959 | + 'inactive' => esc_html__('Inactive', 'event_espresso'), |
|
960 | 960 | ); |
961 | 961 | $id = 'id="espresso-active-status-dropdown-filter"'; |
962 | 962 | $class = 'wide'; |
963 | - return EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class ); |
|
963 | + return EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class); |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | |
@@ -972,8 +972,8 @@ discard block |
||
972 | 972 | * @return string html |
973 | 973 | */ |
974 | 974 | public function category_dropdown() { |
975 | - $cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
976 | - return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat ); |
|
975 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
976 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | |
@@ -987,20 +987,20 @@ discard block |
||
987 | 987 | public function total_events_today() { |
988 | 988 | $start = EEM_Datetime::instance()->convert_datetime_for_query( |
989 | 989 | 'DTT_EVT_start', |
990 | - date( 'Y-m-d' ) . ' 00:00:00', |
|
990 | + date('Y-m-d').' 00:00:00', |
|
991 | 991 | 'Y-m-d H:i:s', |
992 | 992 | 'UTC' |
993 | 993 | ); |
994 | 994 | $end = EEM_Datetime::instance()->convert_datetime_for_query( |
995 | 995 | 'DTT_EVT_start', |
996 | - date( 'Y-m-d' ) . ' 23:59:59', |
|
996 | + date('Y-m-d').' 23:59:59', |
|
997 | 997 | 'Y-m-d H:i:s', |
998 | 998 | 'UTC' |
999 | 999 | ); |
1000 | 1000 | $where = array( |
1001 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array( $start, $end ) ), |
|
1001 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)), |
|
1002 | 1002 | ); |
1003 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1003 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
1004 | 1004 | return $count; |
1005 | 1005 | } |
1006 | 1006 | |
@@ -1014,25 +1014,25 @@ discard block |
||
1014 | 1014 | */ |
1015 | 1015 | public function total_events_this_month() { |
1016 | 1016 | //Dates |
1017 | - $this_year_r = date( 'Y' ); |
|
1018 | - $this_month_r = date( 'm' ); |
|
1019 | - $days_this_month = date( 't' ); |
|
1017 | + $this_year_r = date('Y'); |
|
1018 | + $this_month_r = date('m'); |
|
1019 | + $days_this_month = date('t'); |
|
1020 | 1020 | $start = EEM_Datetime::instance()->convert_datetime_for_query( |
1021 | 1021 | 'DTT_EVT_start', |
1022 | - $this_year_r . '-' . $this_month_r . '-01 00:00:00', |
|
1022 | + $this_year_r.'-'.$this_month_r.'-01 00:00:00', |
|
1023 | 1023 | 'Y-m-d H:i:s', |
1024 | 1024 | 'UTC' |
1025 | 1025 | ); |
1026 | 1026 | $end = EEM_Datetime::instance()->convert_datetime_for_query( |
1027 | 1027 | 'DTT_EVT_start', |
1028 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', |
|
1028 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', |
|
1029 | 1029 | 'Y-m-d H:i:s', |
1030 | 1030 | 'UTC' |
1031 | 1031 | ); |
1032 | 1032 | $where = array( |
1033 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array( $start, $end ) ), |
|
1033 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)), |
|
1034 | 1034 | ); |
1035 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1035 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
1036 | 1036 | return $count; |
1037 | 1037 | } |
1038 | 1038 | |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | /** DEFAULT TICKETS STUFF **/ |
1042 | 1042 | public function _tickets_overview_list_table() { |
1043 | - $this->_search_btn_label = esc_html__( 'Tickets', 'event_espresso' ); |
|
1043 | + $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
1044 | 1044 | $this->display_admin_list_table_page_with_no_sidebar(); |
1045 | 1045 | } |
1046 | 1046 | |
@@ -1052,46 +1052,46 @@ discard block |
||
1052 | 1052 | * @param bool $trashed |
1053 | 1053 | * @return \EE_Soft_Delete_Base_Class[]|int |
1054 | 1054 | */ |
1055 | - public function get_default_tickets( $per_page = 10, $count = false, $trashed = false ) { |
|
1056 | - $orderby = empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1057 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order']; |
|
1058 | - switch ( $orderby ) { |
|
1055 | + public function get_default_tickets($per_page = 10, $count = false, $trashed = false) { |
|
1056 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1057 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1058 | + switch ($orderby) { |
|
1059 | 1059 | case 'TKT_name' : |
1060 | - $orderby = array( 'TKT_name' => $order ); |
|
1060 | + $orderby = array('TKT_name' => $order); |
|
1061 | 1061 | break; |
1062 | 1062 | case 'TKT_price' : |
1063 | - $orderby = array( 'TKT_price' => $order ); |
|
1063 | + $orderby = array('TKT_price' => $order); |
|
1064 | 1064 | break; |
1065 | 1065 | case 'TKT_uses' : |
1066 | - $orderby = array( 'TKT_uses' => $order ); |
|
1066 | + $orderby = array('TKT_uses' => $order); |
|
1067 | 1067 | break; |
1068 | 1068 | case 'TKT_min' : |
1069 | - $orderby = array( 'TKT_min' => $order ); |
|
1069 | + $orderby = array('TKT_min' => $order); |
|
1070 | 1070 | break; |
1071 | 1071 | case 'TKT_max' : |
1072 | - $orderby = array( 'TKT_max' => $order ); |
|
1072 | + $orderby = array('TKT_max' => $order); |
|
1073 | 1073 | break; |
1074 | 1074 | case 'TKT_qty' : |
1075 | - $orderby = array( 'TKT_qty' => $order ); |
|
1075 | + $orderby = array('TKT_qty' => $order); |
|
1076 | 1076 | break; |
1077 | 1077 | } |
1078 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
1078 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1079 | 1079 | ? $this->_req_data['paged'] |
1080 | 1080 | : 1; |
1081 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
1081 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1082 | 1082 | ? $this->_req_data['perpage'] |
1083 | 1083 | : $per_page; |
1084 | 1084 | $_where = array( |
1085 | 1085 | 'TKT_is_default' => 1, |
1086 | 1086 | 'TKT_deleted' => $trashed, |
1087 | 1087 | ); |
1088 | - $offset = ( $current_page - 1 ) * $per_page; |
|
1089 | - $limit = array( $offset, $per_page ); |
|
1090 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1091 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1088 | + $offset = ($current_page - 1) * $per_page; |
|
1089 | + $limit = array($offset, $per_page); |
|
1090 | + if (isset($this->_req_data['s'])) { |
|
1091 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1092 | 1092 | $_where['OR'] = array( |
1093 | - 'TKT_name' => array( 'LIKE', $sstr ), |
|
1094 | - 'TKT_description' => array( 'LIKE', $sstr ), |
|
1093 | + 'TKT_name' => array('LIKE', $sstr), |
|
1094 | + 'TKT_description' => array('LIKE', $sstr), |
|
1095 | 1095 | ); |
1096 | 1096 | } |
1097 | 1097 | $query_params = array( |
@@ -1100,10 +1100,10 @@ discard block |
||
1100 | 1100 | 'limit' => $limit, |
1101 | 1101 | 'group_by' => 'TKT_ID', |
1102 | 1102 | ); |
1103 | - if ( $count ) { |
|
1104 | - return EEM_Ticket::instance()->count_deleted_and_undeleted( array( $_where ) ); |
|
1103 | + if ($count) { |
|
1104 | + return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
|
1105 | 1105 | } else { |
1106 | - return EEM_Ticket::instance()->get_all_deleted_and_undeleted( $query_params ); |
|
1106 | + return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
1107 | 1107 | } |
1108 | 1108 | } |
1109 | 1109 | |
@@ -1112,34 +1112,34 @@ discard block |
||
1112 | 1112 | /** |
1113 | 1113 | * @param bool $trash |
1114 | 1114 | */ |
1115 | - protected function _trash_or_restore_ticket( $trash = false ) { |
|
1115 | + protected function _trash_or_restore_ticket($trash = false) { |
|
1116 | 1116 | $success = 1; |
1117 | 1117 | $TKT = EEM_Ticket::instance(); |
1118 | 1118 | //checkboxes? |
1119 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1119 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1120 | 1120 | //if array has more than one element then success message should be plural |
1121 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1121 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1122 | 1122 | //cycle thru the boxes |
1123 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1124 | - if ( $trash ) { |
|
1125 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1123 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1124 | + if ($trash) { |
|
1125 | + if ( ! $TKT->delete_by_ID($TKT_ID)) { |
|
1126 | 1126 | $success = 0; |
1127 | 1127 | } |
1128 | 1128 | } else { |
1129 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1129 | + if ( ! $TKT->restore_by_ID($TKT_ID)) { |
|
1130 | 1130 | $success = 0; |
1131 | 1131 | } |
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | } else { |
1135 | 1135 | //grab single id and trash |
1136 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1137 | - if ( $trash ) { |
|
1138 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1136 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1137 | + if ($trash) { |
|
1138 | + if ( ! $TKT->delete_by_ID($TKT_ID)) { |
|
1139 | 1139 | $success = 0; |
1140 | 1140 | } |
1141 | 1141 | } else { |
1142 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1142 | + if ( ! $TKT->restore_by_ID($TKT_ID)) { |
|
1143 | 1143 | $success = 0; |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | 'action' => 'ticket_list_table', |
1150 | 1150 | 'status' => $trash ? '' : 'trashed', |
1151 | 1151 | ); |
1152 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1152 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | |
@@ -1157,20 +1157,20 @@ discard block |
||
1157 | 1157 | protected function _delete_ticket() { |
1158 | 1158 | $success = 1; |
1159 | 1159 | //checkboxes? |
1160 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1160 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1161 | 1161 | //if array has more than one element then success message should be plural |
1162 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1162 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1163 | 1163 | //cycle thru the boxes |
1164 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1164 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1165 | 1165 | //delete |
1166 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1166 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1167 | 1167 | $success = 0; |
1168 | 1168 | } |
1169 | 1169 | } |
1170 | 1170 | } else { |
1171 | 1171 | //grab single id and trash |
1172 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1173 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1172 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1173 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1174 | 1174 | $success = 0; |
1175 | 1175 | } |
1176 | 1176 | } |
@@ -1180,15 +1180,15 @@ discard block |
||
1180 | 1180 | 'status' => 'trashed', |
1181 | 1181 | ); |
1182 | 1182 | //fail safe. If the default ticket count === 1 then we need to redirect to event overview. |
1183 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
1184 | - array( array( 'TKT_is_default' => 1 ) ), |
|
1183 | + if (EEM_Ticket::instance()->count_deleted_and_undeleted( |
|
1184 | + array(array('TKT_is_default' => 1)), |
|
1185 | 1185 | 'TKT_ID', |
1186 | 1186 | true |
1187 | 1187 | ) |
1188 | 1188 | ) { |
1189 | 1189 | $query_args = array(); |
1190 | 1190 | } |
1191 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1191 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | |
@@ -1197,11 +1197,11 @@ discard block |
||
1197 | 1197 | * @param int $TKT_ID |
1198 | 1198 | * @return bool|int |
1199 | 1199 | */ |
1200 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
1201 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
1202 | - $tkt->_remove_relations( 'Datetime' ); |
|
1200 | + protected function _delete_the_ticket($TKT_ID) { |
|
1201 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1202 | + $tkt->_remove_relations('Datetime'); |
|
1203 | 1203 | //delete all related prices first |
1204 | - $tkt->delete_related_permanently( 'Price' ); |
|
1204 | + $tkt->delete_related_permanently('Price'); |
|
1205 | 1205 | return $tkt->delete_permanently(); |
1206 | 1206 | } |
1207 | 1207 |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | 440 | ), |
441 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
441 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
444 | 444 | 'require_nonce' => FALSE |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | 'order' => 15, |
451 | 451 | 'url' => isset($this->_req_data['_REG_ID']) |
452 | 452 | ? add_query_arg( |
453 | - array('_REG_ID' => $this->_req_data['_REG_ID'] ), |
|
453 | + array('_REG_ID' => $this->_req_data['_REG_ID']), |
|
454 | 454 | $this->_current_page_view_url |
455 | 455 | ) |
456 | 456 | : $this->_admin_base_url, |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | 'filename' => 'registrations_details_registrant_details' |
475 | 475 | ) |
476 | 476 | ), |
477 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
478 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
477 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
478 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
479 | 479 | 'require_nonce' => FALSE |
480 | 480 | ), |
481 | 481 | |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'order' => 15, |
500 | 500 | 'persistent' => FALSE |
501 | 501 | ), |
502 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
502 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
503 | 503 | 'require_nonce' => FALSE |
504 | 504 | ), |
505 | 505 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | 'label' => __('Edit Contact', 'event_espresso'), |
509 | 509 | 'order' => 15, |
510 | 510 | 'persistent' => FALSE, |
511 | - '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 |
|
511 | + '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 |
|
512 | 512 | ), |
513 | 513 | 'metaboxes' => array('attendee_editor_metaboxes'), |
514 | 514 | 'require_nonce' => FALSE |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | 'filename' => 'registrations_contact_list_other' |
539 | 539 | ) |
540 | 540 | ), |
541 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
541 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
542 | 542 | 'metaboxes' => array(), |
543 | 543 | 'require_nonce' => FALSE |
544 | 544 | ), |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | protected function _add_screen_options() {} |
558 | 558 | protected function _add_feature_pointers() {} |
559 | 559 | public function admin_init() { |
560 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
560 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
561 | 561 | } |
562 | 562 | public function admin_notices() {} |
563 | 563 | public function admin_footer_scripts() {} |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @return void |
576 | 576 | */ |
577 | 577 | private function _get_registration_status_array() { |
578 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
578 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | public function load_scripts_styles() { |
599 | 599 | //style |
600 | 600 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
601 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
601 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
602 | 602 | wp_enqueue_style('espresso_reg'); |
603 | 603 | |
604 | 604 | //script |
605 | - 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); |
|
605 | + 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); |
|
606 | 606 | wp_enqueue_script('espresso_reg'); |
607 | 607 | } |
608 | 608 | |
@@ -611,9 +611,9 @@ discard block |
||
611 | 611 | public function load_scripts_styles_edit_attendee() { |
612 | 612 | //stuff to only show up on our attendee edit details page. |
613 | 613 | $attendee_details_translations = array( |
614 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
614 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
615 | 615 | ); |
616 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
616 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
617 | 617 | wp_enqueue_script('jquery-validate'); |
618 | 618 | } |
619 | 619 | |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | //styles |
623 | 623 | wp_enqueue_style('espresso-ui-theme'); |
624 | 624 | //scripts |
625 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
626 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
625 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
626 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | |
634 | 634 | public function load_scripts_styles_contact_list() { |
635 | 635 | wp_deregister_style('espresso_reg'); |
636 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
636 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
637 | 637 | wp_enqueue_style('espresso_att'); |
638 | 638 | } |
639 | 639 | |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | |
643 | 643 | |
644 | 644 | public function load_scripts_styles_new_registration() { |
645 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
645 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
646 | 646 | wp_enqueue_script('ee-spco-for-admin'); |
647 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
647 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
648 | 648 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
649 | 649 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
650 | 650 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | //for notification related bulk actions we need to make sure only active messengers have an option. |
672 | 672 | EED_Messages::set_autoloaders(); |
673 | 673 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
674 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
674 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
675 | 675 | $active_mts = $message_resource_manager->list_of_active_message_types(); |
676 | 676 | //key= bulk_action_slug, value= message type. |
677 | 677 | $match_array = array( |
@@ -684,23 +684,23 @@ discard block |
||
684 | 684 | |
685 | 685 | /** setup reg status bulk actions **/ |
686 | 686 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
687 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
687 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
688 | 688 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
689 | 689 | } |
690 | 690 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
691 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
691 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
692 | 692 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
693 | 693 | } |
694 | 694 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
695 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
695 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
696 | 696 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
697 | 697 | } |
698 | 698 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
699 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
699 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
700 | 700 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
701 | 701 | } |
702 | 702 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
703 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
703 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
704 | 704 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
705 | 705 | } |
706 | 706 | |
@@ -709,29 +709,29 @@ discard block |
||
709 | 709 | 'slug' => 'all', |
710 | 710 | 'label' => __('View All Registrations', 'event_espresso'), |
711 | 711 | 'count' => 0, |
712 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
712 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
713 | 713 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
714 | - ) ) |
|
714 | + )) |
|
715 | 715 | ), |
716 | 716 | 'month' => array( |
717 | 717 | 'slug' => 'month', |
718 | 718 | 'label' => __('This Month', 'event_espresso'), |
719 | 719 | 'count' => 0, |
720 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
720 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
721 | 721 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
722 | 722 | )) |
723 | 723 | ), |
724 | 724 | 'today' => array( |
725 | 725 | 'slug' => 'today', |
726 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
726 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
727 | 727 | 'count' => 0, |
728 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
728 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
729 | 729 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
730 | 730 | )) |
731 | 731 | ) |
732 | 732 | ); |
733 | 733 | |
734 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
734 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
735 | 735 | $this->_views['incomplete'] = array( |
736 | 736 | 'slug' => 'incomplete', |
737 | 737 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | ) |
768 | 768 | ); |
769 | 769 | |
770 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
770 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
771 | 771 | $this->_views['trash'] = array( |
772 | 772 | 'slug' => 'trash', |
773 | 773 | 'label' => __('Trash', 'event_espresso'), |
@@ -806,18 +806,18 @@ discard block |
||
806 | 806 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
807 | 807 | ), |
808 | 808 | ); |
809 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
809 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
810 | 810 | $fc_items['resend_registration'] = array( |
811 | 811 | 'class' => 'dashicons dashicons-email-alt', |
812 | 812 | 'desc' => __('Resend Registration Details', 'event_espresso') |
813 | 813 | ); |
814 | 814 | } else { |
815 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
815 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
816 | 816 | } |
817 | 817 | |
818 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
819 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
820 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
818 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
819 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
820 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
821 | 821 | $fc_items['view_related_messages'] = array( |
822 | 822 | 'class' => $related_for_icon['css_class'], |
823 | 823 | 'desc' => $related_for_icon['label'], |
@@ -827,35 +827,35 @@ discard block |
||
827 | 827 | |
828 | 828 | $sc_items = array( |
829 | 829 | 'approved_status' => array( |
830 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
831 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
830 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
831 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
832 | 832 | ), |
833 | 833 | 'pending_status' => array( |
834 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
835 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
834 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
835 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
836 | 836 | ), |
837 | 837 | 'wait_list' => array( |
838 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
|
839 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) |
|
838 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list, |
|
839 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') |
|
840 | 840 | ), |
841 | 841 | 'incomplete_status' => array( |
842 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
843 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
842 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
843 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
844 | 844 | ), |
845 | 845 | 'not_approved' => array( |
846 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
847 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
846 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
847 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
848 | 848 | ), |
849 | 849 | 'declined_status' => array( |
850 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
851 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
850 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
851 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
852 | 852 | ), |
853 | 853 | 'cancelled_status' => array( |
854 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
855 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
854 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
855 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
856 | 856 | ) |
857 | 857 | ); |
858 | - return array_merge( $fc_items, $sc_items ); |
|
858 | + return array_merge($fc_items, $sc_items); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | |
@@ -869,45 +869,45 @@ discard block |
||
869 | 869 | */ |
870 | 870 | protected function _registrations_overview_list_table() { |
871 | 871 | $this->_template_args['admin_page_header'] = ''; |
872 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0; |
|
873 | - if ( $EVT_ID ) { |
|
874 | - if ( EE_Registry::instance()->CAP->current_user_can( |
|
872 | + $EVT_ID = ! empty($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : 0; |
|
873 | + if ($EVT_ID) { |
|
874 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
875 | 875 | 'ee_edit_registrations', |
876 | 876 | 'espresso_registrations_new_registration', |
877 | 877 | $EVT_ID |
878 | 878 | ) |
879 | 879 | ) { |
880 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
880 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
881 | 881 | 'new_registration', |
882 | 882 | 'add-registrant', |
883 | - array( 'event_id' => $EVT_ID ), |
|
883 | + array('event_id' => $EVT_ID), |
|
884 | 884 | 'add-new-h2' |
885 | 885 | ); |
886 | 886 | } |
887 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
888 | - if ( $event instanceof EE_Event ) { |
|
887 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
888 | + if ($event instanceof EE_Event) { |
|
889 | 889 | $this->_template_args['admin_page_header'] = sprintf( |
890 | - __( '%s Viewing registrations for the event: %s%s', 'event_espresso' ), |
|
890 | + __('%s Viewing registrations for the event: %s%s', 'event_espresso'), |
|
891 | 891 | '<h3 style="line-height:1.5em;">', |
892 | - '<br /><a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
893 | - array( 'action' => 'edit', 'post' => $event->ID() ), |
|
892 | + '<br /><a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
893 | + array('action' => 'edit', 'post' => $event->ID()), |
|
894 | 894 | EVENTS_ADMIN_URL |
895 | - ) . '"> ' . $event->get( 'EVT_name' ) . ' </a> ', |
|
895 | + ).'"> '.$event->get('EVT_name').' </a> ', |
|
896 | 896 | '</h3>' |
897 | 897 | ); |
898 | 898 | } |
899 | - $DTT_ID = ! empty( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : 0; |
|
900 | - $datetime = EEM_Datetime::instance()->get_one_by_ID( $DTT_ID ); |
|
901 | - if ( $datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '' ) { |
|
902 | - $this->_template_args['admin_page_header'] = substr( $this->_template_args['admin_page_header'], 0, -5 ); |
|
899 | + $DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0; |
|
900 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID); |
|
901 | + if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') { |
|
902 | + $this->_template_args['admin_page_header'] = substr($this->_template_args['admin_page_header'], 0, -5); |
|
903 | 903 | $this->_template_args['admin_page_header'] .= ' <span class="drk-grey-text">'; |
904 | 904 | $this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>'; |
905 | 905 | $this->_template_args['admin_page_header'] .= $datetime->name(); |
906 | - $this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )'; |
|
906 | + $this->_template_args['admin_page_header'] .= ' ( '.$datetime->start_date().' )'; |
|
907 | 907 | $this->_template_args['admin_page_header'] .= '</span></h3>'; |
908 | 908 | } |
909 | 909 | } |
910 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
910 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
911 | 911 | $this->display_admin_list_table_page_with_no_sidebar(); |
912 | 912 | } |
913 | 913 | |
@@ -922,19 +922,19 @@ discard block |
||
922 | 922 | */ |
923 | 923 | private function _set_registration_object() { |
924 | 924 | //get out if we've already set the object |
925 | - if ( is_object( $this->_registration )) { |
|
925 | + if (is_object($this->_registration)) { |
|
926 | 926 | return TRUE; |
927 | 927 | } |
928 | 928 | |
929 | 929 | $REG = EEM_Registration::instance(); |
930 | 930 | |
931 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
931 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
932 | 932 | |
933 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
933 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
934 | 934 | return TRUE; |
935 | 935 | else { |
936 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
937 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
936 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
937 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
938 | 938 | $this->_registration = NULL; |
939 | 939 | return FALSE; |
940 | 940 | } |
@@ -952,25 +952,25 @@ discard block |
||
952 | 952 | * @throws \EE_Error |
953 | 953 | * @return mixed (int|array) int = count || array of registration objects |
954 | 954 | */ |
955 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
956 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
957 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
958 | - $DTT_ID = isset( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : null; |
|
959 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
960 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
961 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
962 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
955 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
956 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
957 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
958 | + $DTT_ID = isset($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : null; |
|
959 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
960 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
961 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
962 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
963 | 963 | $start_date = FALSE; |
964 | 964 | $end_date = FALSE; |
965 | 965 | $_where = array(); |
966 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
967 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
966 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
967 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
968 | 968 | |
969 | 969 | //set orderby |
970 | 970 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
971 | 971 | |
972 | 972 | |
973 | - switch ( $this->_req_data['orderby'] ) { |
|
973 | + switch ($this->_req_data['orderby']) { |
|
974 | 974 | case '_REG_ID': |
975 | 975 | $orderby = 'REG_ID'; |
976 | 976 | break; |
@@ -990,30 +990,30 @@ discard block |
||
990 | 990 | $orderby = 'REG_date'; |
991 | 991 | } |
992 | 992 | |
993 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
994 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
995 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
993 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
994 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
995 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
996 | 996 | |
997 | 997 | |
998 | - $offset = ($current_page-1)*$per_page; |
|
999 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
998 | + $offset = ($current_page - 1) * $per_page; |
|
999 | + $limit = $count ? NULL : array($offset, $per_page); |
|
1000 | 1000 | |
1001 | - if($EVT_ID){ |
|
1002 | - $_where['EVT_ID']=$EVT_ID; |
|
1001 | + if ($EVT_ID) { |
|
1002 | + $_where['EVT_ID'] = $EVT_ID; |
|
1003 | 1003 | } |
1004 | - if($CAT_ID){ |
|
1004 | + if ($CAT_ID) { |
|
1005 | 1005 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
1006 | 1006 | } |
1007 | 1007 | //if DTT is included we filter by that datetime. |
1008 | - if ( $DTT_ID ) { |
|
1008 | + if ($DTT_ID) { |
|
1009 | 1009 | $_where['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
1010 | 1010 | } |
1011 | - if ( $incomplete ) { |
|
1011 | + if ($incomplete) { |
|
1012 | 1012 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
1013 | 1013 | } else if ( ! $trash) { |
1014 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
1014 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
1015 | 1015 | } |
1016 | - if($reg_status){ |
|
1016 | + if ($reg_status) { |
|
1017 | 1017 | $_where['STS_ID'] = $reg_status; |
1018 | 1018 | } |
1019 | 1019 | |
@@ -1025,103 +1025,103 @@ discard block |
||
1025 | 1025 | $time_start = ' 00:00:00'; |
1026 | 1026 | $time_end = ' 23:59:59'; |
1027 | 1027 | |
1028 | - if($today_a || $today ){ |
|
1028 | + if ($today_a || $today) { |
|
1029 | 1029 | $curdate = date('Y-m-d', current_time('timestamp')); |
1030 | - $_where['REG_date']= array('BETWEEN', |
|
1030 | + $_where['REG_date'] = array('BETWEEN', |
|
1031 | 1031 | array( |
1032 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
1033 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
1032 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
1033 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
1034 | 1034 | )); |
1035 | - }elseif($this_month_a || $this_month){ |
|
1035 | + }elseif ($this_month_a || $this_month) { |
|
1036 | 1036 | $this_month_r = date('m', current_time('timestamp')); |
1037 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
1038 | - $_where['REG_date']= array('BETWEEN', |
|
1037 | + $days_this_month = date('t', current_time('timestamp')); |
|
1038 | + $_where['REG_date'] = array('BETWEEN', |
|
1039 | 1039 | array( |
1040 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
1041 | - 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' ) |
|
1040 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
1041 | + 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') |
|
1042 | 1042 | )); |
1043 | - }elseif($month_range){ |
|
1043 | + }elseif ($month_range) { |
|
1044 | 1044 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1045 | - $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
|
1046 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1047 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
1048 | - $_where['REG_date']= array('BETWEEN', |
|
1049 | - 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' ) ) ); |
|
1050 | - }elseif($start_date && $end_date){ |
|
1045 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : ''; |
|
1046 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1047 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
1048 | + $_where['REG_date'] = array('BETWEEN', |
|
1049 | + 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'))); |
|
1050 | + }elseif ($start_date && $end_date) { |
|
1051 | 1051 | throw new EE_Error("not yet supported"); |
1052 | - }elseif($start_date){ |
|
1052 | + }elseif ($start_date) { |
|
1053 | 1053 | throw new EE_Error("not yet supported"); |
1054 | - }elseif($end_date){ |
|
1054 | + }elseif ($end_date) { |
|
1055 | 1055 | throw new EE_Error("not yet supported"); |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1059 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1058 | + if ( ! empty($this->_req_data['s'])) { |
|
1059 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1060 | 1060 | $_where['OR'] = array( |
1061 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1062 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1063 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1064 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1065 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1066 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1067 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1068 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1069 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1070 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1071 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1072 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1073 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1074 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1075 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1076 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1077 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1078 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1061 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1062 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1063 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1064 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1065 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1066 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1067 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1068 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1069 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1070 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1071 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1072 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1073 | + 'REG_code' => array('LIKE', $sstr), |
|
1074 | + 'REG_count' => array('LIKE', $sstr), |
|
1075 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1076 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1077 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1078 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1079 | 1079 | ); |
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | //capability checks |
1083 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1083 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1084 | 1084 | $_where['AND'] = array( |
1085 | 1085 | 'Event.EVT_wp_user' => get_current_user_id() |
1086 | 1086 | ); |
1087 | 1087 | } |
1088 | 1088 | |
1089 | - if( $count ){ |
|
1090 | - if ( $trash ) { |
|
1091 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1092 | - } else if ( $incomplete ) { |
|
1093 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1089 | + if ($count) { |
|
1090 | + if ($trash) { |
|
1091 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1092 | + } else if ($incomplete) { |
|
1093 | + return EEM_Registration::instance()->count(array($_where)); |
|
1094 | 1094 | } else { |
1095 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1095 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1096 | 1096 | } |
1097 | 1097 | } else { |
1098 | 1098 | //make sure we remove default where conditions cause all registrations matching query are returned |
1099 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1100 | - if ( $per_page !== -1 ) { |
|
1099 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1100 | + if ($per_page !== -1) { |
|
1101 | 1101 | $query_params['limit'] = $limit; |
1102 | 1102 | } |
1103 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1103 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1104 | 1104 | |
1105 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1105 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1106 | 1106 | $first_registration = $registrations[0]; |
1107 | 1107 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1108 | 1108 | $event_name = $first_registration->event_obj()->name(); |
1109 | - $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 ) : ''; |
|
1109 | + $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 ) : ''; |
|
1110 | 1110 | // edit event link |
1111 | - if ( $event_name != '' ) { |
|
1112 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1113 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1114 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1111 | + if ($event_name != '') { |
|
1112 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1113 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1114 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1115 | 1115 | } |
1116 | 1116 | |
1117 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1118 | - $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>'; |
|
1117 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1118 | + $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>'; |
|
1119 | 1119 | |
1120 | 1120 | $this->_template_args['before_admin_page_content'] = ' |
1121 | 1121 | <div id="admin-page-header"> |
1122 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1123 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1124 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1122 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1123 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1124 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1125 | 1125 | </div> |
1126 | 1126 | '; |
1127 | 1127 | |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | |
1160 | 1160 | $this->_set_registration_object(); |
1161 | 1161 | |
1162 | - if ( is_object( $this->_registration )) { |
|
1162 | + if (is_object($this->_registration)) { |
|
1163 | 1163 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1164 | 1164 | $this->_session = $transaction->session_data(); |
1165 | 1165 | |
@@ -1167,10 +1167,10 @@ discard block |
||
1167 | 1167 | |
1168 | 1168 | |
1169 | 1169 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1170 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1170 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1171 | 1171 | |
1172 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime( 'REG_date' ); |
|
1173 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1172 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
1173 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1174 | 1174 | |
1175 | 1175 | $this->_template_args['grand_total'] = $transaction->total(); |
1176 | 1176 | |
@@ -1178,19 +1178,19 @@ discard block |
||
1178 | 1178 | // link back to overview |
1179 | 1179 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1180 | 1180 | $this->_template_args['registration'] = $this->_registration; |
1181 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1182 | - $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' ) ); |
|
1183 | - $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' ) ); |
|
1181 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1182 | + $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')); |
|
1183 | + $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')); |
|
1184 | 1184 | |
1185 | 1185 | //next and previous links |
1186 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1187 | - $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' ) : ''; |
|
1188 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1189 | - $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' ) : ''; |
|
1186 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1187 | + $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') : ''; |
|
1188 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1189 | + $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') : ''; |
|
1190 | 1190 | |
1191 | 1191 | // grab header |
1192 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1193 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1192 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1193 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1194 | 1194 | |
1195 | 1195 | } else { |
1196 | 1196 | |
@@ -1209,17 +1209,17 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | protected function _registration_details_metaboxes() { |
1212 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1212 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1213 | 1213 | $this->_set_registration_object(); |
1214 | 1214 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1215 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1216 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1217 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1218 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1215 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1216 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1217 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1218 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1219 | 1219 | } |
1220 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1221 | - if ( $this->_registration->group_size() > 1 ) { |
|
1222 | - 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' ); |
|
1220 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1221 | + if ($this->_registration->group_size() > 1) { |
|
1222 | + 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'); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | |
@@ -1261,25 +1261,25 @@ discard block |
||
1261 | 1261 | 'html_id' => 'reg-status-change-form', |
1262 | 1262 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
1263 | 1263 | 'subsections' => array( |
1264 | - 'return' => new EE_Hidden_Input( array( |
|
1264 | + 'return' => new EE_Hidden_Input(array( |
|
1265 | 1265 | 'name' => 'return', |
1266 | 1266 | 'default' => 'view_registration' |
1267 | - ) ), |
|
1268 | - 'REG_ID' => new EE_Hidden_Input( array( |
|
1267 | + )), |
|
1268 | + 'REG_ID' => new EE_Hidden_Input(array( |
|
1269 | 1269 | 'name' => 'REG_ID', |
1270 | 1270 | 'default' => $this->_registration->ID() |
1271 | - ) ), |
|
1271 | + )), |
|
1272 | 1272 | 'current_status' => new EE_Form_Section_HTML( |
1273 | 1273 | EEH_HTML::tr( |
1274 | 1274 | EEH_HTML::th( |
1275 | 1275 | EEH_HTML::label( |
1276 | - EEH_HTML::strong( __( 'Current Registration Status', 'event_espresso' ) ) |
|
1276 | + EEH_HTML::strong(__('Current Registration Status', 'event_espresso')) |
|
1277 | 1277 | ) |
1278 | - ) . |
|
1278 | + ). |
|
1279 | 1279 | EEH_HTML::td( |
1280 | 1280 | EEH_HTML::strong( |
1281 | 1281 | $this->_registration->pretty_status(), |
1282 | - '', 'status-' . $this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;' |
|
1282 | + '', 'status-'.$this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;' |
|
1283 | 1283 | ) |
1284 | 1284 | ) |
1285 | 1285 | ) |
@@ -1287,22 +1287,22 @@ discard block |
||
1287 | 1287 | 'reg_status' => new EE_Select_Input( |
1288 | 1288 | $this->_get_reg_statuses(), |
1289 | 1289 | array( |
1290 | - 'html_label_text' => __( 'Change Registration Status to', 'event_espresso' ), |
|
1290 | + 'html_label_text' => __('Change Registration Status to', 'event_espresso'), |
|
1291 | 1291 | 'default' => $this->_registration->status_ID(), |
1292 | 1292 | ) |
1293 | 1293 | ), |
1294 | 1294 | 'send_notifications' => new EE_Yes_No_Input( |
1295 | 1295 | array( |
1296 | - 'html_label_text' => __( 'Send Related Messages', 'event_espresso' ), |
|
1296 | + 'html_label_text' => __('Send Related Messages', 'event_espresso'), |
|
1297 | 1297 | 'default' => false, |
1298 | - 'html_help_text' => __( 'If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso' ), |
|
1298 | + 'html_help_text' => __('If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso'), |
|
1299 | 1299 | ) |
1300 | 1300 | ), |
1301 | - 'submit' => new EE_Submit_Input( array( |
|
1301 | + 'submit' => new EE_Submit_Input(array( |
|
1302 | 1302 | 'html_class' => 'button-primary', |
1303 | 1303 | 'html_label_text' => ' ', |
1304 | - 'default' => __( 'Update Registration Status', 'event_espresso' ) |
|
1305 | - ) ), |
|
1304 | + 'default' => __('Update Registration Status', 'event_espresso') |
|
1305 | + )), |
|
1306 | 1306 | ), |
1307 | 1307 | ) |
1308 | 1308 | ); |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | * Returns an array of all the buttons for the various statuses and switch status actions |
1316 | 1316 | * @return string |
1317 | 1317 | */ |
1318 | - protected function _get_current_reg_status_help_text( $STS_ID = '' ) { |
|
1318 | + protected function _get_current_reg_status_help_text($STS_ID = '') { |
|
1319 | 1319 | //$reg_status_help_text = array( |
1320 | 1320 | // 'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ), |
1321 | 1321 | // 'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ), |
@@ -1348,14 +1348,14 @@ discard block |
||
1348 | 1348 | */ |
1349 | 1349 | protected function _get_reg_statuses() { |
1350 | 1350 | $reg_status_array = EEM_Registration::instance()->reg_status_array(); |
1351 | - unset ( $reg_status_array[ EEM_Registration::status_id_incomplete ] ); |
|
1351 | + unset ($reg_status_array[EEM_Registration::status_id_incomplete]); |
|
1352 | 1352 | // get current reg status |
1353 | 1353 | $current_status = $this->_registration->status_ID(); |
1354 | 1354 | // is registration for free event? This will determine whether to display the pending payment option |
1355 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free() ) { |
|
1356 | - unset( $reg_status_array[ EEM_Registration::status_id_pending_payment ] ); |
|
1355 | + if ($current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free()) { |
|
1356 | + unset($reg_status_array[EEM_Registration::status_id_pending_payment]); |
|
1357 | 1357 | } |
1358 | - return EEM_Status::instance()->localized_status( $reg_status_array, false, 'sentence' ); |
|
1358 | + return EEM_Status::instance()->localized_status($reg_status_array, false, 'sentence'); |
|
1359 | 1359 | } |
1360 | 1360 | |
1361 | 1361 | |
@@ -1368,15 +1368,15 @@ discard block |
||
1368 | 1368 | * |
1369 | 1369 | * @return array (array with reg_id(s) updated and whether update was successful. |
1370 | 1370 | */ |
1371 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1372 | - if ( isset( $this->_req_data[ 'reg_status_change_form' ] ) ) { |
|
1373 | - $REG_IDs = isset( $this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] ) |
|
1374 | - ? (array)$this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] |
|
1371 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1372 | + if (isset($this->_req_data['reg_status_change_form'])) { |
|
1373 | + $REG_IDs = isset($this->_req_data['reg_status_change_form']['REG_ID']) |
|
1374 | + ? (array) $this->_req_data['reg_status_change_form']['REG_ID'] |
|
1375 | 1375 | : array(); |
1376 | 1376 | } else { |
1377 | - $REG_IDs = isset( $this->_req_data[ '_REG_ID' ] ) ? (array)$this->_req_data[ '_REG_ID' ] : array(); |
|
1377 | + $REG_IDs = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1378 | 1378 | } |
1379 | - $success = $this->_set_registration_status( $REG_IDs, $status ); |
|
1379 | + $success = $this->_set_registration_status($REG_IDs, $status); |
|
1380 | 1380 | //notify? |
1381 | 1381 | if ( |
1382 | 1382 | $success |
@@ -1403,21 +1403,21 @@ discard block |
||
1403 | 1403 | * @param bool $status |
1404 | 1404 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1405 | 1405 | */ |
1406 | - protected function _set_registration_status( $REG_IDs = array(), $status = false ) { |
|
1406 | + protected function _set_registration_status($REG_IDs = array(), $status = false) { |
|
1407 | 1407 | $success = false; |
1408 | 1408 | // typecast $REG_IDs |
1409 | - $REG_IDs = (array)$REG_IDs; |
|
1410 | - if ( ! empty( $REG_IDs ) ) { |
|
1409 | + $REG_IDs = (array) $REG_IDs; |
|
1410 | + if ( ! empty($REG_IDs)) { |
|
1411 | 1411 | $success = true; |
1412 | 1412 | // set default status if none is passed |
1413 | 1413 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1414 | 1414 | // sanitize $REG_IDs |
1415 | - $REG_IDs = array_filter( $REG_IDs, 'absint' ); |
|
1415 | + $REG_IDs = array_filter($REG_IDs, 'absint'); |
|
1416 | 1416 | //loop through REG_ID's and change status |
1417 | - foreach ( $REG_IDs as $REG_ID ) { |
|
1418 | - $registration = EEM_Registration::instance()->get_one_by_ID( $REG_ID ); |
|
1419 | - if ( $registration instanceof EE_Registration ) { |
|
1420 | - $registration->set_status( $status ); |
|
1417 | + foreach ($REG_IDs as $REG_ID) { |
|
1418 | + $registration = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
|
1419 | + if ($registration instanceof EE_Registration) { |
|
1420 | + $registration->set_status($status); |
|
1421 | 1421 | $result = $registration->save(); |
1422 | 1422 | // verifying explicit fails because update *may* just return 0 for 0 rows affected |
1423 | 1423 | $success = $result !== false ? $success : false; |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | //reset _req_data['_REG_ID'] for any potential future messages notifications |
1428 | 1428 | $this->_req_data['_REG_ID'] = $REG_IDs; |
1429 | 1429 | //return $success and processed registrations |
1430 | - return array( 'REG_ID' => $REG_IDs, 'success' => $success ); |
|
1430 | + return array('REG_ID' => $REG_IDs, 'success' => $success); |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | |
@@ -1439,49 +1439,49 @@ discard block |
||
1439 | 1439 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1440 | 1440 | * @return void |
1441 | 1441 | */ |
1442 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1443 | - $result = ! empty( $STS_ID ) |
|
1444 | - ? $this->_set_registration_status_from_request( $STS_ID, $notify ) |
|
1445 | - : array( 'success' => false ); |
|
1446 | - $success = isset( $result['success'] ) && $result['success']; |
|
1442 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1443 | + $result = ! empty($STS_ID) |
|
1444 | + ? $this->_set_registration_status_from_request($STS_ID, $notify) |
|
1445 | + : array('success' => false); |
|
1446 | + $success = isset($result['success']) && $result['success']; |
|
1447 | 1447 | //setup success message |
1448 | - if ( $success ) { |
|
1449 | - if ( is_array( $result[ 'REG_ID' ] ) && count( $result[ 'REG_ID' ] ) === 1 ) { |
|
1448 | + if ($success) { |
|
1449 | + if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) { |
|
1450 | 1450 | $msg = sprintf( |
1451 | - __( 'Registration status has been set to %s', 'event_espresso' ), |
|
1452 | - EEH_Template::pretty_status( $STS_ID, false, 'lower' ) |
|
1451 | + __('Registration status has been set to %s', 'event_espresso'), |
|
1452 | + EEH_Template::pretty_status($STS_ID, false, 'lower') |
|
1453 | 1453 | ); |
1454 | 1454 | } else { |
1455 | 1455 | $msg = sprintf( |
1456 | - __( 'Registrations have been set to %s.', 'event_espresso' ), |
|
1457 | - EEH_Template::pretty_status( $STS_ID, false, 'lower' ) |
|
1456 | + __('Registrations have been set to %s.', 'event_espresso'), |
|
1457 | + EEH_Template::pretty_status($STS_ID, false, 'lower') |
|
1458 | 1458 | ); |
1459 | 1459 | } |
1460 | - EE_Error::add_success( $msg ); |
|
1460 | + EE_Error::add_success($msg); |
|
1461 | 1461 | } else { |
1462 | 1462 | EE_Error::add_error( |
1463 | - __( 'Something went wrong, and the status was not changed', 'event_espresso' ), |
|
1463 | + __('Something went wrong, and the status was not changed', 'event_espresso'), |
|
1464 | 1464 | __FILE__, __LINE__, __FUNCTION__ |
1465 | 1465 | ); |
1466 | 1466 | } |
1467 | - if ( isset( $this->_req_data[ 'return' ] ) && $this->_req_data[ 'return' ] == 'view_registration' ) { |
|
1468 | - $route = array( 'action' => 'view_registration', '_REG_ID' => reset( $result[ 'REG_ID' ] ) ); |
|
1467 | + if (isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration') { |
|
1468 | + $route = array('action' => 'view_registration', '_REG_ID' => reset($result['REG_ID'])); |
|
1469 | 1469 | } else { |
1470 | - $route = array( 'action' => 'default' ); |
|
1470 | + $route = array('action' => 'default'); |
|
1471 | 1471 | } |
1472 | 1472 | //unset nonces |
1473 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1474 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1475 | - unset( $this->_req_data[$ref] ); |
|
1473 | + foreach ($this->_req_data as $ref => $value) { |
|
1474 | + if (strpos($ref, 'nonce') !== false) { |
|
1475 | + unset($this->_req_data[$ref]); |
|
1476 | 1476 | continue; |
1477 | 1477 | } |
1478 | 1478 | |
1479 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1479 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1480 | 1480 | $this->_req_data[$ref] = $value; |
1481 | 1481 | } |
1482 | 1482 | //merge request vars so that the reloaded list table contains any existing filter query params |
1483 | - $route = array_merge( $this->_req_data, $route ); |
|
1484 | - $this->_redirect_after_action( $success, '', '', $route, true ); |
|
1483 | + $route = array_merge($this->_req_data, $route); |
|
1484 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
1485 | 1485 | } |
1486 | 1486 | |
1487 | 1487 | |
@@ -1492,51 +1492,51 @@ discard block |
||
1492 | 1492 | protected function _change_reg_status() { |
1493 | 1493 | $this->_req_data['return'] = 'view_registration'; |
1494 | 1494 | //set notify based on whether the send notifications toggle is set or not |
1495 | - $notify = ! empty( $this->_req_data['reg_status_change_form']['send_notifications'] ); |
|
1495 | + $notify = ! empty($this->_req_data['reg_status_change_form']['send_notifications']); |
|
1496 | 1496 | //$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
1497 | - $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] = isset( |
|
1498 | - $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] |
|
1497 | + $this->_req_data['reg_status_change_form']['reg_status'] = isset( |
|
1498 | + $this->_req_data['reg_status_change_form']['reg_status'] |
|
1499 | 1499 | ) |
1500 | - ? $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] |
|
1500 | + ? $this->_req_data['reg_status_change_form']['reg_status'] |
|
1501 | 1501 | : ''; |
1502 | 1502 | |
1503 | - switch ( $this->_req_data[ 'reg_status_change_form' ]['reg_status'] ) { |
|
1503 | + switch ($this->_req_data['reg_status_change_form']['reg_status']) { |
|
1504 | 1504 | |
1505 | 1505 | case EEM_Registration::status_id_approved : |
1506 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1507 | - $this->approve_registration( $notify ); |
|
1506 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1507 | + $this->approve_registration($notify); |
|
1508 | 1508 | break; |
1509 | 1509 | |
1510 | 1510 | case EEM_Registration::status_id_pending_payment : |
1511 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1512 | - $this->pending_registration( $notify ); |
|
1511 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1512 | + $this->pending_registration($notify); |
|
1513 | 1513 | break; |
1514 | 1514 | |
1515 | 1515 | case EEM_Registration::status_id_not_approved : |
1516 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1517 | - $this->not_approve_registration( $notify ); |
|
1516 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1517 | + $this->not_approve_registration($notify); |
|
1518 | 1518 | break; |
1519 | 1519 | |
1520 | 1520 | case EEM_Registration::status_id_declined : |
1521 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1522 | - $this->decline_registration( $notify ); |
|
1521 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1522 | + $this->decline_registration($notify); |
|
1523 | 1523 | break; |
1524 | 1524 | |
1525 | 1525 | case EEM_Registration::status_id_cancelled : |
1526 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1527 | - $this->cancel_registration( $notify ); |
|
1526 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1527 | + $this->cancel_registration($notify); |
|
1528 | 1528 | break; |
1529 | 1529 | |
1530 | 1530 | case EEM_Registration::status_id_wait_list : |
1531 | - case EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) : |
|
1532 | - $this->waitlist_registration( $notify ); |
|
1531 | + case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') : |
|
1532 | + $this->waitlist_registration($notify); |
|
1533 | 1533 | break; |
1534 | 1534 | |
1535 | 1535 | case EEM_Registration::status_id_incomplete : |
1536 | 1536 | default : |
1537 | 1537 | $result['success'] = false; |
1538 | - unset( $this->_req_data['return'] ); |
|
1539 | - $this->_reg_status_change_return( '', false ); |
|
1538 | + unset($this->_req_data['return']); |
|
1539 | + $this->_reg_status_change_return('', false); |
|
1540 | 1540 | break; |
1541 | 1541 | } |
1542 | 1542 | } |
@@ -1550,8 +1550,8 @@ discard block |
||
1550 | 1550 | * @param bool $notify whether or not to notify the registrant about their approval. |
1551 | 1551 | * @return void |
1552 | 1552 | */ |
1553 | - protected function approve_registration( $notify = false ) { |
|
1554 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1553 | + protected function approve_registration($notify = false) { |
|
1554 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1555 | 1555 | } |
1556 | 1556 | |
1557 | 1557 | |
@@ -1563,8 +1563,8 @@ discard block |
||
1563 | 1563 | * @param bool $notify whether or not to notify the registrant about their status change. |
1564 | 1564 | * @return void |
1565 | 1565 | */ |
1566 | - protected function decline_registration( $notify = false ) { |
|
1567 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1566 | + protected function decline_registration($notify = false) { |
|
1567 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1568 | 1568 | } |
1569 | 1569 | |
1570 | 1570 | |
@@ -1576,8 +1576,8 @@ discard block |
||
1576 | 1576 | * @param bool $notify whether or not to notify the registrant about their status change. |
1577 | 1577 | * @return void |
1578 | 1578 | */ |
1579 | - protected function cancel_registration( $notify = false ) { |
|
1580 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1579 | + protected function cancel_registration($notify = false) { |
|
1580 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1581 | 1581 | } |
1582 | 1582 | |
1583 | 1583 | |
@@ -1589,8 +1589,8 @@ discard block |
||
1589 | 1589 | * @param bool $notify whether or not to notify the registrant about their status change. |
1590 | 1590 | * @return void |
1591 | 1591 | */ |
1592 | - protected function not_approve_registration( $notify = false ) { |
|
1593 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1592 | + protected function not_approve_registration($notify = false) { |
|
1593 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1594 | 1594 | } |
1595 | 1595 | |
1596 | 1596 | |
@@ -1602,8 +1602,8 @@ discard block |
||
1602 | 1602 | * @param bool $notify whether or not to notify the registrant about their status change. |
1603 | 1603 | * @return void |
1604 | 1604 | */ |
1605 | - protected function pending_registration( $notify = false ) { |
|
1606 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1605 | + protected function pending_registration($notify = false) { |
|
1606 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | 1609 | |
@@ -1615,8 +1615,8 @@ discard block |
||
1615 | 1615 | * @param bool $notify whether or not to notify the registrant about their status change. |
1616 | 1616 | * @return void |
1617 | 1617 | */ |
1618 | - protected function waitlist_registration( $notify = false ) { |
|
1619 | - $this->_reg_status_change_return( EEM_Registration::status_id_wait_list, $notify ); |
|
1618 | + protected function waitlist_registration($notify = false) { |
|
1619 | + $this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify); |
|
1620 | 1620 | } |
1621 | 1621 | |
1622 | 1622 | |
@@ -1630,14 +1630,14 @@ discard block |
||
1630 | 1630 | public function _reg_details_meta_box() { |
1631 | 1631 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1632 | 1632 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1633 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
1633 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
1634 | 1634 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1635 | 1635 | $this->_session = $transaction->session_data(); |
1636 | 1636 | |
1637 | 1637 | $filters = new EE_Line_Item_Filter_Collection(); |
1638 | 1638 | //$filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
1639 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1640 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1639 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1640 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1641 | 1641 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1642 | 1642 | $line_item_display = new EE_Line_Item_Display( |
1643 | 1643 | 'reg_admin_table', |
@@ -1645,7 +1645,7 @@ discard block |
||
1645 | 1645 | ); |
1646 | 1646 | $this->_template_args['line_item_table'] = $line_item_display->display_line_item( |
1647 | 1647 | $filtered_line_item_tree, |
1648 | - array( 'EE_Registration' => $this->_registration ) |
|
1648 | + array('EE_Registration' => $this->_registration) |
|
1649 | 1649 | ); |
1650 | 1650 | $attendee = $this->_registration->attendee(); |
1651 | 1651 | |
@@ -1655,7 +1655,7 @@ discard block |
||
1655 | 1655 | 'espresso_transactions_view_transaction' |
1656 | 1656 | ) |
1657 | 1657 | ) { |
1658 | - $this->_template_args[ 'view_transaction_button' ] = EEH_Template::get_button_or_link( |
|
1658 | + $this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link( |
|
1659 | 1659 | EE_Admin_Page::add_query_args_and_nonce( |
1660 | 1660 | array( |
1661 | 1661 | 'action' => 'view_transaction', |
@@ -1663,12 +1663,12 @@ discard block |
||
1663 | 1663 | ), |
1664 | 1664 | TXN_ADMIN_URL |
1665 | 1665 | ), |
1666 | - esc_html__( ' View Transaction' ), |
|
1666 | + esc_html__(' View Transaction'), |
|
1667 | 1667 | 'button secondary-button right', |
1668 | 1668 | 'dashicons dashicons-cart' |
1669 | 1669 | ); |
1670 | 1670 | } else { |
1671 | - $this->_template_args[ 'view_transaction_button' ] = ''; |
|
1671 | + $this->_template_args['view_transaction_button'] = ''; |
|
1672 | 1672 | } |
1673 | 1673 | |
1674 | 1674 | if ( |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | 'espresso_registrations_resend_registration' |
1679 | 1679 | ) |
1680 | 1680 | ) { |
1681 | - $this->_template_args[ 'resend_registration_button' ] = EEH_Template::get_button_or_link( |
|
1681 | + $this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link( |
|
1682 | 1682 | EE_Admin_Page::add_query_args_and_nonce( |
1683 | 1683 | array( |
1684 | 1684 | 'action' => 'resend_registration', |
@@ -1687,55 +1687,55 @@ discard block |
||
1687 | 1687 | ), |
1688 | 1688 | REG_ADMIN_URL |
1689 | 1689 | ), |
1690 | - esc_html__( ' Resend Registration' ), |
|
1690 | + esc_html__(' Resend Registration'), |
|
1691 | 1691 | 'button secondary-button right', |
1692 | 1692 | 'dashicons dashicons-email-alt' |
1693 | 1693 | ); |
1694 | 1694 | } else { |
1695 | - $this->_template_args[ 'resend_registration_button' ] = ''; |
|
1695 | + $this->_template_args['resend_registration_button'] = ''; |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1699 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1699 | + $payment = $transaction->get_first_related('Payment'); |
|
1700 | 1700 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1701 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1701 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1702 | 1702 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1703 | 1703 | |
1704 | 1704 | $reg_details = array( |
1705 | 1705 | 'payment_method' => $payment_method->name(), |
1706 | 1706 | 'response_msg' => $payment->gateway_response(), |
1707 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1707 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1708 | 1708 | 'registration_session' => $this->_registration->session_ID(), |
1709 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1710 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1709 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1710 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1711 | 1711 | ); |
1712 | 1712 | |
1713 | 1713 | |
1714 | - if ( isset( $reg_details['registration_id'] )) { |
|
1714 | + if (isset($reg_details['registration_id'])) { |
|
1715 | 1715 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1716 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1716 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1717 | 1717 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1718 | 1718 | } |
1719 | 1719 | |
1720 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1720 | + if (isset($reg_details['payment_method'])) { |
|
1721 | 1721 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1722 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1722 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1723 | 1723 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1724 | 1724 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1725 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1725 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1726 | 1726 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1727 | 1727 | } |
1728 | 1728 | |
1729 | 1729 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1730 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1730 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1731 | 1731 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1732 | 1732 | |
1733 | 1733 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1734 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1734 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1735 | 1735 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1736 | 1736 | |
1737 | 1737 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1738 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1738 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1739 | 1739 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1740 | 1740 | |
1741 | 1741 | $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( |
@@ -1748,8 +1748,8 @@ discard block |
||
1748 | 1748 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1749 | 1749 | $this->_template_args['event_id'] = $this->_registration->event_ID(); |
1750 | 1750 | |
1751 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1752 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1751 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1752 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1753 | 1753 | |
1754 | 1754 | } |
1755 | 1755 | |
@@ -1763,14 +1763,14 @@ discard block |
||
1763 | 1763 | */ |
1764 | 1764 | public function _reg_questions_meta_box() { |
1765 | 1765 | //allow someone to override this method entirely |
1766 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1767 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1768 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1766 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1767 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1768 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1769 | 1769 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1770 | 1770 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1771 | 1771 | |
1772 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1773 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1772 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1773 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1774 | 1774 | } |
1775 | 1775 | } |
1776 | 1776 | |
@@ -1784,12 +1784,12 @@ discard block |
||
1784 | 1784 | * @param string $output |
1785 | 1785 | * @return string |
1786 | 1786 | */ |
1787 | - public function form_before_question_group( $output ) { |
|
1787 | + public function form_before_question_group($output) { |
|
1788 | 1788 | EE_Error::doing_it_wrong( |
1789 | - __CLASS__ . '::' . __FUNCTION__, |
|
1790 | - __( 'This method would have been protected but was used on a filter callback' |
|
1789 | + __CLASS__.'::'.__FUNCTION__, |
|
1790 | + __('This method would have been protected but was used on a filter callback' |
|
1791 | 1791 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1792 | - 'event_espresso' ), |
|
1792 | + 'event_espresso'), |
|
1793 | 1793 | '4.8.32.rc.000' |
1794 | 1794 | ); |
1795 | 1795 | return ' |
@@ -1808,20 +1808,20 @@ discard block |
||
1808 | 1808 | * @param string $output |
1809 | 1809 | * @return string |
1810 | 1810 | */ |
1811 | - public function form_after_question_group( $output ) { |
|
1811 | + public function form_after_question_group($output) { |
|
1812 | 1812 | EE_Error::doing_it_wrong( |
1813 | - __CLASS__ . '::' . __FUNCTION__, |
|
1814 | - __( 'This method would have been protected but was used on a filter callback' |
|
1813 | + __CLASS__.'::'.__FUNCTION__, |
|
1814 | + __('This method would have been protected but was used on a filter callback' |
|
1815 | 1815 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1816 | - 'event_espresso' ), |
|
1816 | + 'event_espresso'), |
|
1817 | 1817 | '4.8.32.rc.000' |
1818 | 1818 | ); |
1819 | 1819 | return ' |
1820 | 1820 | <tr class="hide-if-no-js"> |
1821 | 1821 | <th> </th> |
1822 | 1822 | <td class="reg-admin-edit-attendee-question-td"> |
1823 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1824 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1823 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1824 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1825 | 1825 | <div class="dashicons dashicons-edit"></div> |
1826 | 1826 | </a> |
1827 | 1827 | </td> |
@@ -1841,18 +1841,18 @@ discard block |
||
1841 | 1841 | * @param string $label |
1842 | 1842 | * @return string |
1843 | 1843 | */ |
1844 | - public function form_form_field_label_wrap( $label ) { |
|
1844 | + public function form_form_field_label_wrap($label) { |
|
1845 | 1845 | EE_Error::doing_it_wrong( |
1846 | - __CLASS__ . '::' . __FUNCTION__, |
|
1847 | - __( 'This method would have been protected but was used on a filter callback' |
|
1846 | + __CLASS__.'::'.__FUNCTION__, |
|
1847 | + __('This method would have been protected but was used on a filter callback' |
|
1848 | 1848 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1849 | - 'event_espresso' ), |
|
1849 | + 'event_espresso'), |
|
1850 | 1850 | '4.8.32.rc.000' |
1851 | 1851 | ); |
1852 | 1852 | return ' |
1853 | 1853 | <tr> |
1854 | 1854 | <th> |
1855 | - ' . $label . ' |
|
1855 | + ' . $label.' |
|
1856 | 1856 | </th>'; |
1857 | 1857 | } |
1858 | 1858 | |
@@ -1866,17 +1866,17 @@ discard block |
||
1866 | 1866 | * @param string $input |
1867 | 1867 | * @return string |
1868 | 1868 | */ |
1869 | - public function form_form_field_input__wrap( $input ) { |
|
1869 | + public function form_form_field_input__wrap($input) { |
|
1870 | 1870 | EE_Error::doing_it_wrong( |
1871 | - __CLASS__ . '::' . __FUNCTION__, |
|
1872 | - __( 'This method would have been protected but was used on a filter callback' |
|
1871 | + __CLASS__.'::'.__FUNCTION__, |
|
1872 | + __('This method would have been protected but was used on a filter callback' |
|
1873 | 1873 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1874 | - 'event_espresso' ), |
|
1874 | + 'event_espresso'), |
|
1875 | 1875 | '4.8.32.rc.000' |
1876 | 1876 | ); |
1877 | 1877 | return ' |
1878 | 1878 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1879 | - ' . $input . ' |
|
1879 | + ' . $input.' |
|
1880 | 1880 | </td> |
1881 | 1881 | </tr>'; |
1882 | 1882 | } |
@@ -1890,14 +1890,14 @@ discard block |
||
1890 | 1890 | * @return void |
1891 | 1891 | */ |
1892 | 1892 | protected function _update_attendee_registration_form() { |
1893 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1894 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1895 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1896 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1897 | - if( $success ) { |
|
1893 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1894 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1895 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1896 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1897 | + if ($success) { |
|
1898 | 1898 | $what = __('Registration Form', 'event_espresso'); |
1899 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1900 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1899 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1900 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1901 | 1901 | } |
1902 | 1902 | } |
1903 | 1903 | } |
@@ -1908,11 +1908,11 @@ discard block |
||
1908 | 1908 | * @param int $REG_ID |
1909 | 1909 | * @return EE_Registration_Custom_Questions_Form |
1910 | 1910 | */ |
1911 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1912 | - if( ! $this->_reg_custom_questions_form ) { |
|
1913 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1914 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1915 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1911 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1912 | + if ( ! $this->_reg_custom_questions_form) { |
|
1913 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1914 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1915 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1916 | 1916 | } |
1917 | 1917 | return $this->_reg_custom_questions_form; |
1918 | 1918 | } |
@@ -1925,17 +1925,17 @@ discard block |
||
1925 | 1925 | * @param bool $REG_ID |
1926 | 1926 | * @return bool |
1927 | 1927 | */ |
1928 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1928 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1929 | 1929 | |
1930 | 1930 | if ( ! $REG_ID) { |
1931 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1931 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1932 | 1932 | } |
1933 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1934 | - $form->receive_form_submission( $this->_req_data ); |
|
1933 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1934 | + $form->receive_form_submission($this->_req_data); |
|
1935 | 1935 | $success = false; |
1936 | - if( $form->is_valid() ) { |
|
1937 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1938 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1936 | + if ($form->is_valid()) { |
|
1937 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1938 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1939 | 1939 | $where_conditions = array( |
1940 | 1940 | 'QST_ID' => $question_id, |
1941 | 1941 | 'REG_ID' => $REG_ID |
@@ -1943,19 +1943,19 @@ discard block |
||
1943 | 1943 | $possibly_new_values = array( |
1944 | 1944 | 'ANS_value' => $input->normalized_value() |
1945 | 1945 | ); |
1946 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1947 | - if( $answer instanceof EE_Answer ) { |
|
1948 | - $success = $answer->save( $possibly_new_values ); |
|
1946 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1947 | + if ($answer instanceof EE_Answer) { |
|
1948 | + $success = $answer->save($possibly_new_values); |
|
1949 | 1949 | } else { |
1950 | 1950 | //insert it then |
1951 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1952 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1951 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1952 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1953 | 1953 | $success = $answer->save(); |
1954 | 1954 | } |
1955 | 1955 | } |
1956 | 1956 | } |
1957 | 1957 | } else { |
1958 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1958 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1959 | 1959 | } |
1960 | 1960 | return $success; |
1961 | 1961 | } |
@@ -1973,31 +1973,31 @@ discard block |
||
1973 | 1973 | $registrations = $REG->get_all(array( |
1974 | 1974 | array( |
1975 | 1975 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1976 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1976 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1977 | 1977 | ), |
1978 | 1978 | 'force_join'=>array('Attendee'))); |
1979 | 1979 | |
1980 | 1980 | $this->_template_args['attendees'] = array(); |
1981 | 1981 | $this->_template_args['attendee_notice'] = ''; |
1982 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1983 | - 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__ ); |
|
1982 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1983 | + 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__); |
|
1984 | 1984 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1985 | 1985 | } else { |
1986 | 1986 | |
1987 | 1987 | $att_nmbr = 1; |
1988 | - foreach ( $registrations as $registration ) { |
|
1988 | + foreach ($registrations as $registration) { |
|
1989 | 1989 | /* @var $registration EE_Registration */ |
1990 | 1990 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1991 | - $this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID(); |
|
1992 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1993 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1994 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1995 | - $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 : ''; |
|
1991 | + $this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID(); |
|
1992 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1993 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1994 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1995 | + $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 : ''; |
|
1996 | 1996 | |
1997 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1997 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1998 | 1998 | |
1999 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
2000 | - $this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name(); |
|
1999 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
2000 | + $this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name(); |
|
2001 | 2001 | |
2002 | 2002 | $att_nmbr++; |
2003 | 2003 | } |
@@ -2007,8 +2007,8 @@ discard block |
||
2007 | 2007 | |
2008 | 2008 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
2009 | 2009 | } |
2010 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
2011 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2010 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
2011 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2012 | 2012 | |
2013 | 2013 | } |
2014 | 2014 | |
@@ -2029,14 +2029,14 @@ discard block |
||
2029 | 2029 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
2030 | 2030 | |
2031 | 2031 | //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 create button or not) |
2032 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
2032 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
2033 | 2033 | |
2034 | 2034 | $primary_registration = $this->_registration->get_primary_registration(); |
2035 | 2035 | $primary_attendee = $primary_registration instanceof EE_Registration |
2036 | 2036 | ? $primary_registration->attendee() |
2037 | 2037 | : null; |
2038 | 2038 | |
2039 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
2039 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
2040 | 2040 | //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. |
2041 | 2041 | $primary_registration = NULL; |
2042 | 2042 | } |
@@ -2045,27 +2045,27 @@ discard block |
||
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
2048 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
2049 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
2050 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
2048 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
2049 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
2050 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
2051 | 2051 | $this->_template_args['phone'] = $attendee->phone(); |
2052 | 2052 | |
2053 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
2053 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
2054 | 2054 | |
2055 | 2055 | |
2056 | 2056 | //edit link |
2057 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
2057 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
2058 | 2058 | $this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso'); |
2059 | 2059 | |
2060 | 2060 | //create link |
2061 | - $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 ): ''; |
|
2061 | + $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) : ''; |
|
2062 | 2062 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
2063 | 2063 | |
2064 | 2064 | $this->_template_args['att_check'] = $att_check; |
2065 | 2065 | |
2066 | 2066 | |
2067 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
2068 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2067 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
2068 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2069 | 2069 | } |
2070 | 2070 | |
2071 | 2071 | |
@@ -2078,7 +2078,7 @@ discard block |
||
2078 | 2078 | * @access protected |
2079 | 2079 | * @return void |
2080 | 2080 | */ |
2081 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
2081 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
2082 | 2082 | $REGM = EEM_Registration::instance(); |
2083 | 2083 | |
2084 | 2084 | $success = 1; |
@@ -2088,26 +2088,26 @@ discard block |
||
2088 | 2088 | $dtts = array(); |
2089 | 2089 | |
2090 | 2090 | //if empty _REG_ID then get out because there's nothing to do |
2091 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
2091 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2092 | 2092 | $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'); |
2093 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
2094 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
2093 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
2094 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
2095 | 2095 | } |
2096 | 2096 | |
2097 | 2097 | //Checkboxes |
2098 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2098 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2099 | 2099 | // if array has more than one element than success message should be plural |
2100 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
2100 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
2101 | 2101 | // cycle thru checkboxes |
2102 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
2102 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
2103 | 2103 | /** @var EE_Registration $REG */ |
2104 | - $REG = $REGM->get_one_by_ID( $REG_ID); |
|
2104 | + $REG = $REGM->get_one_by_ID($REG_ID); |
|
2105 | 2105 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
2106 | - if ( $payment_count > 0 ) { |
|
2107 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
2106 | + if ($payment_count > 0) { |
|
2107 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
2108 | 2108 | $error = 1; |
2109 | 2109 | $success = 0; |
2110 | - 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__ ); |
|
2110 | + 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__); |
|
2111 | 2111 | continue; //can't trash this registration because it has payments. |
2112 | 2112 | } |
2113 | 2113 | $ticket = $REG->get_first_related('Ticket'); |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | $dtts = array_merge($dtts, $dtt); |
2117 | 2117 | |
2118 | 2118 | $updated = $trash ? $REG->delete() : $REG->restore(); |
2119 | - if ( !$updated ) { |
|
2119 | + if ( ! $updated) { |
|
2120 | 2120 | $success = 0; |
2121 | 2121 | } else { |
2122 | 2122 | $success = 2; |
@@ -2131,7 +2131,7 @@ discard block |
||
2131 | 2131 | $tickets[$ticket->ID()] = $ticket; |
2132 | 2132 | $dtts = $ticket->get_many_related('Datetime'); |
2133 | 2133 | $updated = $trash ? $REG->delete() : $REG->restore(); |
2134 | - if ( ! $updated ) { |
|
2134 | + if ( ! $updated) { |
|
2135 | 2135 | $success = 0; |
2136 | 2136 | } |
2137 | 2137 | |
@@ -2141,10 +2141,10 @@ discard block |
||
2141 | 2141 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
2142 | 2142 | EEM_Datetime::instance()->update_sold($dtts); |
2143 | 2143 | |
2144 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
2145 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2144 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
2145 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2146 | 2146 | $overwrite_msgs = $error ? TRUE : FALSE; |
2147 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
2147 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
2148 | 2148 | } |
2149 | 2149 | |
2150 | 2150 | |
@@ -2168,16 +2168,16 @@ discard block |
||
2168 | 2168 | $success = 1; |
2169 | 2169 | |
2170 | 2170 | //Checkboxes |
2171 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2171 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2172 | 2172 | // if array has more than one element than success message should be plural |
2173 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
2173 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
2174 | 2174 | // cycle thru checkboxes |
2175 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
2175 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
2176 | 2176 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
2177 | - if ( ! $REG instanceof EE_Registration ) |
|
2177 | + if ( ! $REG instanceof EE_Registration) |
|
2178 | 2178 | continue; |
2179 | 2179 | $deleted = $this->_delete_registration($REG); |
2180 | - if ( !$deleted ) { |
|
2180 | + if ( ! $deleted) { |
|
2181 | 2181 | $success = 0; |
2182 | 2182 | } |
2183 | 2183 | } |
@@ -2187,15 +2187,15 @@ discard block |
||
2187 | 2187 | $REG_ID = $this->_req_data['_REG_ID']; |
2188 | 2188 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
2189 | 2189 | $deleted = $this->_delete_registration($REG); |
2190 | - if ( ! $deleted ) { |
|
2190 | + if ( ! $deleted) { |
|
2191 | 2191 | $success = 0; |
2192 | 2192 | } |
2193 | 2193 | |
2194 | 2194 | } |
2195 | 2195 | |
2196 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
2197 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
2198 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
2196 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
2197 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
2198 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
2199 | 2199 | } |
2200 | 2200 | |
2201 | 2201 | |
@@ -2207,31 +2207,31 @@ discard block |
||
2207 | 2207 | * @param EE_Registration $REG registration to be deleted permenantly |
2208 | 2208 | * @return boolean true = successful deletion, false = fail. |
2209 | 2209 | */ |
2210 | - protected function _delete_registration( EE_Registration $REG ) { |
|
2210 | + protected function _delete_registration(EE_Registration $REG) { |
|
2211 | 2211 | //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. |
2212 | 2212 | $TXN = $REG->get_first_related('Transaction'); |
2213 | 2213 | $REGS = $TXN->get_many_related('Registration'); |
2214 | 2214 | |
2215 | 2215 | $all_trashed = TRUE; |
2216 | - foreach ( $REGS as $registration ) { |
|
2217 | - if ( ! $registration->get('REG_deleted') ) |
|
2216 | + foreach ($REGS as $registration) { |
|
2217 | + if ( ! $registration->get('REG_deleted')) |
|
2218 | 2218 | $all_trashed = FALSE; |
2219 | 2219 | } |
2220 | 2220 | |
2221 | - if ( ! $all_trashed ) { |
|
2222 | - 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__ ); |
|
2221 | + if ( ! $all_trashed) { |
|
2222 | + 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__); |
|
2223 | 2223 | return false; |
2224 | 2224 | } |
2225 | 2225 | |
2226 | 2226 | //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). |
2227 | - foreach ( $REGS as $registration ) { |
|
2227 | + foreach ($REGS as $registration) { |
|
2228 | 2228 | |
2229 | 2229 | //delete related answers |
2230 | 2230 | $registration->delete_related_permanently('Answer'); |
2231 | 2231 | |
2232 | 2232 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
2233 | 2233 | $attendee = $registration->get_first_related('Attendee'); |
2234 | - if ( $attendee instanceof EE_Attendee ) { |
|
2234 | + if ($attendee instanceof EE_Attendee) { |
|
2235 | 2235 | $registration->_remove_relation_to($attendee, 'Attendee'); |
2236 | 2236 | } |
2237 | 2237 | |
@@ -2241,7 +2241,7 @@ discard block |
||
2241 | 2241 | //now delete permanently the checkins related to this registration. |
2242 | 2242 | $registration->delete_related_permanently('Checkin'); |
2243 | 2243 | |
2244 | - if ( $registration->ID() === $REG->ID() ) |
|
2244 | + if ($registration->ID() === $REG->ID()) |
|
2245 | 2245 | continue; //we don't want to delete permanently the existing registration just yet. |
2246 | 2246 | |
2247 | 2247 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2278,35 +2278,35 @@ discard block |
||
2278 | 2278 | * @return void |
2279 | 2279 | */ |
2280 | 2280 | public function new_registration() { |
2281 | - if ( ! $this->_set_reg_event() ) { |
|
2282 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2281 | + if ( ! $this->_set_reg_event()) { |
|
2282 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2283 | 2283 | } |
2284 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2284 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2285 | 2285 | // gotta start with a clean slate if we're not coming here via ajax |
2286 | 2286 | if ( |
2287 | - ! defined('DOING_AJAX' ) |
|
2288 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2287 | + ! defined('DOING_AJAX') |
|
2288 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2289 | 2289 | ) { |
2290 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2290 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2291 | 2291 | } |
2292 | 2292 | |
2293 | - $this->_template_args['event_name'] = '' ; |
|
2293 | + $this->_template_args['event_name'] = ''; |
|
2294 | 2294 | // event name |
2295 | - if ( $this->_reg_event ) { |
|
2295 | + if ($this->_reg_event) { |
|
2296 | 2296 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2297 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2298 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2299 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2297 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2298 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2299 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2300 | 2300 | } |
2301 | 2301 | |
2302 | 2302 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2303 | 2303 | |
2304 | - if ( defined('DOING_AJAX' ) ) { |
|
2304 | + if (defined('DOING_AJAX')) { |
|
2305 | 2305 | $this->_return_json(); |
2306 | 2306 | } |
2307 | 2307 | // grab header |
2308 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2309 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2308 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2309 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2310 | 2310 | |
2311 | 2311 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2312 | 2312 | // the details template wrapper |
@@ -2323,7 +2323,7 @@ discard block |
||
2323 | 2323 | * @return string html |
2324 | 2324 | */ |
2325 | 2325 | protected function _get_registration_step_content() { |
2326 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2326 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2327 | 2327 | $warning_msg = sprintf( |
2328 | 2328 | __( |
2329 | 2329 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2339,7 +2339,7 @@ discard block |
||
2339 | 2339 | '</b>' |
2340 | 2340 | ); |
2341 | 2341 | return ' |
2342 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2342 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2343 | 2343 | <script > |
2344 | 2344 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2345 | 2345 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2374,16 +2374,16 @@ discard block |
||
2374 | 2374 | $cart = EE_Registry::instance()->SSN->cart(); |
2375 | 2375 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2376 | 2376 | |
2377 | - switch ( $step ) { |
|
2377 | + switch ($step) { |
|
2378 | 2378 | case 'ticket' : |
2379 | 2379 | $hidden_fields['processing_registration']['value'] = 1; |
2380 | 2380 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2381 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2381 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2382 | 2382 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2383 | 2383 | $template_args['show_notification_toggle'] = FALSE; |
2384 | 2384 | break; |
2385 | 2385 | case 'questions' : |
2386 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2386 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2387 | 2387 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2388 | 2388 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2389 | 2389 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2392,10 +2392,10 @@ discard block |
||
2392 | 2392 | break; |
2393 | 2393 | } |
2394 | 2394 | |
2395 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2395 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2396 | 2396 | |
2397 | 2397 | return EEH_Template::display_template( |
2398 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2398 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2399 | 2399 | ); |
2400 | 2400 | } |
2401 | 2401 | |
@@ -2410,11 +2410,11 @@ discard block |
||
2410 | 2410 | * @return boolean |
2411 | 2411 | */ |
2412 | 2412 | private function _set_reg_event() { |
2413 | - if ( is_object( $this->_reg_event )) { |
|
2413 | + if (is_object($this->_reg_event)) { |
|
2414 | 2414 | return TRUE; |
2415 | 2415 | } |
2416 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2417 | - if ( ! $EVT_ID ) { |
|
2416 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2417 | + if ( ! $EVT_ID) { |
|
2418 | 2418 | return FALSE; |
2419 | 2419 | } |
2420 | 2420 | |
@@ -2435,82 +2435,82 @@ discard block |
||
2435 | 2435 | public function process_reg_step() { |
2436 | 2436 | EE_System::do_not_cache(); |
2437 | 2437 | $this->_set_reg_event(); |
2438 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2438 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2439 | 2439 | |
2440 | 2440 | //what step are we on? |
2441 | 2441 | $cart = EE_Registry::instance()->SSN->cart(); |
2442 | 2442 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2443 | 2443 | |
2444 | 2444 | //if doing ajax then we need to verify the nonce |
2445 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2446 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2447 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2445 | + if (defined('DOING_AJAX')) { |
|
2446 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2447 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2448 | 2448 | } |
2449 | 2449 | |
2450 | - switch ( $step ) { |
|
2450 | + switch ($step) { |
|
2451 | 2451 | |
2452 | 2452 | case 'ticket' : |
2453 | 2453 | //process ticket selection |
2454 | 2454 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2455 | - if ( $success ) { |
|
2456 | - EE_Error::add_success( esc_html__( 'Tickets Selected. Now complete the registration.', 'event_espresso' ) ); |
|
2455 | + if ($success) { |
|
2456 | + EE_Error::add_success(esc_html__('Tickets Selected. Now complete the registration.', 'event_espresso')); |
|
2457 | 2457 | } else { |
2458 | 2458 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2459 | 2459 | } |
2460 | - if ( defined('DOING_AJAX') ) { |
|
2460 | + if (defined('DOING_AJAX')) { |
|
2461 | 2461 | $this->new_registration(); //display next step |
2462 | 2462 | } else { |
2463 | 2463 | $query_args['action'] = 'new_registration'; |
2464 | 2464 | $query_args['processing_registration'] = 1; |
2465 | 2465 | $query_args['event_id'] = $this->_reg_event->ID(); |
2466 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2466 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2467 | 2467 | } |
2468 | 2468 | break; |
2469 | 2469 | |
2470 | 2470 | case 'questions' : |
2471 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2472 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2471 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2472 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2473 | 2473 | } |
2474 | 2474 | //process registration |
2475 | 2475 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2476 | - if ( $cart instanceof EE_Cart ) { |
|
2476 | + if ($cart instanceof EE_Cart) { |
|
2477 | 2477 | $grand_total = $cart->get_cart_grand_total(); |
2478 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2478 | + if ($grand_total instanceof EE_Line_Item) { |
|
2479 | 2479 | $grand_total->save_this_and_descendants_to_txn(); |
2480 | 2480 | } |
2481 | 2481 | } |
2482 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2482 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2483 | 2483 | $query_args = array( |
2484 | 2484 | 'action' => 'new_registration', |
2485 | 2485 | 'processing_registration' => 2, |
2486 | 2486 | 'event_id' => $this->_reg_event->ID() |
2487 | 2487 | ); |
2488 | 2488 | |
2489 | - if ( defined('DOING_AJAX' )) { |
|
2489 | + if (defined('DOING_AJAX')) { |
|
2490 | 2490 | //display registration form again because there are errors (maybe validation?) |
2491 | 2491 | $this->new_registration(); |
2492 | 2492 | return; |
2493 | 2493 | } else { |
2494 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2494 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2495 | 2495 | return; |
2496 | 2496 | } |
2497 | 2497 | } |
2498 | 2498 | /** @type EE_Transaction_Payments $transaction_payments */ |
2499 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2499 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2500 | 2500 | // maybe update status, and make sure to save transaction if not done already |
2501 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2501 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2502 | 2502 | $transaction->save(); |
2503 | 2503 | } |
2504 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2504 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2505 | 2505 | $this->_req_data = array(); |
2506 | 2506 | $query_args = array( |
2507 | 2507 | 'action' => 'redirect_to_txn', |
2508 | 2508 | 'TXN_ID' => $transaction->ID(), |
2509 | 2509 | 'EVT_ID' => $this->_reg_event->ID(), |
2510 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2510 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2511 | 2511 | 'redirect_from' => 'new_registration' |
2512 | 2512 | ); |
2513 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2513 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2514 | 2514 | break; |
2515 | 2515 | } |
2516 | 2516 | |
@@ -2527,21 +2527,21 @@ discard block |
||
2527 | 2527 | */ |
2528 | 2528 | public function redirect_to_txn() { |
2529 | 2529 | EE_System::do_not_cache(); |
2530 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2530 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2531 | 2531 | $query_args = array( |
2532 | 2532 | 'action' => 'view_transaction', |
2533 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2533 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2534 | 2534 | 'page' => 'espresso_transactions' |
2535 | 2535 | ); |
2536 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2537 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2538 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2539 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2536 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2537 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2538 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2539 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2540 | 2540 | } |
2541 | 2541 | EE_Error::add_success( |
2542 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2542 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2543 | 2543 | ); |
2544 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2544 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2545 | 2545 | } |
2546 | 2546 | |
2547 | 2547 | |
@@ -2552,7 +2552,7 @@ discard block |
||
2552 | 2552 | * @return void |
2553 | 2553 | */ |
2554 | 2554 | protected function _attendee_contact_list_table() { |
2555 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2555 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2556 | 2556 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2557 | 2557 | $this->display_admin_list_table_page_with_no_sidebar(); |
2558 | 2558 | } |
@@ -2567,10 +2567,10 @@ discard block |
||
2567 | 2567 | * @access public |
2568 | 2568 | * @return array |
2569 | 2569 | */ |
2570 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2570 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2571 | 2571 | |
2572 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2573 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2572 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2573 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2574 | 2574 | $ATT_MDL = EEM_Attendee::instance(); |
2575 | 2575 | |
2576 | 2576 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2598,47 +2598,47 @@ discard block |
||
2598 | 2598 | $orderby = 'ATT_lname'; |
2599 | 2599 | } |
2600 | 2600 | |
2601 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2601 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2602 | 2602 | |
2603 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2604 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2605 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2603 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2604 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2605 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2606 | 2606 | |
2607 | 2607 | $_where = array(); |
2608 | 2608 | |
2609 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
2610 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2609 | + if ( ! empty($this->_req_data['s'])) { |
|
2610 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2611 | 2611 | $_where['OR'] = array( |
2612 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2613 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2614 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2615 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2616 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2617 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2618 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2619 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2620 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2621 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2622 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2623 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2624 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2625 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2626 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2627 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2628 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2612 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2613 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2614 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2615 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2616 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2617 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2618 | + 'ATT_email' => array('LIKE', $sstr), |
|
2619 | + 'ATT_address' => array('LIKE', $sstr), |
|
2620 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2621 | + 'ATT_city' => array('LIKE', $sstr), |
|
2622 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2623 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2624 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2625 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2626 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2627 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2628 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2629 | 2629 | ); |
2630 | 2630 | } |
2631 | 2631 | |
2632 | 2632 | |
2633 | - $offset = ($current_page-1)*$per_page; |
|
2634 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2633 | + $offset = ($current_page - 1) * $per_page; |
|
2634 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2635 | 2635 | |
2636 | - if ( $trash ) { |
|
2637 | - $_where['status'] = array( '!=', 'publish' ); |
|
2638 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true ): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2636 | + if ($trash) { |
|
2637 | + $_where['status'] = array('!=', 'publish'); |
|
2638 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2639 | 2639 | } else { |
2640 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2641 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit ), 'ATT_ID' , true ) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2640 | + $_where['status'] = array('IN', array('publish')); |
|
2641 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2642 | 2642 | } |
2643 | 2643 | |
2644 | 2644 | return $all_attendees; |
@@ -2655,10 +2655,10 @@ discard block |
||
2655 | 2655 | */ |
2656 | 2656 | protected function _resend_registration() { |
2657 | 2657 | $this->_process_resend_registration(); |
2658 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2658 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2659 | 2659 | 'action' => 'default' |
2660 | 2660 | ); |
2661 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2661 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2662 | 2662 | } |
2663 | 2663 | |
2664 | 2664 | |
@@ -2666,26 +2666,26 @@ discard block |
||
2666 | 2666 | |
2667 | 2667 | |
2668 | 2668 | |
2669 | - public function _registrations_report(){ |
|
2670 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2671 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2669 | + public function _registrations_report() { |
|
2670 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2671 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2672 | 2672 | array( |
2673 | 2673 | 'page' => 'espresso_batch', |
2674 | 2674 | 'batch' => 'file', |
2675 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2676 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2677 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2678 | - )) ); |
|
2675 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2676 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2677 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2678 | + ))); |
|
2679 | 2679 | } else { |
2680 | 2680 | $new_request_args = array( |
2681 | 2681 | 'export' => 'report', |
2682 | 2682 | 'action' => 'registrations_report_for_event', |
2683 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2683 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2684 | 2684 | ); |
2685 | 2685 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2686 | 2686 | |
2687 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2688 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2687 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2688 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2689 | 2689 | $EE_Export = EE_Export::instance($this->_req_data); |
2690 | 2690 | $EE_Export->export(); |
2691 | 2691 | } |
@@ -2694,26 +2694,26 @@ discard block |
||
2694 | 2694 | |
2695 | 2695 | |
2696 | 2696 | |
2697 | - public function _contact_list_export(){ |
|
2698 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2699 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2697 | + public function _contact_list_export() { |
|
2698 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2699 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2700 | 2700 | $EE_Export = EE_Export::instance($this->_req_data); |
2701 | 2701 | $EE_Export->export_attendees(); |
2702 | 2702 | } |
2703 | 2703 | } |
2704 | 2704 | |
2705 | - public function _contact_list_report(){ |
|
2706 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2707 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2705 | + public function _contact_list_report() { |
|
2706 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2707 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2708 | 2708 | array( |
2709 | 2709 | 'page' => 'espresso_batch', |
2710 | 2710 | 'batch' => 'file', |
2711 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2712 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2713 | - )) ); |
|
2711 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2712 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2713 | + ))); |
|
2714 | 2714 | } else { |
2715 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2716 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2715 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2716 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2717 | 2717 | $EE_Export = EE_Export::instance($this->_req_data); |
2718 | 2718 | $EE_Export->report_attendees(); |
2719 | 2719 | } |
@@ -2732,73 +2732,73 @@ discard block |
||
2732 | 2732 | * @return void |
2733 | 2733 | */ |
2734 | 2734 | protected function _duplicate_attendee() { |
2735 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2735 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2736 | 2736 | //verify we have necessary info |
2737 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2738 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2739 | - $query_args = array( 'action' => $action ); |
|
2737 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2738 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2739 | + $query_args = array('action' => $action); |
|
2740 | 2740 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2741 | 2741 | } |
2742 | 2742 | |
2743 | 2743 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2744 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2744 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2745 | 2745 | $attendee = $registration->attendee(); |
2746 | 2746 | |
2747 | 2747 | //remove relation of existing attendee on registration |
2748 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2748 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2749 | 2749 | //new attendee |
2750 | 2750 | $new_attendee = clone $attendee; |
2751 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2751 | + $new_attendee->set('ATT_ID', 0); |
|
2752 | 2752 | $new_attendee->save(); |
2753 | 2753 | |
2754 | 2754 | //add new attendee to reg |
2755 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2755 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2756 | 2756 | |
2757 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2757 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2758 | 2758 | |
2759 | 2759 | //redirect to edit page for attendee |
2760 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2760 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2761 | 2761 | |
2762 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2762 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2763 | 2763 | } |
2764 | 2764 | |
2765 | 2765 | |
2766 | 2766 | //related to cpt routes |
2767 | 2767 | protected function _insert_update_cpt_item($post_id, $post) { |
2768 | 2768 | $success = true; |
2769 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2769 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2770 | 2770 | //for attendee updates |
2771 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2771 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2772 | 2772 | //note we should only be UPDATING attendees at this point. |
2773 | 2773 | $updated_fields = array( |
2774 | 2774 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2775 | 2775 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2776 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2776 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2777 | 2777 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2778 | 2778 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2779 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2780 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2781 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2782 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2783 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2784 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2779 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2780 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2781 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2782 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2783 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2784 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2785 | 2785 | ); |
2786 | - foreach ( $updated_fields as $field => $value ) { |
|
2786 | + foreach ($updated_fields as $field => $value) { |
|
2787 | 2787 | $attendee->set($field, $value); |
2788 | 2788 | } |
2789 | 2789 | |
2790 | 2790 | $success = $attendee->save(); |
2791 | 2791 | |
2792 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2793 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2794 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2795 | - 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 ) ); |
|
2792 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2793 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2794 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2795 | + 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)); |
|
2796 | 2796 | } |
2797 | 2797 | } |
2798 | 2798 | } |
2799 | 2799 | |
2800 | - if ( $success === FALSE ) |
|
2801 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2800 | + if ($success === FALSE) |
|
2801 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2802 | 2802 | |
2803 | 2803 | } |
2804 | 2804 | |
@@ -2818,17 +2818,17 @@ discard block |
||
2818 | 2818 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2819 | 2819 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2820 | 2820 | |
2821 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2822 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2821 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2822 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2823 | 2823 | } |
2824 | 2824 | |
2825 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2825 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2826 | 2826 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2827 | 2827 | } |
2828 | 2828 | |
2829 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2830 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2831 | - 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'); |
|
2829 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2830 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2831 | + 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'); |
|
2832 | 2832 | } |
2833 | 2833 | |
2834 | 2834 | |
@@ -2837,10 +2837,10 @@ discard block |
||
2837 | 2837 | * @param WP_Post $post wp post object |
2838 | 2838 | * @return string attendee contact info ( and form ) |
2839 | 2839 | */ |
2840 | - public function attendee_contact_info( $post ) { |
|
2840 | + public function attendee_contact_info($post) { |
|
2841 | 2841 | //get attendee object ( should already have it ) |
2842 | 2842 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2843 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2843 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2844 | 2844 | EEH_Template::display_template($template, $this->_template_args); |
2845 | 2845 | } |
2846 | 2846 | |
@@ -2856,12 +2856,12 @@ discard block |
||
2856 | 2856 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2857 | 2857 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2858 | 2858 | new EE_Question_Form_Input( |
2859 | - EE_Question::new_instance( array( |
|
2859 | + EE_Question::new_instance(array( |
|
2860 | 2860 | 'QST_ID' => 0, |
2861 | 2861 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2862 | 2862 | 'QST_system' => 'admin-state' |
2863 | 2863 | )), |
2864 | - EE_Answer::new_instance( array( |
|
2864 | + EE_Answer::new_instance(array( |
|
2865 | 2865 | 'ANS_ID' => 0, |
2866 | 2866 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2867 | 2867 | )), |
@@ -2874,12 +2874,12 @@ discard block |
||
2874 | 2874 | )); |
2875 | 2875 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2876 | 2876 | new EE_Question_Form_Input( |
2877 | - EE_Question::new_instance( array( |
|
2877 | + EE_Question::new_instance(array( |
|
2878 | 2878 | 'QST_ID' => 0, |
2879 | 2879 | 'QST_display_text' => __('Country', 'event_espresso'), |
2880 | 2880 | 'QST_system' => 'admin-country' |
2881 | 2881 | )), |
2882 | - EE_Answer::new_instance( array( |
|
2882 | + EE_Answer::new_instance(array( |
|
2883 | 2883 | 'ANS_ID' => 0, |
2884 | 2884 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2885 | 2885 | )), |
@@ -2890,8 +2890,8 @@ discard block |
||
2890 | 2890 | 'append_qstn_id' => FALSE |
2891 | 2891 | ) |
2892 | 2892 | )); |
2893 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2894 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2893 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2894 | + EEH_Template::display_template($template, $this->_template_args); |
|
2895 | 2895 | |
2896 | 2896 | } |
2897 | 2897 | |
@@ -2901,11 +2901,11 @@ discard block |
||
2901 | 2901 | * @access protected |
2902 | 2902 | * @return void |
2903 | 2903 | */ |
2904 | - public function attendee_registrations_meta_box( $post ) { |
|
2904 | + public function attendee_registrations_meta_box($post) { |
|
2905 | 2905 | |
2906 | 2906 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2907 | 2907 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2908 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2908 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2909 | 2909 | EEH_Template::display_template($template, $this->_template_args); |
2910 | 2910 | |
2911 | 2911 | } |
@@ -2919,8 +2919,8 @@ discard block |
||
2919 | 2919 | * @return string html for new form. |
2920 | 2920 | */ |
2921 | 2921 | public function after_title_form_fields($post) { |
2922 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2923 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2922 | + if ($post->post_type == 'espresso_attendees') { |
|
2923 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2924 | 2924 | $template_args['attendee'] = $this->_cpt_model_obj; |
2925 | 2925 | EEH_Template::display_template($template, $template_args); |
2926 | 2926 | } |
@@ -2937,21 +2937,21 @@ discard block |
||
2937 | 2937 | * @access protected |
2938 | 2938 | * @return void |
2939 | 2939 | */ |
2940 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2940 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2941 | 2941 | |
2942 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2942 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2943 | 2943 | |
2944 | 2944 | $ATT_MDL = EEM_Attendee::instance(); |
2945 | 2945 | |
2946 | 2946 | $success = 1; |
2947 | 2947 | //Checkboxes |
2948 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2948 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2949 | 2949 | // if array has more than one element than success message should be plural |
2950 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2950 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2951 | 2951 | // cycle thru checkboxes |
2952 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2953 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2954 | - if ( !$updated ) { |
|
2952 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2953 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2954 | + if ( ! $updated) { |
|
2955 | 2955 | $success = 0; |
2956 | 2956 | } |
2957 | 2957 | } |
@@ -2960,18 +2960,18 @@ discard block |
||
2960 | 2960 | // grab single id and delete |
2961 | 2961 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2962 | 2962 | //get attendee |
2963 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2963 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2964 | 2964 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2965 | 2965 | $updated = $att->save(); |
2966 | - if ( ! $updated ) { |
|
2966 | + if ( ! $updated) { |
|
2967 | 2967 | $success = 0; |
2968 | 2968 | } |
2969 | 2969 | |
2970 | 2970 | } |
2971 | 2971 | |
2972 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2973 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2974 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2972 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2973 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2974 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2975 | 2975 | |
2976 | 2976 | } |
2977 | 2977 |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class EED_Ticket_Selector extends EED_Module { |
28 | 28 | |
29 | - const debug = false; // true false |
|
29 | + const debug = false; // true false |
|
30 | 30 | |
31 | - /** |
|
31 | + /** |
|
32 | 32 | * event that ticket selector is being generated for |
33 | 33 | * |
34 | 34 | * @access protected |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | protected static $_event = NULL; |
38 | 38 | |
39 | 39 | /** |
40 | - * array of datetimes and the spaces available for them |
|
41 | - * |
|
42 | - * @access private |
|
43 | - * @var array |
|
44 | - */ |
|
40 | + * array of datetimes and the spaces available for them |
|
41 | + * |
|
42 | + * @access private |
|
43 | + * @var array |
|
44 | + */ |
|
45 | 45 | private static $_available_spaces = array(); |
46 | 46 | |
47 | 47 | /** |
48 | - * max attendees that can register for event at one time |
|
49 | - * |
|
50 | - * @access private |
|
51 | - * @var int |
|
52 | - */ |
|
48 | + * max attendees that can register for event at one time |
|
49 | + * |
|
50 | + * @access private |
|
51 | + * @var int |
|
52 | + */ |
|
53 | 53 | private static $_max_atndz = EE_INF; |
54 | 54 | |
55 | 55 | |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | return $permalink_string; |
220 | 220 | } |
221 | 221 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
222 | - . __( 'Embed', 'event_espresso' ) |
|
223 | - . '</a> '; |
|
222 | + . __( 'Embed', 'event_espresso' ) |
|
223 | + . '</a> '; |
|
224 | 224 | $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
225 | 225 | $iframe_string = esc_html( |
226 | 226 | '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | * @return array|boolean |
650 | 650 | */ |
651 | 651 | public function process_ticket_selections() { |
652 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
652 | + do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
653 | 653 | // check nonce |
654 | 654 | if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'process_ticket_selections_nonce' ) ) { |
655 | 655 | return false; |
@@ -720,20 +720,20 @@ discard block |
||
720 | 720 | } |
721 | 721 | } |
722 | 722 | do_action( |
723 | - 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', |
|
724 | - EE_Registry::instance()->CART, |
|
725 | - $this |
|
726 | - ); |
|
723 | + 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', |
|
724 | + EE_Registry::instance()->CART, |
|
725 | + $this |
|
726 | + ); |
|
727 | 727 | //d( EE_Registry::instance()->CART ); |
728 | 728 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
729 | 729 | |
730 | 730 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd ) ) { |
731 | 731 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added ) ) { |
732 | 732 | do_action( |
733 | - 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', |
|
734 | - EE_Registry::instance()->CART, |
|
735 | - $this |
|
736 | - ); |
|
733 | + 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', |
|
734 | + EE_Registry::instance()->CART, |
|
735 | + $this |
|
736 | + ); |
|
737 | 737 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
738 | 738 | EE_Registry::instance()->CART->save_cart( FALSE ); |
739 | 739 | EE_Registry::instance()->SSN->update(); |
@@ -746,20 +746,20 @@ discard block |
||
746 | 746 | |
747 | 747 | EE_Error::get_notices( false, true ); |
748 | 748 | wp_safe_redirect( |
749 | - apply_filters( |
|
750 | - 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', |
|
751 | - EE_Registry::instance()->CFG->core->reg_page_url() |
|
752 | - ) |
|
753 | - ); |
|
749 | + apply_filters( |
|
750 | + 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', |
|
751 | + EE_Registry::instance()->CFG->core->reg_page_url() |
|
752 | + ) |
|
753 | + ); |
|
754 | 754 | exit(); |
755 | 755 | |
756 | 756 | } else { |
757 | 757 | if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention') ) { |
758 | 758 | // nothing added to cart |
759 | 759 | EE_Error::add_attention( |
760 | - __( 'No tickets were added for the event.', 'event_espresso' ), |
|
761 | - __FILE__, __FUNCTION__, __LINE__ |
|
762 | - ); |
|
760 | + __( 'No tickets were added for the event.', 'event_espresso' ), |
|
761 | + __FILE__, __FUNCTION__, __LINE__ |
|
762 | + ); |
|
763 | 763 | } |
764 | 764 | } |
765 | 765 | |
@@ -926,13 +926,13 @@ discard block |
||
926 | 926 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
927 | 927 | // get the number of spaces left for this datetime ticket |
928 | 928 | $available_spaces = self::_ticket_datetime_availability( $ticket ); |
929 | - if (self::debug) { |
|
930 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()"; |
|
931 | - echo "<br /> . ticket->ID(): " . $ticket->ID(); |
|
932 | - echo "<br /> . requested qty: " . $qty; |
|
933 | - echo "<br /> . available_spaces: " . $available_spaces; |
|
934 | - } |
|
935 | - // compare available spaces against the number of tickets being purchased |
|
929 | + if (self::debug) { |
|
930 | + echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()"; |
|
931 | + echo "<br /> . ticket->ID(): " . $ticket->ID(); |
|
932 | + echo "<br /> . requested qty: " . $qty; |
|
933 | + echo "<br /> . available_spaces: " . $available_spaces; |
|
934 | + } |
|
935 | + // compare available spaces against the number of tickets being purchased |
|
936 | 936 | if ( $available_spaces >= $qty ) { |
937 | 937 | // allow addons to prevent a ticket from being added to cart |
938 | 938 | if ( |
@@ -1113,11 +1113,11 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | |
1115 | 1115 | /** |
1116 | - * load js |
|
1117 | - * |
|
1118 | - * @access public |
|
1119 | - * @return void |
|
1120 | - */ |
|
1116 | + * load js |
|
1117 | + * |
|
1118 | + * @access public |
|
1119 | + * @return void |
|
1120 | + */ |
|
1121 | 1121 | public static function load_tckt_slctr_assets() { |
1122 | 1122 | // add some style |
1123 | 1123 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class EED_Ticket_Selector extends EED_Module { |
28 | 28 | |
29 | - const debug = false; // true false |
|
29 | + const debug = false; // true false |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * event that ticket selector is being generated for |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | * @return EED_Ticket_Selector |
68 | 68 | */ |
69 | 69 | public static function instance() { |
70 | - return parent::get_instance( __CLASS__ ); |
|
70 | + return parent::get_instance(__CLASS__); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | 74 | |
75 | - protected function set_config(){ |
|
76 | - $this->set_config_section( 'template_settings' ); |
|
77 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
78 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
75 | + protected function set_config() { |
|
76 | + $this->set_config_section('template_settings'); |
|
77 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
78 | + $this->set_config_name('EED_Ticket_Selector'); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function set_hooks() { |
92 | 92 | // routing |
93 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
94 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
95 | - EE_Config::register_route( 'cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections' ); |
|
96 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
93 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
94 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
95 | + EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections'); |
|
96 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
97 | 97 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
98 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
98 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
99 | 99 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
100 | 100 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
101 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
101 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * @return void |
111 | 111 | */ |
112 | 112 | public static function set_hooks_admin() { |
113 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
113 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
114 | 114 | //add button for iframe code to event editor. |
115 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
116 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
115 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
116 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | public static function set_definitions() { |
128 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
129 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
128 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
129 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
130 | 130 | |
131 | 131 | //if config is not set, initialize |
132 | 132 | //If config is not set, set it. |
133 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
133 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
134 | 134 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
135 | 135 | } |
136 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
136 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param object $WP |
145 | 145 | * @return void |
146 | 146 | */ |
147 | - public function run( $WP ) {} |
|
147 | + public function run($WP) {} |
|
148 | 148 | |
149 | 149 | |
150 | 150 | /** |
@@ -156,23 +156,23 @@ discard block |
||
156 | 156 | public function ticket_selector_iframe() { |
157 | 157 | self::$_in_iframe = true; |
158 | 158 | /** @type EEM_Event $EEM_Event */ |
159 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
159 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
160 | 160 | $event = $EEM_Event->get_one_by_ID( |
161 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
161 | + EE_Registry::instance()->REQ->get('event', 0) |
|
162 | 162 | ); |
163 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
164 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
163 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
164 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
165 | 165 | $template_args['css'] = apply_filters( |
166 | 166 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
167 | 167 | array( |
168 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
169 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
170 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
171 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
168 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
169 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
170 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
171 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
172 | 172 | ) |
173 | 173 | ); |
174 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
175 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
174 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
175 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
176 | 176 | $template_args['eei18n'] = apply_filters( |
177 | 177 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
178 | 178 | EE_Registry::localize_i18n_js_strings() |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | $template_args['js'] = apply_filters( |
181 | 181 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
182 | 182 | array( |
183 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
184 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
185 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
183 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
184 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
185 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
186 | 186 | ) |
187 | 187 | ); |
188 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
189 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
188 | + $template_args['notices'] = EEH_Template::display_template( |
|
189 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
190 | 190 | array(), |
191 | 191 | true |
192 | 192 | ); |
193 | 193 | EEH_Template::display_template( |
194 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
194 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
195 | 195 | $template_args |
196 | 196 | ); |
197 | 197 | exit; |
@@ -210,25 +210,25 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return string The new html string for the permalink area. |
212 | 212 | */ |
213 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
213 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
214 | 214 | //make sure this is ONLY when editing and the event id has been set. |
215 | - if ( ! empty( $id ) ) { |
|
216 | - $post = get_post( $id ); |
|
215 | + if ( ! empty($id)) { |
|
216 | + $post = get_post($id); |
|
217 | 217 | //if NOT event then let's get out. |
218 | - if ( $post->post_type !== 'espresso_events' ) { |
|
218 | + if ($post->post_type !== 'espresso_events') { |
|
219 | 219 | return $permalink_string; |
220 | 220 | } |
221 | 221 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
222 | - . __( 'Embed', 'event_espresso' ) |
|
222 | + . __('Embed', 'event_espresso') |
|
223 | 223 | . '</a> '; |
224 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
224 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
225 | 225 | $iframe_string = esc_html( |
226 | - '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
|
226 | + '<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>' |
|
227 | 227 | ); |
228 | 228 | $permalink_string .= ' |
229 | 229 | <div id="js-ts-iframe" style="display:none"> |
230 | 230 | <div style="width:100%; height: 500px;"> |
231 | - ' . $iframe_string . ' |
|
231 | + ' . $iframe_string.' |
|
232 | 232 | </div> |
233 | 233 | </div>'; |
234 | 234 | } |
@@ -247,22 +247,22 @@ discard block |
||
247 | 247 | * @param mixed $event |
248 | 248 | * @return bool |
249 | 249 | */ |
250 | - protected static function set_event( $event = null ) { |
|
251 | - if( $event === null ) { |
|
250 | + protected static function set_event($event = null) { |
|
251 | + if ($event === null) { |
|
252 | 252 | global $post; |
253 | 253 | $event = $post; |
254 | 254 | } |
255 | - if ( $event instanceof EE_Event ) { |
|
255 | + if ($event instanceof EE_Event) { |
|
256 | 256 | self::$_event = $event; |
257 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
257 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
258 | 258 | self::$_event = $event->EE_Event; |
259 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
260 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
259 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
260 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
261 | 261 | self::$_event = $event->EE_Event; |
262 | 262 | } else { |
263 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
264 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
265 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
263 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
264 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
265 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
266 | 266 | return false; |
267 | 267 | } |
268 | 268 | return true; |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | * @param bool $view_details |
282 | 282 | * @return string |
283 | 283 | */ |
284 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
284 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
285 | 285 | // reset filter for displaying submit button |
286 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
286 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
287 | 287 | // poke and prod incoming event till it tells us what it is |
288 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
288 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
289 | 289 | return false; |
290 | 290 | } |
291 | 291 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | && ( |
297 | 297 | ! self::$_event->display_ticket_selector() |
298 | 298 | || $view_details |
299 | - || post_password_required( $event_post ) |
|
299 | + || post_password_required($event_post) |
|
300 | 300 | || ( |
301 | 301 | $_event_active_status != EE_Datetime::active |
302 | 302 | && $_event_active_status != EE_Datetime::upcoming |
@@ -314,34 +314,34 @@ discard block |
||
314 | 314 | $template_args = array(); |
315 | 315 | $template_args['event_status'] = $_event_active_status; |
316 | 316 | |
317 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
318 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
317 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
318 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
319 | 319 | |
320 | 320 | $template_args['EVT_ID'] = self::$_event->ID(); |
321 | 321 | $template_args['event'] = self::$_event; |
322 | 322 | |
323 | 323 | // is the event expired ? |
324 | 324 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
325 | - if ( $template_args['event_is_expired'] ) { |
|
326 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
325 | + if ($template_args['event_is_expired']) { |
|
326 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | $ticket_query_args = array( |
330 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
331 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
330 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
331 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
332 | 332 | ); |
333 | 333 | |
334 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
334 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
335 | 335 | //use the correct applicable time query depending on what version of core is being run. |
336 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
337 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
336 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
337 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | // get all tickets for this event ordered by the datetime |
341 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
341 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
342 | 342 | |
343 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
344 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
343 | + if (count($template_args['tickets']) < 1) { |
|
344 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
@@ -350,36 +350,36 @@ discard block |
||
350 | 350 | self::$_event->additional_limit() |
351 | 351 | ); |
352 | 352 | $template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz; |
353 | - if ( $template_args['max_atndz'] < 1 ) { |
|
354 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
355 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
356 | - $sales_closed_msg .= sprintf( |
|
357 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
353 | + if ($template_args['max_atndz'] < 1) { |
|
354 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
355 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
356 | + $sales_closed_msg .= sprintf( |
|
357 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
358 | 358 | '<div class="ee-attention" style="text-align: left;"><b>', |
359 | 359 | '</b><br />', |
360 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
360 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
361 | 361 | '</a></span></div>' |
362 | 362 | ); |
363 | 363 | } |
364 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
364 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
365 | 365 | } |
366 | 366 | |
367 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
368 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
367 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
368 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
369 | 369 | |
370 | 370 | // redirecting to another site for registration ?? |
371 | 371 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
372 | 372 | // set up the form (but not for the admin) |
373 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
373 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
374 | 374 | // if not redirecting to another site for registration |
375 | - if ( ! $external_url ) { |
|
375 | + if ( ! $external_url) { |
|
376 | 376 | // then display the ticket selector |
377 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
377 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
378 | 378 | } else { |
379 | 379 | // if not we still need to trigger the display of the submit button |
380 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
380 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
381 | 381 | //display notice to admin that registration is external |
382 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
382 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
383 | 383 | } |
384 | 384 | // submit button and form close tag |
385 | 385 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -399,25 +399,25 @@ discard block |
||
399 | 399 | * @param string $external_url |
400 | 400 | * @return string |
401 | 401 | */ |
402 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
402 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
403 | 403 | // if redirecting, we don't need any anything else |
404 | - if ( $external_url ) { |
|
405 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
406 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
407 | - foreach ( $query_args as $query_arg => $value ) { |
|
408 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
404 | + if ($external_url) { |
|
405 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
406 | + $query_args = EEH_URL::get_query_string($external_url); |
|
407 | + foreach ($query_args as $query_arg => $value) { |
|
408 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
409 | 409 | } |
410 | 410 | return $html; |
411 | 411 | } |
412 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
413 | - if ( ! $checkout_url ) { |
|
414 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
413 | + if ( ! $checkout_url) { |
|
414 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | } |
416 | 416 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
417 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
418 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
417 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
418 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
419 | 419 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
420 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
420 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
421 | 421 | return $html; |
422 | 422 | } |
423 | 423 | |
@@ -432,18 +432,18 @@ discard block |
||
432 | 432 | * @return string |
433 | 433 | */ |
434 | 434 | public static function display_ticket_selector_submit() { |
435 | - if ( ! is_admin() ) { |
|
436 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
435 | + if ( ! is_admin()) { |
|
436 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
437 | 437 | $btn_text = apply_filters( |
438 | 438 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
439 | - __('Register Now', 'event_espresso' ), |
|
439 | + __('Register Now', 'event_espresso'), |
|
440 | 440 | EED_Ticket_Selector::$_event |
441 | 441 | ); |
442 | 442 | $external_url = EED_Ticket_Selector::$_event->external_url(); |
443 | - $html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"'; |
|
443 | + $html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"'; |
|
444 | 444 | $html .= ' class="ticket-selector-submit-btn '; |
445 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
446 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
445 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
446 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
447 | 447 | $html .= apply_filters( |
448 | 448 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
449 | 449 | '', |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | ); |
452 | 452 | $html .= '<div class="clear"><br/></div></form>'; |
453 | 453 | return $html; |
454 | - } else if ( is_archive() ) { |
|
455 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
454 | + } else if (is_archive()) { |
|
455 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
456 | 456 | } else if ( |
457 | 457 | EED_Ticket_Selector::$_event instanceof EE_Event |
458 | 458 | // if $_max_atndz === 1 (ie: a "Dude Where's my Ticket Selector?" type event) |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $html = apply_filters( |
465 | 465 | 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', |
466 | 466 | sprintf( |
467 | - __( '%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso' ), |
|
467 | + __('%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso'), |
|
468 | 468 | '<p class="no-ticket-selector-msg important-notice">', |
469 | 469 | EED_Ticket_Selector::$_event->name(), |
470 | 470 | '</p>' |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | ); |
474 | 474 | $html .= '<div class="clear"></div></form>'; |
475 | 475 | return $html; |
476 | - } else if ( EE_Registry::instance()->SSN->cart() instanceof EE_Cart ) { |
|
477 | - if ( ! EE_Registry::instance()->SSN->cart()->all_ticket_quantity_count() ) { |
|
476 | + } else if (EE_Registry::instance()->SSN->cart() instanceof EE_Cart) { |
|
477 | + if ( ! EE_Registry::instance()->SSN->cart()->all_ticket_quantity_count()) { |
|
478 | 478 | return ''; |
479 | 479 | } |
480 | 480 | return EED_Ticket_Selector::display_proceed_btn_when_tickets_in_cart(); |
@@ -504,12 +504,12 @@ discard block |
||
504 | 504 | $html .= '">'; |
505 | 505 | $html .= apply_filters( |
506 | 506 | 'FHEE__EED_Ticket_Selector__proceed_to_registration_btn_txt', |
507 | - __( 'Proceed to Registration', 'event_espresso' ) |
|
507 | + __('Proceed to Registration', 'event_espresso') |
|
508 | 508 | ); |
509 | 509 | $html .= ' <span class="dashicons dashicons-arrow-right-alt2"></span>'; |
510 | 510 | $html .= '</a>'; |
511 | 511 | $html .= '<div class="clear"></div>'; |
512 | - $cancel_url = EEH_Event_View::event_link_url( self::$_event->ID() ); |
|
512 | + $cancel_url = EEH_Event_View::event_link_url(self::$_event->ID()); |
|
513 | 513 | $cancel_url = add_query_arg( |
514 | 514 | array( |
515 | 515 | 'ee' => 'cancel_ticket_selections', |
@@ -518,11 +518,11 @@ discard block |
||
518 | 518 | ), |
519 | 519 | $cancel_url |
520 | 520 | ); |
521 | - $cancel_url = wp_nonce_url( $cancel_url, 'cancel_ticket_selections', 'cancel_ticket_selections_nonce' ); |
|
522 | - $html .= '<a class="ticket-selector-submit-btn small-text" href="' . $cancel_url . '">'; |
|
521 | + $cancel_url = wp_nonce_url($cancel_url, 'cancel_ticket_selections', 'cancel_ticket_selections_nonce'); |
|
522 | + $html .= '<a class="ticket-selector-submit-btn small-text" href="'.$cancel_url.'">'; |
|
523 | 523 | $html .= apply_filters( |
524 | 524 | 'FHEE__EED_Ticket_Selector__cancel_ticket_selections_txt', |
525 | - __( 'cancel ticket selection', 'event_espresso' ) |
|
525 | + __('cancel ticket selection', 'event_espresso') |
|
526 | 526 | ); |
527 | 527 | $html .= '</a>'; |
528 | 528 | $html .= '<div class="clear"><br/></div>'; |
@@ -555,8 +555,8 @@ discard block |
||
555 | 555 | * @return string |
556 | 556 | */ |
557 | 557 | public static function display_view_details_btn() { |
558 | - if ( ! self::$_event->get_permalink() ) { |
|
559 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
558 | + if ( ! self::$_event->get_permalink()) { |
|
559 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
560 | 560 | } |
561 | 561 | $view_details_btn = '<form method="POST" action="'; |
562 | 562 | $view_details_btn .= apply_filters( |
@@ -565,9 +565,9 @@ discard block |
||
565 | 565 | self::$_event |
566 | 566 | ); |
567 | 567 | $view_details_btn .= '">'; |
568 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
569 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
570 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
568 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
569 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
570 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
571 | 571 | $view_details_btn .= '<div class="clear"><br/></div>'; |
572 | 572 | $view_details_btn .= '</form>'; |
573 | 573 | return $view_details_btn; |
@@ -584,19 +584,19 @@ discard block |
||
584 | 584 | */ |
585 | 585 | public static function cancel_ticket_selections() { |
586 | 586 | // check nonce |
587 | - if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'cancel_ticket_selections_nonce' ) ) { |
|
587 | + if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('cancel_ticket_selections_nonce')) { |
|
588 | 588 | return false; |
589 | 589 | } |
590 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__ ); |
|
591 | - if ( EE_Registry::instance()->REQ->is_set( 'event_id' ) ) { |
|
590 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
591 | + if (EE_Registry::instance()->REQ->is_set('event_id')) { |
|
592 | 592 | wp_safe_redirect( |
593 | 593 | EEH_Event_View::event_link_url( |
594 | - EE_Registry::instance()->REQ->get( 'event_id' ) |
|
594 | + EE_Registry::instance()->REQ->get('event_id') |
|
595 | 595 | ) |
596 | 596 | ); |
597 | 597 | } else { |
598 | 598 | wp_safe_redirect( |
599 | - site_url( '/' . EE_Registry::instance()->CFG->core->event_cpt_slug . '/' ) |
|
599 | + site_url('/'.EE_Registry::instance()->CFG->core->event_cpt_slug.'/') |
|
600 | 600 | ); |
601 | 601 | } |
602 | 602 | die(); |
@@ -611,15 +611,15 @@ discard block |
||
611 | 611 | * @param string $nonce_name |
612 | 612 | * @return bool |
613 | 613 | */ |
614 | - public static function process_ticket_selector_nonce( $nonce_name ) { |
|
614 | + public static function process_ticket_selector_nonce($nonce_name) { |
|
615 | 615 | if ( |
616 | 616 | ! is_admin() |
617 | 617 | && ( |
618 | - ! EE_Registry::instance()->REQ->is_set( $nonce_name ) |
|
618 | + ! EE_Registry::instance()->REQ->is_set($nonce_name) |
|
619 | 619 | || |
620 | 620 | ! wp_verify_nonce( |
621 | - EE_Registry::instance()->REQ->get( $nonce_name ), |
|
622 | - str_replace( '_nonce', '', $nonce_name ) |
|
621 | + EE_Registry::instance()->REQ->get($nonce_name), |
|
622 | + str_replace('_nonce', '', $nonce_name) |
|
623 | 623 | ) |
624 | 624 | ) |
625 | 625 | ) { |
@@ -649,9 +649,9 @@ discard block |
||
649 | 649 | * @return array|boolean |
650 | 650 | */ |
651 | 651 | public function process_ticket_selections() { |
652 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
652 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
653 | 653 | // check nonce |
654 | - if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'process_ticket_selections_nonce' ) ) { |
|
654 | + if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('process_ticket_selections_nonce')) { |
|
655 | 655 | return false; |
656 | 656 | } |
657 | 657 | |
@@ -661,58 +661,58 @@ discard block |
||
661 | 661 | ); |
662 | 662 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
663 | 663 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
664 | - EE_Registry::instance()->load_core( 'Session' ); |
|
664 | + EE_Registry::instance()->load_core('Session'); |
|
665 | 665 | // unless otherwise requested, clear the session |
666 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
667 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
666 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
667 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
668 | 668 | } |
669 | 669 | //d( EE_Registry::instance()->SSN ); |
670 | 670 | |
671 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
671 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
672 | 672 | // do we have an event id? |
673 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
673 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
674 | 674 | // validate/sanitize data |
675 | 675 | $valid = self::_validate_post_data(); |
676 | 676 | //check total tickets ordered vs max number of attendees that can register |
677 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
677 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
678 | 678 | |
679 | 679 | // ordering too many tickets !!! |
680 | 680 | $total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso'); |
681 | - $limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] ); |
|
681 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
682 | 682 | // dev only message |
683 | 683 | $max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso'); |
684 | - $limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] ); |
|
685 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
684 | + $limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']); |
|
685 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
686 | 686 | } else { |
687 | 687 | |
688 | 688 | // all data appears to be valid |
689 | 689 | $tckts_slctd = false; |
690 | 690 | $tickets_added = 0; |
691 | 691 | // validate/sanitize data |
692 | - $valid = apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid ); |
|
693 | - if ( $valid[ 'total_tickets' ] >0 ) { |
|
692 | + $valid = apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid); |
|
693 | + if ($valid['total_tickets'] > 0) { |
|
694 | 694 | // load cart |
695 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
695 | + EE_Registry::instance()->load_core('Cart'); |
|
696 | 696 | |
697 | 697 | // cycle thru the number of data rows sent from the event listing |
698 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
698 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
699 | 699 | // does this row actually contain a ticket quantity? |
700 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
700 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
701 | 701 | // YES we have a ticket quantity |
702 | 702 | $tckts_slctd = TRUE; |
703 | 703 | // d( $valid['ticket_obj'][$x] ); |
704 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
704 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
705 | 705 | // then add ticket to cart |
706 | - $tickets_added += self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
706 | + $tickets_added += self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
707 | 707 | //echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
708 | 708 | //echo "\n . ticket_added: " . $ticket_added . '<br />'; |
709 | - if ( EE_Error::has_error() ) { |
|
709 | + if (EE_Error::has_error()) { |
|
710 | 710 | break; |
711 | 711 | } |
712 | 712 | } else { |
713 | 713 | // nothing added to cart retrieved |
714 | 714 | EE_Error::add_error( |
715 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
715 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
716 | 716 | __FILE__, __FUNCTION__, __LINE__ |
717 | 717 | ); |
718 | 718 | } |
@@ -727,24 +727,24 @@ discard block |
||
727 | 727 | //d( EE_Registry::instance()->CART ); |
728 | 728 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
729 | 729 | |
730 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd ) ) { |
|
731 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added ) ) { |
|
730 | + if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd)) { |
|
731 | + if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) { |
|
732 | 732 | do_action( |
733 | 733 | 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', |
734 | 734 | EE_Registry::instance()->CART, |
735 | 735 | $this |
736 | 736 | ); |
737 | 737 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
738 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
738 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
739 | 739 | EE_Registry::instance()->SSN->update(); |
740 | 740 | //d( EE_Registry::instance()->CART ); |
741 | 741 | // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
742 | 742 | // just return TRUE for registrations being made from admin |
743 | - if ( is_admin() ) { |
|
743 | + if (is_admin()) { |
|
744 | 744 | return TRUE; |
745 | 745 | } |
746 | 746 | |
747 | - EE_Error::get_notices( false, true ); |
|
747 | + EE_Error::get_notices(false, true); |
|
748 | 748 | wp_safe_redirect( |
749 | 749 | apply_filters( |
750 | 750 | 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', |
@@ -754,10 +754,10 @@ discard block |
||
754 | 754 | exit(); |
755 | 755 | |
756 | 756 | } else { |
757 | - if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention') ) { |
|
757 | + if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) { |
|
758 | 758 | // nothing added to cart |
759 | 759 | EE_Error::add_attention( |
760 | - __( 'No tickets were added for the event.', 'event_espresso' ), |
|
760 | + __('No tickets were added for the event.', 'event_espresso'), |
|
761 | 761 | __FILE__, __FUNCTION__, __LINE__ |
762 | 762 | ); |
763 | 763 | } |
@@ -765,21 +765,21 @@ discard block |
||
765 | 765 | |
766 | 766 | } else { |
767 | 767 | // no ticket quantities were selected |
768 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
768 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
769 | 769 | } |
770 | 770 | } |
771 | 771 | // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
772 | 772 | // at this point, just return if registration is being made from admin |
773 | - if ( is_admin() ) { |
|
773 | + if (is_admin()) { |
|
774 | 774 | return FALSE; |
775 | 775 | } |
776 | - if ( $valid['return_url'] ) { |
|
777 | - EE_Error::get_notices( FALSE, TRUE ); |
|
778 | - wp_safe_redirect( $valid['return_url'] ); |
|
776 | + if ($valid['return_url']) { |
|
777 | + EE_Error::get_notices(FALSE, TRUE); |
|
778 | + wp_safe_redirect($valid['return_url']); |
|
779 | 779 | exit(); |
780 | - } elseif ( isset( $event_to_add['id'] )) { |
|
781 | - EE_Error::get_notices( FALSE, TRUE ); |
|
782 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
780 | + } elseif (isset($event_to_add['id'])) { |
|
781 | + EE_Error::get_notices(FALSE, TRUE); |
|
782 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
783 | 783 | exit(); |
784 | 784 | } else { |
785 | 785 | echo EE_Error::get_notices(); |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | } else { |
789 | 789 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
790 | 790 | EE_Error::add_error( |
791 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
791 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
792 | 792 | __FILE__, __FUNCTION__, __LINE__ |
793 | 793 | ); |
794 | 794 | } |
@@ -806,18 +806,18 @@ discard block |
||
806 | 806 | * @return array or FALSE |
807 | 807 | */ |
808 | 808 | private static function _validate_post_data() { |
809 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
809 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
810 | 810 | |
811 | 811 | // start with an empty array() |
812 | 812 | $valid_data = array(); |
813 | 813 | // d( $_POST ); |
814 | 814 | //if event id is valid |
815 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
816 | - if ( $id ) { |
|
815 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
816 | + if ($id) { |
|
817 | 817 | // grab valid id |
818 | 818 | $valid_data['id'] = $id; |
819 | 819 | // grab and sanitize return-url |
820 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
820 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
821 | 821 | // array of other form names |
822 | 822 | $inputs_to_clean = array( |
823 | 823 | 'event_id' => 'tkt-slctr-event-id', |
@@ -830,22 +830,22 @@ discard block |
||
830 | 830 | // let's track the total number of tickets ordered.' |
831 | 831 | $valid_data['total_tickets'] = 0; |
832 | 832 | // cycle through $inputs_to_clean array |
833 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
833 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
834 | 834 | // check for POST data |
835 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
835 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
836 | 836 | // grab value |
837 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
837 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
838 | 838 | switch ($what) { |
839 | 839 | |
840 | 840 | // integers |
841 | 841 | case 'event_id': |
842 | - $valid_data[$what] = absint( $input_value ); |
|
842 | + $valid_data[$what] = absint($input_value); |
|
843 | 843 | // get event via the event id we put in the form |
844 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
844 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
845 | 845 | break; |
846 | 846 | case 'rows': |
847 | 847 | case 'max_atndz': |
848 | - $valid_data[$what] = absint( $input_value ); |
|
848 | + $valid_data[$what] = absint($input_value); |
|
849 | 849 | break; |
850 | 850 | |
851 | 851 | // arrays of integers |
@@ -853,27 +853,27 @@ discard block |
||
853 | 853 | // d( $input_value ); |
854 | 854 | $row_qty = $input_value; |
855 | 855 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
856 | - if( ! is_array( $row_qty )) { |
|
856 | + if ( ! is_array($row_qty)) { |
|
857 | 857 | // get number of rows |
858 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
858 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
859 | 859 | // d( $rows ); |
860 | 860 | // explode ints by the dash |
861 | - $row_qty = explode( '-', $row_qty ); |
|
862 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
863 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
864 | - $row_qty = array( $row => $qty ); |
|
861 | + $row_qty = explode('-', $row_qty); |
|
862 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
863 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
864 | + $row_qty = array($row => $qty); |
|
865 | 865 | // d( $row_qty ); |
866 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
867 | - if ( ! isset( $row_qty[$x] )) { |
|
866 | + for ($x = 1; $x <= $rows; $x++) { |
|
867 | + if ( ! isset($row_qty[$x])) { |
|
868 | 868 | $row_qty[$x] = 0; |
869 | 869 | } |
870 | 870 | } |
871 | 871 | } |
872 | - ksort( $row_qty ); |
|
872 | + ksort($row_qty); |
|
873 | 873 | // d( $row_qty ); |
874 | 874 | // cycle thru values |
875 | - foreach ( $row_qty as $qty ) { |
|
876 | - $qty = absint( $qty ); |
|
875 | + foreach ($row_qty as $qty) { |
|
876 | + $qty = absint($qty); |
|
877 | 877 | // sanitize as integers |
878 | 878 | $valid_data[$what][] = $qty; |
879 | 879 | $valid_data['total_tickets'] += $qty; |
@@ -884,19 +884,19 @@ discard block |
||
884 | 884 | case 'ticket_id': |
885 | 885 | $value_array = array(); |
886 | 886 | // cycle thru values |
887 | - foreach ( $input_value as $key=>$value ) { |
|
887 | + foreach ($input_value as $key=>$value) { |
|
888 | 888 | // allow only numbers, letters, spaces, commas and dashes |
889 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
889 | + $value_array[$key] = wp_strip_all_tags($value); |
|
890 | 890 | // get ticket via the ticket id we put in the form |
891 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
892 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
891 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
892 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
893 | 893 | } |
894 | - $valid_data[ $what ] = $value_array; |
|
894 | + $valid_data[$what] = $value_array; |
|
895 | 895 | break; |
896 | 896 | |
897 | 897 | case 'return_url' : |
898 | 898 | // grab and sanitize return-url |
899 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
899 | + $valid_data[$what] = esc_url_raw($input_value); |
|
900 | 900 | break; |
901 | 901 | |
902 | 902 | } // end switch $what |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | } // end foreach $inputs_to_clean |
905 | 905 | |
906 | 906 | } else { |
907 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
907 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
908 | 908 | return FALSE; |
909 | 909 | } |
910 | 910 | |
@@ -922,18 +922,18 @@ discard block |
||
922 | 922 | * @param int $qty |
923 | 923 | * @return int quantity of tickets added |
924 | 924 | */ |
925 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
926 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
925 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
926 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
927 | 927 | // get the number of spaces left for this datetime ticket |
928 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
928 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
929 | 929 | if (self::debug) { |
930 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()"; |
|
931 | - echo "<br /> . ticket->ID(): " . $ticket->ID(); |
|
932 | - echo "<br /> . requested qty: " . $qty; |
|
933 | - echo "<br /> . available_spaces: " . $available_spaces; |
|
930 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."()"; |
|
931 | + echo "<br /> . ticket->ID(): ".$ticket->ID(); |
|
932 | + echo "<br /> . requested qty: ".$qty; |
|
933 | + echo "<br /> . available_spaces: ".$available_spaces; |
|
934 | 934 | } |
935 | 935 | // compare available spaces against the number of tickets being purchased |
936 | - if ( $available_spaces >= $qty ) { |
|
936 | + if ($available_spaces >= $qty) { |
|
937 | 937 | // allow addons to prevent a ticket from being added to cart |
938 | 938 | if ( |
939 | 939 | ! apply_filters( |
@@ -946,10 +946,10 @@ discard block |
||
946 | 946 | ) { |
947 | 947 | return 0; |
948 | 948 | } |
949 | - $qty = apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket ); |
|
949 | + $qty = apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket); |
|
950 | 950 | // add event to cart |
951 | - if( $qty && EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
952 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
951 | + if ($qty && EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
952 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
953 | 953 | return $qty; |
954 | 954 | } else { |
955 | 955 | return 0; |
@@ -957,9 +957,9 @@ discard block |
||
957 | 957 | } else { |
958 | 958 | // tickets can not be purchased but let's find the exact number left |
959 | 959 | // for the last ticket selected PRIOR to subtracting tickets |
960 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
960 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
961 | 961 | // greedy greedy greedy eh? |
962 | - if ( $available_spaces > 0 ) { |
|
962 | + if ($available_spaces > 0) { |
|
963 | 963 | if ( |
964 | 964 | apply_filters( |
965 | 965 | 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error', |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | $available_spaces |
970 | 970 | ) |
971 | 971 | ) { |
972 | - EED_Ticket_Selector::_display_availability_error( $available_spaces ); |
|
972 | + EED_Ticket_Selector::_display_availability_error($available_spaces); |
|
973 | 973 | } |
974 | 974 | } else { |
975 | 975 | EE_Error::add_error( |
@@ -994,10 +994,10 @@ discard block |
||
994 | 994 | * @access private |
995 | 995 | * @param int $available_spaces |
996 | 996 | */ |
997 | - private static function _display_availability_error( $available_spaces = 1 ) { |
|
997 | + private static function _display_availability_error($available_spaces = 1) { |
|
998 | 998 | // add error messaging - we're using the _n function that will generate |
999 | 999 | // the appropriate singular or plural message based on the number of $available_spaces |
1000 | - if ( EE_Registry::instance()->CART->all_ticket_quantity_count() ) { |
|
1000 | + if (EE_Registry::instance()->CART->all_ticket_quantity_count()) { |
|
1001 | 1001 | $msg = sprintf( |
1002 | 1002 | _n( |
1003 | 1003 | 'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.', |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | '<br />' |
1021 | 1021 | ); |
1022 | 1022 | } |
1023 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1023 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | |
@@ -1035,22 +1035,22 @@ discard block |
||
1035 | 1035 | * @param bool $get_original_ticket_spaces |
1036 | 1036 | * @return int |
1037 | 1037 | */ |
1038 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
1038 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
1039 | 1039 | // if the $_available_spaces array has not been set up yet... |
1040 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
1041 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
1040 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
1041 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
1042 | 1042 | } |
1043 | 1043 | $available_spaces = $ticket->qty() - $ticket->sold(); |
1044 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
1044 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
1045 | 1045 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
1046 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
1046 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
1047 | 1047 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
1048 | - if ( $get_original_ticket_spaces ) { |
|
1048 | + if ($get_original_ticket_spaces) { |
|
1049 | 1049 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
1050 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
1050 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
1051 | 1051 | } else { |
1052 | 1052 | // we want the updated ticket availability as stored in the "datetimes" array |
1053 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
1053 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
1054 | 1054 | } |
1055 | 1055 | } |
1056 | 1056 | } |
@@ -1066,23 +1066,23 @@ discard block |
||
1066 | 1066 | * @param EE_Ticket $ticket |
1067 | 1067 | * @return int |
1068 | 1068 | */ |
1069 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
1069 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
1070 | 1070 | // first, get all of the datetimes that are available to this ticket |
1071 | 1071 | $datetimes = $ticket->get_many_related( |
1072 | 1072 | 'Datetime', |
1073 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
1073 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
1074 | 1074 | ); |
1075 | - if ( ! empty( $datetimes )) { |
|
1075 | + if ( ! empty($datetimes)) { |
|
1076 | 1076 | // now loop thru all of the datetimes |
1077 | - foreach ( $datetimes as $datetime ) { |
|
1078 | - if ( $datetime instanceof EE_Datetime ) { |
|
1077 | + foreach ($datetimes as $datetime) { |
|
1078 | + if ($datetime instanceof EE_Datetime) { |
|
1079 | 1079 | // the number of spaces available for the datetime without considering individual ticket quantities |
1080 | 1080 | $spaces_remaining = $datetime->spaces_remaining(); |
1081 | 1081 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
1082 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
1082 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
1083 | 1083 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
1084 | 1084 | // else just take the datetime spaces remaining, and assign to the datetimes array |
1085 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
1085 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
1086 | 1086 | } |
1087 | 1087 | } |
1088 | 1088 | } |
@@ -1098,12 +1098,12 @@ discard block |
||
1098 | 1098 | * @param int $qty |
1099 | 1099 | * @return int |
1100 | 1100 | */ |
1101 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
1102 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
1101 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
1102 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
1103 | 1103 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
1104 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
1104 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
1105 | 1105 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
1106 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
1106 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
1107 | 1107 | } |
1108 | 1108 | } |
1109 | 1109 | } |
@@ -1120,8 +1120,8 @@ discard block |
||
1120 | 1120 | */ |
1121 | 1121 | public static function load_tckt_slctr_assets() { |
1122 | 1122 | // add some style |
1123 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
1124 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
1123 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
1124 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
1125 | 1125 | wp_enqueue_style('ticket_selector'); |
1126 | 1126 | // make it dance |
1127 | 1127 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -1135,9 +1135,9 @@ discard block |
||
1135 | 1135 | |
1136 | 1136 | public static function load_tckt_slctr_assets_admin() { |
1137 | 1137 | //iframe button js on admin event editor page |
1138 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
1139 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
1140 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
1138 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
1139 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1140 | + wp_enqueue_script('ticket_selector_embed'); |
|
1141 | 1141 | } |
1142 | 1142 | } |
1143 | 1143 |
@@ -8,31 +8,31 @@ discard block |
||
8 | 8 | |
9 | 9 | $row = 1; |
10 | 10 | $max = 1; |
11 | -$ticket_count = count( $tickets ); |
|
11 | +$ticket_count = count($tickets); |
|
12 | 12 | |
13 | -if ( ! $ticket_count ) { |
|
13 | +if ( ! $ticket_count) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | $required_ticket_sold_out = FALSE; |
18 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
18 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
19 | 19 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
20 | 20 | : new EE_Ticket_Selector_Config(); |
21 | 21 | |
22 | 22 | ob_start(); |
23 | 23 | |
24 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
25 | - if ( $ticket instanceof EE_Ticket ) { |
|
26 | - $remaining = max( $ticket->remaining(), 0 ); |
|
24 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
25 | + if ($ticket instanceof EE_Ticket) { |
|
26 | + $remaining = max($ticket->remaining(), 0); |
|
27 | 27 | // max tickets or $max_atndz, whichever is smaller |
28 | - $max = min( $ticket->max(), $max_atndz );; |
|
28 | + $max = min($ticket->max(), $max_atndz); ; |
|
29 | 29 | // offer the number of $tickets_remaining or $max, whichever is smaller |
30 | - $max = min( $remaining, $max ); |
|
30 | + $max = min($remaining, $max); |
|
31 | 31 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
32 | 32 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
33 | 33 | // and if the ticket is required, then make sure that min qty is at least 1 |
34 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
35 | - if ( ! $ticket->is_on_sale() || $remaining < $min ) { |
|
34 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
35 | + if ( ! $ticket->is_on_sale() || $remaining < $min) { |
|
36 | 36 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
37 | 37 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
38 | 38 | } |
@@ -40,42 +40,42 @@ discard block |
||
40 | 40 | $ticket_price = $ticket->get_ticket_total_with_taxes(); |
41 | 41 | $ticket_bundle = FALSE; |
42 | 42 | // for ticket bundles, set min and max qty the same |
43 | - if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) { |
|
43 | + if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) { |
|
44 | 44 | $ticket_price = $ticket_price * $ticket->min(); |
45 | 45 | $ticket_bundle = TRUE; |
46 | 46 | } |
47 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
47 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
48 | 48 | $is_remaining = $remaining > 0 ? true : false; |
49 | 49 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
50 | 50 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
51 | - $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status( false, $is_remaining ); |
|
51 | + $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(false, $is_remaining); |
|
52 | 52 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
53 | 53 | // check ticket status |
54 | - switch ( $tkt_status ) { |
|
54 | + switch ($tkt_status) { |
|
55 | 55 | // sold_out |
56 | 56 | case EE_Ticket::sold_out : |
57 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE, $is_remaining ) . '</span>'; |
|
57 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE, $is_remaining).'</span>'; |
|
58 | 58 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
59 | 59 | break; |
60 | 60 | // expired |
61 | 61 | case EE_Ticket::expired : |
62 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
62 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
63 | 63 | $status_class = 'ticket-sales-expired lt-grey-text'; |
64 | 64 | break; |
65 | 65 | // archived |
66 | 66 | case EE_Ticket::archived : |
67 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
67 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
68 | 68 | $status_class = 'archived-ticket hidden'; |
69 | 69 | break; |
70 | 70 | // pending |
71 | 71 | case EE_Ticket::pending : |
72 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
72 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
73 | 73 | $status_class = 'ticket-pending'; |
74 | 74 | break; |
75 | 75 | // onsale |
76 | 76 | case EE_Ticket::onsale : |
77 | 77 | default : |
78 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
78 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
79 | 79 | $status_class = 'ticket-on-sale'; |
80 | 80 | break; |
81 | 81 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
116 | 116 | ); |
117 | 117 | ?> |
118 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
118 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
119 | 119 | <?php |
120 | 120 | /** |
121 | 121 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @var string|bool |
129 | 129 | */ |
130 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
130 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
131 | 131 | echo $new_row_cells_content; |
132 | 132 | echo '</tr>'; |
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | ?> |
136 | 136 | <td class="tckt-slctr-tbl-td-name"> |
137 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
138 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
139 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
140 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
137 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
138 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
139 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
140 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
141 | 141 | </a> |
142 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
143 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
142 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
143 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
144 | 144 | </a> |
145 | 145 | <?php endif; //end show details check ?> |
146 | - <?php if ( $ticket->required() ) { ?> |
|
147 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
146 | + <?php if ($ticket->required()) { ?> |
|
147 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
148 | 148 | <?php } ?> |
149 | 149 | <?php |
150 | 150 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -158,63 +158,63 @@ discard block |
||
158 | 158 | // echo '<br/><b> $ticket->required() : ' . $ticket->uses() . '</b>'; |
159 | 159 | ?> |
160 | 160 | </td> |
161 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
162 | - <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?> <span class="smaller-text no-bold"><?php |
|
163 | - if ( $ticket_bundle ) { |
|
164 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
161 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
162 | + <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?> <span class="smaller-text no-bold"><?php |
|
163 | + if ($ticket_bundle) { |
|
164 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
165 | 165 | } else { |
166 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
166 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
167 | 167 | }?></span> </td> |
168 | 168 | <?php } ?> |
169 | 169 | <td class="tckt-slctr-tbl-td-qty cntr"> |
170 | 170 | <?php |
171 | 171 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
172 | 172 | // sold out or other status ? |
173 | - if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) { |
|
173 | + if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) { |
|
174 | 174 | ?> |
175 | - <span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold Out', 'event_espresso' ));?></span> |
|
175 | + <span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold Out', 'event_espresso')); ?></span> |
|
176 | 176 | <?php |
177 | - } else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) { |
|
177 | + } else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) { |
|
178 | 178 | echo $ticket_status; |
179 | - } else if ( $tkt_status == EE_Ticket::pending ) { |
|
179 | + } else if ($tkt_status == EE_Ticket::pending) { |
|
180 | 180 | ?> |
181 | 181 | <div class="ticket-pending-pg"> |
182 | - <span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes On Sale', 'event_espresso' )); ?></span><br/> |
|
183 | - <span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span> |
|
182 | + <span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes On Sale', 'event_espresso')); ?></span><br/> |
|
183 | + <span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span> |
|
184 | 184 | </div> |
185 | 185 | <?php |
186 | 186 | // min qty purchasable is less than tickets available |
187 | - } else if ( $ticket->min() > $remaining ) { |
|
187 | + } else if ($ticket->min() > $remaining) { |
|
188 | 188 | ?> |
189 | 189 | <div class="archived-ticket-pg"> |
190 | - <span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/> |
|
190 | + <span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/> |
|
191 | 191 | </div> |
192 | 192 | <?php |
193 | 193 | // if only one attendee is allowed to register at a time |
194 | - } else if ( $max_atndz == 1 ) { |
|
194 | + } else if ($max_atndz == 1) { |
|
195 | 195 | // display submit button since we have tickets available |
196 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
196 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
197 | 197 | ?> |
198 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
198 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
199 | 199 | <?php |
200 | 200 | $hidden_input_qty = FALSE; |
201 | 201 | |
202 | - } else if ( $max_atndz == 0 ) { |
|
203 | - echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>'; |
|
204 | - } elseif ( $max > 0 ) { |
|
202 | + } else if ($max_atndz == 0) { |
|
203 | + echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>'; |
|
204 | + } elseif ($max > 0) { |
|
205 | 205 | // display submit button since we have tickets available |
206 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
206 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
207 | 207 | |
208 | 208 | ?> |
209 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
209 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
210 | 210 | <?php |
211 | 211 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
212 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
212 | + if ( ! $ticket->required() && $min !== 0) { |
|
213 | 213 | ?> |
214 | 214 | <option value="0"> 0 </option> |
215 | 215 | <?php } |
216 | 216 | // offer ticket quantities from the min to the max |
217 | - for ( $i = $min; $i <= $max; $i++) { |
|
217 | + for ($i = $min; $i <= $max; $i++) { |
|
218 | 218 | ?> |
219 | 219 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
220 | 220 | <?php } ?> |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | } |
226 | 226 | // depending on group reg we need to change the format for qty |
227 | - if ( $hidden_input_qty ) { |
|
227 | + if ($hidden_input_qty) { |
|
228 | 228 | ?> |
229 | 229 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
230 | 230 | <?php |
@@ -234,33 +234,33 @@ discard block |
||
234 | 234 | |
235 | 235 | </td> |
236 | 236 | </tr> |
237 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
238 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
237 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
238 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
239 | 239 | <td class="tckt-slctr-tkt-details-td" colspan="3" > |
240 | 240 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
241 | 241 | |
242 | 242 | <section class="tckt-slctr-tkt-details-sctn"> |
243 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
243 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
244 | 244 | <p><?php echo $ticket->description(); ?></p> |
245 | 245 | |
246 | - <?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
246 | + <?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
247 | 247 | <section class="tckt-slctr-tkt-price-sctn"> |
248 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
248 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
249 | 249 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
250 | 250 | <table class="tckt-slctr-tkt-details-tbl"> |
251 | 251 | <thead> |
252 | 252 | <tr> |
253 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
254 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
255 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
253 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
254 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
255 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
256 | 256 | </tr> |
257 | 257 | </thead> |
258 | 258 | <tbody> |
259 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
259 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
260 | 260 | <tr> |
261 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
262 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
263 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
261 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
262 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
263 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
264 | 264 | </tr> |
265 | 265 | <?php |
266 | 266 | $running_total = $ticket->base_price()->amount(); |
@@ -268,44 +268,44 @@ discard block |
||
268 | 268 | $running_total = 0; |
269 | 269 | } |
270 | 270 | // now add price modifiers |
271 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
271 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
272 | 272 | <tr> |
273 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
274 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
275 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
273 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
274 | + <?php if ($price_mod->is_percent()) { ?> |
|
275 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
276 | 276 | <?php |
277 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
277 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
278 | 278 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
279 | 279 | ?> |
280 | 280 | <?php } else { ?> |
281 | 281 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
282 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
282 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
283 | 283 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
284 | 284 | <?php } ?> |
285 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
285 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
286 | 286 | <?php $running_total += $new_sub_total; ?> |
287 | 287 | </tr> |
288 | 288 | <?php } ?> |
289 | - <?php if ( $ticket->taxable() ) { ?> |
|
289 | + <?php if ($ticket->taxable()) { ?> |
|
290 | 290 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
291 | 291 | <tr> |
292 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
293 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
292 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
293 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
294 | 294 | </tr> |
295 | 295 | |
296 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
296 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
297 | 297 | <tr> |
298 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
299 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
300 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
301 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
298 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
299 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
300 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
301 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
302 | 302 | <?php $running_total += $tax_amount; ?> |
303 | 303 | </tr> |
304 | 304 | <?php } ?> |
305 | 305 | <?php } ?> |
306 | 306 | <tr> |
307 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
308 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
307 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
308 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
309 | 309 | </tr> |
310 | 310 | </tbody> |
311 | 311 | </table> |
@@ -315,106 +315,106 @@ discard block |
||
315 | 315 | <?php } ?> |
316 | 316 | |
317 | 317 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
318 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
319 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
320 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
321 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
318 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
319 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
320 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
321 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
322 | 322 | </section> |
323 | 323 | <br/> |
324 | 324 | |
325 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
325 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
326 | 326 | |
327 | - <?php if ( $ticket->min() && $ticket->max() ) { ?> |
|
327 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
328 | 328 | <section class="tckt-slctr-tkt-quantities-sctn"> |
329 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
330 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
331 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
332 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
329 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
330 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
331 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
332 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
333 | 333 | <?php //$max = min( $max, $max_atndz );?> |
334 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
334 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
335 | 335 | </section> |
336 | 336 | <br/> |
337 | 337 | <?php } ?> |
338 | 338 | |
339 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
339 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
340 | 340 | <section class="tckt-slctr-tkt-uses-sctn"> |
341 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
341 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
342 | 342 | <span class="drk-grey-text small-text no-bold"> - <?php |
343 | 343 | echo apply_filters( |
344 | 344 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
345 | 345 | sprintf( |
346 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
346 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
347 | 347 | '<br/>', |
348 | 348 | '<strong>', |
349 | 349 | '</strong>' |
350 | 350 | ) |
351 | 351 | ); |
352 | 352 | ?></span><br/> |
353 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
353 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
354 | 354 | </section> |
355 | 355 | <?php } ?> |
356 | 356 | |
357 | 357 | <?php |
358 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
358 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
359 | 359 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
360 | - if ( ! empty( $datetimes )) { ?> |
|
360 | + if ( ! empty($datetimes)) { ?> |
|
361 | 361 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
362 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
363 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
362 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
363 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
364 | 364 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
365 | 365 | <table class="tckt-slctr-tkt-details-tbl"> |
366 | 366 | <thead> |
367 | 367 | <tr> |
368 | 368 | <th class="tckt-slctr-tkt-details-date-th"> |
369 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
369 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
370 | 370 | </th> |
371 | 371 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
372 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
372 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
373 | 373 | </th> |
374 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
374 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
375 | 375 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
376 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
376 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
377 | 377 | </th> |
378 | 378 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
379 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
379 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
380 | 380 | </th> |
381 | 381 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
382 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
382 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
383 | 383 | </th> |
384 | 384 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
385 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
385 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
386 | 386 | </th> |
387 | 387 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
388 | 388 | </tr> |
389 | 389 | </thead> |
390 | 390 | <tbody> |
391 | 391 | <?php |
392 | - foreach ( $datetimes as $datetime ) { |
|
393 | - if ( $datetime instanceof EE_Datetime ) { |
|
392 | + foreach ($datetimes as $datetime) { |
|
393 | + if ($datetime instanceof EE_Datetime) { |
|
394 | 394 | ?> |
395 | 395 | |
396 | 396 | <tr> |
397 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
397 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
398 | 398 | <?php $datetime_name = $datetime->name(); ?> |
399 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
400 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
399 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
400 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
401 | 401 | </td> |
402 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
403 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
402 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
403 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
404 | 404 | </td> |
405 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
406 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
405 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
406 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
407 | 407 | <?php echo $ticket->sold(); ?> |
408 | 408 | </td> |
409 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
410 | - <?php echo $remaining === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $remaining; ?> |
|
409 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
410 | + <?php echo $remaining === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $remaining; ?> |
|
411 | 411 | </td> |
412 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
412 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
413 | 413 | <?php echo $datetime->sold(); ?> |
414 | 414 | </td> |
415 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
416 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
417 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
415 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
416 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
417 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
418 | 418 | </td> |
419 | 419 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
420 | 420 | </tr> |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | </div> |
433 | 433 | </td> |
434 | 434 | </tr> |
435 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
435 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
436 | 436 | <?php |
437 | 437 | $row++; |
438 | 438 | } |
@@ -441,32 +441,32 @@ discard block |
||
441 | 441 | $ticket_row_html = ob_get_clean(); |
442 | 442 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
443 | 443 | $hide_ticket_selector = $ticket_count == 1 && $max_atndz == 1 && $ticket->is_free() ? true : false; |
444 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
444 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
445 | 445 | // EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
446 | 446 | // EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ ); |
447 | 447 | // EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ ); |
448 | 448 | //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ ); |
449 | 449 | remove_filter( |
450 | 450 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
451 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
451 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
452 | 452 | ); |
453 | 453 | remove_filter( |
454 | 454 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
455 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
455 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
456 | 456 | ); |
457 | -if ( ! $hide_ticket_selector ) { |
|
457 | +if ( ! $hide_ticket_selector) { |
|
458 | 458 | ?> |
459 | 459 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
460 | 460 | |
461 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
461 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
462 | 462 | |
463 | 463 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
464 | 464 | <thead> |
465 | 465 | <tr> |
466 | 466 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
467 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
467 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
468 | 468 | </th> |
469 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
469 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
470 | 470 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
471 | 471 | <?php |
472 | 472 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @param string 'Price' The translatable text to display in the table header for price |
478 | 478 | * @param int $EVT_ID The Event ID |
479 | 479 | */ |
480 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
480 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
481 | 481 | ?> |
482 | 482 | </th> |
483 | 483 | <?php } ?> |
@@ -491,24 +491,24 @@ discard block |
||
491 | 491 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
492 | 492 | * @param int $EVT_ID The Event ID |
493 | 493 | */ |
494 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
494 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
495 | 495 | ?> |
496 | 496 | </th> |
497 | 497 | </tr> |
498 | 498 | </thead> |
499 | 499 | <tbody> |
500 | - <?php echo $ticket_row_html;?> |
|
500 | + <?php echo $ticket_row_html; ?> |
|
501 | 501 | </tbody> |
502 | 502 | </table> |
503 | 503 | |
504 | 504 | <input type="hidden" name="noheader" value="true" /> |
505 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" /> |
|
505 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" /> |
|
506 | 506 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
507 | 507 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
508 | 508 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
509 | 509 | |
510 | 510 | <?php |
511 | - if ( $max_atndz > 0 && ! $hide_ticket_selector ) { |
|
511 | + if ($max_atndz > 0 && ! $hide_ticket_selector) { |
|
512 | 512 | echo apply_filters( |
513 | 513 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
514 | 514 | '' |
@@ -516,10 +516,10 @@ discard block |
||
516 | 516 | } |
517 | 517 | ?> |
518 | 518 | |
519 | - <?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?> |
|
519 | + <?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?> |
|
520 | 520 | |
521 | 521 | </div> |
522 | -<?php } else if ( isset( $TKT_ID ) ) { ?> |
|
522 | +<?php } else if (isset($TKT_ID)) { ?> |
|
523 | 523 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
524 | 524 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
525 | 525 | <input type="hidden" name="noheader" value="true"/> |
@@ -528,27 +528,27 @@ discard block |
||
528 | 528 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
529 | 529 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
530 | 530 | <?php |
531 | - if ( $ticket instanceof EE_Ticket ) { |
|
532 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
531 | + if ($ticket instanceof EE_Ticket) { |
|
532 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
533 | 533 | $ticket_description = $ticket->description(); |
534 | 534 | ?> |
535 | 535 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
536 | 536 | <div class="no-tkt-slctr-ticket-content-dv"> |
537 | 537 | <h5><?php echo $ticket->name(); ?></h5> |
538 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
538 | + <?php if ( ! empty($ticket_description)) { ?> |
|
539 | 539 | <p><?php echo $ticket_description; ?></p> |
540 | 540 | <?php } ?> |
541 | 541 | </div> |
542 | 542 | <?php |
543 | 543 | add_filter( |
544 | 544 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
545 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
545 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
546 | 546 | ); |
547 | 547 | add_filter( |
548 | 548 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
549 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
549 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
550 | 550 | ); |
551 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
551 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | */ |
44 | 44 | |
45 | -if ( function_exists( 'espresso_version' ) ) { |
|
45 | +if (function_exists('espresso_version')) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | function espresso_duplicate_plugin_error() { |
52 | 52 | ?> |
53 | 53 | <div class="error"> |
54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
55 | 55 | </div> |
56 | 56 | <?php |
57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
58 | 58 | } |
59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
@@ -67,103 +67,103 @@ discard block |
||
67 | 67 | * @return string |
68 | 68 | */ |
69 | 69 | function espresso_version() { |
70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.12.rc.004' ); |
|
70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.12.rc.004'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // define versions |
74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
79 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
80 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
79 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
80 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
81 | 81 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
82 | - if ( ! defined( 'DS' ) ) { |
|
83 | - define( 'DS', '/' ); |
|
82 | + if ( ! defined('DS')) { |
|
83 | + define('DS', '/'); |
|
84 | 84 | } |
85 | - if ( ! defined( 'PS' ) ) { |
|
86 | - define( 'PS', PATH_SEPARATOR ); |
|
85 | + if ( ! defined('PS')) { |
|
86 | + define('PS', PATH_SEPARATOR); |
|
87 | 87 | } |
88 | - if ( ! defined( 'SP' ) ) { |
|
89 | - define( 'SP', ' ' ); |
|
88 | + if ( ! defined('SP')) { |
|
89 | + define('SP', ' '); |
|
90 | 90 | } |
91 | - if ( ! defined( 'EENL' ) ) { |
|
92 | - define( 'EENL', "\n" ); |
|
91 | + if ( ! defined('EENL')) { |
|
92 | + define('EENL', "\n"); |
|
93 | 93 | } |
94 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
94 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
95 | 95 | // define the plugin directory and URL |
96 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
98 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
99 | 99 | // main root folder paths |
100 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
101 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
102 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
103 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
104 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
105 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
106 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
107 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
100 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
101 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
102 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
103 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
104 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
105 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
106 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
107 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
108 | 108 | // core system paths |
109 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
110 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
111 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
112 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
113 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
114 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
115 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
116 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
117 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
118 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
119 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
120 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
109 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
110 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
111 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
112 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
113 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
114 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
115 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
116 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
117 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
118 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
119 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
120 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
121 | 121 | // gateways |
122 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
123 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
122 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
123 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
124 | 124 | // asset URL paths |
125 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
126 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
127 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
128 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
129 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
130 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
125 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
126 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
127 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
128 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
129 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
130 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
131 | 131 | // define upload paths |
132 | 132 | $uploads = wp_upload_dir(); |
133 | 133 | // define the uploads directory and URL |
134 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
135 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
135 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
136 | 136 | // define the templates directory and URL |
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
138 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
138 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
139 | 139 | // define the gateway directory and URL |
140 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
141 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
142 | 142 | // languages folder/path |
143 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
144 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
143 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
144 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
145 | 145 | //check for dompdf fonts in uploads |
146 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
147 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
146 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
147 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
148 | 148 | } |
149 | 149 | //ajax constants |
150 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
151 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
150 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
151 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
152 | 152 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
153 | 153 | //you're better to use this than its straight value (currently -1) in case you ever |
154 | 154 | //want to change its default value! or find when -1 means infinity |
155 | - define( 'EE_INF_IN_DB', -1 ); |
|
156 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
157 | - define( 'EE_DEBUG', false ); |
|
155 | + define('EE_INF_IN_DB', -1); |
|
156 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
157 | + define('EE_DEBUG', false); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * espresso_plugin_activation |
161 | 161 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
162 | 162 | */ |
163 | 163 | function espresso_plugin_activation() { |
164 | - update_option( 'ee_espresso_activation', true ); |
|
164 | + update_option('ee_espresso_activation', true); |
|
165 | 165 | } |
166 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
166 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
167 | 167 | |
168 | 168 | |
169 | 169 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | // } |
178 | 178 | // |
179 | 179 | } |
180 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
180 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
181 | 181 | |
182 | 182 | |
183 | 183 | |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | */ |
188 | 188 | function espresso_load_error_handling() { |
189 | 189 | // load debugging tools |
190 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
191 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
190 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
191 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
192 | 192 | EEH_Debug_Tools::instance(); |
193 | 193 | } |
194 | 194 | // load error handling |
195 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
196 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
195 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
196 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
197 | 197 | } else { |
198 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
198 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -209,25 +209,25 @@ discard block |
||
209 | 209 | * @param string $full_path_to_file |
210 | 210 | * @throws EE_Error |
211 | 211 | */ |
212 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
212 | + function espresso_load_required($classname, $full_path_to_file) { |
|
213 | 213 | static $error_handling_loaded = false; |
214 | - if ( ! $error_handling_loaded ) { |
|
214 | + if ( ! $error_handling_loaded) { |
|
215 | 215 | espresso_load_error_handling(); |
216 | 216 | $error_handling_loaded = true; |
217 | 217 | } |
218 | - if ( is_readable( $full_path_to_file ) ) { |
|
219 | - require_once( $full_path_to_file ); |
|
218 | + if (is_readable($full_path_to_file)) { |
|
219 | + require_once($full_path_to_file); |
|
220 | 220 | } else { |
221 | - throw new EE_Error ( sprintf( |
|
222 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
221 | + throw new EE_Error(sprintf( |
|
222 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
223 | 223 | $classname |
224 | - ) ); |
|
224 | + )); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
229 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
230 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
228 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
229 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
230 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
231 | 231 | new EE_Bootstrap(); |
232 | 232 | |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | |
238 | 238 | |
239 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
239 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
240 | 240 | /** |
241 | 241 | * deactivate_plugin |
242 | 242 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
246 | 246 | * @return void |
247 | 247 | */ |
248 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
249 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
250 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
248 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
249 | + if ( ! function_exists('deactivate_plugins')) { |
|
250 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
251 | 251 | } |
252 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
253 | - deactivate_plugins( $plugin_basename ); |
|
252 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
253 | + deactivate_plugins($plugin_basename); |
|
254 | 254 | } |
255 | 255 | } |