@@ -864,8 +864,8 @@ |
||
864 | 864 | //set the attendee array to blank on each loop; |
865 | 865 | $aee = array(); |
866 | 866 | if ( isset( $this->_data->reg_obj ) |
867 | - && ( $this->_data->reg_obj->attendee_ID() != $att_id ) |
|
868 | - && $this->_single_message |
|
867 | + && ( $this->_data->reg_obj->attendee_ID() != $att_id ) |
|
868 | + && $this->_single_message |
|
869 | 869 | ) { |
870 | 870 | continue; |
871 | 871 | } |
@@ -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 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * EE_Base_Class_Object |
275 | 275 | * @return mixed ( EE_Base_Class||EE_Base_Class[] ) |
276 | 276 | */ |
277 | - abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id ); |
|
277 | + abstract protected function _get_data_for_context($context, EE_Registration $registration, $id); |
|
278 | 278 | |
279 | 279 | |
280 | 280 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @deprecated 4.9.0 |
302 | 302 | * @return int |
303 | 303 | */ |
304 | - protected function _get_id_for_msg_url( $context, EE_Registration $registration ) { |
|
304 | + protected function _get_id_for_msg_url($context, EE_Registration $registration) { |
|
305 | 305 | return 0; |
306 | 306 | } |
307 | 307 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * sending. |
331 | 331 | * @since 4.9.0 |
332 | 332 | */ |
333 | - public function do_messenger_hooks( $messenger = null ) { |
|
333 | + public function do_messenger_hooks($messenger = null) { |
|
334 | 334 | $this->_active_messenger = $messenger; |
335 | 335 | $this->_do_messenger_hooks(); |
336 | 336 | } |
@@ -379,10 +379,10 @@ discard block |
||
379 | 379 | * @param mixed $data This sets the data property for the message type with the incoming data used for generating. |
380 | 380 | * @return string (the reference for the data handler) (will be an empty string if could not be determined). |
381 | 381 | */ |
382 | - public function get_data_handler( $data ) { |
|
382 | + public function get_data_handler($data) { |
|
383 | 383 | $this->_data = $data; |
384 | 384 | $this->_set_data_handler(); |
385 | - return apply_filters( 'FHEE__EE_message_type__get_data_handler', $this->_data_handler, $this ); |
|
385 | + return apply_filters('FHEE__EE_message_type__get_data_handler', $this->_data_handler, $this); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -419,26 +419,26 @@ discard block |
||
419 | 419 | * @deprecated 4.9.0 Likely 4.9.10 or 4.10.0 will remove this method completely |
420 | 420 | * @return string generated url |
421 | 421 | */ |
422 | - public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) { |
|
422 | + public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) { |
|
423 | 423 | //validate context |
424 | 424 | //valid context? |
425 | - if ( ! isset( $this->_contexts[ $context ] ) ) { |
|
425 | + if ( ! isset($this->_contexts[$context])) { |
|
426 | 426 | throw new EE_Error( |
427 | 427 | sprintf( |
428 | - __( 'The context %s is not a valid context for %s.', 'event_espresso' ), |
|
428 | + __('The context %s is not a valid context for %s.', 'event_espresso'), |
|
429 | 429 | $context, |
430 | - get_class( $this ) |
|
430 | + get_class($this) |
|
431 | 431 | ) |
432 | 432 | ); |
433 | 433 | } |
434 | 434 | //valid sending_messenger? |
435 | 435 | $not_valid_msgr = false; |
436 | - foreach ( $this->_with_messengers as $generating => $sendings ) { |
|
437 | - if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === false ) { |
|
436 | + foreach ($this->_with_messengers as $generating => $sendings) { |
|
437 | + if (empty($sendings) || array_search($sending_messenger, $sendings) === false) { |
|
438 | 438 | $not_valid_msgr = true; |
439 | 439 | } |
440 | 440 | } |
441 | - if ( $not_valid_msgr ) { |
|
441 | + if ($not_valid_msgr) { |
|
442 | 442 | throw new EE_Error( |
443 | 443 | sprintf( |
444 | 444 | __( |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | 'event_espresso' |
447 | 447 | ), |
448 | 448 | $sending_messenger, |
449 | - get_class( $this ) |
|
449 | + get_class($this) |
|
450 | 450 | ) |
451 | 451 | ); |
452 | 452 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $this->name, |
458 | 458 | $registration, |
459 | 459 | $this->_GRP_ID, |
460 | - $this->_get_id_for_msg_url( $context, $registration ) |
|
460 | + $this->_get_id_for_msg_url($context, $registration) |
|
461 | 461 | ); |
462 | 462 | } |
463 | 463 | |
@@ -476,26 +476,26 @@ discard block |
||
476 | 476 | * EE_Base_Class_Object |
477 | 477 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
478 | 478 | */ |
479 | - public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) { |
|
479 | + public function get_data_for_context($context, EE_Registration $registration, $id = 0) { |
|
480 | 480 | //valid context? |
481 | - if ( ! isset( $this->_contexts[ $context ] ) ) { |
|
481 | + if ( ! isset($this->_contexts[$context])) { |
|
482 | 482 | throw new EE_Error( |
483 | 483 | sprintf( |
484 | - __( 'The context %s is not a valid context for %s.', 'event_espresso' ), |
|
484 | + __('The context %s is not a valid context for %s.', 'event_espresso'), |
|
485 | 485 | $context, |
486 | - get_class( $this ) |
|
486 | + get_class($this) |
|
487 | 487 | ) |
488 | 488 | ); |
489 | 489 | } |
490 | 490 | //get data and apply global and class specific filters on it. |
491 | 491 | $data = apply_filters( |
492 | 492 | 'FHEE__EE_message_type__get_data_for_context__data', |
493 | - $this->_get_data_for_context( $context, $registration, $id ), |
|
493 | + $this->_get_data_for_context($context, $registration, $id), |
|
494 | 494 | $this |
495 | 495 | ); |
496 | - $data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this ); |
|
496 | + $data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this); |
|
497 | 497 | //if empty then something went wrong! |
498 | - if ( empty( $data ) ) { |
|
498 | + if (empty($data)) { |
|
499 | 499 | throw new EE_Error( |
500 | 500 | sprintf( |
501 | 501 | __( |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | */ |
540 | 540 | protected function _set_with_messengers() { |
541 | 541 | $this->_with_messengers = array( |
542 | - 'email' => array( 'html' ), |
|
542 | + 'email' => array('html'), |
|
543 | 543 | ); |
544 | 544 | } |
545 | 545 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | */ |
554 | 554 | public function with_messengers() { |
555 | 555 | return apply_filters( |
556 | - 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), |
|
556 | + 'FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), |
|
557 | 557 | $this->_with_messengers |
558 | 558 | ); |
559 | 559 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $messengers = array() |
581 | 581 | ) { |
582 | 582 | //we can also further refine the context by action (if present). |
583 | - return $this->_get_admin_page_content( $page, $action, $extra, $messengers ); |
|
583 | + return $this->_get_admin_page_content($page, $action, $extra, $messengers); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | public function get_master_templates() { |
616 | 616 | //first class specific filter then filter that by the global filter. |
617 | 617 | $master_templates = apply_filters( |
618 | - 'FHEE__' . get_class( $this ) . '__get_master_templates', |
|
618 | + 'FHEE__'.get_class($this).'__get_master_templates', |
|
619 | 619 | $this->_master_templates |
620 | 620 | ); |
621 | - return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this ); |
|
621 | + return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -632,20 +632,20 @@ discard block |
||
632 | 632 | * @return array An array indexed by context where each context is an array of EE_Messages_Addressee objects for |
633 | 633 | * that context |
634 | 634 | */ |
635 | - public function get_addressees( EE_Messages_incoming_data $data, $context = '' ) { |
|
635 | + public function get_addressees(EE_Messages_incoming_data $data, $context = '') { |
|
636 | 636 | //override _data |
637 | 637 | $this->_data = $data; |
638 | 638 | $addressees = array(); |
639 | 639 | //if incoming context then limit to that context |
640 | - if ( ! empty( $context ) ) { |
|
641 | - $cntxt = ! empty( $this->_contexts[ $context ] ) ? $this->_contexts[ $context ] : ''; |
|
642 | - if ( ! empty( $cntxt ) ) { |
|
640 | + if ( ! empty($context)) { |
|
641 | + $cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : ''; |
|
642 | + if ( ! empty($cntxt)) { |
|
643 | 643 | $this->_contexts = array(); |
644 | - $this->_contexts[ $context ] = $cntxt; |
|
644 | + $this->_contexts[$context] = $cntxt; |
|
645 | 645 | } |
646 | 646 | } |
647 | 647 | $this->_set_default_addressee_data(); |
648 | - if ( $this->_process_data() ) { |
|
648 | + if ($this->_process_data()) { |
|
649 | 649 | $addressees = $this->_addressees; |
650 | 650 | } |
651 | 651 | return $addressees; |
@@ -661,14 +661,14 @@ discard block |
||
661 | 661 | */ |
662 | 662 | protected function _process_data() { |
663 | 663 | //at a minimum, we NEED EE_Attendee objects. |
664 | - if ( empty( $this->_data->attendees ) ) { |
|
665 | - return false; //there's no data to process! |
|
664 | + if (empty($this->_data->attendees)) { |
|
665 | + return false; //there's no data to process! |
|
666 | 666 | } |
667 | 667 | // process addressees for each context. Child classes will have to have methods for |
668 | 668 | // each context defined to handle the processing of the data object within them |
669 | - foreach ( $this->_contexts as $context => $details ) { |
|
670 | - $xpctd_method = '_' . $context . '_addressees'; |
|
671 | - if ( ! method_exists( $this, $xpctd_method ) ) { |
|
669 | + foreach ($this->_contexts as $context => $details) { |
|
670 | + $xpctd_method = '_'.$context.'_addressees'; |
|
671 | + if ( ! method_exists($this, $xpctd_method)) { |
|
672 | 672 | throw new EE_Error( |
673 | 673 | sprintf( |
674 | 674 | __( |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | ) |
681 | 681 | ); |
682 | 682 | } |
683 | - $this->_addressees[ $context ] = call_user_func( array( $this, $xpctd_method ) ); |
|
683 | + $this->_addressees[$context] = call_user_func(array($this, $xpctd_method)); |
|
684 | 684 | } |
685 | 685 | return true; //data was processed successfully. |
686 | 686 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | 'grand_total_line_item' => $this->_data->grand_total_line_item, |
703 | 703 | 'txn' => $this->_data->txn, |
704 | 704 | 'payments' => $this->_data->payments, |
705 | - 'payment' => isset( $this->_data->payment ) && $this->_data->payment instanceof EE_Payment |
|
705 | + 'payment' => isset($this->_data->payment) && $this->_data->payment instanceof EE_Payment |
|
706 | 706 | ? $this->_data->payment |
707 | 707 | : null, |
708 | 708 | 'reg_objs' => $this->_data->reg_objs, |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | 'txn_status' => $this->_data->txn_status, |
716 | 716 | 'total_ticket_count' => $this->_data->total_ticket_count, |
717 | 717 | ); |
718 | - if ( is_array( $this->_data->primary_attendee_data ) ) { |
|
718 | + if (is_array($this->_data->primary_attendee_data)) { |
|
719 | 719 | $this->_default_addressee_data = array_merge( |
720 | 720 | $this->_default_addressee_data, |
721 | 721 | $this->_data->primary_attendee_data |
@@ -759,24 +759,24 @@ discard block |
||
759 | 759 | 'messenger', |
760 | 760 | ); |
761 | 761 | $contexts = $this->get_contexts(); |
762 | - foreach ( $contexts as $context => $details ) { |
|
763 | - $this->_valid_shortcodes[ $context ] = $all_shortcodes; |
|
762 | + foreach ($contexts as $context => $details) { |
|
763 | + $this->_valid_shortcodes[$context] = $all_shortcodes; |
|
764 | 764 | //make sure non admin context does not include the event_author shortcodes |
765 | - if ( $context != 'admin' ) { |
|
766 | - if ( ( $key = array_search( 'event_author', $this->_valid_shortcodes[ $context ] ) ) !== false ) { |
|
767 | - unset( $this->_valid_shortcodes[ $context ][ $key ] ); |
|
765 | + if ($context != 'admin') { |
|
766 | + if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) { |
|
767 | + unset($this->_valid_shortcodes[$context][$key]); |
|
768 | 768 | } |
769 | 769 | } |
770 | 770 | } |
771 | 771 | // make sure admin context does not include the recipient_details shortcodes |
772 | 772 | // IF we have admin context hooked in message types might not have that context. |
773 | - if ( ! empty( $this->_valid_shortcodes['admin'] ) ) { |
|
774 | - if ( ( $key = array_search( 'recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false ) { |
|
775 | - unset( $this->_valid_shortcodes['admin'][ $key ] ); |
|
773 | + if ( ! empty($this->_valid_shortcodes['admin'])) { |
|
774 | + if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) { |
|
775 | + unset($this->_valid_shortcodes['admin'][$key]); |
|
776 | 776 | } |
777 | 777 | //make sure admin context does not include the recipient_details shortcodes |
778 | - if ( ( $key = array_search( 'recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false ) { |
|
779 | - unset( $this->_valid_shortcodes['admin'][ $key ] ); |
|
778 | + if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) { |
|
779 | + unset($this->_valid_shortcodes['admin'][$key]); |
|
780 | 780 | } |
781 | 781 | } |
782 | 782 | } |
@@ -789,9 +789,9 @@ discard block |
||
789 | 789 | * @param array $new_config array of valid shortcodes (by context) |
790 | 790 | * @return void sets valid_shortcodes property |
791 | 791 | */ |
792 | - public function reset_valid_shortcodes_config( $new_config ) { |
|
793 | - foreach ( $new_config as $context => $shortcodes ) { |
|
794 | - $this->_valid_shortcodes[ $context ] = $shortcodes; |
|
792 | + public function reset_valid_shortcodes_config($new_config) { |
|
793 | + foreach ($new_config as $context => $shortcodes) { |
|
794 | + $this->_valid_shortcodes[$context] = $shortcodes; |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | |
@@ -808,13 +808,13 @@ discard block |
||
808 | 808 | $addressees = array(); |
809 | 809 | // first we need to get the event admin user id for all the events |
810 | 810 | // and setup an addressee object for each unique admin user. |
811 | - foreach ( $this->_data->events as $line_ref => $event ) { |
|
812 | - $admin_id = $this->_get_event_admin_id( $event['ID'] ); |
|
811 | + foreach ($this->_data->events as $line_ref => $event) { |
|
812 | + $admin_id = $this->_get_event_admin_id($event['ID']); |
|
813 | 813 | //make sure we are just including the events that belong to this admin! |
814 | - $admin_events[ $admin_id ][ $line_ref ] = $event; |
|
814 | + $admin_events[$admin_id][$line_ref] = $event; |
|
815 | 815 | } |
816 | 816 | //k now we can loop through the event_admins and setup the addressee data. |
817 | - foreach ( $admin_events as $admin_id => $event_details ) { |
|
817 | + foreach ($admin_events as $admin_id => $event_details) { |
|
818 | 818 | $aee = array( |
819 | 819 | 'user_id' => $admin_id, |
820 | 820 | 'events' => $event_details, |
@@ -822,8 +822,8 @@ discard block |
||
822 | 822 | 'recipient_id' => $admin_id, |
823 | 823 | 'recipient_type' => 'WP_User', |
824 | 824 | ); |
825 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
826 | - $addressees[] = new EE_Messages_Addressee( $aee ); |
|
825 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
826 | + $addressees[] = new EE_Messages_Addressee($aee); |
|
827 | 827 | } |
828 | 828 | return $addressees; |
829 | 829 | } |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | $aee['recipient_id'] = $aee['primary_att_obj'] instanceof EE_Attendee ? $aee['primary_att_obj']->ID() : 0; |
844 | 844 | $aee['recipient_type'] = 'Attendee'; |
845 | 845 | //great now we can instantiate the $addressee object and return (as an array); |
846 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
846 | + $add[] = new EE_Messages_Addressee($aee); |
|
847 | 847 | return $add; |
848 | 848 | } |
849 | 849 | |
@@ -860,25 +860,25 @@ discard block |
||
860 | 860 | //we just have to loop through the attendees. We'll also set the attached events for each attendee. |
861 | 861 | //use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we? |
862 | 862 | $already_processed = array(); |
863 | - foreach ( $this->_data->attendees as $att_id => $details ) { |
|
863 | + foreach ($this->_data->attendees as $att_id => $details) { |
|
864 | 864 | //set the attendee array to blank on each loop; |
865 | 865 | $aee = array(); |
866 | - if ( isset( $this->_data->reg_obj ) |
|
867 | - && ( $this->_data->reg_obj->attendee_ID() != $att_id ) |
|
866 | + if (isset($this->_data->reg_obj) |
|
867 | + && ($this->_data->reg_obj->attendee_ID() != $att_id) |
|
868 | 868 | && $this->_single_message |
869 | 869 | ) { |
870 | 870 | continue; |
871 | 871 | } |
872 | 872 | // is $this->_regs_for_sending present? |
873 | 873 | // If so, let's make sure we ONLY generate addressee for registrations in that array. |
874 | - if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) { |
|
875 | - $regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] ); |
|
876 | - if ( empty( $regs_allowed ) ) { |
|
874 | + if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) { |
|
875 | + $regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']); |
|
876 | + if (empty($regs_allowed)) { |
|
877 | 877 | continue; |
878 | 878 | } |
879 | 879 | } |
880 | 880 | if ( |
881 | - in_array( $details['attendee_email'], $already_processed ) |
|
881 | + in_array($details['attendee_email'], $already_processed) |
|
882 | 882 | && apply_filters( |
883 | 883 | 'FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', |
884 | 884 | true, |
@@ -889,14 +889,14 @@ discard block |
||
889 | 889 | continue; |
890 | 890 | } |
891 | 891 | $already_processed[] = $details['attendee_email']; |
892 | - foreach ( $details as $item => $value ) { |
|
893 | - $aee[ $item ] = $value; |
|
894 | - if ( $item == 'line_ref' ) { |
|
895 | - foreach ( $value as $event_id ) { |
|
896 | - $aee['events'][ $event_id ] = $this->_data->events[ $event_id ]; |
|
892 | + foreach ($details as $item => $value) { |
|
893 | + $aee[$item] = $value; |
|
894 | + if ($item == 'line_ref') { |
|
895 | + foreach ($value as $event_id) { |
|
896 | + $aee['events'][$event_id] = $this->_data->events[$event_id]; |
|
897 | 897 | } |
898 | 898 | } |
899 | - if ( $item == 'attendee_email' ) { |
|
899 | + if ($item == 'attendee_email') { |
|
900 | 900 | $aee['attendee_email'] = $value; |
901 | 901 | } |
902 | 902 | /*if ( $item == 'registration_id' ) { |
@@ -905,13 +905,13 @@ discard block |
||
905 | 905 | } |
906 | 906 | // note the FIRST reg object in this array is the one |
907 | 907 | // we'll use for this attendee as the primary registration for this attendee. |
908 | - $aee['reg_obj'] = reset( $this->_data->attendees[ $att_id ]['reg_objs'] ); |
|
908 | + $aee['reg_obj'] = reset($this->_data->attendees[$att_id]['reg_objs']); |
|
909 | 909 | $aee['attendees'] = $this->_data->attendees; |
910 | 910 | $aee['recipient_id'] = $att_id; |
911 | 911 | $aee['recipient_type'] = 'Attendee'; |
912 | 912 | //merge in the primary attendee data |
913 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
914 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
913 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
914 | + $add[] = new EE_Messages_Addressee($aee); |
|
915 | 915 | } |
916 | 916 | return $add; |
917 | 917 | } |
@@ -922,8 +922,8 @@ discard block |
||
922 | 922 | * @param $event_id |
923 | 923 | * @return int |
924 | 924 | */ |
925 | - protected function _get_event_admin_id( $event_id ) { |
|
926 | - $event = EEM_Event::instance()->get_one_by_ID( $event_id ); |
|
925 | + protected function _get_event_admin_id($event_id) { |
|
926 | + $event = EEM_Event::instance()->get_one_by_ID($event_id); |
|
927 | 927 | return $event instanceof EE_Event ? $event->wp_user() : 0; |
928 | 928 | } |
929 | 929 |
@@ -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 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @param array $addressee_data We're expecting an incoming array of data that will be used to fill the properties |
261 | 261 | * for the object. |
262 | 262 | */ |
263 | - public function __construct( $addressee_data ) { |
|
263 | + public function __construct($addressee_data) { |
|
264 | 264 | $this->_data = $addressee_data; |
265 | 265 | $this->_set_properties(); |
266 | 266 | } |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | * @return void. |
276 | 276 | */ |
277 | 277 | protected function _set_properties() { |
278 | - foreach ( $this->_data as $prop => $value ) { |
|
279 | - if ( property_exists( $this, $prop ) ) { |
|
278 | + foreach ($this->_data as $prop => $value) { |
|
279 | + if (property_exists($this, $prop)) { |
|
280 | 280 | $this->{$prop} = $value; |
281 | 281 | } |
282 | 282 | } |
283 | 283 | //if user_id present we'll use this to set the fname and lname and admin_email. |
284 | - if ( ! empty( $this->user_id ) ) { |
|
284 | + if ( ! empty($this->user_id)) { |
|
285 | 285 | $this->user_id = (int) $this->user_id; |
286 | - $user = get_userdata( $this->user_id ); |
|
286 | + $user = get_userdata($this->user_id); |
|
287 | 287 | $this->fname = $user->user_firstname; |
288 | 288 | $this->lname = $user->user_lastname; |
289 | 289 | $this->admin_email = $user->user_email; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -40,50 +40,50 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | protected function _init_props() { |
43 | - $this->label = esc_html__( 'Transaction Shortcodes', 'event_espresso' ); |
|
44 | - $this->description = esc_html__( 'All shortcodes specific to transaction related data', 'event_espresso' ); |
|
43 | + $this->label = esc_html__('Transaction Shortcodes', 'event_espresso'); |
|
44 | + $this->description = esc_html__('All shortcodes specific to transaction related data', 'event_espresso'); |
|
45 | 45 | $this->_shortcodes = array( |
46 | - '[TXN_ID]' => esc_html__( 'The transaction id for the purchase.', 'event_espresso' ), |
|
47 | - '[PAYMENT_URL]' => esc_html__( 'This is a link to make a payment for the event', 'event_espresso' ), |
|
48 | - '[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__( 'This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso' ) . '<ul>' |
|
49 | - . '<li>' . sprintf( esc_html__( '%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
50 | - . '<li>' . sprintf( esc_html__( '%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
51 | - . '<li>' . sprintf( esc_html__( '%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
46 | + '[TXN_ID]' => esc_html__('The transaction id for the purchase.', 'event_espresso'), |
|
47 | + '[PAYMENT_URL]' => esc_html__('This is a link to make a payment for the event', 'event_espresso'), |
|
48 | + '[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>' |
|
49 | + . '<li>'.sprintf(esc_html__('%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
50 | + . '<li>'.sprintf(esc_html__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
51 | + . '<li>'.sprintf(esc_html__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
52 | 52 | . '</ul>', |
53 | - '[PAYMENT_DUE_DATE_*]' => esc_html__( 'This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso' ) |
|
53 | + '[PAYMENT_DUE_DATE_*]' => esc_html__('This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso') |
|
54 | 54 | . '<ul>' |
55 | - . '<li>' . sprintf( esc_html__( '%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
56 | - . '<li>' . sprintf( esc_html__( '%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
57 | - . '<li>' . sprintf( esc_html__( '%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>', |
|
58 | - '[INVOICE_LINK]' => esc_html__( 'This is a full html link to the invoice', 'event_espresso' ), |
|
59 | - '[INVOICE_URL]' => esc_html__( 'This is just the url for the invoice', 'event_espresso' ), |
|
60 | - '[INVOICE_LOGO_URL]' => esc_html__( 'This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso' ), |
|
61 | - '[INVOICE_LOGO]' => esc_html__( 'This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso' ), |
|
62 | - '[INVOICE_PAYEE_NAME]' => esc_html__( 'This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
63 | - '[INVOICE_PAYEE_ADDRESS]' => esc_html__( 'This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
64 | - '[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__( 'This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ), |
|
65 | - '[INVOICE_PAYEE_EMAIL]' => esc_html__( 'This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
66 | - '[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf( esc_html__( 'This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will output: GST: 12345t56. If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ), '<code>', '</code>' ), |
|
67 | - '[TOTAL_COST]' => esc_html__( 'The total cost for the transaction', 'event_espresso' ), |
|
68 | - '[TXN_STATUS]' => esc_html__( 'The transaction status for the transaction.', 'event_espresso' ), |
|
69 | - '[TXN_STATUS_ID]' => esc_html__( 'The ID representing the transaction status as saved in the db. This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso' ), |
|
70 | - '[PAYMENT_STATUS]' => esc_html__( 'The transaction status for the transaction. This parses to the same value as the [TXN_STATUS] shortcode and still remains here for legacy support.', 'event_espresso' ), |
|
71 | - '[PAYMENT_GATEWAY]' => esc_html__( 'The payment gateway used for the transaction', 'event_espresso' ), |
|
72 | - '[AMOUNT_PAID]' => esc_html__( 'The amount paid or refunded. This will only have a value if there was a payment or refund at the time of generating the message.', 'event_espresso' ), |
|
73 | - '[LAST_AMOUNT_PAID]' => esc_html__( 'This is the last payment or refund made on the transaction related to the message being generated.', 'event_espresso' ), |
|
74 | - '[TOTAL_AMOUNT_PAID]' => esc_html__( 'This parses to the total amount paid over all payments', 'event_espresso' ), |
|
75 | - '[TOTAL_OWING]' => esc_html__( 'The total owing on a transaction with no attributes.', 'event_espresso' ), |
|
76 | - '[TXN_SUBTOTAL]' => esc_html__( 'The subtotal for all txn line items.', 'event_espresso' ), |
|
77 | - '[TXN_TAX_SUBTOTAL]' => esc_html__( 'The subtotal for all tax line items.', 'event_espresso' ), |
|
78 | - '[OWING_STATUS_MESSAGE_*]' => esc_html__( 'A dynamic shortcode for adjusting how total owing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso' ) . '<p></ul>' . |
|
79 | - '<li><strong>still_owing</strong>:' . esc_html__( 'If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount owing). The default is:', 'event_espresso' ) . sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso' ), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' . |
|
80 | - '<li><strong>none_owing</strong>:' . esc_html__( 'If the transaction is paid in full, then you can indicate how this gets displayed. Note, that it defaults to just be the total owing.', 'event_espresso' ) . '</li></ul></p>', |
|
81 | - '[TXN_TOTAL_TICKETS]' => esc_html__( 'The total number of all tickets purchased in a transaction', 'event_espresso' ), |
|
82 | - '[TKT_QTY_PURCHASED]' => sprintf( esc_html__( 'The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso' ), '<strong>', '</strong>' ), |
|
83 | - '[TRANSACTION_ADMIN_URL]' => esc_html__( 'The url to the admin page for this transaction', 'event_espresso' ), |
|
84 | - '[RECEIPT_URL]' => esc_html__( 'This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso' ), |
|
85 | - '[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso' ), |
|
86 | - '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( esc_html__( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' ) |
|
55 | + . '<li>'.sprintf(esc_html__('%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
56 | + . '<li>'.sprintf(esc_html__('%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
57 | + . '<li>'.sprintf(esc_html__('%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>', |
|
58 | + '[INVOICE_LINK]' => esc_html__('This is a full html link to the invoice', 'event_espresso'), |
|
59 | + '[INVOICE_URL]' => esc_html__('This is just the url for the invoice', 'event_espresso'), |
|
60 | + '[INVOICE_LOGO_URL]' => esc_html__('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'), |
|
61 | + '[INVOICE_LOGO]' => esc_html__('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'), |
|
62 | + '[INVOICE_PAYEE_NAME]' => esc_html__('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
63 | + '[INVOICE_PAYEE_ADDRESS]' => esc_html__('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
64 | + '[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'), |
|
65 | + '[INVOICE_PAYEE_EMAIL]' => esc_html__('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
66 | + '[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf(esc_html__('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will output: GST: 12345t56. If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'), '<code>', '</code>'), |
|
67 | + '[TOTAL_COST]' => esc_html__('The total cost for the transaction', 'event_espresso'), |
|
68 | + '[TXN_STATUS]' => esc_html__('The transaction status for the transaction.', 'event_espresso'), |
|
69 | + '[TXN_STATUS_ID]' => esc_html__('The ID representing the transaction status as saved in the db. This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'), |
|
70 | + '[PAYMENT_STATUS]' => esc_html__('The transaction status for the transaction. This parses to the same value as the [TXN_STATUS] shortcode and still remains here for legacy support.', 'event_espresso'), |
|
71 | + '[PAYMENT_GATEWAY]' => esc_html__('The payment gateway used for the transaction', 'event_espresso'), |
|
72 | + '[AMOUNT_PAID]' => esc_html__('The amount paid or refunded. This will only have a value if there was a payment or refund at the time of generating the message.', 'event_espresso'), |
|
73 | + '[LAST_AMOUNT_PAID]' => esc_html__('This is the last payment or refund made on the transaction related to the message being generated.', 'event_espresso'), |
|
74 | + '[TOTAL_AMOUNT_PAID]' => esc_html__('This parses to the total amount paid over all payments', 'event_espresso'), |
|
75 | + '[TOTAL_OWING]' => esc_html__('The total owing on a transaction with no attributes.', 'event_espresso'), |
|
76 | + '[TXN_SUBTOTAL]' => esc_html__('The subtotal for all txn line items.', 'event_espresso'), |
|
77 | + '[TXN_TAX_SUBTOTAL]' => esc_html__('The subtotal for all tax line items.', 'event_espresso'), |
|
78 | + '[OWING_STATUS_MESSAGE_*]' => esc_html__('A dynamic shortcode for adjusting how total owing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'. |
|
79 | + '<li><strong>still_owing</strong>:'.esc_html__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount owing). The default is:', 'event_espresso').sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'. |
|
80 | + '<li><strong>none_owing</strong>:'.esc_html__('If the transaction is paid in full, then you can indicate how this gets displayed. Note, that it defaults to just be the total owing.', 'event_espresso').'</li></ul></p>', |
|
81 | + '[TXN_TOTAL_TICKETS]' => esc_html__('The total number of all tickets purchased in a transaction', 'event_espresso'), |
|
82 | + '[TKT_QTY_PURCHASED]' => sprintf(esc_html__('The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso'), '<strong>', '</strong>'), |
|
83 | + '[TRANSACTION_ADMIN_URL]' => esc_html__('The url to the admin page for this transaction', 'event_espresso'), |
|
84 | + '[RECEIPT_URL]' => esc_html__('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'), |
|
85 | + '[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso'), |
|
86 | + '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(esc_html__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>') |
|
87 | 87 | ); |
88 | 88 | } |
89 | 89 | |
@@ -94,40 +94,40 @@ discard block |
||
94 | 94 | * @param string $shortcode the shortcode to be parsed. |
95 | 95 | * @return string parsed shortcode |
96 | 96 | */ |
97 | - protected function _parser( $shortcode ) { |
|
97 | + protected function _parser($shortcode) { |
|
98 | 98 | |
99 | 99 | //attempt to get the transaction. Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction. |
100 | 100 | $transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null; |
101 | - $transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction; |
|
101 | + $transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction; |
|
102 | 102 | |
103 | 103 | //payment |
104 | 104 | $payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null; |
105 | - $payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment; |
|
105 | + $payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment; |
|
106 | 106 | |
107 | 107 | |
108 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
108 | + if ( ! $transaction instanceof EE_Transaction) { |
|
109 | 109 | return ''; |
110 | 110 | } |
111 | 111 | |
112 | - switch ( $shortcode ) { |
|
112 | + switch ($shortcode) { |
|
113 | 113 | case '[TXN_ID]' : |
114 | 114 | return $transaction->ID(); |
115 | 115 | break; |
116 | 116 | |
117 | 117 | case '[PAYMENT_URL]' : |
118 | 118 | $payment_url = $transaction->payment_overview_url(); |
119 | - return empty( $payment_url ) ? esc_html__( 'http://dummypaymenturlforpreview.com', 'event_espresso' ) : $payment_url; |
|
119 | + return empty($payment_url) ? esc_html__('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case '[INVOICE_LINK]' : |
123 | 123 | $invoice_url = $transaction->invoice_url(); |
124 | - $invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
125 | - return sprintf( esc_html__( '%sClick here for Invoice%s', 'event_espresso' ), '<a href="' . $invoice_url . '">', '</a>' ); |
|
124 | + $invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
125 | + return sprintf(esc_html__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>'); |
|
126 | 126 | break; /**/ |
127 | 127 | |
128 | 128 | case '[INVOICE_URL]' : |
129 | 129 | $invoice_url = $transaction->invoice_url(); |
130 | - return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
130 | + return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
131 | 131 | break; |
132 | 132 | |
133 | 133 | case '[INVOICE_LOGO_URL]' : |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | break; |
136 | 136 | |
137 | 137 | case '[INVOICE_LOGO]' : |
138 | - return $this->_get_invoice_logo( true ); |
|
138 | + return $this->_get_invoice_logo(true); |
|
139 | 139 | break; |
140 | 140 | |
141 | 141 | case '[INVOICE_PAYEE_NAME]' : |
@@ -157,18 +157,18 @@ discard block |
||
157 | 157 | |
158 | 158 | case '[TOTAL_COST]' : |
159 | 159 | $total = $transaction->total(); |
160 | - return ! empty($total) ? EEH_Template::format_currency( $total ) : ''; |
|
160 | + return ! empty($total) ? EEH_Template::format_currency($total) : ''; |
|
161 | 161 | break; |
162 | 162 | |
163 | 163 | case '[PAYMENT_STATUS]' : |
164 | 164 | $status = $transaction->pretty_status(); |
165 | - return ! empty($status) ? $status : esc_html__( 'Unknown', 'event_espresso' ); |
|
165 | + return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso'); |
|
166 | 166 | break; /**/ |
167 | 167 | |
168 | 168 | // note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity. |
169 | 169 | case '[TXN_STATUS]': |
170 | 170 | $status = $transaction->pretty_status(); |
171 | - return ! empty( $status ) ? $status : esc_html__( 'Unknown', 'event_espresso' ); |
|
171 | + return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso'); |
|
172 | 172 | break; |
173 | 173 | |
174 | 174 | case '[TXN_STATUS_ID]' : |
@@ -176,36 +176,36 @@ discard block |
||
176 | 176 | break; |
177 | 177 | |
178 | 178 | case '[PAYMENT_GATEWAY]' : |
179 | - return $this->_get_payment_gateway( $transaction ); |
|
179 | + return $this->_get_payment_gateway($transaction); |
|
180 | 180 | break; |
181 | 181 | |
182 | 182 | case '[AMOUNT_PAID]' : |
183 | 183 | return $payment instanceof EE_Payment |
184 | - ? EEH_Template::format_currency( $payment->amount() ) |
|
185 | - : EEH_Template::format_currency( 0 ); |
|
184 | + ? EEH_Template::format_currency($payment->amount()) |
|
185 | + : EEH_Template::format_currency(0); |
|
186 | 186 | break; |
187 | 187 | |
188 | 188 | case '[LAST_AMOUNT_PAID]' : |
189 | 189 | $last_payment = $transaction->last_payment(); |
190 | 190 | return $last_payment instanceof EE_Payment |
191 | - ? EEH_Template::format_currency( $last_payment->amount() ) |
|
192 | - : EEH_Template::format_currency( 0 ); |
|
191 | + ? EEH_Template::format_currency($last_payment->amount()) |
|
192 | + : EEH_Template::format_currency(0); |
|
193 | 193 | |
194 | 194 | case '[TOTAL_AMOUNT_PAID]' : |
195 | - return EEH_Template::format_currency( $transaction->paid() ); |
|
195 | + return EEH_Template::format_currency($transaction->paid()); |
|
196 | 196 | break; |
197 | 197 | |
198 | 198 | case '[TOTAL_OWING]' : |
199 | 199 | $total_owing = $transaction->remaining(); |
200 | - return EEH_Template::format_currency( $total_owing ); |
|
200 | + return EEH_Template::format_currency($total_owing); |
|
201 | 201 | break; |
202 | 202 | |
203 | 203 | case '[TXN_SUBTOTAL]' : |
204 | - return EEH_Template::format_currency( $this->_get_subtotal() ); |
|
204 | + return EEH_Template::format_currency($this->_get_subtotal()); |
|
205 | 205 | break; |
206 | 206 | |
207 | 207 | case '[TXN_TAX_SUBTOTAL]' : |
208 | - return EEH_Template::format_currency( $this->_get_subtotal( true ) ); |
|
208 | + return EEH_Template::format_currency($this->_get_subtotal(true)); |
|
209 | 209 | break; |
210 | 210 | |
211 | 211 | case '[TKT_QTY_PURCHASED]' : |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | break; |
215 | 215 | |
216 | 216 | case '[TRANSACTION_ADMIN_URL]' : |
217 | - require_once EE_CORE . 'admin/EE_Admin_Page.core.php'; |
|
218 | - $query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() ); |
|
219 | - $url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url( 'admin.php' ) ); |
|
217 | + require_once EE_CORE.'admin/EE_Admin_Page.core.php'; |
|
218 | + $query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID()); |
|
219 | + $url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')); |
|
220 | 220 | return $url; |
221 | 221 | break; |
222 | 222 | |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | //get primary_registration |
225 | 225 | $reg = $this->_data->primary_reg_obj; |
226 | 226 | |
227 | - if ( ! $reg instanceof EE_Registration ) { |
|
227 | + if ( ! $reg instanceof EE_Registration) { |
|
228 | 228 | return ''; |
229 | 229 | } |
230 | 230 | return $reg->receipt_url(); |
231 | 231 | break; |
232 | 232 | |
233 | 233 | case '[INVOICE_RECEIPT_SWITCHER_URL]' : |
234 | - return $this->_get_invoice_receipt_switcher( false ); |
|
234 | + return $this->_get_invoice_receipt_switcher(false); |
|
235 | 235 | break; |
236 | 236 | |
237 | 237 | case '[INVOICE_RECEIPT_SWITCHER_BUTTON]' : |
@@ -241,20 +241,20 @@ discard block |
||
241 | 241 | |
242 | 242 | } |
243 | 243 | |
244 | - if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== false ) { |
|
245 | - return $this->_get_custom_total_owing( $shortcode ); |
|
244 | + if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== false) { |
|
245 | + return $this->_get_custom_total_owing($shortcode); |
|
246 | 246 | } |
247 | 247 | |
248 | - if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== false ) { |
|
249 | - return $this->_get_invoice_payee_tax_number( $shortcode ); |
|
248 | + if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== false) { |
|
249 | + return $this->_get_invoice_payee_tax_number($shortcode); |
|
250 | 250 | } |
251 | 251 | |
252 | - if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== false ) { |
|
253 | - return $this->_get_payment_link_if_needed( $shortcode ); |
|
252 | + if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== false) { |
|
253 | + return $this->_get_payment_link_if_needed($shortcode); |
|
254 | 254 | } |
255 | 255 | |
256 | - if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) { |
|
257 | - return $this->_get_payment_due_date( $shortcode, $transaction ); |
|
256 | + if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) { |
|
257 | + return $this->_get_payment_due_date($shortcode, $transaction); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | return ''; |
@@ -271,19 +271,19 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return string parsed. |
273 | 273 | */ |
274 | - private function _get_custom_total_owing( $shortcode ) { |
|
275 | - $valid_shortcodes = array( 'transaction' ); |
|
276 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
274 | + private function _get_custom_total_owing($shortcode) { |
|
275 | + $valid_shortcodes = array('transaction'); |
|
276 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
277 | 277 | |
278 | 278 | //ensure default is set. |
279 | 279 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
280 | 280 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0; |
281 | 281 | |
282 | - if ( $total_owing > 0 ) { |
|
283 | - $owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso' ), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ); |
|
284 | - $owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
282 | + if ($total_owing > 0) { |
|
283 | + $owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>'); |
|
284 | + $owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
285 | 285 | } else { |
286 | - $owing_content = ! empty( $attrs['none_owing']) ? $attrs['none_owing'] : ''; |
|
286 | + $owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : ''; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | return $owing_content; |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @param EE_Transaction $transaction |
296 | 296 | * @return string |
297 | 297 | */ |
298 | - private function _get_payment_gateway( $transaction ) { |
|
299 | - $pm = $this->_get_payment_method( $transaction ); |
|
298 | + private function _get_payment_gateway($transaction) { |
|
299 | + $pm = $this->_get_payment_method($transaction); |
|
300 | 300 | return $pm instanceof EE_Payment_Method ? $pm->name() : ''; |
301 | 301 | } |
302 | 302 | |
@@ -311,37 +311,37 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @return string url or html |
313 | 313 | */ |
314 | - private function _get_invoice_logo( $img_tags = false ) { |
|
314 | + private function _get_invoice_logo($img_tags = false) { |
|
315 | 315 | //try to get the invoice payment method's logo for this transaction image first |
316 | 316 | $pm = $this->_get_payment_method(); |
317 | - if ( $pm instanceof EE_Payment_Method ){ |
|
318 | - $invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', true ); |
|
317 | + if ($pm instanceof EE_Payment_Method) { |
|
318 | + $invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', true); |
|
319 | 319 | } else { |
320 | 320 | $invoice_logo_url = null; |
321 | 321 | } |
322 | - if ( empty( $invoice_logo_url ) ){ |
|
322 | + if (empty($invoice_logo_url)) { |
|
323 | 323 | $invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url; |
324 | 324 | } |
325 | 325 | |
326 | - if ( empty( $invoice_logo_url ) ) { |
|
326 | + if (empty($invoice_logo_url)) { |
|
327 | 327 | return ''; |
328 | 328 | } |
329 | 329 | |
330 | - if ( ! $img_tags ) { |
|
330 | + if ( ! $img_tags) { |
|
331 | 331 | return $invoice_logo_url; |
332 | 332 | } |
333 | 333 | |
334 | 334 | //image tags have been requested. |
335 | - $image_size = getimagesize( $invoice_logo_url ); |
|
335 | + $image_size = getimagesize($invoice_logo_url); |
|
336 | 336 | |
337 | 337 | //if image is wider than 200px, set the width to 200 |
338 | - if ( $image_size[0] > 300 ) { |
|
338 | + if ($image_size[0] > 300) { |
|
339 | 339 | $image_width = 300; |
340 | 340 | } else { |
341 | 341 | $image_width = $image_size[0]; |
342 | 342 | } |
343 | 343 | |
344 | - return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />'; |
|
344 | + return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />'; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | private function _get_invoice_payee_name() { |
359 | 359 | $payee_name = null; |
360 | 360 | $pm = $this->_get_payment_method(); |
361 | - if ( $pm instanceof EE_Payment_Method ){ |
|
362 | - $payee_name = $pm->get_extra_meta( 'pdf_payee_name', true ); |
|
361 | + if ($pm instanceof EE_Payment_Method) { |
|
362 | + $payee_name = $pm->get_extra_meta('pdf_payee_name', true); |
|
363 | 363 | } |
364 | - $payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name; |
|
364 | + $payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name; |
|
365 | 365 | return $payee_name; |
366 | 366 | } |
367 | 367 | |
@@ -373,16 +373,16 @@ discard block |
||
373 | 373 | * @param EE_Transaction|null $transaction |
374 | 374 | * @return \EE_Payment_Method|mixed|null|void |
375 | 375 | */ |
376 | - private function _get_payment_method( $transaction = null ){ |
|
377 | - if ( $transaction instanceof EE_Transaction ) { |
|
376 | + private function _get_payment_method($transaction = null) { |
|
377 | + if ($transaction instanceof EE_Transaction) { |
|
378 | 378 | $payment_method = $transaction->payment_method(); |
379 | - if ( empty( $payment_method ) ) { |
|
380 | - return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' ) ); |
|
379 | + if (empty($payment_method)) { |
|
380 | + return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
381 | 381 | } |
382 | 382 | return $payment_method; |
383 | 383 | } else { |
384 | 384 | //get the first payment method we can find |
385 | - return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' ) ); |
|
385 | + return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | private function _get_invoice_payee_email() { |
400 | 400 | $payee_email = null; |
401 | 401 | $pm = $this->_get_payment_method(); |
402 | - if ( $pm instanceof EE_Payment_Method ){ |
|
403 | - $payee_email = $pm->get_extra_meta( 'pdf_payee_email', true ); |
|
402 | + if ($pm instanceof EE_Payment_Method) { |
|
403 | + $payee_email = $pm->get_extra_meta('pdf_payee_email', true); |
|
404 | 404 | } |
405 | - $payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email; |
|
405 | + $payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email; |
|
406 | 406 | return $payee_email; |
407 | 407 | } |
408 | 408 | |
@@ -418,24 +418,24 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @return string |
420 | 420 | */ |
421 | - private function _get_invoice_payee_tax_number( $shortcode ) { |
|
421 | + private function _get_invoice_payee_tax_number($shortcode) { |
|
422 | 422 | $payee_tax_number = null; |
423 | 423 | $pm = $this->_get_payment_method(); |
424 | - if ( $pm instanceof EE_Payment_Method ){ |
|
425 | - $payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', true ); |
|
424 | + if ($pm instanceof EE_Payment_Method) { |
|
425 | + $payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', true); |
|
426 | 426 | } |
427 | - $payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number; |
|
427 | + $payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number; |
|
428 | 428 | |
429 | - if ( empty( $payee_tax_number ) ) { |
|
429 | + if (empty($payee_tax_number)) { |
|
430 | 430 | return ''; |
431 | 431 | } |
432 | 432 | |
433 | 433 | //any attributes? |
434 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
434 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
435 | 435 | |
436 | 436 | //prefix? |
437 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__( 'VAT/Tax Number: ', 'event_espresso' ); |
|
438 | - return $prefix . $payee_tax_number; |
|
437 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
438 | + return $prefix.$payee_tax_number; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -452,22 +452,22 @@ discard block |
||
452 | 452 | private function _get_invoice_payee_address() { |
453 | 453 | $payee_address = null; |
454 | 454 | $pm = $this->_get_payment_method(); |
455 | - if ( $pm instanceof EE_Payment_Method ){ |
|
456 | - $payee_address = $pm->get_extra_meta( 'pdf_payee_address', true ); |
|
455 | + if ($pm instanceof EE_Payment_Method) { |
|
456 | + $payee_address = $pm->get_extra_meta('pdf_payee_address', true); |
|
457 | 457 | } |
458 | - if ( empty( $payee_address ) ) { |
|
458 | + if (empty($payee_address)) { |
|
459 | 459 | $organization = EE_Registry::instance()->CFG->organization; |
460 | - $payee_address = $organization->get_pretty( 'address_1' ) . '<br>'; |
|
461 | - $payee_address .= ! empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : ''; |
|
462 | - $payee_address .= $organization->get_pretty( 'city' ) . '<br>'; |
|
460 | + $payee_address = $organization->get_pretty('address_1').'<br>'; |
|
461 | + $payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : ''; |
|
462 | + $payee_address .= $organization->get_pretty('city').'<br>'; |
|
463 | 463 | |
464 | 464 | //state |
465 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID ); |
|
466 | - $payee_address .= $state instanceof EE_State ? $state->name() : ''; |
|
465 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID); |
|
466 | + $payee_address .= $state instanceof EE_State ? $state->name() : ''; |
|
467 | 467 | |
468 | 468 | //Country |
469 | - $payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : ''; |
|
470 | - $payee_address .= ! empty( $organization->zip ) ? $organization->zip : ''; |
|
469 | + $payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : ''; |
|
470 | + $payee_address .= ! empty($organization->zip) ? $organization->zip : ''; |
|
471 | 471 | } |
472 | 472 | return $payee_address; |
473 | 473 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | private function _get_invoice_payment_instructions() { |
486 | 486 | $instructions = null; |
487 | 487 | $pm = $this->_get_payment_method(); |
488 | - return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', true ) : ''; |
|
488 | + return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', true) : ''; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -499,27 +499,27 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @return string |
501 | 501 | */ |
502 | - protected function _get_invoice_receipt_switcher( $button = true ) { |
|
502 | + protected function _get_invoice_receipt_switcher($button = true) { |
|
503 | 503 | $reg = $this->_data->primary_reg_obj; |
504 | - $message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : ''; |
|
505 | - if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) { |
|
504 | + $message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : ''; |
|
505 | + if ( ! $reg instanceof EE_Registration || empty($message_type)) { |
|
506 | 506 | return ''; |
507 | 507 | } |
508 | 508 | |
509 | - $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false; |
|
510 | - $switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__( 'View Invoice', 'event_espresso' ) : esc_html__( 'Switch to Invoice', 'event_espresso' ); |
|
511 | - $switch_to_label = ! $switch_to_invoice ? esc_html__( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label; |
|
509 | + $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false; |
|
510 | + $switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__('View Invoice', 'event_espresso') : esc_html__('Switch to Invoice', 'event_espresso'); |
|
511 | + $switch_to_label = ! $switch_to_invoice ? esc_html__('Switch to Receipt', 'event_espresso') : $switch_to_label; |
|
512 | 512 | $switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url(); |
513 | 513 | |
514 | - if ( ! $button ) { |
|
514 | + if ( ! $button) { |
|
515 | 515 | return $switch_to_url; |
516 | 516 | } |
517 | 517 | |
518 | - if ( ! empty( $switch_to_url ) ) { |
|
518 | + if ( ! empty($switch_to_url)) { |
|
519 | 519 | |
520 | 520 | return ' |
521 | - <form method="post" action="' . $switch_to_url . '" > |
|
522 | - <input class="print_button" type="submit" value="' . $switch_to_label . '" /> |
|
521 | + <form method="post" action="' . $switch_to_url.'" > |
|
522 | + <input class="print_button" type="submit" value="' . $switch_to_label.'" /> |
|
523 | 523 | </form> |
524 | 524 | '; |
525 | 525 | } |
@@ -559,10 +559,10 @@ discard block |
||
559 | 559 | * |
560 | 560 | * @return int |
561 | 561 | */ |
562 | - private function _get_subtotal( $tax = false ) { |
|
563 | - $grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : null; |
|
562 | + private function _get_subtotal($tax = false) { |
|
563 | + $grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : null; |
|
564 | 564 | |
565 | - if ( ! $grand_total instanceof EE_Line_Item ) { |
|
565 | + if ( ! $grand_total instanceof EE_Line_Item) { |
|
566 | 566 | return 0; |
567 | 567 | } |
568 | 568 | |
@@ -581,26 +581,26 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @return string parsed. |
583 | 583 | */ |
584 | - private function _get_payment_link_if_needed( $shortcode ) { |
|
585 | - $valid_shortcodes = array( 'transaction' ); |
|
586 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
584 | + private function _get_payment_link_if_needed($shortcode) { |
|
585 | + $valid_shortcodes = array('transaction'); |
|
586 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
587 | 587 | |
588 | 588 | //ensure default is set. |
589 | 589 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
590 | 590 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0; |
591 | 591 | |
592 | - if ( $total_owing > 0 ) { |
|
593 | - $class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout'; |
|
594 | - $custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.'; |
|
595 | - $container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p'; |
|
596 | - $opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : ''; |
|
597 | - $opening_tag .= ! empty( $opening_tag ) && ! empty( $class ) ? ' class="' . $class . '"' : $opening_tag; |
|
598 | - $opening_tag .= ! empty( $opening_tag ) ? '>' : $opening_tag; |
|
599 | - $closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : ''; |
|
600 | - $content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag; |
|
592 | + if ($total_owing > 0) { |
|
593 | + $class = isset($attrs['class']) ? $attrs['class'] : 'callout'; |
|
594 | + $custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.'; |
|
595 | + $container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p'; |
|
596 | + $opening_tag = ! empty($container_tag) ? '<'.$container_tag : ''; |
|
597 | + $opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag; |
|
598 | + $opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag; |
|
599 | + $closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : ''; |
|
600 | + $content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag; |
|
601 | 601 | |
602 | 602 | //we need to re run this string through the parser to catch any shortcodes that are in it. |
603 | - $owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
603 | + $owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
604 | 604 | } else { |
605 | 605 | return ''; |
606 | 606 | } |
@@ -620,31 +620,31 @@ discard block |
||
620 | 620 | * @param EE_Transaction $transaction |
621 | 621 | * @return string |
622 | 622 | */ |
623 | - protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) { |
|
623 | + protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) { |
|
624 | 624 | //if transaction is paid in full then we can just return an empty string |
625 | - if ( $transaction->remaining() === 0 ) { |
|
625 | + if ($transaction->remaining() === 0) { |
|
626 | 626 | return ''; |
627 | 627 | } |
628 | 628 | |
629 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
630 | - $format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' ); |
|
631 | - $days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30; |
|
632 | - $prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : esc_html__( 'Payment in full due by: ', 'event_espresso' ); |
|
633 | - $transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' ); |
|
629 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
630 | + $format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format'); |
|
631 | + $days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30; |
|
632 | + $prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : esc_html__('Payment in full due by: ', 'event_espresso'); |
|
633 | + $transaction_created = $transaction->get_DateTime_object('TXN_timestamp'); |
|
634 | 634 | |
635 | 635 | //setup date due: |
636 | 636 | try { |
637 | - if ( $transaction_created instanceof DateTime ) { |
|
638 | - $date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format ); |
|
637 | + if ($transaction_created instanceof DateTime) { |
|
638 | + $date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format); |
|
639 | 639 | } else { |
640 | 640 | throw new Exception(); |
641 | 641 | } |
642 | - } catch( Exception $e ) { |
|
642 | + } catch (Exception $e) { |
|
643 | 643 | //format was likely invalid. |
644 | 644 | $date_due = 'Unable to calculate date due, likely the format string is invalid.'; |
645 | 645 | } |
646 | 646 | |
647 | - return $prefix_text . $date_due; |
|
647 | + return $prefix_text.$date_due; |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | } //end EE_Transaction Shortcodes library |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | 'persistent' => FALSE |
246 | 246 | ), |
247 | 247 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
248 | - 'help_tabs' => array( |
|
248 | + 'help_tabs' => array( |
|
249 | 249 | 'registration_form_add_question_help_tab' => array( |
250 | 250 | 'title' => esc_html__('Add Question', 'event_espresso'), |
251 | 251 | 'filename' => 'registration_form_add_question' |
252 | 252 | ), |
253 | 253 | ), |
254 | - 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
254 | + 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
255 | 255 | 'require_nonce' => FALSE |
256 | 256 | ), |
257 | 257 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | 'filename' => 'registration_form_add_question_group' |
269 | 269 | ), |
270 | 270 | ), |
271 | - 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
271 | + 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
272 | 272 | 'require_nonce' => FALSE |
273 | 273 | ), |
274 | 274 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | 'filename' => 'registration_form_edit_question_group' |
287 | 287 | ), |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
289 | + 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
290 | 290 | 'require_nonce' => FALSE |
291 | 291 | ), |
292 | 292 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | 'filename' => 'registration_form_reg_form_settings' |
306 | 306 | ), |
307 | 307 | ), |
308 | - 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
308 | + 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
309 | 309 | 'require_nonce' => FALSE |
310 | 310 | ) |
311 | 311 | |
@@ -430,11 +430,11 @@ discard block |
||
430 | 430 | |
431 | 431 | protected function _questions_overview_list_table() { |
432 | 432 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
433 | - 'add_question', |
|
434 | - 'add_question', |
|
435 | - array(), |
|
436 | - 'add-new-h2' |
|
437 | - ); |
|
433 | + 'add_question', |
|
434 | + 'add_question', |
|
435 | + array(), |
|
436 | + 'add-new-h2' |
|
437 | + ); |
|
438 | 438 | parent::_questions_overview_list_table(); |
439 | 439 | } |
440 | 440 | |
@@ -443,11 +443,11 @@ discard block |
||
443 | 443 | protected function _question_groups_overview_list_table() { |
444 | 444 | $this->_search_btn_label = esc_html__('Question Groups', 'event_espresso'); |
445 | 445 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
446 | - 'add_question_group', |
|
447 | - 'add_question_group', |
|
448 | - array(), |
|
449 | - 'add-new-h2' |
|
450 | - ); |
|
446 | + 'add_question_group', |
|
447 | + 'add_question_group', |
|
448 | + array(), |
|
449 | + 'add-new-h2' |
|
450 | + ); |
|
451 | 451 | $this->display_admin_list_table_page_with_sidebar(); |
452 | 452 | } |
453 | 453 | |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | * @return EE_Form_Section_Proper |
944 | 944 | */ |
945 | 945 | protected function _email_validation_settings_form() { |
946 | - return new EE_Form_Section_Proper( |
|
946 | + return new EE_Form_Section_Proper( |
|
947 | 947 | array( |
948 | 948 | 'name' => 'email_validation_settings', |
949 | 949 | 'html_id' => 'email_validation_settings', |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | ), |
962 | 962 | array( |
963 | 963 | 'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' ) |
964 | - . EEH_Template::get_help_tab_link( 'email_validation_info' ), |
|
964 | + . EEH_Template::get_help_tab_link( 'email_validation_info' ), |
|
965 | 965 | 'html_help_text' => esc_html__( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'), |
966 | 966 | 'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level ) |
967 | 967 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
@@ -983,8 +983,8 @@ discard block |
||
983 | 983 | * @return \EE_Registration_Config |
984 | 984 | */ |
985 | 985 | public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) { |
986 | - $prev_email_validation_level = $EE_Registration_Config->email_validation_level; |
|
987 | - try { |
|
986 | + $prev_email_validation_level = $EE_Registration_Config->email_validation_level; |
|
987 | + try { |
|
988 | 988 | $email_validation_settings_form = $this->_email_validation_settings_form(); |
989 | 989 | // if not displaying a form, then check for form submission |
990 | 990 | if ( $email_validation_settings_form->was_submitted() ) { |
@@ -995,38 +995,38 @@ discard block |
||
995 | 995 | // grab validated data from form |
996 | 996 | $valid_data = $email_validation_settings_form->valid_data(); |
997 | 997 | if ( isset( $valid_data['email_validation_level'] ) ) { |
998 | - $email_validation_level = $valid_data['email_validation_level']; |
|
999 | - // now if they want to use international email addresses |
|
1000 | - if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) { |
|
1001 | - // in case we need to reset their email validation level, |
|
1002 | - // make sure that the previous value wasn't already set to one of the i18n options. |
|
1003 | - if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) { |
|
1004 | - // if so, then reset it back to "basic" since that is the only other option that, |
|
1005 | - // despite offering poor validation, supports i18n email addresses |
|
1006 | - $prev_email_validation_level = 'basic'; |
|
1007 | - } |
|
1008 | - // confirm our i18n email validation will work on the server |
|
1009 | - if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) { |
|
1010 | - // or reset email validation level to previous value |
|
1011 | - $email_validation_level = $prev_email_validation_level; |
|
1012 | - } |
|
1013 | - } |
|
1014 | - $EE_Registration_Config->email_validation_level = $email_validation_level; |
|
1015 | - } else { |
|
998 | + $email_validation_level = $valid_data['email_validation_level']; |
|
999 | + // now if they want to use international email addresses |
|
1000 | + if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) { |
|
1001 | + // in case we need to reset their email validation level, |
|
1002 | + // make sure that the previous value wasn't already set to one of the i18n options. |
|
1003 | + if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) { |
|
1004 | + // if so, then reset it back to "basic" since that is the only other option that, |
|
1005 | + // despite offering poor validation, supports i18n email addresses |
|
1006 | + $prev_email_validation_level = 'basic'; |
|
1007 | + } |
|
1008 | + // confirm our i18n email validation will work on the server |
|
1009 | + if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) { |
|
1010 | + // or reset email validation level to previous value |
|
1011 | + $email_validation_level = $prev_email_validation_level; |
|
1012 | + } |
|
1013 | + } |
|
1014 | + $EE_Registration_Config->email_validation_level = $email_validation_level; |
|
1015 | + } else { |
|
1016 | 1016 | EE_Error::add_error( |
1017 | 1017 | esc_html__( |
1018 | 1018 | 'Invalid or missing Email Validation settings. Please refresh the form and try again.', |
1019 | 1019 | 'event_espresso' |
1020 | 1020 | ), |
1021 | - __FILE__, __FUNCTION__, __LINE__ |
|
1022 | - ); |
|
1021 | + __FILE__, __FUNCTION__, __LINE__ |
|
1022 | + ); |
|
1023 | 1023 | } |
1024 | 1024 | } else { |
1025 | 1025 | if ( $email_validation_settings_form->submission_error_message() !== '' ) { |
1026 | 1026 | EE_Error::add_error( |
1027 | 1027 | $email_validation_settings_form->submission_error_message(), |
1028 | - __FILE__, __FUNCTION__, __LINE__ |
|
1029 | - ); |
|
1028 | + __FILE__, __FUNCTION__, __LINE__ |
|
1029 | + ); |
|
1030 | 1030 | } |
1031 | 1031 | } |
1032 | 1032 | } |
@@ -1038,61 +1038,61 @@ discard block |
||
1038 | 1038 | |
1039 | 1039 | |
1040 | 1040 | |
1041 | - /** |
|
1042 | - * confirms that the server's PHP version has the PCRE module enabled, |
|
1043 | - * and that the PCRE version works with our i18n email validation |
|
1044 | - * |
|
1045 | - * @param \EE_Registration_Config $EE_Registration_Config |
|
1046 | - * @param string $email_validation_level |
|
1047 | - * @return bool |
|
1048 | - */ |
|
1049 | - private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level) |
|
1050 | - { |
|
1051 | - // first check that PCRE is enabled |
|
1052 | - if ( ! defined('PREG_BAD_UTF8_ERROR')) { |
|
1053 | - EE_Error::add_error( |
|
1054 | - sprintf( |
|
1055 | - esc_html__( |
|
1056 | - 'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.', |
|
1057 | - 'event_espresso' |
|
1058 | - ), |
|
1059 | - '<br />' |
|
1060 | - ), |
|
1061 | - __FILE__, |
|
1062 | - __FUNCTION__, |
|
1063 | - __LINE__ |
|
1064 | - ); |
|
1065 | - return false; |
|
1066 | - } else { |
|
1067 | - // PCRE support is enabled, but let's still |
|
1068 | - // perform a test to see if the server will support it. |
|
1069 | - // but first, save the updated validation level to the config, |
|
1070 | - // so that the validation strategy picks it up. |
|
1071 | - // this will get bumped back down if it doesn't work |
|
1072 | - $EE_Registration_Config->email_validation_level = $email_validation_level; |
|
1073 | - try { |
|
1074 | - $email_validator = new EE_Email_Validation_Strategy(); |
|
1075 | - $i18n_email_address = apply_filters( |
|
1076 | - 'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address', |
|
1077 | - 'jägerjü[email protected]' |
|
1078 | - ); |
|
1079 | - $email_validator->validate($i18n_email_address); |
|
1080 | - } catch (Exception $e) { |
|
1081 | - EE_Error::add_error( |
|
1082 | - sprintf( |
|
1083 | - esc_html__( |
|
1084 | - 'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s', |
|
1085 | - 'event_espresso' |
|
1086 | - ), |
|
1087 | - '<br />', |
|
1088 | - '<a href="http://php.net/manual/en/pcre.installation.php" target="_blank">http://php.net/manual/en/pcre.installation.php</a>' |
|
1089 | - ), |
|
1090 | - __FILE__, __FUNCTION__, __LINE__ |
|
1091 | - ); |
|
1092 | - return false; |
|
1093 | - } |
|
1094 | - } |
|
1095 | - return true; |
|
1096 | - } |
|
1041 | + /** |
|
1042 | + * confirms that the server's PHP version has the PCRE module enabled, |
|
1043 | + * and that the PCRE version works with our i18n email validation |
|
1044 | + * |
|
1045 | + * @param \EE_Registration_Config $EE_Registration_Config |
|
1046 | + * @param string $email_validation_level |
|
1047 | + * @return bool |
|
1048 | + */ |
|
1049 | + private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level) |
|
1050 | + { |
|
1051 | + // first check that PCRE is enabled |
|
1052 | + if ( ! defined('PREG_BAD_UTF8_ERROR')) { |
|
1053 | + EE_Error::add_error( |
|
1054 | + sprintf( |
|
1055 | + esc_html__( |
|
1056 | + 'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.', |
|
1057 | + 'event_espresso' |
|
1058 | + ), |
|
1059 | + '<br />' |
|
1060 | + ), |
|
1061 | + __FILE__, |
|
1062 | + __FUNCTION__, |
|
1063 | + __LINE__ |
|
1064 | + ); |
|
1065 | + return false; |
|
1066 | + } else { |
|
1067 | + // PCRE support is enabled, but let's still |
|
1068 | + // perform a test to see if the server will support it. |
|
1069 | + // but first, save the updated validation level to the config, |
|
1070 | + // so that the validation strategy picks it up. |
|
1071 | + // this will get bumped back down if it doesn't work |
|
1072 | + $EE_Registration_Config->email_validation_level = $email_validation_level; |
|
1073 | + try { |
|
1074 | + $email_validator = new EE_Email_Validation_Strategy(); |
|
1075 | + $i18n_email_address = apply_filters( |
|
1076 | + 'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address', |
|
1077 | + 'jägerjü[email protected]' |
|
1078 | + ); |
|
1079 | + $email_validator->validate($i18n_email_address); |
|
1080 | + } catch (Exception $e) { |
|
1081 | + EE_Error::add_error( |
|
1082 | + sprintf( |
|
1083 | + esc_html__( |
|
1084 | + 'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s', |
|
1085 | + 'event_espresso' |
|
1086 | + ), |
|
1087 | + '<br />', |
|
1088 | + '<a href="http://php.net/manual/en/pcre.installation.php" target="_blank">http://php.net/manual/en/pcre.installation.php</a>' |
|
1089 | + ), |
|
1090 | + __FILE__, __FUNCTION__, __LINE__ |
|
1091 | + ); |
|
1092 | + return false; |
|
1093 | + } |
|
1094 | + } |
|
1095 | + return true; |
|
1096 | + } |
|
1097 | 1097 | |
1098 | 1098 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
37 | 37 | * @access public |
38 | 38 | */ |
39 | - public function __construct( $routing = TRUE ) { |
|
40 | - define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS ); |
|
41 | - define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS ); |
|
42 | - define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' ); |
|
43 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS ); |
|
44 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' ); |
|
45 | - parent::__construct( $routing ); |
|
39 | + public function __construct($routing = TRUE) { |
|
40 | + define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS); |
|
41 | + define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS); |
|
42 | + define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/'); |
|
43 | + define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS); |
|
44 | + define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/'); |
|
45 | + parent::__construct($routing); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function _extend_page_config() { |
54 | 54 | $this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN; |
55 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
56 | - $qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0; |
|
55 | + $qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
56 | + $qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0; |
|
57 | 57 | |
58 | 58 | $new_page_routes = array( |
59 | 59 | 'question_groups' => array( |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'func' => '_trash_or_restore_questions', |
87 | 87 | 'capability' => 'ee_delete_question', |
88 | 88 | 'obj_id' => $qst_id, |
89 | - 'args' => array( 'trash' => FALSE ), |
|
89 | + 'args' => array('trash' => FALSE), |
|
90 | 90 | 'noheader' => TRUE |
91 | 91 | ), |
92 | 92 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | 'trash_question_group' => array( |
147 | 147 | 'func' => '_trash_or_restore_question_groups', |
148 | - 'args' => array( 'trash' => TRUE ), |
|
148 | + 'args' => array('trash' => TRUE), |
|
149 | 149 | 'capability' => 'ee_delete_question_group', |
150 | 150 | 'obj_id' => $qsg_id, |
151 | 151 | 'noheader' => TRUE |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | 'restore_question_group' => array( |
155 | 155 | 'func' => '_trash_or_restore_question_groups', |
156 | - 'args' => array( 'trash' => FALSE ), |
|
156 | + 'args' => array('trash' => FALSE), |
|
157 | 157 | 'capability' => 'ee_delete_question_group', |
158 | 158 | 'obj_id' => $qsg_id, |
159 | 159 | 'noheader' => TRUE |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | 'update_question_group' => array( |
170 | 170 | 'func' => '_insert_or_update_question_group', |
171 | - 'args' => array('new_question_group' => FALSE ), |
|
171 | + 'args' => array('new_question_group' => FALSE), |
|
172 | 172 | 'capability' => 'ee_edit_question_group', |
173 | 173 | 'obj_id' => $qsg_id, |
174 | 174 | 'noheader' => TRUE, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | 'noheader' => TRUE |
207 | 207 | ), |
208 | 208 | ); |
209 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
209 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
210 | 210 | |
211 | 211 | $new_page_config = array( |
212 | 212 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | 'filename' => 'registration_form_question_groups_views_bulk_actions_search' |
231 | 231 | ), |
232 | 232 | ), |
233 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
233 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
234 | 234 | 'metaboxes' => $this->_default_espresso_metaboxes, |
235 | 235 | 'require_nonce' => FALSE, |
236 | 236 | 'qtips' => array( |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | 'order' => 5, |
245 | 245 | 'persistent' => FALSE |
246 | 246 | ), |
247 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
247 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
248 | 248 | 'help_tabs' => array( |
249 | 249 | 'registration_form_add_question_help_tab' => array( |
250 | 250 | 'title' => esc_html__('Add Question', 'event_espresso'), |
251 | 251 | 'filename' => 'registration_form_add_question' |
252 | 252 | ), |
253 | 253 | ), |
254 | - 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
254 | + 'help_tour' => array('Registration_Form_Add_Question_Help_Tour'), |
|
255 | 255 | 'require_nonce' => FALSE |
256 | 256 | ), |
257 | 257 | |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | 'order' => 5, |
262 | 262 | 'persistent' => FALSE |
263 | 263 | ), |
264 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
264 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
265 | 265 | 'help_tabs' => array( |
266 | 266 | 'registration_form_add_question_group_help_tab' => array( |
267 | 267 | 'title' => esc_html__('Add Question Group', 'event_espresso'), |
268 | 268 | 'filename' => 'registration_form_add_question_group' |
269 | 269 | ), |
270 | 270 | ), |
271 | - 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
271 | + 'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'), |
|
272 | 272 | 'require_nonce' => FALSE |
273 | 273 | ), |
274 | 274 | |
@@ -277,16 +277,16 @@ discard block |
||
277 | 277 | 'label' => esc_html__('Edit Question Group', 'event_espresso'), |
278 | 278 | 'order' => 5, |
279 | 279 | 'persistent' => FALSE, |
280 | - 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
280 | + 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
281 | 281 | ), |
282 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
282 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
283 | 283 | 'help_tabs' => array( |
284 | 284 | 'registration_form_edit_question_group_help_tab' => array( |
285 | 285 | 'title' => esc_html__('Edit Question Group', 'event_espresso'), |
286 | 286 | 'filename' => 'registration_form_edit_question_group' |
287 | 287 | ), |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
289 | + 'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'), |
|
290 | 290 | 'require_nonce' => FALSE |
291 | 291 | ), |
292 | 292 | |
@@ -298,19 +298,19 @@ discard block |
||
298 | 298 | 'labels' => array( |
299 | 299 | 'publishbox' => esc_html__('Update Settings', 'event_espresso') |
300 | 300 | ), |
301 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
301 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
302 | 302 | 'help_tabs' => array( |
303 | 303 | 'registration_form_reg_form_settings_help_tab' => array( |
304 | 304 | 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
305 | 305 | 'filename' => 'registration_form_reg_form_settings' |
306 | 306 | ), |
307 | 307 | ), |
308 | - 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
308 | + 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
309 | 309 | 'require_nonce' => FALSE |
310 | 310 | ) |
311 | 311 | |
312 | 312 | ); |
313 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
313 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
314 | 314 | |
315 | 315 | //change the list table we're going to use so it's the NEW list table! |
316 | 316 | $this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table'; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | 'edit_question_group' => esc_html__('Edit Question Group', 'event_espresso'), |
325 | 325 | 'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'), |
326 | 326 | ); |
327 | - $this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels ); |
|
327 | + $this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels); |
|
328 | 328 | |
329 | 329 | } |
330 | 330 | |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | |
334 | 334 | |
335 | 335 | protected function _ajax_hooks() { |
336 | - add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' )); |
|
336 | + add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order')); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
340 | 340 | |
341 | 341 | |
342 | 342 | public function load_scripts_styles_question_groups() { |
343 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
343 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @return void |
362 | 362 | */ |
363 | 363 | public function load_sortable_question_script() { |
364 | - wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
364 | + wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
365 | 365 | wp_enqueue_script('ee-question-sortable'); |
366 | 366 | } |
367 | 367 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | ) |
381 | 381 | ); |
382 | 382 | |
383 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
383 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
384 | 384 | $this->_views['trash'] = array( |
385 | 385 | 'slug' => 'trash', |
386 | 386 | 'label' => esc_html__('Trash', 'event_espresso'), |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | ) |
411 | 411 | ); |
412 | 412 | |
413 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) { |
|
413 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) { |
|
414 | 414 | $this->_views['trash'] = array( |
415 | 415 | 'slug' => 'trash', |
416 | 416 | 'label' => esc_html__('Trash', 'event_espresso'), |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | |
430 | 430 | |
431 | 431 | protected function _questions_overview_list_table() { |
432 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
432 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
433 | 433 | 'add_question', |
434 | 434 | 'add_question', |
435 | 435 | array(), |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | protected function _question_groups_overview_list_table() { |
444 | 444 | $this->_search_btn_label = esc_html__('Question Groups', 'event_espresso'); |
445 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
445 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
446 | 446 | 'add_question_group', |
447 | 447 | 'add_question_group', |
448 | 448 | array(), |
@@ -456,24 +456,24 @@ discard block |
||
456 | 456 | |
457 | 457 | |
458 | 458 | |
459 | - protected function _delete_question(){ |
|
460 | - $success = $this->_delete_items( $this->_question_model ); |
|
459 | + protected function _delete_question() { |
|
460 | + $success = $this->_delete_items($this->_question_model); |
|
461 | 461 | $this->_redirect_after_action( |
462 | 462 | $success, |
463 | - $this->_question_model->item_name( $success ), |
|
463 | + $this->_question_model->item_name($success), |
|
464 | 464 | 'deleted', |
465 | - array( 'action' => 'default', 'status' => 'all' ) |
|
465 | + array('action' => 'default', 'status' => 'all') |
|
466 | 466 | ); |
467 | 467 | } |
468 | 468 | |
469 | 469 | |
470 | 470 | protected function _delete_questions() { |
471 | - $success = $this->_delete_items( $this->_question_model ); |
|
471 | + $success = $this->_delete_items($this->_question_model); |
|
472 | 472 | $this->_redirect_after_action( |
473 | 473 | $success, |
474 | - $this->_question_model->item_name( $success ), |
|
474 | + $this->_question_model->item_name($success), |
|
475 | 475 | 'deleted permanently', |
476 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
476 | + array('action' => 'default', 'status' => 'trash') |
|
477 | 477 | ); |
478 | 478 | } |
479 | 479 | |
@@ -484,26 +484,26 @@ discard block |
||
484 | 484 | * @param EEM_Soft_Delete_Base $model |
485 | 485 | * @return int number of items deleted permanently |
486 | 486 | */ |
487 | - private function _delete_items(EEM_Soft_Delete_Base $model){ |
|
487 | + private function _delete_items(EEM_Soft_Delete_Base $model) { |
|
488 | 488 | $success = 0; |
489 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
490 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
489 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
490 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
491 | 491 | // if array has more than one element than success message should be plural |
492 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
492 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
493 | 493 | // cycle thru bulk action checkboxes |
494 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
495 | - if ( ! $this->_delete_item( $ID, $model ) ) { |
|
494 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
495 | + if ( ! $this->_delete_item($ID, $model)) { |
|
496 | 496 | $success = 0; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
500 | - }elseif( !empty($this->_req_data['QSG_ID'])){ |
|
501 | - $success = $this->_delete_item( $this->_req_data['QSG_ID'], $model ); |
|
500 | + }elseif ( ! empty($this->_req_data['QSG_ID'])) { |
|
501 | + $success = $this->_delete_item($this->_req_data['QSG_ID'], $model); |
|
502 | 502 | |
503 | - }elseif( !empty($this->_req_data['QST_ID'])){ |
|
504 | - $success = $this->_delete_item( $this->_req_data['QST_ID'], $model ); |
|
505 | - }else{ |
|
506 | - EE_Error::add_error( sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ ); |
|
503 | + }elseif ( ! empty($this->_req_data['QST_ID'])) { |
|
504 | + $success = $this->_delete_item($this->_req_data['QST_ID'], $model); |
|
505 | + } else { |
|
506 | + EE_Error::add_error(sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__); |
|
507 | 507 | } |
508 | 508 | return $success; |
509 | 509 | } |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | * @param EEM_Soft_Delete_Base $model |
515 | 515 | * @return boolean |
516 | 516 | */ |
517 | - protected function _delete_item( $id, $model ) { |
|
518 | - if( $model instanceof EEM_Question ) { |
|
519 | - EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) ); |
|
517 | + protected function _delete_item($id, $model) { |
|
518 | + if ($model instanceof EEM_Question) { |
|
519 | + EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id)))); |
|
520 | 520 | } |
521 | - return $model->delete_permanently_by_ID( absint( $id ) ); |
|
521 | + return $model->delete_permanently_by_ID(absint($id)); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | |
@@ -530,41 +530,41 @@ discard block |
||
530 | 530 | |
531 | 531 | |
532 | 532 | |
533 | - protected function _edit_question_group( $type = 'add' ) { |
|
534 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
535 | - $ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE; |
|
533 | + protected function _edit_question_group($type = 'add') { |
|
534 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
535 | + $ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE; |
|
536 | 536 | |
537 | - switch( $this->_req_action ) { |
|
537 | + switch ($this->_req_action) { |
|
538 | 538 | case 'add_question_group' : |
539 | - $this->_admin_page_title = esc_html__( 'Add Question Group', 'event_espresso' ); |
|
539 | + $this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso'); |
|
540 | 540 | break; |
541 | 541 | case 'edit_question_group' : |
542 | - $this->_admin_page_title = esc_html__( 'Edit Question Group', 'event_espresso' ); |
|
542 | + $this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso'); |
|
543 | 543 | break; |
544 | 544 | default : |
545 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
545 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
546 | 546 | } |
547 | 547 | // add ID to title if editing |
548 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
549 | - if($ID){ |
|
548 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
549 | + if ($ID) { |
|
550 | 550 | /** @var EE_Question_Group $questionGroup */ |
551 | - $questionGroup=$this->_question_group_model->get_one_by_ID( $ID); |
|
552 | - $additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
551 | + $questionGroup = $this->_question_group_model->get_one_by_ID($ID); |
|
552 | + $additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
553 | 553 | $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); |
554 | - }else{ |
|
554 | + } else { |
|
555 | 555 | /** @var EE_Question_Group $questionGroup */ |
556 | 556 | $questionGroup = EEM_Question_Group::instance()->create_default_object(); |
557 | 557 | $questionGroup->set_order_to_latest(); |
558 | 558 | $this->_set_add_edit_form_tags('insert_question_group'); |
559 | 559 | } |
560 | 560 | $this->_template_args['values'] = $this->_yes_no_values; |
561 | - $this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group(); |
|
562 | - $this->_template_args['QSG_ID']=$ID ? $ID : TRUE; |
|
563 | - $this->_template_args['question_group']=$questionGroup; |
|
561 | + $this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group(); |
|
562 | + $this->_template_args['QSG_ID'] = $ID ? $ID : TRUE; |
|
563 | + $this->_template_args['question_group'] = $questionGroup; |
|
564 | 564 | |
565 | - $redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url ); |
|
566 | - $this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL ); |
|
567 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
565 | + $redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url); |
|
566 | + $this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL); |
|
567 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE); |
|
568 | 568 | |
569 | 569 | // the details template wrapper |
570 | 570 | $this->display_admin_page_with_sidebar(); |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | |
576 | 576 | protected function _delete_question_groups() { |
577 | 577 | $success = $this->_delete_items($this->_question_group_model); |
578 | - $this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' )); |
|
578 | + $this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash')); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -583,71 +583,71 @@ discard block |
||
583 | 583 | /** |
584 | 584 | * @param bool $new_question_group |
585 | 585 | */ |
586 | - protected function _insert_or_update_question_group( $new_question_group = TRUE) { |
|
587 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
588 | - $set_column_values=$this->_set_column_values_for($this->_question_group_model); |
|
589 | - if ( $new_question_group ){ |
|
586 | + protected function _insert_or_update_question_group($new_question_group = TRUE) { |
|
587 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
588 | + $set_column_values = $this->_set_column_values_for($this->_question_group_model); |
|
589 | + if ($new_question_group) { |
|
590 | 590 | $QSG_ID = $this->_question_group_model->insert($set_column_values); |
591 | 591 | $success = $QSG_ID ? 1 : 0; |
592 | 592 | } else { |
593 | 593 | $QSG_ID = absint($this->_req_data['QSG_ID']); |
594 | - unset( $set_column_values[ 'QSG_ID' ] ); |
|
595 | - $success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID ))); |
|
594 | + unset($set_column_values['QSG_ID']); |
|
595 | + $success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID))); |
|
596 | 596 | } |
597 | - $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone ); |
|
597 | + $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone); |
|
598 | 598 | // update the existing related questions |
599 | 599 | // BUT FIRST... delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group) |
600 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) { |
|
600 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) { |
|
601 | 601 | // delete where QST ID = system phone question ID and Question Group ID is NOT this group |
602 | - EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID )))); |
|
602 | + EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID)))); |
|
603 | 603 | } |
604 | 604 | /** @type EE_Question_Group $question_group */ |
605 | - $question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID ); |
|
605 | + $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID); |
|
606 | 606 | $questions = $question_group->questions(); |
607 | 607 | // make sure system phone question is added to list of questions for this group |
608 | - if ( ! isset( $questions[$phone_question_id ] )) { |
|
609 | - $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id ); |
|
608 | + if ( ! isset($questions[$phone_question_id])) { |
|
609 | + $questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id); |
|
610 | 610 | } |
611 | 611 | |
612 | - foreach( $questions as $question_ID => $question ){ |
|
612 | + foreach ($questions as $question_ID => $question) { |
|
613 | 613 | // first we always check for order. |
614 | - if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){ |
|
614 | + if ( ! empty($this->_req_data['question_orders'][$question_ID])) { |
|
615 | 615 | //update question order |
616 | - $question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] ); |
|
616 | + $question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | // then we always check if adding or removing. |
620 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) { |
|
621 | - $question_group->add_question( $question_ID ); |
|
620 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) { |
|
621 | + $question_group->add_question($question_ID); |
|
622 | 622 | } else { |
623 | 623 | // not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it) |
624 | 624 | if ( |
625 | 625 | in_array( |
626 | 626 | $question->system_ID(), |
627 | - EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() ) |
|
627 | + EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group()) |
|
628 | 628 | ) |
629 | 629 | ) { |
630 | 630 | continue; |
631 | 631 | } else { |
632 | - $question_group->remove_question( $question_ID ); |
|
632 | + $question_group->remove_question($question_ID); |
|
633 | 633 | } |
634 | 634 | } |
635 | 635 | } |
636 | 636 | // save new related questions |
637 | - if ( isset( $this->_req_data['questions'] )) { |
|
638 | - foreach( $this->_req_data['questions'] as $QST_ID ){ |
|
639 | - $question_group->add_question( $QST_ID ); |
|
640 | - if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) { |
|
641 | - $question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] ); |
|
637 | + if (isset($this->_req_data['questions'])) { |
|
638 | + foreach ($this->_req_data['questions'] as $QST_ID) { |
|
639 | + $question_group->add_question($QST_ID); |
|
640 | + if (isset($this->_req_data['question_orders'][$QST_ID])) { |
|
641 | + $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]); |
|
642 | 642 | } |
643 | 643 | } |
644 | 644 | } |
645 | 645 | |
646 | - if ( $success !== FALSE ) { |
|
647 | - $msg = $new_question_group ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() ); |
|
648 | - EE_Error::add_success( $msg ); |
|
646 | + if ($success !== FALSE) { |
|
647 | + $msg = $new_question_group ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name()); |
|
648 | + EE_Error::add_success($msg); |
|
649 | 649 | } |
650 | - $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE); |
|
650 | + $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE); |
|
651 | 651 | |
652 | 652 | } |
653 | 653 | |
@@ -655,20 +655,20 @@ discard block |
||
655 | 655 | * duplicates a question and all its question options and redirects to the new question. |
656 | 656 | */ |
657 | 657 | public function _duplicate_question() { |
658 | - $question_ID = (int)$this->_req_data[ 'QST_ID' ]; |
|
659 | - $question = EEM_Question::instance()->get_one_by_ID( $question_ID ); |
|
660 | - if( $question instanceof EE_Question ) { |
|
658 | + $question_ID = (int) $this->_req_data['QST_ID']; |
|
659 | + $question = EEM_Question::instance()->get_one_by_ID($question_ID); |
|
660 | + if ($question instanceof EE_Question) { |
|
661 | 661 | $new_question = $question->duplicate(); |
662 | - if( $new_question instanceof EE_Question ) { |
|
663 | - $this->_redirect_after_action( true, esc_html__( 'Question', 'event_espresso' ), esc_html__( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE); |
|
662 | + if ($new_question instanceof EE_Question) { |
|
663 | + $this->_redirect_after_action(true, esc_html__('Question', 'event_espresso'), esc_html__('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE); |
|
664 | 664 | } else { |
665 | 665 | global $wpdb; |
666 | - EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ ); |
|
667 | - $this->_redirect_after_action(false, '', '', array('action'=>'default'), false ); |
|
666 | + EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__); |
|
667 | + $this->_redirect_after_action(false, '', '', array('action'=>'default'), false); |
|
668 | 668 | } |
669 | 669 | } else { |
670 | - EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ ); |
|
671 | - $this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false ); |
|
670 | + EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__); |
|
671 | + $this->_redirect_after_action(false, '', '', array('action' => 'default'), false); |
|
672 | 672 | } |
673 | 673 | } |
674 | 674 | |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | /** |
678 | 678 | * @param bool $trash |
679 | 679 | */ |
680 | - protected function _trash_or_restore_question_groups( $trash = TRUE) { |
|
681 | - $this->_trash_or_restore_items( $this->_question_group_model, $trash ); |
|
680 | + protected function _trash_or_restore_question_groups($trash = TRUE) { |
|
681 | + $this->_trash_or_restore_items($this->_question_group_model, $trash); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -686,9 +686,9 @@ discard block |
||
686 | 686 | /** |
687 | 687 | *_trash_question |
688 | 688 | */ |
689 | - protected function _trash_question(){ |
|
690 | - $success=$this->_question_model->delete_by_ID( (int)$this->_req_data['QST_ID'] ); |
|
691 | - $query_args=array('action'=>'default','status'=>'all'); |
|
689 | + protected function _trash_question() { |
|
690 | + $success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']); |
|
691 | + $query_args = array('action'=>'default', 'status'=>'all'); |
|
692 | 692 | $this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args); |
693 | 693 | } |
694 | 694 | |
@@ -697,8 +697,8 @@ discard block |
||
697 | 697 | /** |
698 | 698 | * @param bool $trash |
699 | 699 | */ |
700 | - protected function _trash_or_restore_questions( $trash=TRUE){ |
|
701 | - $this->_trash_or_restore_items( $this->_question_model, $trash ); |
|
700 | + protected function _trash_or_restore_questions($trash = TRUE) { |
|
701 | + $this->_trash_or_restore_items($this->_question_model, $trash); |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | |
@@ -710,21 +710,21 @@ discard block |
||
710 | 710 | *@param EEM_Soft_Delete_Base $model |
711 | 711 | * @param boolean $trash whether to trash or restore |
712 | 712 | */ |
713 | - private function _trash_or_restore_items( EEM_Soft_Delete_Base $model, $trash = TRUE ) { |
|
713 | + private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = TRUE) { |
|
714 | 714 | |
715 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
715 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
716 | 716 | |
717 | 717 | $success = 1; |
718 | 718 | //Checkboxes |
719 | 719 | //echo "trash $trash"; |
720 | 720 | //var_dump($this->_req_data['checkbox']);die; |
721 | - if ( isset( $this->_req_data['checkbox'] )) { |
|
722 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
721 | + if (isset($this->_req_data['checkbox'])) { |
|
722 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
723 | 723 | // if array has more than one element than success message should be plural |
724 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
724 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
725 | 725 | // cycle thru bulk action checkboxes |
726 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
727 | - if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) { |
|
726 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
727 | + if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) { |
|
728 | 728 | $success = 0; |
729 | 729 | } |
730 | 730 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | } else { |
733 | 733 | // grab single id and delete |
734 | 734 | $ID = absint($this->_req_data['checkbox']); |
735 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
735 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
736 | 736 | $success = 0; |
737 | 737 | } |
738 | 738 | } |
@@ -740,25 +740,25 @@ discard block |
||
740 | 740 | } else { |
741 | 741 | // delete via trash link |
742 | 742 | // grab single id and delete |
743 | - $ID = absint($this->_req_data[ $model->primary_key_name() ]); |
|
744 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
743 | + $ID = absint($this->_req_data[$model->primary_key_name()]); |
|
744 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
745 | 745 | $success = 0; |
746 | 746 | } |
747 | 747 | |
748 | 748 | } |
749 | 749 | |
750 | 750 | |
751 | - $action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) ); |
|
751 | + $action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) ); |
|
752 | 752 | //echo "action :$action"; |
753 | 753 | //$action = 'questions' ? 'default' : $action; |
754 | - if($trash){ |
|
754 | + if ($trash) { |
|
755 | 755 | $action_desc = 'trashed'; |
756 | 756 | $status = 'trash'; |
757 | - }else{ |
|
757 | + } else { |
|
758 | 758 | $action_desc = 'restored'; |
759 | 759 | $status = 'all'; |
760 | 760 | } |
761 | - $this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) ); |
|
761 | + $this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status)); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | |
@@ -769,16 +769,16 @@ discard block |
||
769 | 769 | * @param bool|false $count |
770 | 770 | * @return \EE_Soft_Delete_Base_Class[]|int |
771 | 771 | */ |
772 | - public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) { |
|
772 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
773 | 773 | $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
774 | 774 | |
775 | - if( $count ){ |
|
775 | + if ($count) { |
|
776 | 776 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
777 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
778 | - $results=$this->_question_model->count_deleted($where); |
|
779 | - }else{ |
|
777 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
778 | + $results = $this->_question_model->count_deleted($where); |
|
779 | + } else { |
|
780 | 780 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
781 | - $results=$this->_question_model->get_all_deleted($query_params); |
|
781 | + $results = $this->_question_model->get_all_deleted($query_params); |
|
782 | 782 | } |
783 | 783 | return $results; |
784 | 784 | } |
@@ -791,13 +791,13 @@ discard block |
||
791 | 791 | * @param bool|false $count |
792 | 792 | * @return \EE_Soft_Delete_Base_Class[] |
793 | 793 | */ |
794 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
795 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
796 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
797 | - if ($count){ |
|
798 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
794 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
795 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
796 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
797 | + if ($count) { |
|
798 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
799 | 799 | $results = $questionGroupModel->count($where); |
800 | - }else{ |
|
800 | + } else { |
|
801 | 801 | $results = $questionGroupModel->get_all($query_params); |
802 | 802 | } |
803 | 803 | return $results; |
@@ -811,14 +811,14 @@ discard block |
||
811 | 811 | * @param bool $count |
812 | 812 | * @return \EE_Soft_Delete_Base_Class[]|int |
813 | 813 | */ |
814 | - public function get_trashed_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
815 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
816 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
817 | - if($count){ |
|
818 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
814 | + public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
815 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
816 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
817 | + if ($count) { |
|
818 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
819 | 819 | $query_params['limit'] = NULL; |
820 | 820 | $results = $questionGroupModel->count_deleted($where); |
821 | - }else{ |
|
821 | + } else { |
|
822 | 822 | $results = $questionGroupModel->get_all_deleted($query_params); |
823 | 823 | } |
824 | 824 | return $results; |
@@ -831,32 +831,32 @@ discard block |
||
831 | 831 | */ |
832 | 832 | public function update_question_group_order() { |
833 | 833 | |
834 | - $success = esc_html__( 'Question group order was updated successfully.', 'event_espresso' ); |
|
834 | + $success = esc_html__('Question group order was updated successfully.', 'event_espresso'); |
|
835 | 835 | |
836 | 836 | // grab our row IDs |
837 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) |
|
838 | - ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) |
|
837 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) |
|
838 | + ? explode(',', rtrim($this->_req_data['row_ids'], ',')) |
|
839 | 839 | : array(); |
840 | 840 | |
841 | - $perpage = !empty( $this->_req_data['perpage'] ) |
|
841 | + $perpage = ! empty($this->_req_data['perpage']) |
|
842 | 842 | ? (int) $this->_req_data['perpage'] |
843 | 843 | : NULL; |
844 | - $curpage = !empty( $this->_req_data['curpage'] ) |
|
844 | + $curpage = ! empty($this->_req_data['curpage']) |
|
845 | 845 | ? (int) $this->_req_data['curpage'] |
846 | 846 | : NULL; |
847 | 847 | |
848 | - if ( ! empty( $row_ids ) ) { |
|
848 | + if ( ! empty($row_ids)) { |
|
849 | 849 | //figure out where we start the row_id count at for the current page. |
850 | - $qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage; |
|
850 | + $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage; |
|
851 | 851 | |
852 | - $row_count = count( $row_ids ); |
|
853 | - for( $i = 0; $i < $row_count; $i++ ) { |
|
852 | + $row_count = count($row_ids); |
|
853 | + for ($i = 0; $i < $row_count; $i++) { |
|
854 | 854 | //Update the questions when re-ordering |
855 | 855 | $updated = EEM_Question_Group::instance()->update( |
856 | - array( 'QSG_order' => $qsgcount ), |
|
857 | - array( array( 'QSG_ID' => $row_ids[ $i ] ) ) |
|
856 | + array('QSG_order' => $qsgcount), |
|
857 | + array(array('QSG_ID' => $row_ids[$i])) |
|
858 | 858 | ); |
859 | - if ( $updated === false ) { |
|
859 | + if ($updated === false) { |
|
860 | 860 | $success = false; |
861 | 861 | } |
862 | 862 | $qsgcount++; |
@@ -866,10 +866,10 @@ discard block |
||
866 | 866 | } |
867 | 867 | |
868 | 868 | $errors = ! $success |
869 | - ? esc_html__( 'An error occurred. The question group order was not updated.', 'event_espresso' ) |
|
869 | + ? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso') |
|
870 | 870 | : false; |
871 | 871 | |
872 | - echo json_encode( array( 'return_data' => false, 'success' => $success, 'errors' => $errors )); |
|
872 | + echo json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors)); |
|
873 | 873 | die(); |
874 | 874 | |
875 | 875 | } |
@@ -888,17 +888,17 @@ discard block |
||
888 | 888 | $this->_template_args['values'] = $this->_yes_no_values; |
889 | 889 | add_action( |
890 | 890 | 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
891 | - array( $this, 'email_validation_settings_form' ), |
|
891 | + array($this, 'email_validation_settings_form'), |
|
892 | 892 | 2 |
893 | 893 | ); |
894 | - $this->_template_args = (array)apply_filters( |
|
894 | + $this->_template_args = (array) apply_filters( |
|
895 | 895 | 'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', |
896 | 896 | $this->_template_args |
897 | 897 | ); |
898 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
899 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
898 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
899 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
900 | 900 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
901 | - REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php', |
|
901 | + REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php', |
|
902 | 902 | $this->_template_args, |
903 | 903 | TRUE |
904 | 904 | ); |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | EE_Registry::instance()->CFG, |
920 | 920 | __FILE__, __FUNCTION__, __LINE__ |
921 | 921 | ); |
922 | - $this->_redirect_after_action( $success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) ); |
|
922 | + $this->_redirect_after_action($success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings')); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | |
@@ -950,20 +950,20 @@ discard block |
||
950 | 950 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
951 | 951 | 'subsections' => array( |
952 | 952 | 'email_validation_hdr' => new EE_Form_Section_HTML( |
953 | - EEH_HTML::h2( esc_html__( 'Email Validation Settings', 'event_espresso' ) ) |
|
953 | + EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso')) |
|
954 | 954 | ), |
955 | 955 | 'email_validation_level' => new EE_Select_Input( |
956 | 956 | array( |
957 | - 'basic' => esc_html__( 'Basic', 'event_espresso' ), |
|
958 | - 'wp_default' => esc_html__( 'WordPress Default', 'event_espresso' ), |
|
959 | - 'i18n' => esc_html__( 'International', 'event_espresso' ), |
|
960 | - 'i18n_dns' => esc_html__( 'International + DNS Check', 'event_espresso' ), |
|
957 | + 'basic' => esc_html__('Basic', 'event_espresso'), |
|
958 | + 'wp_default' => esc_html__('WordPress Default', 'event_espresso'), |
|
959 | + 'i18n' => esc_html__('International', 'event_espresso'), |
|
960 | + 'i18n_dns' => esc_html__('International + DNS Check', 'event_espresso'), |
|
961 | 961 | ), |
962 | 962 | array( |
963 | - 'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' ) |
|
964 | - . EEH_Template::get_help_tab_link( 'email_validation_info' ), |
|
965 | - 'html_help_text' => esc_html__( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'), |
|
966 | - 'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level ) |
|
963 | + 'html_label_text' => esc_html__('Email Validation Level', 'event_espresso') |
|
964 | + . EEH_Template::get_help_tab_link('email_validation_info'), |
|
965 | + 'html_help_text' => esc_html__('These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'), |
|
966 | + 'default' => isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
|
967 | 967 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
968 | 968 | : 'wp_default', |
969 | 969 | 'required' => false |
@@ -982,25 +982,25 @@ discard block |
||
982 | 982 | * @param \EE_Registration_Config $EE_Registration_Config |
983 | 983 | * @return \EE_Registration_Config |
984 | 984 | */ |
985 | - public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) { |
|
985 | + public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config) { |
|
986 | 986 | $prev_email_validation_level = $EE_Registration_Config->email_validation_level; |
987 | 987 | try { |
988 | 988 | $email_validation_settings_form = $this->_email_validation_settings_form(); |
989 | 989 | // if not displaying a form, then check for form submission |
990 | - if ( $email_validation_settings_form->was_submitted() ) { |
|
990 | + if ($email_validation_settings_form->was_submitted()) { |
|
991 | 991 | // capture form data |
992 | 992 | $email_validation_settings_form->receive_form_submission(); |
993 | 993 | // validate form data |
994 | - if ( $email_validation_settings_form->is_valid() ) { |
|
994 | + if ($email_validation_settings_form->is_valid()) { |
|
995 | 995 | // grab validated data from form |
996 | 996 | $valid_data = $email_validation_settings_form->valid_data(); |
997 | - if ( isset( $valid_data['email_validation_level'] ) ) { |
|
997 | + if (isset($valid_data['email_validation_level'])) { |
|
998 | 998 | $email_validation_level = $valid_data['email_validation_level']; |
999 | 999 | // now if they want to use international email addresses |
1000 | - if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) { |
|
1000 | + if ($email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns') { |
|
1001 | 1001 | // in case we need to reset their email validation level, |
1002 | 1002 | // make sure that the previous value wasn't already set to one of the i18n options. |
1003 | - if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) { |
|
1003 | + if ($prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns') { |
|
1004 | 1004 | // if so, then reset it back to "basic" since that is the only other option that, |
1005 | 1005 | // despite offering poor validation, supports i18n email addresses |
1006 | 1006 | $prev_email_validation_level = 'basic'; |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | ); |
1023 | 1023 | } |
1024 | 1024 | } else { |
1025 | - if ( $email_validation_settings_form->submission_error_message() !== '' ) { |
|
1025 | + if ($email_validation_settings_form->submission_error_message() !== '') { |
|
1026 | 1026 | EE_Error::add_error( |
1027 | 1027 | $email_validation_settings_form->submission_error_message(), |
1028 | 1028 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | } |
1031 | 1031 | } |
1032 | 1032 | } |
1033 | - } catch ( EE_Error $e ) { |
|
1033 | + } catch (EE_Error $e) { |
|
1034 | 1034 | $e->get_error(); |
1035 | 1035 | } |
1036 | 1036 | return $EE_Registration_Config; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->_cpt_edit_routes = array( |
67 | 67 | 'espresso_events' => 'edit' |
68 | 68 | ); |
69 | - add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) ); |
|
69 | + add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit')); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | protected function _ajax_hooks() { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | 'edit' => esc_html__('Update Event', 'event_espresso'), |
93 | 93 | 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
94 | 94 | 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
95 | - 'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ) |
|
95 | + 'template_settings' => esc_html__('Update Settings', 'event_espresso') |
|
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | //load field generator helper |
103 | 103 | |
104 | 104 | //is there a evt_id in the request? |
105 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
106 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
105 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
106 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
107 | 107 | |
108 | 108 | |
109 | 109 | $this->_page_routes = array( |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | 'help_tour' => array( |
318 | 318 | 'Event_Editor_Help_Tour' |
319 | 319 | ), |
320 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
320 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
321 | 321 | 'require_nonce' => FALSE |
322 | 322 | ), |
323 | 323 | 'edit' => array( |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | /*'help_tour' => array( |
374 | 374 | 'Event_Edit_Help_Tour' |
375 | 375 | ),*/ |
376 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
376 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
377 | 377 | 'require_nonce' => FALSE |
378 | 378 | ), |
379 | 379 | 'default_event_settings' => array( |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | 'filename' => 'events_default_settings_status' |
396 | 396 | ) |
397 | 397 | ), |
398 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour'), |
|
398 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
399 | 399 | 'require_nonce' => FALSE |
400 | 400 | ), |
401 | 401 | //template settings |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | 'filename' => 'general_settings_templates' |
412 | 412 | ) |
413 | 413 | ), |
414 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
414 | + 'help_tour' => array('Templates_Help_Tour'), |
|
415 | 415 | 'require_nonce' => FALSE |
416 | 416 | ), |
417 | 417 | //event category stuff |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | 'label' => esc_html__('Edit Category', 'event_espresso'), |
436 | 436 | 'order' => 15, |
437 | 437 | 'persistent' => FALSE, |
438 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
438 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
439 | 439 | ), |
440 | 440 | 'help_tabs' => array( |
441 | 441 | 'edit_category_help_tab' => array( |
@@ -505,14 +505,14 @@ discard block |
||
505 | 505 | |
506 | 506 | public function load_scripts_styles() { |
507 | 507 | |
508 | - wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
509 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
508 | + wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
509 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
510 | 510 | wp_enqueue_style('events-admin-css'); |
511 | 511 | wp_enqueue_style('ee-cat-admin'); |
512 | 512 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
513 | 513 | //registers for all views |
514 | 514 | //scripts |
515 | - wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
515 | + wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | /** |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | public function load_scripts_styles_edit() { |
531 | 531 | //styles |
532 | 532 | wp_enqueue_style('espresso-ui-theme'); |
533 | - wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
533 | + wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
534 | 534 | wp_enqueue_style('event-editor-css'); |
535 | 535 | |
536 | 536 | //scripts |
537 | - wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION ); |
|
537 | + wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION); |
|
538 | 538 | wp_enqueue_script('event-datetime-metabox'); |
539 | 539 | |
540 | 540 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | |
570 | 570 | |
571 | 571 | public function admin_init() { |
572 | - EE_Registry::$i18n_js_strings[ 'image_confirm' ] = esc_html__( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ); |
|
572 | + EE_Registry::$i18n_js_strings['image_confirm'] = esc_html__('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -590,12 +590,12 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function verify_event_edit($event = NULL) { |
592 | 592 | // no event? |
593 | - if ( empty( $event )) { |
|
593 | + if (empty($event)) { |
|
594 | 594 | // set event |
595 | 595 | $event = $this->_cpt_model_obj; |
596 | 596 | } |
597 | 597 | // STILL no event? |
598 | - if ( empty ( $event )) { |
|
598 | + if (empty ($event)) { |
|
599 | 599 | return; |
600 | 600 | } |
601 | 601 | $orig_status = $event->status(); |
@@ -609,27 +609,27 @@ discard block |
||
609 | 609 | return; |
610 | 610 | } |
611 | 611 | //made it here so it IS active... next check that any of the tickets are sold. |
612 | - if ( $event->is_sold_out( true ) ) { |
|
613 | - if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) { |
|
612 | + if ($event->is_sold_out(true)) { |
|
613 | + if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) { |
|
614 | 614 | EE_Error::add_attention( |
615 | 615 | sprintf( |
616 | - esc_html__( '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.', 'event_espresso' ), |
|
617 | - EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' ) |
|
616 | + esc_html__('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.', 'event_espresso'), |
|
617 | + EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence') |
|
618 | 618 | ) |
619 | 619 | ); |
620 | 620 | } |
621 | 621 | return; |
622 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
622 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
623 | 623 | EE_Error::add_attention( |
624 | 624 | sprintf( |
625 | - esc_html__( '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.', |
|
626 | - 'event_espresso' ), |
|
627 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
625 | + esc_html__('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.', |
|
626 | + 'event_espresso'), |
|
627 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
628 | 628 | ) |
629 | 629 | ); |
630 | 630 | } |
631 | 631 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
632 | - if ( ! $event->tickets_on_sale() ) { |
|
632 | + if ( ! $event->tickets_on_sale()) { |
|
633 | 633 | return; |
634 | 634 | } |
635 | 635 | //made it here so show warning |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | */ |
649 | 649 | protected function _edit_event_warning() { |
650 | 650 | // we don't want to add warnings during these requests |
651 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) { |
|
651 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') { |
|
652 | 652 | return; |
653 | 653 | } |
654 | 654 | EE_Error::add_attention( |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | ), |
680 | 680 | ); |
681 | 681 | |
682 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
682 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
683 | 683 | $this->_views['trash'] = array( |
684 | 684 | 'slug' => 'trash', |
685 | 685 | 'label' => esc_html__('Trash', 'event_espresso'), |
@@ -709,39 +709,39 @@ discard block |
||
709 | 709 | 'desc' => esc_html__('View Registrations for Event', 'event_espresso') |
710 | 710 | ) |
711 | 711 | ); |
712 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
712 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
713 | 713 | $statuses = array( |
714 | 714 | 'sold_out_status' => array( |
715 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
716 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' ) |
|
715 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
716 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence') |
|
717 | 717 | ), |
718 | 718 | 'active_status' => array( |
719 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
720 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' ) |
|
719 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
720 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence') |
|
721 | 721 | ), |
722 | 722 | 'upcoming_status' => array( |
723 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
724 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' ) |
|
723 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
724 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence') |
|
725 | 725 | ), |
726 | 726 | 'postponed_status' => array( |
727 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
728 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' ) |
|
727 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
728 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence') |
|
729 | 729 | ), |
730 | 730 | 'cancelled_status' => array( |
731 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
732 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' ) |
|
731 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
732 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence') |
|
733 | 733 | ), |
734 | 734 | 'expired_status' => array( |
735 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
736 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' ) |
|
735 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
736 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence') |
|
737 | 737 | ), |
738 | 738 | 'inactive_status' => array( |
739 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
740 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' ) |
|
739 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
740 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence') |
|
741 | 741 | ) |
742 | 742 | ); |
743 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
744 | - return array_merge( $items, $statuses ); |
|
743 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
744 | + return array_merge($items, $statuses); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -753,8 +753,8 @@ discard block |
||
753 | 753 | * @return EEM_Event |
754 | 754 | */ |
755 | 755 | private function _event_model() { |
756 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
757 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
756 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
757 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
758 | 758 | } |
759 | 759 | return $this->_event_model; |
760 | 760 | } |
@@ -773,12 +773,12 @@ discard block |
||
773 | 773 | * @param string $new_slug what the slug is |
774 | 774 | * @return string The new html string for the permalink area |
775 | 775 | */ |
776 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
776 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
777 | 777 | //make sure this is only when editing |
778 | - if ( !empty( $id ) ) { |
|
779 | - $post = get_post( $id ); |
|
780 | - $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' . esc_html__('Shortcode', 'event_espresso') . '</a> '; |
|
781 | - $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">'; |
|
778 | + if ( ! empty($id)) { |
|
779 | + $post = get_post($id); |
|
780 | + $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">'.esc_html__('Shortcode', 'event_espresso').'</a> '; |
|
781 | + $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">'; |
|
782 | 782 | } |
783 | 783 | return $return; |
784 | 784 | } |
@@ -794,10 +794,10 @@ discard block |
||
794 | 794 | * @return string html for generated table |
795 | 795 | */ |
796 | 796 | protected function _events_overview_list_table() { |
797 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
798 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), esc_html__("View Event Archive Page", "event_espresso"), 'button' ) . |
|
797 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
798 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), esc_html__("View Event Archive Page", "event_espresso"), 'button'). |
|
799 | 799 | $this->_display_legend($this->_event_legend_items()); |
800 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
800 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
801 | 801 | $this->display_admin_list_table_page_with_no_sidebar(); |
802 | 802 | } |
803 | 803 | |
@@ -813,51 +813,51 @@ discard block |
||
813 | 813 | |
814 | 814 | |
815 | 815 | |
816 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
816 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
817 | 817 | |
818 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
818 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
819 | 819 | //getout we're not processing an event save. |
820 | 820 | return; |
821 | 821 | } |
822 | 822 | |
823 | 823 | $event_values = array( |
824 | - 'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
825 | - 'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
824 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
825 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
826 | 826 | 'EVT_additional_limit' => min( |
827 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
828 | - !empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ), |
|
829 | - 'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
830 | - 'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
831 | - 'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
832 | - 'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL, |
|
833 | - 'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL, |
|
834 | - 'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL |
|
827 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
828 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ), |
|
829 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
830 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
831 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
832 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL, |
|
833 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL, |
|
834 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL |
|
835 | 835 | ); |
836 | 836 | |
837 | 837 | //update event |
838 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
838 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
839 | 839 | |
840 | 840 | |
841 | 841 | //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! |
842 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
843 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
842 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
843 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
844 | 844 | |
845 | 845 | |
846 | 846 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
847 | - $event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) ); |
|
847 | + $event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))); |
|
848 | 848 | |
849 | 849 | $att_success = TRUE; |
850 | 850 | |
851 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
852 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
853 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
851 | + foreach ($event_update_callbacks as $e_callback) { |
|
852 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
853 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | //any errors? |
857 | - if ( $success && FALSE === $att_success ) { |
|
858 | - EE_Error::add_error( esc_html__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
859 | - } else if ( $success === FALSE ) { |
|
860 | - EE_Error::add_error( esc_html__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + if ($success && FALSE === $att_success) { |
|
858 | + EE_Error::add_error(esc_html__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
859 | + } else if ($success === FALSE) { |
|
860 | + EE_Error::add_error(esc_html__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | |
@@ -867,14 +867,14 @@ discard block |
||
867 | 867 | /** |
868 | 868 | * @see parent::restore_item() |
869 | 869 | */ |
870 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
870 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
871 | 871 | //copy existing event meta to new post |
872 | 872 | $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
873 | - if ( $post_evt instanceof EE_Event ) { |
|
873 | + if ($post_evt instanceof EE_Event) { |
|
874 | 874 | //meta revision restore |
875 | - $post_evt->restore_revision( $revision_id ); |
|
875 | + $post_evt->restore_revision($revision_id); |
|
876 | 876 | //related objs restore |
877 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
877 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
@@ -887,52 +887,52 @@ discard block |
||
887 | 887 | * @param array $data The request data from the form |
888 | 888 | * @return bool Success or fail. |
889 | 889 | */ |
890 | - protected function _default_venue_update( $evtobj, $data ) { |
|
891 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
890 | + protected function _default_venue_update($evtobj, $data) { |
|
891 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
892 | 892 | $venue_model = EE_Registry::instance()->load_model('Venue'); |
893 | 893 | $rows_affected = NULL; |
894 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
894 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
895 | 895 | |
896 | 896 | // very important. If we don't have a venue name... |
897 | 897 | // then we'll get out because not necessary to create empty venue |
898 | - if ( empty( $data['venue_title'] ) ) { |
|
898 | + if (empty($data['venue_title'])) { |
|
899 | 899 | return false; |
900 | 900 | } |
901 | 901 | |
902 | 902 | $venue_array = array( |
903 | 903 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
904 | - 'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL, |
|
905 | - 'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL, |
|
906 | - 'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL, |
|
907 | - 'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL, |
|
908 | - 'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL, |
|
909 | - 'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL, |
|
910 | - 'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL, |
|
911 | - 'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL, |
|
912 | - 'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL, |
|
913 | - 'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL, |
|
914 | - 'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL, |
|
915 | - 'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL, |
|
916 | - 'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL, |
|
917 | - 'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
918 | - 'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL, |
|
919 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
904 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL, |
|
905 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL, |
|
906 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL, |
|
907 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL, |
|
908 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL, |
|
909 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL, |
|
910 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL, |
|
911 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL, |
|
912 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL, |
|
913 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL, |
|
914 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL, |
|
915 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL, |
|
916 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL, |
|
917 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
918 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL, |
|
919 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
920 | 920 | 'status' => 'publish' |
921 | 921 | ); |
922 | 922 | |
923 | 923 | |
924 | 924 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
925 | - if ( !empty( $venue_id ) ) { |
|
926 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
927 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
925 | + if ( ! empty($venue_id)) { |
|
926 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
927 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
928 | 928 | //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. |
929 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
929 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
930 | 930 | return $rows_affected > 0 ? TRUE : FALSE; |
931 | 931 | } else { |
932 | 932 | //we insert the venue |
933 | - $venue_id = $venue_model->insert( $venue_array ); |
|
934 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
935 | - return !empty( $venue_id ) ? TRUE : FALSE; |
|
933 | + $venue_id = $venue_model->insert($venue_array); |
|
934 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
935 | + return ! empty($venue_id) ? TRUE : FALSE; |
|
936 | 936 | } |
937 | 937 | //when we have the ancestor come in it's already been handled by the revision save. |
938 | 938 | } |
@@ -946,54 +946,54 @@ discard block |
||
946 | 946 | * @param array $data The request data from the form |
947 | 947 | * @return bool success or fail |
948 | 948 | */ |
949 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
949 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
950 | 950 | $success = true; |
951 | 951 | $saved_dtt = null; |
952 | 952 | $saved_tickets = array(); |
953 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
953 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
954 | 954 | |
955 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
955 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
956 | 956 | //trim all values to ensure any excess whitespace is removed. |
957 | - $dtt = array_map( 'trim', $dtt ); |
|
958 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
957 | + $dtt = array_map('trim', $dtt); |
|
958 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
959 | 959 | $datetime_values = array( |
960 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
960 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
961 | 961 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
962 | 962 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
963 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
963 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
964 | 964 | 'DTT_order' => $row, |
965 | 965 | ); |
966 | 966 | |
967 | 967 | //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. |
968 | 968 | |
969 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
970 | - $DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
971 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
972 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
973 | - foreach ( $datetime_values as $field => $value ) { |
|
974 | - $DTM->set( $field, $value ); |
|
969 | + if ( ! empty($dtt['DTT_ID'])) { |
|
970 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']); |
|
971 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
972 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
973 | + foreach ($datetime_values as $field => $value) { |
|
974 | + $DTM->set($field, $value); |
|
975 | 975 | } |
976 | 976 | |
977 | 977 | //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. |
978 | 978 | $saved_dtts[$DTM->ID()] = $DTM; |
979 | 979 | } else { |
980 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE ); |
|
981 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
982 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
983 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
984 | - foreach ( $datetime_values as $field => $value ) { |
|
985 | - $DTM->set( $field, $value ); |
|
980 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE); |
|
981 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
982 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
983 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
984 | + foreach ($datetime_values as $field => $value) { |
|
985 | + $DTM->set($field, $value); |
|
986 | 986 | } |
987 | 987 | } |
988 | 988 | $DTM->save(); |
989 | 989 | |
990 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
990 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
991 | 991 | |
992 | 992 | //load DTT helper |
993 | 993 | |
994 | 994 | //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. |
995 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
996 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
995 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
996 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
997 | 997 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
998 | 998 | $DTT->save(); |
999 | 999 | } |
@@ -1001,45 +1001,45 @@ discard block |
||
1001 | 1001 | //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. |
1002 | 1002 | $saved_dtt = $DTT; |
1003 | 1003 | |
1004 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
1004 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | //no dtts get deleted so we don't do any of that logic here. |
1008 | 1008 | //update tickets next |
1009 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
1010 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1011 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1009 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1010 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1011 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1012 | 1012 | $update_prices = false; |
1013 | - $ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1013 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1014 | 1014 | |
1015 | 1015 | // trim inputs to ensure any excess whitespace is removed. |
1016 | - $tkt = array_map( 'trim', $tkt ); |
|
1016 | + $tkt = array_map('trim', $tkt); |
|
1017 | 1017 | |
1018 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1018 | + if (empty($tkt['TKT_start_date'])) { |
|
1019 | 1019 | //let's use now in the set timezone. |
1020 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1021 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1020 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1021 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1024 | + if (empty($tkt['TKT_end_date'])) { |
|
1025 | 1025 | //use the start date of the first datetime |
1026 | 1026 | $dtt = $evtobj->first_datetime(); |
1027 | - $tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] ); |
|
1027 | + $tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | $TKT_values = array( |
1031 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
1032 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1033 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1034 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1031 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
1032 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1033 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1034 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1035 | 1035 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1036 | 1036 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1037 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1038 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ], |
|
1039 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1040 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1037 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1038 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1039 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1040 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1041 | 1041 | 'TKT_row' => $row, |
1042 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1042 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1043 | 1043 | 'TKT_price' => $ticket_price |
1044 | 1044 | ); |
1045 | 1045 | |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | |
1048 | 1048 | |
1049 | 1049 | //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. |
1050 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1050 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1051 | 1051 | $TKT_values['TKT_ID'] = 0; |
1052 | 1052 | $TKT_values['TKT_is_default'] = 0; |
1053 | 1053 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1058,58 +1058,58 @@ discard block |
||
1058 | 1058 | //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. |
1059 | 1059 | //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. |
1060 | 1060 | |
1061 | - if ( !empty( $tkt['TKT_ID'] ) ) { |
|
1062 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1063 | - if ( $TKT instanceof EE_Ticket ) { |
|
1064 | - $ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
1061 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1062 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']); |
|
1063 | + if ($TKT instanceof EE_Ticket) { |
|
1064 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
1065 | 1065 | //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. |
1066 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false; |
|
1067 | - $TKT->set_date_format( $incoming_date_formats[ 0 ] ); |
|
1068 | - $TKT->set_time_format( $incoming_date_formats[ 1 ] ); |
|
1066 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false; |
|
1067 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1068 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1069 | 1069 | //set new values |
1070 | - foreach ( $TKT_values as $field => $value ) { |
|
1071 | - if ( $field == 'TKT_qty' ) { |
|
1072 | - $TKT->set_qty( $value ); |
|
1070 | + foreach ($TKT_values as $field => $value) { |
|
1071 | + if ($field == 'TKT_qty') { |
|
1072 | + $TKT->set_qty($value); |
|
1073 | 1073 | } else { |
1074 | - $TKT->set( $field, $value ); |
|
1074 | + $TKT->set($field, $value); |
|
1075 | 1075 | } |
1076 | 1076 | } |
1077 | 1077 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1078 | - if ( $create_new_TKT ) { |
|
1078 | + if ($create_new_TKT) { |
|
1079 | 1079 | //archive the old ticket first |
1080 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1080 | + $TKT->set('TKT_deleted', 1); |
|
1081 | 1081 | $TKT->save(); |
1082 | 1082 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1083 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1083 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1084 | 1084 | //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. |
1085 | 1085 | $TKT = clone $TKT; |
1086 | - $TKT->set( 'TKT_ID', 0 ); |
|
1087 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1088 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1089 | - $TKT->set( 'TKT_sold', 0 ); |
|
1086 | + $TKT->set('TKT_ID', 0); |
|
1087 | + $TKT->set('TKT_deleted', 0); |
|
1088 | + $TKT->set('TKT_price', $ticket_price); |
|
1089 | + $TKT->set('TKT_sold', 0); |
|
1090 | 1090 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1091 | 1091 | $update_prices = true; |
1092 | 1092 | } |
1093 | 1093 | //make sure price is set if it hasn't been already |
1094 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1094 | + $TKT->set('TKT_price', $ticket_price); |
|
1095 | 1095 | } |
1096 | 1096 | |
1097 | 1097 | } else { |
1098 | 1098 | //no TKT_id so a new TKT |
1099 | 1099 | $TKT_values['TKT_price'] = $ticket_price; |
1100 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE ); |
|
1101 | - if ( $TKT instanceof EE_Ticket ) { |
|
1100 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE); |
|
1101 | + if ($TKT instanceof EE_Ticket) { |
|
1102 | 1102 | //need to reset values to properly account for the date formats |
1103 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1104 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1105 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1103 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1104 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1105 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1106 | 1106 | |
1107 | 1107 | //set new values |
1108 | - foreach ( $TKT_values as $field => $value ) { |
|
1109 | - if ( $field == 'TKT_qty' ) { |
|
1110 | - $TKT->set_qty( $value ); |
|
1108 | + foreach ($TKT_values as $field => $value) { |
|
1109 | + if ($field == 'TKT_qty') { |
|
1110 | + $TKT->set_qty($value); |
|
1111 | 1111 | } else { |
1112 | - $TKT->set( $field, $value ); |
|
1112 | + $TKT->set($field, $value); |
|
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | |
@@ -1117,31 +1117,31 @@ discard block |
||
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | // cap ticket qty by datetime reg limits |
1120 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1120 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1121 | 1121 | //update ticket. |
1122 | 1122 | $TKT->save(); |
1123 | 1123 | |
1124 | 1124 | //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. |
1125 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
1126 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
1125 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1126 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1127 | 1127 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
1128 | 1128 | $TKT->save(); |
1129 | 1129 | } |
1130 | 1130 | |
1131 | 1131 | //initially let's add the ticket to the dtt |
1132 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1132 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1133 | 1133 | |
1134 | 1134 | $saved_tickets[$TKT->ID()] = $TKT; |
1135 | 1135 | |
1136 | 1136 | //add prices to ticket |
1137 | - $this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices ); |
|
1137 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1138 | 1138 | } |
1139 | 1139 | //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. |
1140 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1141 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1140 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1141 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1142 | 1142 | |
1143 | - foreach ( $tickets_removed as $id ) { |
|
1144 | - $id = absint( $id ); |
|
1143 | + foreach ($tickets_removed as $id) { |
|
1144 | + $id = absint($id); |
|
1145 | 1145 | |
1146 | 1146 | //get the ticket for this id |
1147 | 1147 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | //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) |
1150 | 1150 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
1151 | 1151 | |
1152 | - foreach( $dtts as $dtt ) { |
|
1152 | + foreach ($dtts as $dtt) { |
|
1153 | 1153 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
1154 | 1154 | } |
1155 | 1155 | |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1161 | 1161 | $tkt_to_remove->delete_permanently(); |
1162 | 1162 | } |
1163 | - return array( $saved_dtt, $saved_tickets ); |
|
1163 | + return array($saved_dtt, $saved_tickets); |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | |
@@ -1175,31 +1175,31 @@ discard block |
||
1175 | 1175 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1176 | 1176 | * @return void |
1177 | 1177 | */ |
1178 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) { |
|
1179 | - foreach ( $prices as $row => $prc ) { |
|
1178 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) { |
|
1179 | + foreach ($prices as $row => $prc) { |
|
1180 | 1180 | $PRC_values = array( |
1181 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
1182 | - 'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL, |
|
1183 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1184 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1185 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1181 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
1182 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL, |
|
1183 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1184 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1185 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1186 | 1186 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1187 | 1187 | 'PRC_order' => $row |
1188 | 1188 | ); |
1189 | 1189 | |
1190 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1190 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1191 | 1191 | $PRC_values['PRC_ID'] = 0; |
1192 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
1192 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
1193 | 1193 | } else { |
1194 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1194 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1195 | 1195 | //update this price with new values |
1196 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1197 | - $PRC->set( $field, $newprc ); |
|
1196 | + foreach ($PRC_values as $field => $newprc) { |
|
1197 | + $PRC->set($field, $newprc); |
|
1198 | 1198 | } |
1199 | 1199 | $PRC->save(); |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1202 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1203 | 1203 | } |
1204 | 1204 | } |
1205 | 1205 | |
@@ -1237,9 +1237,9 @@ discard block |
||
1237 | 1237 | //load formatter helper |
1238 | 1238 | |
1239 | 1239 | //args for getting related registrations |
1240 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1241 | - $not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) ); |
|
1242 | - $pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) ); |
|
1240 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1241 | + $not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved)); |
|
1242 | + $pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment)); |
|
1243 | 1243 | |
1244 | 1244 | |
1245 | 1245 | // publish box |
@@ -1268,9 +1268,9 @@ discard block |
||
1268 | 1268 | ), |
1269 | 1269 | REG_ADMIN_URL |
1270 | 1270 | ), |
1271 | - 'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ), |
|
1272 | - 'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ), |
|
1273 | - 'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ), |
|
1271 | + 'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args), |
|
1272 | + 'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args), |
|
1273 | + 'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args), |
|
1274 | 1274 | 'misc_pub_section_class' => apply_filters( |
1275 | 1275 | 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', |
1276 | 1276 | 'misc-pub-section' |
@@ -1289,9 +1289,9 @@ discard block |
||
1289 | 1289 | 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', |
1290 | 1290 | $this->_cpt_model_obj |
1291 | 1291 | ); |
1292 | - $publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean(); |
|
1292 | + $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
|
1293 | 1293 | // load template |
1294 | - EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args ); |
|
1294 | + EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args); |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | |
@@ -1323,16 +1323,16 @@ discard block |
||
1323 | 1323 | $this->verify_cpt_object(); |
1324 | 1324 | add_meta_box( |
1325 | 1325 | 'espresso_event_editor_tickets', |
1326 | - esc_html__( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1327 | - array( $this, 'ticket_metabox' ), |
|
1326 | + esc_html__('Event Datetime & Ticket', 'event_espresso'), |
|
1327 | + array($this, 'ticket_metabox'), |
|
1328 | 1328 | $this->page_slug, |
1329 | 1329 | 'normal', |
1330 | 1330 | 'high' |
1331 | 1331 | ); |
1332 | 1332 | add_meta_box( |
1333 | 1333 | 'espresso_event_editor_event_options', |
1334 | - esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
1335 | - array( $this, 'registration_options_meta_box' ), |
|
1334 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
1335 | + array($this, 'registration_options_meta_box'), |
|
1336 | 1336 | $this->page_slug, |
1337 | 1337 | 'side', |
1338 | 1338 | 'default' |
@@ -1362,36 +1362,36 @@ discard block |
||
1362 | 1362 | 'disabled' => '' |
1363 | 1363 | ); |
1364 | 1364 | |
1365 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL; |
|
1365 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL; |
|
1366 | 1366 | |
1367 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1367 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1368 | 1368 | |
1369 | 1369 | /** |
1370 | 1370 | * 1. Start with retrieving Datetimes |
1371 | 1371 | * 2. Fore each datetime get related tickets |
1372 | 1372 | * 3. For each ticket get related prices |
1373 | 1373 | */ |
1374 | - $times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id ); |
|
1374 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1375 | 1375 | /** @type EE_Datetime $first_datetime */ |
1376 | - $first_datetime = reset( $times ); |
|
1376 | + $first_datetime = reset($times); |
|
1377 | 1377 | //do we get related tickets? |
1378 | - if ( $first_datetime instanceof EE_Datetime |
|
1379 | - && $first_datetime->ID() !== 0 ) { |
|
1378 | + if ($first_datetime instanceof EE_Datetime |
|
1379 | + && $first_datetime->ID() !== 0) { |
|
1380 | 1380 | $existing_datetime_ids[] = $first_datetime->get('DTT_ID'); |
1381 | 1381 | $template_args['time'] = $first_datetime; |
1382 | 1382 | $related_tickets = $first_datetime->tickets( |
1383 | 1383 | array( |
1384 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1384 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1385 | 1385 | 'default_where_conditions' => 'none' |
1386 | 1386 | ) |
1387 | 1387 | ); |
1388 | 1388 | |
1389 | - if ( !empty($related_tickets) ) { |
|
1389 | + if ( ! empty($related_tickets)) { |
|
1390 | 1390 | $template_args['total_ticket_rows'] = count($related_tickets); |
1391 | 1391 | $row = 0; |
1392 | - foreach ( $related_tickets as $ticket ) { |
|
1392 | + foreach ($related_tickets as $ticket) { |
|
1393 | 1393 | $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
1394 | - $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row ); |
|
1394 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row); |
|
1395 | 1395 | |
1396 | 1396 | $row++; |
1397 | 1397 | } |
@@ -1399,13 +1399,13 @@ discard block |
||
1399 | 1399 | $template_args['total_ticket_rows'] = 1; |
1400 | 1400 | /** @type EE_Ticket $ticket */ |
1401 | 1401 | $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
1402 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1402 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1403 | 1403 | } |
1404 | 1404 | } else { |
1405 | 1405 | $template_args['time'] = $times[0]; |
1406 | 1406 | /** @type EE_Ticket $ticket */ |
1407 | 1407 | $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
1408 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1408 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1409 | 1409 | // NOTE: we're just sending the first default row |
1410 | 1410 | // (decaf can't manage default tickets so this should be sufficient); |
1411 | 1411 | } |
@@ -1414,8 +1414,8 @@ discard block |
||
1414 | 1414 | $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
1415 | 1415 | $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
1416 | 1416 | $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
1417 | - $template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE ); |
|
1418 | - $template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' ); |
|
1417 | + $template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE); |
|
1418 | + $template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'); |
|
1419 | 1419 | EEH_Template::display_template($template, $template_args); |
1420 | 1420 | } |
1421 | 1421 | |
@@ -1430,21 +1430,21 @@ discard block |
||
1430 | 1430 | * @param int $row |
1431 | 1431 | * @return string generated html for the ticket row. |
1432 | 1432 | */ |
1433 | - private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) { |
|
1433 | + private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) { |
|
1434 | 1434 | $template_args = array( |
1435 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1436 | - 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '', |
|
1435 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1436 | + 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '', |
|
1437 | 1437 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1438 | 1438 | 'TKT_ID' => $ticket->get('TKT_ID'), |
1439 | 1439 | 'TKT_name' => $ticket->get('TKT_name'), |
1440 | 1440 | 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
1441 | 1441 | 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
1442 | 1442 | 'TKT_is_default' => $ticket->get('TKT_is_default'), |
1443 | - 'TKT_qty' => $ticket->get_pretty('TKT_qty','input'), |
|
1443 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1444 | 1444 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1445 | 1445 | 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
1446 | - 'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1447 | - 'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled' |
|
1446 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1447 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled' |
|
1448 | 1448 | ); |
1449 | 1449 | |
1450 | 1450 | $price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object(); |
@@ -1460,23 +1460,23 @@ discard block |
||
1460 | 1460 | |
1461 | 1461 | //make sure we have default start and end dates if skeleton |
1462 | 1462 | //handle rows that should NOT be empty |
1463 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1463 | + if (empty($template_args['TKT_start_date'])) { |
|
1464 | 1464 | //if empty then the start date will be now. |
1465 | 1465 | $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
1466 | 1466 | } |
1467 | 1467 | |
1468 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1468 | + if (empty($template_args['TKT_end_date'])) { |
|
1469 | 1469 | //get the earliest datetime (if present); |
1470 | - $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1470 | + $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1471 | 1471 | |
1472 | - if ( !empty( $earliest_dtt ) ) |
|
1472 | + if ( ! empty($earliest_dtt)) |
|
1473 | 1473 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
1474 | 1474 | else |
1475 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1475 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))); |
|
1476 | 1476 | } |
1477 | 1477 | |
1478 | - $template_args = array_merge( $template_args, $price_args ); |
|
1479 | - $template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1478 | + $template_args = array_merge($template_args, $price_args); |
|
1479 | + $template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1480 | 1480 | return EEH_Template::display_template($template, $template_args, TRUE); |
1481 | 1481 | } |
1482 | 1482 | |
@@ -1505,8 +1505,8 @@ discard block |
||
1505 | 1505 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
1506 | 1506 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
1507 | 1507 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
1508 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
1509 | - $templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
1508 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
1509 | + $templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
1510 | 1510 | EEH_Template::display_template($templatepath, $template_args); |
1511 | 1511 | } |
1512 | 1512 | |
@@ -1534,21 +1534,21 @@ discard block |
||
1534 | 1534 | $EEME = $this->_event_model(); |
1535 | 1535 | |
1536 | 1536 | $offset = ($current_page - 1) * $per_page; |
1537 | - $limit = $count ? NULL : $offset . ',' . $per_page; |
|
1537 | + $limit = $count ? NULL : $offset.','.$per_page; |
|
1538 | 1538 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
1539 | 1539 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
1540 | 1540 | |
1541 | 1541 | if (isset($this->_req_data['month_range'])) { |
1542 | 1542 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1543 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1544 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1543 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1544 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | $where = array(); |
1548 | 1548 | |
1549 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
1549 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
1550 | 1550 | //determine what post_status our condition will have for the query. |
1551 | - switch ( $status ) { |
|
1551 | + switch ($status) { |
|
1552 | 1552 | case 'month' : |
1553 | 1553 | case 'today' : |
1554 | 1554 | case NULL : |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | break; |
1557 | 1557 | |
1558 | 1558 | case 'draft' : |
1559 | - $where['status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1559 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1560 | 1560 | break; |
1561 | 1561 | |
1562 | 1562 | default : |
@@ -1564,43 +1564,43 @@ discard block |
||
1564 | 1564 | } |
1565 | 1565 | |
1566 | 1566 | //categories? |
1567 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1567 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1568 | 1568 | |
1569 | - if ( !empty ( $category ) ) { |
|
1569 | + if ( ! empty ($category)) { |
|
1570 | 1570 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1571 | 1571 | $where['Term_Taxonomy.term_id'] = $category; |
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | //date where conditions |
1575 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1575 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1576 | 1576 | if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
1577 | - $DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) ); |
|
1578 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1579 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) ); |
|
1580 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) ); |
|
1577 | + $DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone())); |
|
1578 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1579 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1580 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1581 | 1581 | } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
1582 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1583 | - $start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) ); |
|
1584 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1585 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1586 | - } else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) { |
|
1587 | - $now = date( 'Y-m-01' ); |
|
1588 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1589 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1590 | - $end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1591 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1582 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1583 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1584 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1585 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1586 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1587 | + $now = date('Y-m-01'); |
|
1588 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1589 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1590 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1591 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1592 | 1592 | } |
1593 | 1593 | |
1594 | 1594 | |
1595 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1596 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
1595 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1596 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
1597 | 1597 | } else { |
1598 | - if ( ! isset( $where['status'] ) ) { |
|
1599 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1598 | + if ( ! isset($where['status'])) { |
|
1599 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1600 | 1600 | $where['OR'] = array( |
1601 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1601 | + 'status*restrict_private' => array('!=', 'private'), |
|
1602 | 1602 | 'AND' => array( |
1603 | - 'status*inclusive' => array( '=', 'private' ), |
|
1603 | + 'status*inclusive' => array('=', 'private'), |
|
1604 | 1604 | 'EVT_wp_user' => get_current_user_id() |
1605 | 1605 | ) |
1606 | 1606 | ); |
@@ -1608,16 +1608,16 @@ discard block |
||
1608 | 1608 | } |
1609 | 1609 | } |
1610 | 1610 | |
1611 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1612 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1611 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1612 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1613 | 1613 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1614 | 1614 | } |
1615 | 1615 | } |
1616 | 1616 | |
1617 | 1617 | |
1618 | 1618 | //search query handling |
1619 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1620 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1619 | + if (isset($this->_req_data['s'])) { |
|
1620 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1621 | 1621 | $where['OR'] = array( |
1622 | 1622 | 'EVT_name' => array('LIKE', $search_string), |
1623 | 1623 | 'EVT_desc' => array('LIKE', $search_string), |
@@ -1626,32 +1626,32 @@ discard block |
||
1626 | 1626 | } |
1627 | 1627 | |
1628 | 1628 | |
1629 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1630 | - $query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data ); |
|
1629 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1630 | + $query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data); |
|
1631 | 1631 | |
1632 | 1632 | |
1633 | 1633 | //let's first check if we have special requests coming in. |
1634 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1635 | - switch ( $this->_req_data['active_status'] ) { |
|
1634 | + if (isset($this->_req_data['active_status'])) { |
|
1635 | + switch ($this->_req_data['active_status']) { |
|
1636 | 1636 | case 'upcoming' : |
1637 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1637 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1638 | 1638 | break; |
1639 | 1639 | |
1640 | 1640 | case 'expired' : |
1641 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1641 | + return $EEME->get_expired_events($query_params, $count); |
|
1642 | 1642 | break; |
1643 | 1643 | |
1644 | 1644 | case 'active' : |
1645 | - return $EEME->get_active_events( $query_params, $count ); |
|
1645 | + return $EEME->get_active_events($query_params, $count); |
|
1646 | 1646 | break; |
1647 | 1647 | |
1648 | 1648 | case 'inactive' : |
1649 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1649 | + return $EEME->get_inactive_events($query_params, $count); |
|
1650 | 1650 | break; |
1651 | 1651 | } |
1652 | 1652 | } |
1653 | 1653 | |
1654 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1654 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1655 | 1655 | |
1656 | 1656 | return $events; |
1657 | 1657 | } |
@@ -1660,23 +1660,23 @@ discard block |
||
1660 | 1660 | |
1661 | 1661 | |
1662 | 1662 | //handling for WordPress CPT actions (trash, restore, delete) |
1663 | - public function trash_cpt_item( $post_id ) { |
|
1663 | + public function trash_cpt_item($post_id) { |
|
1664 | 1664 | $this->_req_data['EVT_ID'] = $post_id; |
1665 | - $this->_trash_or_restore_event( 'trash', FALSE ); |
|
1665 | + $this->_trash_or_restore_event('trash', FALSE); |
|
1666 | 1666 | } |
1667 | 1667 | |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | |
1671 | - public function restore_cpt_item( $post_id ) { |
|
1671 | + public function restore_cpt_item($post_id) { |
|
1672 | 1672 | $this->_req_data['EVT_ID'] = $post_id; |
1673 | - $this->_trash_or_restore_event( 'draft', FALSE ); |
|
1673 | + $this->_trash_or_restore_event('draft', FALSE); |
|
1674 | 1674 | } |
1675 | 1675 | |
1676 | 1676 | |
1677 | - public function delete_cpt_item( $post_id ) { |
|
1677 | + public function delete_cpt_item($post_id) { |
|
1678 | 1678 | $this->_req_data['EVT_ID'] = $post_id; |
1679 | - $this->_delete_event( FALSE ); |
|
1679 | + $this->_delete_event(FALSE); |
|
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | |
@@ -1688,7 +1688,7 @@ discard block |
||
1688 | 1688 | * @param string $event_status |
1689 | 1689 | * @return void |
1690 | 1690 | */ |
1691 | - protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
1691 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) { |
|
1692 | 1692 | //determine the event id and set to array. |
1693 | 1693 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
1694 | 1694 | // loop thru events |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | // clean status |
1697 | 1697 | $event_status = sanitize_key($event_status); |
1698 | 1698 | // grab status |
1699 | - if (!empty($event_status)) { |
|
1699 | + if ( ! empty($event_status)) { |
|
1700 | 1700 | $success = $this->_change_event_status($EVT_ID, $event_status); |
1701 | 1701 | } else { |
1702 | 1702 | $success = FALSE; |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | } |
1711 | 1711 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1712 | 1712 | |
1713 | - if ( $redirect_after ) |
|
1713 | + if ($redirect_after) |
|
1714 | 1714 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
1715 | 1715 | } |
1716 | 1716 | |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | // clean status |
1726 | 1726 | $event_status = sanitize_key($event_status); |
1727 | 1727 | // grab status |
1728 | - if (!empty($event_status)) { |
|
1728 | + if ( ! empty($event_status)) { |
|
1729 | 1729 | $success = TRUE; |
1730 | 1730 | //determine the event id and set to array. |
1731 | 1731 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
@@ -1735,7 +1735,7 @@ discard block |
||
1735 | 1735 | $results = $this->_change_event_status($EVT_ID, $event_status); |
1736 | 1736 | $success = $results !== FALSE ? $success : FALSE; |
1737 | 1737 | } else { |
1738 | - $msg = sprintf( esc_html__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID); |
|
1738 | + $msg = sprintf(esc_html__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID); |
|
1739 | 1739 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1740 | 1740 | $success = FALSE; |
1741 | 1741 | } |
@@ -1760,15 +1760,15 @@ discard block |
||
1760 | 1760 | * @param string $event_status |
1761 | 1761 | * @return bool |
1762 | 1762 | */ |
1763 | - private function _change_event_status( $EVT_ID = 0, $event_status = '') { |
|
1763 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1764 | 1764 | // grab event id |
1765 | - if (!$EVT_ID) { |
|
1765 | + if ( ! $EVT_ID) { |
|
1766 | 1766 | $msg = esc_html__('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1767 | 1767 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1768 | 1768 | return FALSE; |
1769 | 1769 | } |
1770 | 1770 | |
1771 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1771 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1772 | 1772 | |
1773 | 1773 | // clean status |
1774 | 1774 | $event_status = sanitize_key($event_status); |
@@ -1794,11 +1794,11 @@ discard block |
||
1794 | 1794 | $hook = FALSE; |
1795 | 1795 | } |
1796 | 1796 | //use class to change status |
1797 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1797 | + $this->_cpt_model_obj->set_status($event_status); |
|
1798 | 1798 | $success = $this->_cpt_model_obj->save(); |
1799 | 1799 | |
1800 | 1800 | if ($success === FALSE) { |
1801 | - $msg = sprintf( esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1801 | + $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1802 | 1802 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1803 | 1803 | return FALSE; |
1804 | 1804 | } |
@@ -1816,15 +1816,15 @@ discard block |
||
1816 | 1816 | * @access protected |
1817 | 1817 | * @param bool $redirect_after |
1818 | 1818 | */ |
1819 | - protected function _delete_event( $redirect_after = TRUE ) { |
|
1819 | + protected function _delete_event($redirect_after = TRUE) { |
|
1820 | 1820 | //determine the event id and set to array. |
1821 | 1821 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL; |
1822 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1822 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1823 | 1823 | |
1824 | 1824 | |
1825 | 1825 | // loop thru events |
1826 | 1826 | if ($EVT_ID) { |
1827 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1827 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1828 | 1828 | // get list of events with no prices |
1829 | 1829 | $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
1830 | 1830 | // remove this event from the list of events with no prices |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1839 | 1839 | } |
1840 | 1840 | |
1841 | - if ( $redirect_after ) |
|
1841 | + if ($redirect_after) |
|
1842 | 1842 | $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
1843 | 1843 | } |
1844 | 1844 | |
@@ -1856,12 +1856,12 @@ discard block |
||
1856 | 1856 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
1857 | 1857 | // loop thru events |
1858 | 1858 | foreach ($EVT_IDs as $EVT_ID) { |
1859 | - $EVT_ID = absint( $EVT_ID ); |
|
1860 | - if ( $EVT_ID ) { |
|
1861 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
1859 | + $EVT_ID = absint($EVT_ID); |
|
1860 | + if ($EVT_ID) { |
|
1861 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
1862 | 1862 | $success = $results !== FALSE ? $success : FALSE; |
1863 | 1863 | // remove this event from the list of events with no prices |
1864 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1864 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1865 | 1865 | } else { |
1866 | 1866 | $success = FALSE; |
1867 | 1867 | $msg = esc_html__('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso'); |
@@ -1881,9 +1881,9 @@ discard block |
||
1881 | 1881 | * @param int $EVT_ID |
1882 | 1882 | * @return bool |
1883 | 1883 | */ |
1884 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
1884 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
1885 | 1885 | // grab event id |
1886 | - if ( ! $EVT_ID ) { |
|
1886 | + if ( ! $EVT_ID) { |
|
1887 | 1887 | $msg = esc_html__('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1888 | 1888 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1889 | 1889 | return FALSE; |
@@ -1892,19 +1892,19 @@ discard block |
||
1892 | 1892 | ! $this->_cpt_model_obj instanceof EE_Event |
1893 | 1893 | || $this->_cpt_model_obj->ID() !== $EVT_ID |
1894 | 1894 | ) { |
1895 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1895 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1896 | 1896 | } |
1897 | 1897 | |
1898 | - if ( ! $this->_cpt_model_obj instanceof EE_Event ) { |
|
1898 | + if ( ! $this->_cpt_model_obj instanceof EE_Event) { |
|
1899 | 1899 | return false; |
1900 | 1900 | } |
1901 | 1901 | |
1902 | 1902 | //need to delete related tickets and prices first. |
1903 | 1903 | $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
1904 | - foreach ( $datetimes as $datetime ) { |
|
1904 | + foreach ($datetimes as $datetime) { |
|
1905 | 1905 | $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
1906 | 1906 | $tickets = $datetime->get_many_related('Ticket'); |
1907 | - foreach ( $tickets as $ticket ) { |
|
1907 | + foreach ($tickets as $ticket) { |
|
1908 | 1908 | $ticket->_remove_relation_to($datetime, 'Datetime'); |
1909 | 1909 | $ticket->delete_related_permanently('Price'); |
1910 | 1910 | $ticket->delete_permanently(); |
@@ -1914,14 +1914,14 @@ discard block |
||
1914 | 1914 | |
1915 | 1915 | //what about related venues or terms? |
1916 | 1916 | $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
1917 | - foreach ( $venues as $venue ) { |
|
1917 | + foreach ($venues as $venue) { |
|
1918 | 1918 | $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
1919 | 1919 | } |
1920 | 1920 | |
1921 | 1921 | //any attached question groups? |
1922 | 1922 | $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
1923 | - if ( !empty( $question_groups ) ) { |
|
1924 | - foreach ( $question_groups as $question_group ) { |
|
1923 | + if ( ! empty($question_groups)) { |
|
1924 | + foreach ($question_groups as $question_group) { |
|
1925 | 1925 | $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
1926 | 1926 | } |
1927 | 1927 | } |
@@ -1930,26 +1930,26 @@ discard block |
||
1930 | 1930 | |
1931 | 1931 | |
1932 | 1932 | //Message Template Groups |
1933 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
1933 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
1934 | 1934 | |
1935 | 1935 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
1936 | 1936 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
1937 | 1937 | |
1938 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
1938 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
1939 | 1939 | $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
1940 | 1940 | } |
1941 | 1941 | |
1942 | 1942 | $success = $this->_cpt_model_obj->delete_permanently(); |
1943 | 1943 | // did it all go as planned ? |
1944 | 1944 | if ($success) { |
1945 | - $msg = sprintf( esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
1945 | + $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
1946 | 1946 | EE_Error::add_success($msg); |
1947 | 1947 | } else { |
1948 | - $msg = sprintf( esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), $EVT_ID); |
|
1948 | + $msg = sprintf(esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), $EVT_ID); |
|
1949 | 1949 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1950 | 1950 | return FALSE; |
1951 | 1951 | } |
1952 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
1952 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
1953 | 1953 | return TRUE; |
1954 | 1954 | } |
1955 | 1955 | |
@@ -1966,7 +1966,7 @@ discard block |
||
1966 | 1966 | */ |
1967 | 1967 | public function total_events() { |
1968 | 1968 | |
1969 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1969 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
1970 | 1970 | return $count; |
1971 | 1971 | } |
1972 | 1972 | |
@@ -1981,10 +1981,10 @@ discard block |
||
1981 | 1981 | */ |
1982 | 1982 | public function total_events_draft() { |
1983 | 1983 | $where = array( |
1984 | - 'status' => array( 'IN', array('draft', 'auto-draft' ) ) |
|
1984 | + 'status' => array('IN', array('draft', 'auto-draft')) |
|
1985 | 1985 | ); |
1986 | 1986 | |
1987 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1987 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
1988 | 1988 | return $count; |
1989 | 1989 | } |
1990 | 1990 | |
@@ -2003,7 +2003,7 @@ discard block |
||
2003 | 2003 | 'status' => 'trash' |
2004 | 2004 | ); |
2005 | 2005 | |
2006 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2006 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2007 | 2007 | return $count; |
2008 | 2008 | } |
2009 | 2009 | |
@@ -2031,11 +2031,11 @@ discard block |
||
2031 | 2031 | // translated |
2032 | 2032 | TRUE |
2033 | 2033 | ); |
2034 | - $this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment; |
|
2034 | + $this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment; |
|
2035 | 2035 | |
2036 | 2036 | $this->_set_add_edit_form_tags('update_default_event_settings'); |
2037 | 2037 | $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
2038 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE); |
|
2038 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE); |
|
2039 | 2039 | $this->display_admin_page_with_sidebar(); |
2040 | 2040 | } |
2041 | 2041 | |
@@ -2061,9 +2061,9 @@ discard block |
||
2061 | 2061 | |
2062 | 2062 | protected function _template_settings() { |
2063 | 2063 | $this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso'); |
2064 | - $this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />'; |
|
2065 | - $this->_template_args['preview_text'] = '<strong>'.esc_html__( '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.', 'event_espresso' ).'</strong>'; |
|
2066 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2064 | + $this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />'; |
|
2065 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__('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.', 'event_espresso').'</strong>'; |
|
2066 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2067 | 2067 | } |
2068 | 2068 | |
2069 | 2069 | |
@@ -2076,22 +2076,22 @@ discard block |
||
2076 | 2076 | * @return void |
2077 | 2077 | */ |
2078 | 2078 | private function _set_category_object() { |
2079 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2079 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
2080 | 2080 | return; //already have the category object so get out. |
2081 | 2081 | |
2082 | 2082 | //set default category object |
2083 | 2083 | $this->_set_empty_category_object(); |
2084 | 2084 | |
2085 | 2085 | //only set if we've got an id |
2086 | - if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) { |
|
2086 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2087 | 2087 | return; |
2088 | 2088 | } |
2089 | 2089 | |
2090 | 2090 | $category_id = absint($this->_req_data['EVT_CAT_ID']); |
2091 | 2091 | |
2092 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2092 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2093 | 2093 | |
2094 | - if ( !empty( $term ) ) { |
|
2094 | + if ( ! empty($term)) { |
|
2095 | 2095 | $this->_category->category_name = $term->name; |
2096 | 2096 | $this->_category->category_identifier = $term->slug; |
2097 | 2097 | $this->_category->category_desc = $term->description; |
@@ -2105,15 +2105,15 @@ discard block |
||
2105 | 2105 | |
2106 | 2106 | private function _set_empty_category_object() { |
2107 | 2107 | $this->_category = new stdClass(); |
2108 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2108 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2109 | 2109 | $this->_category->id = $this->_category->parent = 0; |
2110 | 2110 | } |
2111 | 2111 | |
2112 | 2112 | |
2113 | 2113 | protected function _category_list_table() { |
2114 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2114 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2115 | 2115 | $this->_search_btn_label = esc_html__('Categories', 'event_espresso'); |
2116 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
|
2116 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
|
2117 | 2117 | $this->display_admin_list_table_page_with_sidebar(); |
2118 | 2118 | } |
2119 | 2119 | |
@@ -2127,14 +2127,14 @@ discard block |
||
2127 | 2127 | $this->_set_add_edit_form_tags($route); |
2128 | 2128 | |
2129 | 2129 | $this->_set_category_object(); |
2130 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
2130 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2131 | 2131 | |
2132 | 2132 | $delete_action = 'delete_category'; |
2133 | 2133 | |
2134 | 2134 | //custom redirect |
2135 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url ); |
|
2135 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
2136 | 2136 | |
2137 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2137 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2138 | 2138 | |
2139 | 2139 | //take care of contents |
2140 | 2140 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -2148,25 +2148,25 @@ discard block |
||
2148 | 2148 | 'type' => 'wp_editor', |
2149 | 2149 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
2150 | 2150 | 'class' => 'my_editor_custom', |
2151 | - 'wpeditor_args' => array('media_buttons' => FALSE ) |
|
2151 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
2152 | 2152 | ); |
2153 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2153 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2154 | 2154 | |
2155 | - $all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
2155 | + $all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
2156 | 2156 | |
2157 | 2157 | //setup category select for term parents. |
2158 | 2158 | $category_select_values[] = array( |
2159 | 2159 | 'text' => esc_html__('No Parent', 'event_espresso'), |
2160 | 2160 | 'id' => 0 |
2161 | 2161 | ); |
2162 | - foreach ( $all_terms as $term ) { |
|
2162 | + foreach ($all_terms as $term) { |
|
2163 | 2163 | $category_select_values[] = array( |
2164 | 2164 | 'text' => $term->name, |
2165 | 2165 | 'id' => $term->term_id |
2166 | 2166 | ); |
2167 | 2167 | } |
2168 | 2168 | |
2169 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
2169 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
2170 | 2170 | |
2171 | 2171 | $template_args = array( |
2172 | 2172 | 'category' => $this->_category, |
@@ -2176,15 +2176,15 @@ discard block |
||
2176 | 2176 | 'disable' => '', |
2177 | 2177 | 'disabled_message' => FALSE |
2178 | 2178 | ); |
2179 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2180 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
2179 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2180 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
2181 | 2181 | } |
2182 | 2182 | |
2183 | 2183 | |
2184 | 2184 | protected function _delete_categories() { |
2185 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2185 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2186 | 2186 | |
2187 | - foreach ( $cat_ids as $cat_id ) { |
|
2187 | + foreach ($cat_ids as $cat_id) { |
|
2188 | 2188 | $this->_delete_category($cat_id); |
2189 | 2189 | } |
2190 | 2190 | |
@@ -2192,7 +2192,7 @@ discard block |
||
2192 | 2192 | $query_args = array( |
2193 | 2193 | 'action' => 'category_list' |
2194 | 2194 | ); |
2195 | - $this->_redirect_after_action(0,'','',$query_args); |
|
2195 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2196 | 2196 | |
2197 | 2197 | } |
2198 | 2198 | |
@@ -2202,61 +2202,61 @@ discard block |
||
2202 | 2202 | |
2203 | 2203 | protected function _delete_category($cat_id) { |
2204 | 2204 | global $wpdb; |
2205 | - $cat_id = absint( $cat_id ); |
|
2206 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2205 | + $cat_id = absint($cat_id); |
|
2206 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2207 | 2207 | } |
2208 | 2208 | |
2209 | 2209 | |
2210 | 2210 | |
2211 | 2211 | protected function _insert_or_update_category($new_category) { |
2212 | 2212 | |
2213 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
2213 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
2214 | 2214 | $success = 0; //we already have a success message so lets not send another. |
2215 | 2215 | |
2216 | - if ( $cat_id ) { |
|
2216 | + if ($cat_id) { |
|
2217 | 2217 | $query_args = array( |
2218 | 2218 | 'action' => 'edit_category', |
2219 | 2219 | 'EVT_CAT_ID' => $cat_id |
2220 | 2220 | ); |
2221 | 2221 | } else { |
2222 | - $query_args = array( 'action' => 'add_category' ); |
|
2222 | + $query_args = array('action' => 'add_category'); |
|
2223 | 2223 | } |
2224 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
2224 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
2225 | 2225 | |
2226 | 2226 | } |
2227 | 2227 | |
2228 | 2228 | |
2229 | 2229 | |
2230 | - private function _insert_category( $update = FALSE ) { |
|
2230 | + private function _insert_category($update = FALSE) { |
|
2231 | 2231 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2232 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2233 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2234 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2232 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2233 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2234 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2235 | 2235 | |
2236 | - if ( empty( $category_name ) ) { |
|
2237 | - $msg = esc_html__( 'You must add a name for the category.', 'event_espresso' ); |
|
2238 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2236 | + if (empty($category_name)) { |
|
2237 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
2238 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2239 | 2239 | return false; |
2240 | 2240 | } |
2241 | 2241 | |
2242 | - $term_args=array( |
|
2242 | + $term_args = array( |
|
2243 | 2243 | 'name'=>$category_name, |
2244 | 2244 | 'description'=>$category_desc, |
2245 | 2245 | 'parent'=>$category_parent |
2246 | 2246 | ); |
2247 | 2247 | //was the category_identifier input disabled? |
2248 | - if(isset($this->_req_data['category_identifier'])){ |
|
2248 | + if (isset($this->_req_data['category_identifier'])) { |
|
2249 | 2249 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2250 | 2250 | } |
2251 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2251 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2252 | 2252 | |
2253 | - if ( !is_array( $insert_ids ) ) { |
|
2254 | - $msg = esc_html__( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2255 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2253 | + if ( ! is_array($insert_ids)) { |
|
2254 | + $msg = esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
2255 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2256 | 2256 | } else { |
2257 | 2257 | $cat_id = $insert_ids['term_id']; |
2258 | - $msg = sprintf ( esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name ); |
|
2259 | - EE_Error::add_success( $msg ); |
|
2258 | + $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name); |
|
2259 | + EE_Error::add_success($msg); |
|
2260 | 2260 | } |
2261 | 2261 | |
2262 | 2262 | return $cat_id; |
@@ -2265,32 +2265,32 @@ discard block |
||
2265 | 2265 | |
2266 | 2266 | |
2267 | 2267 | |
2268 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2268 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
2269 | 2269 | global $wpdb; |
2270 | 2270 | |
2271 | 2271 | //testing term stuff |
2272 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2273 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2274 | - $limit = ($current_page-1)*$per_page; |
|
2272 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2273 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2274 | + $limit = ($current_page - 1) * $per_page; |
|
2275 | 2275 | |
2276 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2276 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2277 | 2277 | |
2278 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2279 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2278 | + if (isset($this->_req_data['s'])) { |
|
2279 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2280 | 2280 | $where['OR'] = array( |
2281 | - 'Term.name' => array( 'LIKE', $sstr), |
|
2282 | - 'description' => array( 'LIKE', $sstr ) |
|
2281 | + 'Term.name' => array('LIKE', $sstr), |
|
2282 | + 'description' => array('LIKE', $sstr) |
|
2283 | 2283 | ); |
2284 | 2284 | } |
2285 | 2285 | |
2286 | 2286 | $query_params = array( |
2287 | - $where , |
|
2288 | - 'order_by' => array( $orderby => $order ), |
|
2289 | - 'limit' => $limit . ',' . $per_page, |
|
2287 | + $where, |
|
2288 | + 'order_by' => array($orderby => $order), |
|
2289 | + 'limit' => $limit.','.$per_page, |
|
2290 | 2290 | 'force_join' => array('Term') |
2291 | 2291 | ); |
2292 | 2292 | |
2293 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2293 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2294 | 2294 | |
2295 | 2295 | return $categories; |
2296 | 2296 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | class Maintenance_Admin_Page extends EE_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | |
48 | 48 | protected function _ajax_hooks() { |
49 | - add_action('wp_ajax_migration_step',array($this,'migration_step')); |
|
50 | - add_action('wp_ajax_add_error_to_migrations_ran',array($this,'add_error_to_migrations_ran')); |
|
49 | + add_action('wp_ajax_migration_step', array($this, 'migration_step')); |
|
50 | + add_action('wp_ajax_add_error_to_migrations_ran', array($this, 'add_error_to_migrations_ran')); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->_admin_page_title = EE_MAINTENANCE_LABEL; |
57 | 57 | $this->_labels = array( |
58 | 58 | 'buttons' => array( |
59 | - 'reset_capabilities' => __( 'Reset Event Espresso Capabilities', 'event_espresso' ) |
|
59 | + 'reset_capabilities' => __('Reset Event Espresso Capabilities', 'event_espresso') |
|
60 | 60 | ) |
61 | 61 | ); |
62 | 62 | } |
@@ -155,23 +155,23 @@ discard block |
||
155 | 155 | * default maintenance page. If we're in maintenance mode level 2, then we need to show |
156 | 156 | * the migration scripts and all that UI. |
157 | 157 | */ |
158 | - public function _maintenance(){ |
|
158 | + public function _maintenance() { |
|
159 | 159 | //it all depends if we're in maintenance model level 1 (frontend-only) or |
160 | 160 | //level 2 (everything except maintenance page) |
161 | - try{ |
|
161 | + try { |
|
162 | 162 | //get the current maintenance level and check if |
163 | 163 | //we are removed |
164 | 164 | $mm = EE_Maintenance_Mode::instance()->level(); |
165 | 165 | $placed_in_mm = EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
166 | - if( $mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm){ |
|
166 | + if ($mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) { |
|
167 | 167 | //we just took the site out of maintenance mode, so notify the user. |
168 | 168 | //unfortunately this message appears to be echoed on the NEXT page load... |
169 | 169 | //oh well, we should really be checking for this on addon deactivation anyways |
170 | - EE_Error::add_attention( __( 'Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso' ) ); |
|
171 | - $this->_process_notices( array( 'page' => 'espresso_maintenance_settings'), false ); |
|
170 | + EE_Error::add_attention(__('Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso')); |
|
171 | + $this->_process_notices(array('page' => 'espresso_maintenance_settings'), false); |
|
172 | 172 | } |
173 | 173 | //in case an exception is thrown while trying to handle migrations |
174 | - switch(EE_Maintenance_Mode::instance()->level()){ |
|
174 | + switch (EE_Maintenance_Mode::instance()->level()) { |
|
175 | 175 | case EE_Maintenance_Mode::level_0_not_in_maintenance: |
176 | 176 | case EE_Maintenance_Mode::level_1_frontend_only_maintenance: |
177 | 177 | $show_maintenance_switch = true; |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | case EE_Maintenance_Mode::level_2_complete_maintenance: |
184 | 184 | $show_maintenance_switch = false; |
185 | 185 | $show_migration_progress = true; |
186 | - if(isset($this->_req_data['continue_migration'])){ |
|
186 | + if (isset($this->_req_data['continue_migration'])) { |
|
187 | 187 | $show_backup_db_text = false; |
188 | - }else{ |
|
188 | + } else { |
|
189 | 189 | $show_backup_db_text = true; |
190 | 190 | } |
191 | 191 | $scripts_needing_to_run = EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts(); |
192 | 192 | $addons_should_be_upgraded_first = EE_Data_Migration_Manager::instance()->addons_need_updating(); |
193 | 193 | $script_names = array(); |
194 | 194 | $current_script = NULL; |
195 | - foreach($scripts_needing_to_run as $script){ |
|
196 | - if($script instanceof EE_Data_Migration_Script_Base){ |
|
197 | - if( ! $current_script){ |
|
195 | + foreach ($scripts_needing_to_run as $script) { |
|
196 | + if ($script instanceof EE_Data_Migration_Script_Base) { |
|
197 | + if ( ! $current_script) { |
|
198 | 198 | $current_script = $script; |
199 | 199 | $current_script->migration_page_hooks(); |
200 | 200 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | $most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true); |
207 | 207 | $exception_thrown = false; |
208 | - }catch(EE_Error $e){ |
|
208 | + } catch (EE_Error $e) { |
|
209 | 209 | |
210 | 210 | EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage()); |
211 | 211 | //now, just so we can display the page correctly, make a error migration script stage object |
@@ -215,54 +215,54 @@ discard block |
||
215 | 215 | $exception_thrown = true; |
216 | 216 | } |
217 | 217 | $current_db_state = EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set(); |
218 | - $current_db_state = str_replace( '.decaf', '', $current_db_state ); |
|
219 | - if($exception_thrown || |
|
220 | - ( $most_recent_migration && |
|
218 | + $current_db_state = str_replace('.decaf', '', $current_db_state); |
|
219 | + if ($exception_thrown || |
|
220 | + ($most_recent_migration && |
|
221 | 221 | $most_recent_migration instanceof EE_Data_Migration_Script_Base && |
222 | 222 | $most_recent_migration->is_broken() |
223 | - )){ |
|
224 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php'; |
|
225 | - $this->_template_args[ 'support_url' ] = 'http://eventespresso.com/support/forums/'; |
|
226 | - $this->_template_args[ 'next_url' ] = EEH_URL::add_query_args_and_nonce(array( 'action' => 'confirm_migration_crash_report_sent', 'success' => '0' ), EE_MAINTENANCE_ADMIN_URL ); |
|
227 | - }elseif($addons_should_be_upgraded_first){ |
|
228 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php'; |
|
229 | - }else{ |
|
230 | - if($most_recent_migration && |
|
231 | - $most_recent_migration instanceof EE_Data_Migration_Script_Base && |
|
232 | - $most_recent_migration->can_continue()){ |
|
223 | + )) { |
|
224 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_was_borked_page.template.php'; |
|
225 | + $this->_template_args['support_url'] = 'http://eventespresso.com/support/forums/'; |
|
226 | + $this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce(array('action' => 'confirm_migration_crash_report_sent', 'success' => '0'), EE_MAINTENANCE_ADMIN_URL); |
|
227 | + }elseif ($addons_should_be_upgraded_first) { |
|
228 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_upgrade_addons_before_migrating.template.php'; |
|
229 | + } else { |
|
230 | + if ($most_recent_migration && |
|
231 | + $most_recent_migration instanceof EE_Data_Migration_Script_Base && |
|
232 | + $most_recent_migration->can_continue()) { |
|
233 | 233 | $show_backup_db_text = false; |
234 | 234 | $show_continue_current_migration_script = true; |
235 | 235 | $show_most_recent_migration = true; |
236 | - }elseif(isset($this->_req_data['continue_migration'])){ |
|
236 | + }elseif (isset($this->_req_data['continue_migration'])) { |
|
237 | 237 | $show_most_recent_migration = true; |
238 | 238 | $show_continue_current_migration_script = false; |
239 | - }else{ |
|
239 | + } else { |
|
240 | 240 | $show_most_recent_migration = false; |
241 | 241 | $show_continue_current_migration_script = false; |
242 | 242 | } |
243 | 243 | |
244 | - if(isset($current_script)){ |
|
244 | + if (isset($current_script)) { |
|
245 | 245 | $migrates_to = $current_script->migrates_to_version(); |
246 | - $plugin_slug = $migrates_to[ 'slug' ]; |
|
247 | - $new_version = $migrates_to[ 'version' ]; |
|
248 | - $this->_template_args = array_merge($this->_template_args,array( |
|
249 | - 'current_db_state'=> sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3,$plugin_slug), |
|
250 | - 'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'),$new_version,$plugin_slug) : NULL)); |
|
246 | + $plugin_slug = $migrates_to['slug']; |
|
247 | + $new_version = $migrates_to['version']; |
|
248 | + $this->_template_args = array_merge($this->_template_args, array( |
|
249 | + 'current_db_state'=> sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3, $plugin_slug), |
|
250 | + 'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'), $new_version, $plugin_slug) : NULL)); |
|
251 | 251 | } |
252 | 252 | |
253 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php'; |
|
253 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_page.template.php'; |
|
254 | 254 | $this->_template_args = array_merge( |
255 | 255 | $this->_template_args, |
256 | 256 | array( |
257 | - 'show_most_recent_migration' => $show_most_recent_migration,//flag for showing the most recent migration's status and/or errors |
|
258 | - 'show_migration_progress' => $show_migration_progress,//flag for showing the option to run migrations and see their progress |
|
259 | - 'show_backup_db_text' => $show_backup_db_text,//flag for showing text telling the user to backup their DB |
|
260 | - 'show_maintenance_switch'=> $show_maintenance_switch,//flag for showing the option to change maintenance mode between levels 0 and 1 |
|
261 | - 'script_names'=>$script_names,//array of names of scripts that have run |
|
262 | - 'show_continue_current_migration_script'=>$show_continue_current_migration_script,//flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0 |
|
257 | + 'show_most_recent_migration' => $show_most_recent_migration, //flag for showing the most recent migration's status and/or errors |
|
258 | + 'show_migration_progress' => $show_migration_progress, //flag for showing the option to run migrations and see their progress |
|
259 | + 'show_backup_db_text' => $show_backup_db_text, //flag for showing text telling the user to backup their DB |
|
260 | + 'show_maintenance_switch'=> $show_maintenance_switch, //flag for showing the option to change maintenance mode between levels 0 and 1 |
|
261 | + 'script_names'=>$script_names, //array of names of scripts that have run |
|
262 | + 'show_continue_current_migration_script'=>$show_continue_current_migration_script, //flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0 |
|
263 | 263 | 'reset_db_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL), |
264 | - 'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'),EE_MAINTENANCE_ADMIN_URL), |
|
265 | - 'ultimate_db_state'=> sprintf(__("EE%s", 'event_espresso'),espresso_version()), |
|
264 | + 'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'), EE_MAINTENANCE_ADMIN_URL), |
|
265 | + 'ultimate_db_state'=> sprintf(__("EE%s", 'event_espresso'), espresso_version()), |
|
266 | 266 | ) |
267 | 267 | ); |
268 | 268 | //make sure we have the form fields helper available. It usually is, but sometimes it isn't |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | 'status_fatal_error'=> EE_Data_Migration_Manager::status_fatal_error, |
277 | 277 | 'status_completed'=> EE_Data_Migration_Manager::status_completed)); |
278 | 278 | } |
279 | - $this->_template_args['most_recent_migration'] = $most_recent_migration;//the actual most recently ran migration |
|
279 | + $this->_template_args['most_recent_migration'] = $most_recent_migration; //the actual most recently ran migration |
|
280 | 280 | $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE); |
281 | 281 | $this->display_admin_page_with_sidebar(); |
282 | 282 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | /** |
287 | 287 | * returns JSON and executes another step of the currently-executing data migration (called via ajax) |
288 | 288 | */ |
289 | - public function migration_step(){ |
|
289 | + public function migration_step() { |
|
290 | 290 | $this->_template_args['data'] = EE_Data_Migration_Manager::instance()->response_to_migration_ajax_request(); |
291 | 291 | $this->_return_json(); |
292 | 292 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * Can be used by js when it notices a response with HTML in it in order |
298 | 298 | * to log the malformed response |
299 | 299 | */ |
300 | - public function add_error_to_migrations_ran(){ |
|
300 | + public function add_error_to_migrations_ran() { |
|
301 | 301 | EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($this->_req_data['message']); |
302 | 302 | $this->_template_args['data'] = array('ok'=>true); |
303 | 303 | $this->_return_json(); |
@@ -308,14 +308,14 @@ discard block |
||
308 | 308 | /** |
309 | 309 | * changes the maintenance level, provided there are still no migration scripts that shoudl run |
310 | 310 | */ |
311 | - public function _change_maintenance_level(){ |
|
311 | + public function _change_maintenance_level() { |
|
312 | 312 | $new_level = intval($this->_req_data['maintenance_mode_level']); |
313 | - if( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){ |
|
313 | + if ( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
314 | 314 | EE_Maintenance_Mode::instance()->set_maintenance_level($new_level); |
315 | 315 | $success = true; |
316 | - }else{ |
|
316 | + } else { |
|
317 | 317 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
318 | - $success= false; |
|
318 | + $success = false; |
|
319 | 319 | } |
320 | 320 | $this->_redirect_after_action($success, 'Maintenance Mode', __("Updated", "event_espresso")); |
321 | 321 | } |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @throws \EE_Error |
329 | 329 | */ |
330 | - public function _data_reset_and_delete(){ |
|
331 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php'; |
|
330 | + public function _data_reset_and_delete() { |
|
331 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_data_reset_and_delete.template.php'; |
|
332 | 332 | $this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button( |
333 | 333 | 'reset_capabilities', |
334 | 334 | 'reset_capabilities', |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | false |
339 | 339 | ); |
340 | 340 | $this->_template_args['delete_db_url'] = EE_Admin_Page::add_query_args_and_nonce( |
341 | - array( 'action' => 'delete_db' ), |
|
341 | + array('action' => 'delete_db'), |
|
342 | 342 | EE_MAINTENANCE_ADMIN_URL |
343 | 343 | ); |
344 | 344 | $this->_template_args['reset_db_url'] = EE_Admin_Page::add_query_args_and_nonce( |
345 | - array( 'action' => 'reset_db' ), |
|
345 | + array('action' => 'reset_db'), |
|
346 | 346 | EE_MAINTENANCE_ADMIN_URL |
347 | 347 | ); |
348 | 348 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | |
357 | 357 | |
358 | 358 | protected function _reset_capabilities() { |
359 | - EE_Registry::instance()->CAP->init_caps( true ); |
|
360 | - EE_Error::add_success( __('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso' ) ); |
|
361 | - $this->_redirect_after_action( FALSE, '', '', array( 'action' => 'data_reset' ), TRUE ); |
|
359 | + EE_Registry::instance()->CAP->init_caps(true); |
|
360 | + EE_Error::add_success(__('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso')); |
|
361 | + $this->_redirect_after_action(FALSE, '', '', array('action' => 'data_reset'), TRUE); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | protected function _reattempt_migration() { |
370 | 370 | EE_Data_Migration_Manager::instance()->reattempt(); |
371 | - $this->_redirect_after_action( FALSE, '', '', array( 'action' => 'default' ), TRUE ); |
|
371 | + $this->_redirect_after_action(FALSE, '', '', array('action' => 'default'), TRUE); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | /** |
378 | 378 | * shows the big ol' System Information page |
379 | 379 | */ |
380 | - public function _system_status(){ |
|
381 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php'; |
|
380 | + public function _system_status() { |
|
381 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_system_stati_page.template.php'; |
|
382 | 382 | $this->_template_args['system_stati'] = EEM_System_Status::instance()->get_system_stati(); |
383 | 383 | $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE); |
384 | 384 | $this->display_admin_page_with_sidebar(); |
@@ -386,30 +386,30 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | - public function _send_migration_crash_report(){ |
|
389 | + public function _send_migration_crash_report() { |
|
390 | 390 | $from = $this->_req_data['from']; |
391 | 391 | $from_name = $this->_req_data['from_name']; |
392 | 392 | $body = $this->_req_data['body']; |
393 | - try{ |
|
393 | + try { |
|
394 | 394 | $success = wp_mail(EE_SUPPORT_EMAIL, |
395 | 395 | 'Migration Crash Report', |
396 | - $body."/r/n<br>". print_r(EEM_System_Status::instance()->get_system_stati(),true), |
|
396 | + $body."/r/n<br>".print_r(EEM_System_Status::instance()->get_system_stati(), true), |
|
397 | 397 | array( |
398 | 398 | "from:$from_name<$from>", |
399 | 399 | // 'content-type:text/html charset=UTF-8' |
400 | 400 | )); |
401 | - }catch( Exception $e ){ |
|
401 | + } catch (Exception $e) { |
|
402 | 402 | $success = FALSE; |
403 | 403 | } |
404 | - $this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"),array('success'=>$success,'action'=>'confirm_migration_crash_report_sent')); |
|
404 | + $this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"), array('success'=>$success, 'action'=>'confirm_migration_crash_report_sent')); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
408 | 408 | |
409 | - public function _confirm_migration_crash_report_sent(){ |
|
410 | - try{ |
|
409 | + public function _confirm_migration_crash_report_sent() { |
|
410 | + try { |
|
411 | 411 | $most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true); |
412 | - }catch(EE_Error $e){ |
|
412 | + } catch (EE_Error $e) { |
|
413 | 413 | |
414 | 414 | EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage()); |
415 | 415 | //now, just so we can display the page correctly, make a error migration script stage object |
@@ -417,14 +417,14 @@ discard block |
||
417 | 417 | $most_recent_migration = new EE_DMS_Unknown_1_0_0(); |
418 | 418 | $most_recent_migration->add_error($e->getMessage()); |
419 | 419 | } |
420 | - $success = $this->_req_data['success']=='1' ? true : false; |
|
420 | + $success = $this->_req_data['success'] == '1' ? true : false; |
|
421 | 421 | $this->_template_args['success'] = $success; |
422 | - $this->_template_args[ 'most_recent_migration' ] = $most_recent_migration; |
|
422 | + $this->_template_args['most_recent_migration'] = $most_recent_migration; |
|
423 | 423 | $this->_template_args['reset_db_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL); |
424 | - $this->_template_args[ 'reset_db_page_url' ] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL); |
|
425 | - $this->_template_args[ 'reattempt_action_url' ] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL ); |
|
426 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php'; |
|
427 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path,$this->_template_args,TRUE); |
|
424 | + $this->_template_args['reset_db_page_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL); |
|
425 | + $this->_template_args['reattempt_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL); |
|
426 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_confirm_migration_crash_report_sent.template.php'; |
|
427 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE); |
|
428 | 428 | $this->display_admin_page_with_sidebar(); |
429 | 429 | } |
430 | 430 | |
@@ -437,18 +437,18 @@ discard block |
||
437 | 437 | * @param boolean $nuke_old_ee4_data controls whether or not we |
438 | 438 | * destroy the old ee4 data, or just try initializing ee4 default data |
439 | 439 | */ |
440 | - public function _reset_db( $nuke_old_ee4_data = TRUE ){ |
|
440 | + public function _reset_db($nuke_old_ee4_data = TRUE) { |
|
441 | 441 | EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
442 | 442 | |
443 | - if( $nuke_old_ee4_data ){ |
|
443 | + if ($nuke_old_ee4_data) { |
|
444 | 444 | EEH_Activation::delete_all_espresso_cpt_data(); |
445 | - EEH_Activation::delete_all_espresso_tables_and_data( FALSE ); |
|
445 | + EEH_Activation::delete_all_espresso_tables_and_data(FALSE); |
|
446 | 446 | EEH_Activation::remove_cron_tasks(); |
447 | 447 | } |
448 | 448 | //make sure when we reset the registry's config that it |
449 | 449 | //switches to using the new singleton |
450 | - EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset( TRUE ); |
|
451 | - EE_System::instance()->initialize_db_if_no_migrations_required( TRUE ); |
|
450 | + EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(TRUE); |
|
451 | + EE_System::instance()->initialize_db_if_no_migrations_required(TRUE); |
|
452 | 452 | EE_System::instance()->redirect_to_about_ee(); |
453 | 453 | } |
454 | 454 | |
@@ -457,20 +457,20 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * Deletes ALL EE tables, Records, and Options from the database. |
459 | 459 | */ |
460 | - public function _delete_db(){ |
|
460 | + public function _delete_db() { |
|
461 | 461 | EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
462 | 462 | EEH_Activation::delete_all_espresso_cpt_data(); |
463 | 463 | EEH_Activation::delete_all_espresso_tables_and_data(); |
464 | 464 | EEH_Activation::remove_cron_tasks(); |
465 | 465 | EEH_Activation::deactivate_event_espresso(); |
466 | - wp_safe_redirect( admin_url( 'plugins.php' )); |
|
466 | + wp_safe_redirect(admin_url('plugins.php')); |
|
467 | 467 | exit; |
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
471 | 471 | * sets up EE4 to rerun the migrations from ee3 to ee4 |
472 | 472 | */ |
473 | - public function _rerun_migration_from_ee3(){ |
|
473 | + public function _rerun_migration_from_ee3() { |
|
474 | 474 | EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
475 | 475 | EEH_Activation::delete_all_espresso_cpt_data(); |
476 | 476 | EEH_Activation::delete_all_espresso_tables_and_data(false); |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | wp_enqueue_script('ee_admin_js'); |
498 | 498 | // wp_enqueue_media(); |
499 | 499 | // wp_enqueue_script('media-upload'); |
500 | - wp_enqueue_script('ee-maintenance',EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js',array('jquery'),EVENT_ESPRESSO_VERSION,true); |
|
500 | + wp_enqueue_script('ee-maintenance', EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js', array('jquery'), EVENT_ESPRESSO_VERSION, true); |
|
501 | 501 | |
502 | - wp_register_style( 'espresso_maintenance', EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION ); |
|
502 | + wp_register_style('espresso_maintenance', EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION); |
|
503 | 503 | wp_enqueue_style('espresso_maintenance'); |
504 | 504 | } |
505 | 505 |
@@ -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 | |
@@ -1238,22 +1238,22 @@ discard block |
||
1238 | 1238 | $is_complete = $this->_registration->transaction()->is_completed(); |
1239 | 1239 | //let's get an array of all possible buttons that we can just reference |
1240 | 1240 | $status_buttons = $this->_get_reg_status_buttons(); |
1241 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1242 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1241 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1242 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1243 | 1243 | $template_args['attendee'] = $this->_registration->attendee(); |
1244 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1245 | - if ( $this->_set_registration_object() ) { |
|
1244 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1245 | + if ($this->_set_registration_object()) { |
|
1246 | 1246 | $current_status = $this->_registration->status_ID(); |
1247 | - unset( $status_buttons[$current_status] ); |
|
1248 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1249 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1247 | + unset($status_buttons[$current_status]); |
|
1248 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1249 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1250 | 1250 | } |
1251 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1251 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1252 | 1252 | } |
1253 | 1253 | $template_args['form_url'] = REG_ADMIN_URL; |
1254 | 1254 | $template_args['REG_ID'] = $this->_registration->ID(); |
1255 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1256 | - EEH_Template::display_template( $template, $template_args ); |
|
1255 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1256 | + EEH_Template::display_template($template, $template_args); |
|
1257 | 1257 | |
1258 | 1258 | } |
1259 | 1259 | |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | private function _get_reg_status_buttons() { |
1268 | 1268 | |
1269 | 1269 | $buttons = array( |
1270 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1271 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1272 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1273 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1274 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1270 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1271 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1272 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1273 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1274 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1275 | 1275 | ); |
1276 | 1276 | return $buttons; |
1277 | 1277 | } |
@@ -1285,13 +1285,13 @@ discard block |
||
1285 | 1285 | * |
1286 | 1286 | * @return array (array with reg_id(s) updated and whether update was successful. |
1287 | 1287 | */ |
1288 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1289 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1288 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1289 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1290 | 1290 | |
1291 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1291 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1292 | 1292 | |
1293 | 1293 | //notify? |
1294 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1294 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1295 | 1295 | $this->_process_resend_registration(); |
1296 | 1296 | } |
1297 | 1297 | |
@@ -1309,19 +1309,19 @@ discard block |
||
1309 | 1309 | * @param bool $status |
1310 | 1310 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1311 | 1311 | */ |
1312 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1312 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1313 | 1313 | $success = true; |
1314 | 1314 | // set default status if none is passed |
1315 | 1315 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1316 | 1316 | |
1317 | 1317 | //typecast and sanitize reg_id |
1318 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1318 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1319 | 1319 | |
1320 | 1320 | //loop through REG_ID's and change status |
1321 | - foreach ( $reg_ids as $r_id ) { |
|
1322 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1323 | - if ( $registration instanceof EE_Registration ) { |
|
1324 | - $registration->set_status( $status ); |
|
1321 | + foreach ($reg_ids as $r_id) { |
|
1322 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1323 | + if ($registration instanceof EE_Registration) { |
|
1324 | + $registration->set_status($status); |
|
1325 | 1325 | $result = $registration->save(); |
1326 | 1326 | |
1327 | 1327 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | $this->_req_data['_REG_ID'] = $reg_ids; |
1334 | 1334 | |
1335 | 1335 | //return $success and processed registrations |
1336 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1336 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | |
@@ -1345,37 +1345,37 @@ discard block |
||
1345 | 1345 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1346 | 1346 | * @return void |
1347 | 1347 | */ |
1348 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1348 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1349 | 1349 | |
1350 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1350 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1351 | 1351 | |
1352 | 1352 | |
1353 | - $success = isset( $result['success'] ) && $result['success']; |
|
1353 | + $success = isset($result['success']) && $result['success']; |
|
1354 | 1354 | |
1355 | 1355 | //setup success message |
1356 | - if ( $success ) { |
|
1357 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1358 | - EE_Error::add_success( $msg ); |
|
1356 | + if ($success) { |
|
1357 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1358 | + EE_Error::add_success($msg); |
|
1359 | 1359 | } else { |
1360 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1360 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1361 | 1361 | } |
1362 | 1362 | |
1363 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1363 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1364 | 1364 | //unset nonces |
1365 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1366 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1367 | - unset( $this->_req_data[$ref] ); |
|
1365 | + foreach ($this->_req_data as $ref => $value) { |
|
1366 | + if (strpos($ref, 'nonce') !== false) { |
|
1367 | + unset($this->_req_data[$ref]); |
|
1368 | 1368 | continue; |
1369 | 1369 | } |
1370 | 1370 | |
1371 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1371 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1372 | 1372 | $this->_req_data[$ref] = $value; |
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | //merge request vars so that the reloaded list table contains any existing filter query params |
1376 | - $route = array_merge( $this->_req_data, $route ); |
|
1376 | + $route = array_merge($this->_req_data, $route); |
|
1377 | 1377 | |
1378 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1378 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | |
@@ -1387,29 +1387,29 @@ discard block |
||
1387 | 1387 | protected function _change_reg_status() { |
1388 | 1388 | $this->_req_data['return'] = 'view_registration'; |
1389 | 1389 | //set notify based on whether the send notifications toggle is set or not |
1390 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1391 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1390 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1391 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1392 | 1392 | |
1393 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1394 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1395 | - $this->approve_registration( $notify ); |
|
1393 | + switch ($this->_req_data['_reg_status_id']) { |
|
1394 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1395 | + $this->approve_registration($notify); |
|
1396 | 1396 | break; |
1397 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1398 | - $this->pending_registration( $notify ); |
|
1397 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1398 | + $this->pending_registration($notify); |
|
1399 | 1399 | break; |
1400 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1401 | - $this->not_approve_registration( $notify ); |
|
1400 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1401 | + $this->not_approve_registration($notify); |
|
1402 | 1402 | break; |
1403 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1404 | - $this->decline_registration( $notify ); |
|
1403 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1404 | + $this->decline_registration($notify); |
|
1405 | 1405 | break; |
1406 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1407 | - $this->cancel_registration( $notify ); |
|
1406 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1407 | + $this->cancel_registration($notify); |
|
1408 | 1408 | break; |
1409 | 1409 | default : |
1410 | 1410 | $result['success'] = false; |
1411 | - unset( $this->_req_data['return'] ); |
|
1412 | - $this->_reg_status_change_return( '', false ); |
|
1411 | + unset($this->_req_data['return']); |
|
1412 | + $this->_reg_status_change_return('', false); |
|
1413 | 1413 | break; |
1414 | 1414 | } |
1415 | 1415 | } |
@@ -1422,8 +1422,8 @@ discard block |
||
1422 | 1422 | * @param bool $notify whether or not to notify the registrant about their approval. |
1423 | 1423 | * @return void |
1424 | 1424 | */ |
1425 | - protected function approve_registration( $notify = false ) { |
|
1426 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1425 | + protected function approve_registration($notify = false) { |
|
1426 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | |
@@ -1435,8 +1435,8 @@ discard block |
||
1435 | 1435 | * @param bool $notify whether or not to notify the registrant about their approval. |
1436 | 1436 | * @return void |
1437 | 1437 | */ |
1438 | - protected function decline_registration( $notify = false ) { |
|
1439 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1438 | + protected function decline_registration($notify = false) { |
|
1439 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | |
@@ -1448,8 +1448,8 @@ discard block |
||
1448 | 1448 | * @param bool $notify whether or not to notify the registrant about their approval. |
1449 | 1449 | * @return void |
1450 | 1450 | */ |
1451 | - protected function cancel_registration( $notify = false ) { |
|
1452 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1451 | + protected function cancel_registration($notify = false) { |
|
1452 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | |
@@ -1462,8 +1462,8 @@ discard block |
||
1462 | 1462 | * @param bool $notify whether or not to notify the registrant about their approval. |
1463 | 1463 | * @return void |
1464 | 1464 | */ |
1465 | - protected function not_approve_registration( $notify = false ) { |
|
1466 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1465 | + protected function not_approve_registration($notify = false) { |
|
1466 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | |
@@ -1474,8 +1474,8 @@ discard block |
||
1474 | 1474 | * @param bool $notify whether or not to notify the registrant about their approval. |
1475 | 1475 | * @return void |
1476 | 1476 | */ |
1477 | - protected function pending_registration( $notify = false ) { |
|
1478 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1477 | + protected function pending_registration($notify = false) { |
|
1478 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1479 | 1479 | } |
1480 | 1480 | |
1481 | 1481 | |
@@ -1489,19 +1489,19 @@ discard block |
||
1489 | 1489 | public function _reg_details_meta_box() { |
1490 | 1490 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1491 | 1491 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1492 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
1492 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
1493 | 1493 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1494 | 1494 | $this->_session = $transaction->session_data(); |
1495 | 1495 | |
1496 | 1496 | $filters = new EE_Line_Item_Filter_Collection(); |
1497 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1498 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1499 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1497 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1498 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1499 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1500 | 1500 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1501 | 1501 | |
1502 | 1502 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1503 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1504 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1503 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1504 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1505 | 1505 | |
1506 | 1506 | |
1507 | 1507 | $attendee = $this->_registration->attendee(); |
@@ -1512,10 +1512,10 @@ discard block |
||
1512 | 1512 | ) |
1513 | 1513 | ? EEH_Template::get_button_or_link( |
1514 | 1514 | EE_Admin_Page::add_query_args_and_nonce( |
1515 | - array( 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() ), |
|
1515 | + array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()), |
|
1516 | 1516 | TXN_ADMIN_URL |
1517 | 1517 | ), |
1518 | - esc_html__( ' View Transaction' ), |
|
1518 | + esc_html__(' View Transaction'), |
|
1519 | 1519 | 'button secondary-button right', |
1520 | 1520 | 'dashicons dashicons-cart' |
1521 | 1521 | ) |
@@ -1535,59 +1535,59 @@ discard block |
||
1535 | 1535 | ), |
1536 | 1536 | REG_ADMIN_URL |
1537 | 1537 | ), |
1538 | - esc_html__( ' Resend Registration' ), |
|
1538 | + esc_html__(' Resend Registration'), |
|
1539 | 1539 | 'button secondary-button right', |
1540 | 1540 | 'dashicons dashicons-email-alt' |
1541 | 1541 | ) |
1542 | 1542 | : ''; |
1543 | 1543 | |
1544 | 1544 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1545 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1545 | + $payment = $transaction->get_first_related('Payment'); |
|
1546 | 1546 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1547 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1547 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1548 | 1548 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1549 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1549 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1550 | 1550 | $reg_details = array( |
1551 | 1551 | 'payment_method' => $payment_method->name(), |
1552 | 1552 | 'response_msg' => $payment->gateway_response(), |
1553 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1553 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1554 | 1554 | 'registration_session' => $this->_registration->session_ID(), |
1555 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1556 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1555 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1556 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1557 | 1557 | ); |
1558 | 1558 | |
1559 | 1559 | |
1560 | - if ( isset( $reg_details['registration_id'] )) { |
|
1560 | + if (isset($reg_details['registration_id'])) { |
|
1561 | 1561 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1562 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1562 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1563 | 1563 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1564 | 1564 | } |
1565 | 1565 | |
1566 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1566 | + if (isset($reg_details['payment_method'])) { |
|
1567 | 1567 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1568 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1568 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1569 | 1569 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1570 | 1570 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1571 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1571 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1572 | 1572 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1573 | 1573 | } |
1574 | 1574 | |
1575 | 1575 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1576 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1576 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1577 | 1577 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1578 | 1578 | |
1579 | 1579 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1580 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1580 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1581 | 1581 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1582 | 1582 | |
1583 | 1583 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1584 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1584 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1585 | 1585 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1586 | 1586 | |
1587 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1587 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1588 | 1588 | |
1589 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1590 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1589 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1590 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1591 | 1591 | |
1592 | 1592 | } |
1593 | 1593 | |
@@ -1601,14 +1601,14 @@ discard block |
||
1601 | 1601 | */ |
1602 | 1602 | public function _reg_questions_meta_box() { |
1603 | 1603 | //allow someone to override this method entirely |
1604 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1605 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1606 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1604 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1605 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1606 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1607 | 1607 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1608 | 1608 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1609 | 1609 | |
1610 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1611 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1610 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1611 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1612 | 1612 | } |
1613 | 1613 | } |
1614 | 1614 | |
@@ -1622,12 +1622,12 @@ discard block |
||
1622 | 1622 | * @param string $output |
1623 | 1623 | * @return string |
1624 | 1624 | */ |
1625 | - public function form_before_question_group( $output ) { |
|
1625 | + public function form_before_question_group($output) { |
|
1626 | 1626 | EE_Error::doing_it_wrong( |
1627 | - __CLASS__ . '::' . __FUNCTION__, |
|
1628 | - __( 'This method would have been protected but was used on a filter callback' |
|
1627 | + __CLASS__.'::'.__FUNCTION__, |
|
1628 | + __('This method would have been protected but was used on a filter callback' |
|
1629 | 1629 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1630 | - 'event_espresso' ), |
|
1630 | + 'event_espresso'), |
|
1631 | 1631 | '4.8.32.rc.000' |
1632 | 1632 | ); |
1633 | 1633 | return ' |
@@ -1646,20 +1646,20 @@ discard block |
||
1646 | 1646 | * @param string $output |
1647 | 1647 | * @return string |
1648 | 1648 | */ |
1649 | - public function form_after_question_group( $output ) { |
|
1649 | + public function form_after_question_group($output) { |
|
1650 | 1650 | EE_Error::doing_it_wrong( |
1651 | - __CLASS__ . '::' . __FUNCTION__, |
|
1652 | - __( 'This method would have been protected but was used on a filter callback' |
|
1651 | + __CLASS__.'::'.__FUNCTION__, |
|
1652 | + __('This method would have been protected but was used on a filter callback' |
|
1653 | 1653 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1654 | - 'event_espresso' ), |
|
1654 | + 'event_espresso'), |
|
1655 | 1655 | '4.8.32.rc.000' |
1656 | 1656 | ); |
1657 | 1657 | return ' |
1658 | 1658 | <tr class="hide-if-no-js"> |
1659 | 1659 | <th> </th> |
1660 | 1660 | <td class="reg-admin-edit-attendee-question-td"> |
1661 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1662 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1661 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1662 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1663 | 1663 | <div class="dashicons dashicons-edit"></div> |
1664 | 1664 | </a> |
1665 | 1665 | </td> |
@@ -1679,18 +1679,18 @@ discard block |
||
1679 | 1679 | * @param string $label |
1680 | 1680 | * @return string |
1681 | 1681 | */ |
1682 | - public function form_form_field_label_wrap( $label ) { |
|
1682 | + public function form_form_field_label_wrap($label) { |
|
1683 | 1683 | EE_Error::doing_it_wrong( |
1684 | - __CLASS__ . '::' . __FUNCTION__, |
|
1685 | - __( 'This method would have been protected but was used on a filter callback' |
|
1684 | + __CLASS__.'::'.__FUNCTION__, |
|
1685 | + __('This method would have been protected but was used on a filter callback' |
|
1686 | 1686 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1687 | - 'event_espresso' ), |
|
1687 | + 'event_espresso'), |
|
1688 | 1688 | '4.8.32.rc.000' |
1689 | 1689 | ); |
1690 | 1690 | return ' |
1691 | 1691 | <tr> |
1692 | 1692 | <th> |
1693 | - ' . $label . ' |
|
1693 | + ' . $label.' |
|
1694 | 1694 | </th>'; |
1695 | 1695 | } |
1696 | 1696 | |
@@ -1704,17 +1704,17 @@ discard block |
||
1704 | 1704 | * @param string $input |
1705 | 1705 | * @return string |
1706 | 1706 | */ |
1707 | - public function form_form_field_input__wrap( $input ) { |
|
1707 | + public function form_form_field_input__wrap($input) { |
|
1708 | 1708 | EE_Error::doing_it_wrong( |
1709 | - __CLASS__ . '::' . __FUNCTION__, |
|
1710 | - __( 'This method would have been protected but was used on a filter callback' |
|
1709 | + __CLASS__.'::'.__FUNCTION__, |
|
1710 | + __('This method would have been protected but was used on a filter callback' |
|
1711 | 1711 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1712 | - 'event_espresso' ), |
|
1712 | + 'event_espresso'), |
|
1713 | 1713 | '4.8.32.rc.000' |
1714 | 1714 | ); |
1715 | 1715 | return ' |
1716 | 1716 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1717 | - ' . $input . ' |
|
1717 | + ' . $input.' |
|
1718 | 1718 | </td> |
1719 | 1719 | </tr>'; |
1720 | 1720 | } |
@@ -1728,14 +1728,14 @@ discard block |
||
1728 | 1728 | * @return void |
1729 | 1729 | */ |
1730 | 1730 | protected function _update_attendee_registration_form() { |
1731 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1732 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1733 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1734 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1735 | - if( $success ) { |
|
1731 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1732 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1733 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1734 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1735 | + if ($success) { |
|
1736 | 1736 | $what = __('Registration Form', 'event_espresso'); |
1737 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1738 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1737 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1738 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1739 | 1739 | } |
1740 | 1740 | } |
1741 | 1741 | } |
@@ -1746,11 +1746,11 @@ discard block |
||
1746 | 1746 | * @param int $REG_ID |
1747 | 1747 | * @return EE_Registration_Custom_Questions_Form |
1748 | 1748 | */ |
1749 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1750 | - if( ! $this->_reg_custom_questions_form ) { |
|
1751 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1752 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1753 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1749 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1750 | + if ( ! $this->_reg_custom_questions_form) { |
|
1751 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1752 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1753 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1754 | 1754 | } |
1755 | 1755 | return $this->_reg_custom_questions_form; |
1756 | 1756 | } |
@@ -1763,17 +1763,17 @@ discard block |
||
1763 | 1763 | * @param bool $REG_ID |
1764 | 1764 | * @return bool |
1765 | 1765 | */ |
1766 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1766 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1767 | 1767 | |
1768 | 1768 | if ( ! $REG_ID) { |
1769 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1769 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1770 | 1770 | } |
1771 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1772 | - $form->receive_form_submission( $this->_req_data ); |
|
1771 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1772 | + $form->receive_form_submission($this->_req_data); |
|
1773 | 1773 | $success = false; |
1774 | - if( $form->is_valid() ) { |
|
1775 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1776 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1774 | + if ($form->is_valid()) { |
|
1775 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1776 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1777 | 1777 | $where_conditions = array( |
1778 | 1778 | 'QST_ID' => $question_id, |
1779 | 1779 | 'REG_ID' => $REG_ID |
@@ -1781,19 +1781,19 @@ discard block |
||
1781 | 1781 | $possibly_new_values = array( |
1782 | 1782 | 'ANS_value' => $input->normalized_value() |
1783 | 1783 | ); |
1784 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1785 | - if( $answer instanceof EE_Answer ) { |
|
1786 | - $success = $answer->save( $possibly_new_values ); |
|
1784 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1785 | + if ($answer instanceof EE_Answer) { |
|
1786 | + $success = $answer->save($possibly_new_values); |
|
1787 | 1787 | } else { |
1788 | 1788 | //insert it then |
1789 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1790 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1789 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1790 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1791 | 1791 | $success = $answer->save(); |
1792 | 1792 | } |
1793 | 1793 | } |
1794 | 1794 | } |
1795 | 1795 | } else { |
1796 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1796 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1797 | 1797 | } |
1798 | 1798 | return $success; |
1799 | 1799 | } |
@@ -1811,31 +1811,31 @@ discard block |
||
1811 | 1811 | $registrations = $REG->get_all(array( |
1812 | 1812 | array( |
1813 | 1813 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1814 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1814 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1815 | 1815 | ), |
1816 | 1816 | 'force_join'=>array('Attendee'))); |
1817 | 1817 | |
1818 | 1818 | $this->_template_args['attendees'] = array(); |
1819 | 1819 | $this->_template_args['attendee_notice'] = ''; |
1820 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1821 | - 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__ ); |
|
1820 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1821 | + 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__); |
|
1822 | 1822 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1823 | 1823 | } else { |
1824 | 1824 | |
1825 | 1825 | $att_nmbr = 1; |
1826 | - foreach ( $registrations as $registration ) { |
|
1826 | + foreach ($registrations as $registration) { |
|
1827 | 1827 | /* @var $registration EE_Registration */ |
1828 | 1828 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1829 | - $this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID(); |
|
1830 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1831 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1832 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1833 | - $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 : ''; |
|
1829 | + $this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID(); |
|
1830 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1831 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1832 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1833 | + $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 : ''; |
|
1834 | 1834 | |
1835 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1835 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1836 | 1836 | |
1837 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1838 | - $this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name(); |
|
1837 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1838 | + $this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name(); |
|
1839 | 1839 | |
1840 | 1840 | $att_nmbr++; |
1841 | 1841 | } |
@@ -1845,8 +1845,8 @@ discard block |
||
1845 | 1845 | |
1846 | 1846 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1847 | 1847 | } |
1848 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1849 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1848 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1849 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1850 | 1850 | |
1851 | 1851 | } |
1852 | 1852 | |
@@ -1867,14 +1867,14 @@ discard block |
||
1867 | 1867 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1868 | 1868 | |
1869 | 1869 | //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) |
1870 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1870 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1871 | 1871 | |
1872 | 1872 | $primary_registration = $this->_registration->get_primary_registration(); |
1873 | 1873 | $primary_attendee = $primary_registration instanceof EE_Registration |
1874 | 1874 | ? $primary_registration->attendee() |
1875 | 1875 | : null; |
1876 | 1876 | |
1877 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1877 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1878 | 1878 | //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. |
1879 | 1879 | $primary_registration = NULL; |
1880 | 1880 | } |
@@ -1883,27 +1883,27 @@ discard block |
||
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1886 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1887 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1888 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1886 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1887 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1888 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1889 | 1889 | $this->_template_args['phone'] = $attendee->phone(); |
1890 | 1890 | |
1891 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1891 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1892 | 1892 | |
1893 | 1893 | |
1894 | 1894 | //edit link |
1895 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1895 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1896 | 1896 | $this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso'); |
1897 | 1897 | |
1898 | 1898 | //create link |
1899 | - $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 ): ''; |
|
1899 | + $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) : ''; |
|
1900 | 1900 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1901 | 1901 | |
1902 | 1902 | $this->_template_args['att_check'] = $att_check; |
1903 | 1903 | |
1904 | 1904 | |
1905 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1906 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1905 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1906 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1907 | 1907 | } |
1908 | 1908 | |
1909 | 1909 | |
@@ -1916,7 +1916,7 @@ discard block |
||
1916 | 1916 | * @access protected |
1917 | 1917 | * @return void |
1918 | 1918 | */ |
1919 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1919 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1920 | 1920 | $REGM = EEM_Registration::instance(); |
1921 | 1921 | |
1922 | 1922 | $success = 1; |
@@ -1926,26 +1926,26 @@ discard block |
||
1926 | 1926 | $dtts = array(); |
1927 | 1927 | |
1928 | 1928 | //if empty _REG_ID then get out because there's nothing to do |
1929 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1929 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1930 | 1930 | $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'); |
1931 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1932 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1931 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1932 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1933 | 1933 | } |
1934 | 1934 | |
1935 | 1935 | //Checkboxes |
1936 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1936 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1937 | 1937 | // if array has more than one element than success message should be plural |
1938 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1938 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1939 | 1939 | // cycle thru checkboxes |
1940 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1940 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1941 | 1941 | /** @var EE_Registration $REG */ |
1942 | - $REG = $REGM->get_one_by_ID( $REG_ID); |
|
1942 | + $REG = $REGM->get_one_by_ID($REG_ID); |
|
1943 | 1943 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1944 | - if ( $payment_count > 0 ) { |
|
1945 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1944 | + if ($payment_count > 0) { |
|
1945 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1946 | 1946 | $error = 1; |
1947 | 1947 | $success = 0; |
1948 | - 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__ ); |
|
1948 | + 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__); |
|
1949 | 1949 | continue; //can't trash this registration because it has payments. |
1950 | 1950 | } |
1951 | 1951 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | $dtts = array_merge($dtts, $dtt); |
1955 | 1955 | |
1956 | 1956 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1957 | - if ( !$updated ) { |
|
1957 | + if ( ! $updated) { |
|
1958 | 1958 | $success = 0; |
1959 | 1959 | } else { |
1960 | 1960 | $success = 2; |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | $tickets[$ticket->ID()] = $ticket; |
1970 | 1970 | $dtts = $ticket->get_many_related('Datetime'); |
1971 | 1971 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1972 | - if ( ! $updated ) { |
|
1972 | + if ( ! $updated) { |
|
1973 | 1973 | $success = 0; |
1974 | 1974 | } |
1975 | 1975 | |
@@ -1979,10 +1979,10 @@ discard block |
||
1979 | 1979 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1980 | 1980 | EEM_Datetime::instance()->update_sold($dtts); |
1981 | 1981 | |
1982 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1983 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1982 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1983 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1984 | 1984 | $overwrite_msgs = $error ? TRUE : FALSE; |
1985 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1985 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1986 | 1986 | } |
1987 | 1987 | |
1988 | 1988 | |
@@ -2006,16 +2006,16 @@ discard block |
||
2006 | 2006 | $success = 1; |
2007 | 2007 | |
2008 | 2008 | //Checkboxes |
2009 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2009 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2010 | 2010 | // if array has more than one element than success message should be plural |
2011 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
2011 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
2012 | 2012 | // cycle thru checkboxes |
2013 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
2013 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
2014 | 2014 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
2015 | - if ( ! $REG instanceof EE_Registration ) |
|
2015 | + if ( ! $REG instanceof EE_Registration) |
|
2016 | 2016 | continue; |
2017 | 2017 | $deleted = $this->_delete_registration($REG); |
2018 | - if ( !$deleted ) { |
|
2018 | + if ( ! $deleted) { |
|
2019 | 2019 | $success = 0; |
2020 | 2020 | } |
2021 | 2021 | } |
@@ -2025,15 +2025,15 @@ discard block |
||
2025 | 2025 | $REG_ID = $this->_req_data['_REG_ID']; |
2026 | 2026 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
2027 | 2027 | $deleted = $this->_delete_registration($REG); |
2028 | - if ( ! $deleted ) { |
|
2028 | + if ( ! $deleted) { |
|
2029 | 2029 | $success = 0; |
2030 | 2030 | } |
2031 | 2031 | |
2032 | 2032 | } |
2033 | 2033 | |
2034 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
2035 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
2036 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
2034 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
2035 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
2036 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
2037 | 2037 | } |
2038 | 2038 | |
2039 | 2039 | |
@@ -2045,31 +2045,31 @@ discard block |
||
2045 | 2045 | * @param EE_Registration $REG registration to be deleted permenantly |
2046 | 2046 | * @return boolean true = successful deletion, false = fail. |
2047 | 2047 | */ |
2048 | - protected function _delete_registration( EE_Registration $REG ) { |
|
2048 | + protected function _delete_registration(EE_Registration $REG) { |
|
2049 | 2049 | //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. |
2050 | 2050 | $TXN = $REG->get_first_related('Transaction'); |
2051 | 2051 | $REGS = $TXN->get_many_related('Registration'); |
2052 | 2052 | |
2053 | 2053 | $all_trashed = TRUE; |
2054 | - foreach ( $REGS as $registration ) { |
|
2055 | - if ( ! $registration->get('REG_deleted') ) |
|
2054 | + foreach ($REGS as $registration) { |
|
2055 | + if ( ! $registration->get('REG_deleted')) |
|
2056 | 2056 | $all_trashed = FALSE; |
2057 | 2057 | } |
2058 | 2058 | |
2059 | - if ( ! $all_trashed ) { |
|
2060 | - 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__ ); |
|
2059 | + if ( ! $all_trashed) { |
|
2060 | + 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__); |
|
2061 | 2061 | return false; |
2062 | 2062 | } |
2063 | 2063 | |
2064 | 2064 | //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). |
2065 | - foreach ( $REGS as $registration ) { |
|
2065 | + foreach ($REGS as $registration) { |
|
2066 | 2066 | |
2067 | 2067 | //delete related answers |
2068 | 2068 | $registration->delete_related_permanently('Answer'); |
2069 | 2069 | |
2070 | 2070 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
2071 | 2071 | $attendee = $registration->get_first_related('Attendee'); |
2072 | - if ( $attendee instanceof EE_Attendee ) { |
|
2072 | + if ($attendee instanceof EE_Attendee) { |
|
2073 | 2073 | $registration->_remove_relation_to($attendee, 'Attendee'); |
2074 | 2074 | } |
2075 | 2075 | |
@@ -2079,7 +2079,7 @@ discard block |
||
2079 | 2079 | //now delete permanently the checkins related to this registration. |
2080 | 2080 | $registration->delete_related_permanently('Checkin'); |
2081 | 2081 | |
2082 | - if ( $registration->ID() === $REG->ID() ) |
|
2082 | + if ($registration->ID() === $REG->ID()) |
|
2083 | 2083 | continue; //we don't want to delete permanently the existing registration just yet. |
2084 | 2084 | |
2085 | 2085 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2116,35 +2116,35 @@ discard block |
||
2116 | 2116 | * @return void |
2117 | 2117 | */ |
2118 | 2118 | public function new_registration() { |
2119 | - if ( ! $this->_set_reg_event() ) { |
|
2120 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2119 | + if ( ! $this->_set_reg_event()) { |
|
2120 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2121 | 2121 | } |
2122 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2122 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2123 | 2123 | // gotta start with a clean slate if we're not coming here via ajax |
2124 | 2124 | if ( |
2125 | - ! defined('DOING_AJAX' ) |
|
2126 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2125 | + ! defined('DOING_AJAX') |
|
2126 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2127 | 2127 | ) { |
2128 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2128 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2129 | 2129 | } |
2130 | 2130 | |
2131 | - $this->_template_args['event_name'] = '' ; |
|
2131 | + $this->_template_args['event_name'] = ''; |
|
2132 | 2132 | // event name |
2133 | - if ( $this->_reg_event ) { |
|
2133 | + if ($this->_reg_event) { |
|
2134 | 2134 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2135 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2136 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2137 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2135 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2136 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2137 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2138 | 2138 | } |
2139 | 2139 | |
2140 | 2140 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2141 | 2141 | |
2142 | - if ( defined('DOING_AJAX' ) ) { |
|
2142 | + if (defined('DOING_AJAX')) { |
|
2143 | 2143 | $this->_return_json(); |
2144 | 2144 | } |
2145 | 2145 | // grab header |
2146 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2147 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2146 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2147 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2148 | 2148 | |
2149 | 2149 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2150 | 2150 | // the details template wrapper |
@@ -2161,7 +2161,7 @@ discard block |
||
2161 | 2161 | * @return string html |
2162 | 2162 | */ |
2163 | 2163 | protected function _get_registration_step_content() { |
2164 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2164 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2165 | 2165 | $warning_msg = sprintf( |
2166 | 2166 | __( |
2167 | 2167 | '%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', |
@@ -2177,7 +2177,7 @@ discard block |
||
2177 | 2177 | '</b>' |
2178 | 2178 | ); |
2179 | 2179 | return ' |
2180 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2180 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2181 | 2181 | <script > |
2182 | 2182 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2183 | 2183 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2212,16 +2212,16 @@ discard block |
||
2212 | 2212 | $cart = EE_Registry::instance()->SSN->cart(); |
2213 | 2213 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2214 | 2214 | |
2215 | - switch ( $step ) { |
|
2215 | + switch ($step) { |
|
2216 | 2216 | case 'ticket' : |
2217 | 2217 | $hidden_fields['processing_registration']['value'] = 1; |
2218 | 2218 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2219 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2219 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2220 | 2220 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2221 | 2221 | $template_args['show_notification_toggle'] = FALSE; |
2222 | 2222 | break; |
2223 | 2223 | case 'questions' : |
2224 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2224 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2225 | 2225 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2226 | 2226 | //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. |
2227 | 2227 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2230,10 +2230,10 @@ discard block |
||
2230 | 2230 | break; |
2231 | 2231 | } |
2232 | 2232 | |
2233 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2233 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2234 | 2234 | |
2235 | 2235 | return EEH_Template::display_template( |
2236 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2236 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2237 | 2237 | ); |
2238 | 2238 | } |
2239 | 2239 | |
@@ -2248,11 +2248,11 @@ discard block |
||
2248 | 2248 | * @return boolean |
2249 | 2249 | */ |
2250 | 2250 | private function _set_reg_event() { |
2251 | - if ( is_object( $this->_reg_event )) { |
|
2251 | + if (is_object($this->_reg_event)) { |
|
2252 | 2252 | return TRUE; |
2253 | 2253 | } |
2254 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2255 | - if ( ! $EVT_ID ) { |
|
2254 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2255 | + if ( ! $EVT_ID) { |
|
2256 | 2256 | return FALSE; |
2257 | 2257 | } |
2258 | 2258 | |
@@ -2273,82 +2273,82 @@ discard block |
||
2273 | 2273 | public function process_reg_step() { |
2274 | 2274 | EE_System::do_not_cache(); |
2275 | 2275 | $this->_set_reg_event(); |
2276 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2276 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2277 | 2277 | |
2278 | 2278 | //what step are we on? |
2279 | 2279 | $cart = EE_Registry::instance()->SSN->cart(); |
2280 | 2280 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2281 | 2281 | |
2282 | 2282 | //if doing ajax then we need to verify the nonce |
2283 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2284 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2285 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2283 | + if (defined('DOING_AJAX')) { |
|
2284 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2285 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2286 | 2286 | } |
2287 | 2287 | |
2288 | - switch ( $step ) { |
|
2288 | + switch ($step) { |
|
2289 | 2289 | |
2290 | 2290 | case 'ticket' : |
2291 | 2291 | //process ticket selection |
2292 | 2292 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2293 | - if ( $success ) { |
|
2294 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2293 | + if ($success) { |
|
2294 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2295 | 2295 | } else { |
2296 | 2296 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2297 | 2297 | } |
2298 | - if ( defined('DOING_AJAX') ) { |
|
2298 | + if (defined('DOING_AJAX')) { |
|
2299 | 2299 | $this->new_registration(); //display next step |
2300 | 2300 | } else { |
2301 | 2301 | $query_args['action'] = 'new_registration'; |
2302 | 2302 | $query_args['processing_registration'] = 1; |
2303 | 2303 | $query_args['event_id'] = $this->_reg_event->ID(); |
2304 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2304 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2305 | 2305 | } |
2306 | 2306 | break; |
2307 | 2307 | |
2308 | 2308 | case 'questions' : |
2309 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2310 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2309 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2310 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2311 | 2311 | } |
2312 | 2312 | //process registration |
2313 | 2313 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2314 | - if ( $cart instanceof EE_Cart ) { |
|
2314 | + if ($cart instanceof EE_Cart) { |
|
2315 | 2315 | $grand_total = $cart->get_cart_grand_total(); |
2316 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2316 | + if ($grand_total instanceof EE_Line_Item) { |
|
2317 | 2317 | $grand_total->save_this_and_descendants_to_txn(); |
2318 | 2318 | } |
2319 | 2319 | } |
2320 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2320 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2321 | 2321 | $query_args = array( |
2322 | 2322 | 'action' => 'new_registration', |
2323 | 2323 | 'processing_registration' => 2, |
2324 | 2324 | 'event_id' => $this->_reg_event->ID() |
2325 | 2325 | ); |
2326 | 2326 | |
2327 | - if ( defined('DOING_AJAX' )) { |
|
2327 | + if (defined('DOING_AJAX')) { |
|
2328 | 2328 | //display registration form again because there are errors (maybe validation?) |
2329 | 2329 | $this->new_registration(); |
2330 | 2330 | return; |
2331 | 2331 | } else { |
2332 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2332 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2333 | 2333 | return; |
2334 | 2334 | } |
2335 | 2335 | } |
2336 | 2336 | /** @type EE_Transaction_Payments $transaction_payments */ |
2337 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2337 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2338 | 2338 | // maybe update status, and make sure to save transaction if not done already |
2339 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2339 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2340 | 2340 | $transaction->save(); |
2341 | 2341 | } |
2342 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2342 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2343 | 2343 | $this->_req_data = array(); |
2344 | 2344 | $query_args = array( |
2345 | 2345 | 'action' => 'redirect_to_txn', |
2346 | 2346 | 'TXN_ID' => $transaction->ID(), |
2347 | 2347 | 'EVT_ID' => $this->_reg_event->ID(), |
2348 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2348 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2349 | 2349 | 'redirect_from' => 'new_registration' |
2350 | 2350 | ); |
2351 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2351 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2352 | 2352 | break; |
2353 | 2353 | } |
2354 | 2354 | |
@@ -2365,21 +2365,21 @@ discard block |
||
2365 | 2365 | */ |
2366 | 2366 | public function redirect_to_txn() { |
2367 | 2367 | EE_System::do_not_cache(); |
2368 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2368 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2369 | 2369 | $query_args = array( |
2370 | 2370 | 'action' => 'view_transaction', |
2371 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2371 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2372 | 2372 | 'page' => 'espresso_transactions' |
2373 | 2373 | ); |
2374 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2375 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2376 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2377 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2374 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2375 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2376 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2377 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2378 | 2378 | } |
2379 | 2379 | EE_Error::add_success( |
2380 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2380 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2381 | 2381 | ); |
2382 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2382 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2383 | 2383 | } |
2384 | 2384 | |
2385 | 2385 | |
@@ -2390,7 +2390,7 @@ discard block |
||
2390 | 2390 | * @return void |
2391 | 2391 | */ |
2392 | 2392 | protected function _attendee_contact_list_table() { |
2393 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2393 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2394 | 2394 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2395 | 2395 | $this->display_admin_list_table_page_with_no_sidebar(); |
2396 | 2396 | } |
@@ -2405,10 +2405,10 @@ discard block |
||
2405 | 2405 | * @access public |
2406 | 2406 | * @return array |
2407 | 2407 | */ |
2408 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2408 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2409 | 2409 | |
2410 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2411 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2410 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2411 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2412 | 2412 | $ATT_MDL = EEM_Attendee::instance(); |
2413 | 2413 | |
2414 | 2414 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2436,47 +2436,47 @@ discard block |
||
2436 | 2436 | $orderby = 'ATT_lname'; |
2437 | 2437 | } |
2438 | 2438 | |
2439 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2439 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2440 | 2440 | |
2441 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2442 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2443 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2441 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2442 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2443 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2444 | 2444 | |
2445 | 2445 | $_where = array(); |
2446 | 2446 | |
2447 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
2448 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2447 | + if ( ! empty($this->_req_data['s'])) { |
|
2448 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2449 | 2449 | $_where['OR'] = array( |
2450 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2451 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2452 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2453 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2454 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2455 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2456 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2457 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2458 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2459 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2460 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2461 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2462 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2463 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2464 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2465 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2466 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2450 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2451 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2452 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2453 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2454 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2455 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2456 | + 'ATT_email' => array('LIKE', $sstr), |
|
2457 | + 'ATT_address' => array('LIKE', $sstr), |
|
2458 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2459 | + 'ATT_city' => array('LIKE', $sstr), |
|
2460 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2461 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2462 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2463 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2464 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2465 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2466 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2467 | 2467 | ); |
2468 | 2468 | } |
2469 | 2469 | |
2470 | 2470 | |
2471 | - $offset = ($current_page-1)*$per_page; |
|
2472 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2471 | + $offset = ($current_page - 1) * $per_page; |
|
2472 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2473 | 2473 | |
2474 | - if ( $trash ) { |
|
2475 | - $_where['status'] = array( '!=', 'publish' ); |
|
2476 | - $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)); |
|
2474 | + if ($trash) { |
|
2475 | + $_where['status'] = array('!=', 'publish'); |
|
2476 | + $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)); |
|
2477 | 2477 | } else { |
2478 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2479 | - $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) ); |
|
2478 | + $_where['status'] = array('IN', array('publish')); |
|
2479 | + $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)); |
|
2480 | 2480 | } |
2481 | 2481 | |
2482 | 2482 | return $all_attendees; |
@@ -2493,10 +2493,10 @@ discard block |
||
2493 | 2493 | */ |
2494 | 2494 | protected function _resend_registration() { |
2495 | 2495 | $this->_process_resend_registration(); |
2496 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2496 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2497 | 2497 | 'action' => 'default' |
2498 | 2498 | ); |
2499 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2499 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2500 | 2500 | } |
2501 | 2501 | |
2502 | 2502 | |
@@ -2504,26 +2504,26 @@ discard block |
||
2504 | 2504 | |
2505 | 2505 | |
2506 | 2506 | |
2507 | - public function _registrations_report(){ |
|
2508 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2509 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2507 | + public function _registrations_report() { |
|
2508 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2509 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2510 | 2510 | array( |
2511 | 2511 | 'page' => 'espresso_batch', |
2512 | 2512 | 'batch' => 'file', |
2513 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2514 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2515 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2516 | - )) ); |
|
2513 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2514 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2515 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2516 | + ))); |
|
2517 | 2517 | } else { |
2518 | 2518 | $new_request_args = array( |
2519 | 2519 | 'export' => 'report', |
2520 | 2520 | 'action' => 'registrations_report_for_event', |
2521 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2521 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2522 | 2522 | ); |
2523 | 2523 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2524 | 2524 | |
2525 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2526 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2525 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2526 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2527 | 2527 | $EE_Export = EE_Export::instance($this->_req_data); |
2528 | 2528 | $EE_Export->export(); |
2529 | 2529 | } |
@@ -2532,26 +2532,26 @@ discard block |
||
2532 | 2532 | |
2533 | 2533 | |
2534 | 2534 | |
2535 | - public function _contact_list_export(){ |
|
2536 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2537 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2535 | + public function _contact_list_export() { |
|
2536 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2537 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2538 | 2538 | $EE_Export = EE_Export::instance($this->_req_data); |
2539 | 2539 | $EE_Export->export_attendees(); |
2540 | 2540 | } |
2541 | 2541 | } |
2542 | 2542 | |
2543 | - public function _contact_list_report(){ |
|
2544 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2545 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2543 | + public function _contact_list_report() { |
|
2544 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2545 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2546 | 2546 | array( |
2547 | 2547 | 'page' => 'espresso_batch', |
2548 | 2548 | 'batch' => 'file', |
2549 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2550 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2551 | - )) ); |
|
2549 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2550 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2551 | + ))); |
|
2552 | 2552 | } else { |
2553 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2554 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2553 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2554 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2555 | 2555 | $EE_Export = EE_Export::instance($this->_req_data); |
2556 | 2556 | $EE_Export->report_attendees(); |
2557 | 2557 | } |
@@ -2570,73 +2570,73 @@ discard block |
||
2570 | 2570 | * @return void |
2571 | 2571 | */ |
2572 | 2572 | protected function _duplicate_attendee() { |
2573 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2573 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2574 | 2574 | //verify we have necessary info |
2575 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2576 | - 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__ ); |
|
2577 | - $query_args = array( 'action' => $action ); |
|
2575 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2576 | + 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__); |
|
2577 | + $query_args = array('action' => $action); |
|
2578 | 2578 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2579 | 2579 | } |
2580 | 2580 | |
2581 | 2581 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2582 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2582 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2583 | 2583 | $attendee = $registration->attendee(); |
2584 | 2584 | |
2585 | 2585 | //remove relation of existing attendee on registration |
2586 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2586 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2587 | 2587 | //new attendee |
2588 | 2588 | $new_attendee = clone $attendee; |
2589 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2589 | + $new_attendee->set('ATT_ID', 0); |
|
2590 | 2590 | $new_attendee->save(); |
2591 | 2591 | |
2592 | 2592 | //add new attendee to reg |
2593 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2593 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2594 | 2594 | |
2595 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2595 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2596 | 2596 | |
2597 | 2597 | //redirect to edit page for attendee |
2598 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2598 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2599 | 2599 | |
2600 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2600 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2601 | 2601 | } |
2602 | 2602 | |
2603 | 2603 | |
2604 | 2604 | //related to cpt routes |
2605 | 2605 | protected function _insert_update_cpt_item($post_id, $post) { |
2606 | 2606 | $success = true; |
2607 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2607 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2608 | 2608 | //for attendee updates |
2609 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2609 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2610 | 2610 | //note we should only be UPDATING attendees at this point. |
2611 | 2611 | $updated_fields = array( |
2612 | 2612 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2613 | 2613 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2614 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2614 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2615 | 2615 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2616 | 2616 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2617 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2618 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2619 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2620 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2621 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2622 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2617 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2618 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2619 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2620 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2621 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2622 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2623 | 2623 | ); |
2624 | - foreach ( $updated_fields as $field => $value ) { |
|
2624 | + foreach ($updated_fields as $field => $value) { |
|
2625 | 2625 | $attendee->set($field, $value); |
2626 | 2626 | } |
2627 | 2627 | |
2628 | 2628 | $success = $attendee->save(); |
2629 | 2629 | |
2630 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2631 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2632 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2633 | - 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 ) ); |
|
2630 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2631 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2632 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2633 | + 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)); |
|
2634 | 2634 | } |
2635 | 2635 | } |
2636 | 2636 | } |
2637 | 2637 | |
2638 | - if ( $success === FALSE ) |
|
2639 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2638 | + if ($success === FALSE) |
|
2639 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2640 | 2640 | |
2641 | 2641 | } |
2642 | 2642 | |
@@ -2656,17 +2656,17 @@ discard block |
||
2656 | 2656 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2657 | 2657 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2658 | 2658 | |
2659 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2660 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2659 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2660 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2661 | 2661 | } |
2662 | 2662 | |
2663 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2663 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2664 | 2664 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2665 | 2665 | } |
2666 | 2666 | |
2667 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2668 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2669 | - 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'); |
|
2667 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2668 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2669 | + 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'); |
|
2670 | 2670 | } |
2671 | 2671 | |
2672 | 2672 | |
@@ -2675,10 +2675,10 @@ discard block |
||
2675 | 2675 | * @param WP_Post $post wp post object |
2676 | 2676 | * @return string attendee contact info ( and form ) |
2677 | 2677 | */ |
2678 | - public function attendee_contact_info( $post ) { |
|
2678 | + public function attendee_contact_info($post) { |
|
2679 | 2679 | //get attendee object ( should already have it ) |
2680 | 2680 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2681 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2681 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2682 | 2682 | EEH_Template::display_template($template, $this->_template_args); |
2683 | 2683 | } |
2684 | 2684 | |
@@ -2694,12 +2694,12 @@ discard block |
||
2694 | 2694 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2695 | 2695 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2696 | 2696 | new EE_Question_Form_Input( |
2697 | - EE_Question::new_instance( array( |
|
2697 | + EE_Question::new_instance(array( |
|
2698 | 2698 | 'QST_ID' => 0, |
2699 | 2699 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2700 | 2700 | 'QST_system' => 'admin-state' |
2701 | 2701 | )), |
2702 | - EE_Answer::new_instance( array( |
|
2702 | + EE_Answer::new_instance(array( |
|
2703 | 2703 | 'ANS_ID' => 0, |
2704 | 2704 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2705 | 2705 | )), |
@@ -2712,12 +2712,12 @@ discard block |
||
2712 | 2712 | )); |
2713 | 2713 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2714 | 2714 | new EE_Question_Form_Input( |
2715 | - EE_Question::new_instance( array( |
|
2715 | + EE_Question::new_instance(array( |
|
2716 | 2716 | 'QST_ID' => 0, |
2717 | 2717 | 'QST_display_text' => __('Country', 'event_espresso'), |
2718 | 2718 | 'QST_system' => 'admin-country' |
2719 | 2719 | )), |
2720 | - EE_Answer::new_instance( array( |
|
2720 | + EE_Answer::new_instance(array( |
|
2721 | 2721 | 'ANS_ID' => 0, |
2722 | 2722 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2723 | 2723 | )), |
@@ -2728,8 +2728,8 @@ discard block |
||
2728 | 2728 | 'append_qstn_id' => FALSE |
2729 | 2729 | ) |
2730 | 2730 | )); |
2731 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2732 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2731 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2732 | + EEH_Template::display_template($template, $this->_template_args); |
|
2733 | 2733 | |
2734 | 2734 | } |
2735 | 2735 | |
@@ -2739,11 +2739,11 @@ discard block |
||
2739 | 2739 | * @access protected |
2740 | 2740 | * @return void |
2741 | 2741 | */ |
2742 | - public function attendee_registrations_meta_box( $post ) { |
|
2742 | + public function attendee_registrations_meta_box($post) { |
|
2743 | 2743 | |
2744 | 2744 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2745 | 2745 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2746 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2746 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2747 | 2747 | EEH_Template::display_template($template, $this->_template_args); |
2748 | 2748 | |
2749 | 2749 | } |
@@ -2757,8 +2757,8 @@ discard block |
||
2757 | 2757 | * @return string html for new form. |
2758 | 2758 | */ |
2759 | 2759 | public function after_title_form_fields($post) { |
2760 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2761 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2760 | + if ($post->post_type == 'espresso_attendees') { |
|
2761 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2762 | 2762 | $template_args['attendee'] = $this->_cpt_model_obj; |
2763 | 2763 | EEH_Template::display_template($template, $template_args); |
2764 | 2764 | } |
@@ -2775,21 +2775,21 @@ discard block |
||
2775 | 2775 | * @access protected |
2776 | 2776 | * @return void |
2777 | 2777 | */ |
2778 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2778 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2779 | 2779 | |
2780 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2780 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2781 | 2781 | |
2782 | 2782 | $ATT_MDL = EEM_Attendee::instance(); |
2783 | 2783 | |
2784 | 2784 | $success = 1; |
2785 | 2785 | //Checkboxes |
2786 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2786 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2787 | 2787 | // if array has more than one element than success message should be plural |
2788 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2788 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2789 | 2789 | // cycle thru checkboxes |
2790 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2791 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2792 | - if ( !$updated ) { |
|
2790 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2791 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2792 | + if ( ! $updated) { |
|
2793 | 2793 | $success = 0; |
2794 | 2794 | } |
2795 | 2795 | } |
@@ -2798,18 +2798,18 @@ discard block |
||
2798 | 2798 | // grab single id and delete |
2799 | 2799 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2800 | 2800 | //get attendee |
2801 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2801 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2802 | 2802 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2803 | 2803 | $updated = $att->save(); |
2804 | - if ( ! $updated ) { |
|
2804 | + if ( ! $updated) { |
|
2805 | 2805 | $success = 0; |
2806 | 2806 | } |
2807 | 2807 | |
2808 | 2808 | } |
2809 | 2809 | |
2810 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2811 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2812 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2810 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2811 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2812 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2813 | 2813 | |
2814 | 2814 | } |
2815 | 2815 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | class Custom_Messages_Template_List_Table extends EE_Admin_List_Table { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $admin_page ) { |
|
33 | + public function __construct($admin_page) { |
|
34 | 34 | //Set parent defaults |
35 | 35 | parent::__construct($admin_page); |
36 | 36 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _setup_data() { |
52 | - $this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE, FALSE, FALSE ); |
|
53 | - $this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE, FALSE ); |
|
52 | + $this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE, FALSE, FALSE); |
|
53 | + $this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE, FALSE); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | |
60 | 60 | protected function _set_properties() { |
61 | 61 | $this->_wp_list_args = array( |
62 | - 'singular' => __('Message Template Group', 'event_espresso' ), |
|
63 | - 'plural' => __('Message Template', 'event_espresso' ), |
|
62 | + 'singular' => __('Message Template Group', 'event_espresso'), |
|
63 | + 'plural' => __('Message Template', 'event_espresso'), |
|
64 | 64 | 'ajax' => TRUE, //for now, |
65 | 65 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
66 | 66 | ); |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | 'cb' => '<input type="checkbox" />', |
70 | 70 | 'name' => __('Template Name', 'event_espresso'), |
71 | 71 | 'message_type' => __('Message Type', 'event_espresso'), |
72 | - 'messenger' => __( 'Messenger', 'event_espresso'), |
|
73 | - 'description' => __( 'Description', 'event_espresso' ), |
|
74 | - 'events' => __( 'Events', 'event_espresso'), //count of events using this template. |
|
72 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
73 | + 'description' => __('Description', 'event_espresso'), |
|
74 | + 'events' => __('Events', 'event_espresso'), //count of events using this template. |
|
75 | 75 | 'actions' => '' |
76 | 76 | //'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place. |
77 | 77 | ); |
78 | 78 | |
79 | 79 | $this->_sortable_columns = array( |
80 | - 'messenger' => array( 'MTP_messenger' => TRUE ), |
|
80 | + 'messenger' => array('MTP_messenger' => TRUE), |
|
81 | 81 | //'message_type' => array( 'MTP_message_type' => FALSE ) |
82 | 82 | ); |
83 | 83 | |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return string |
98 | 98 | */ |
99 | - public function single_row( $item ) { |
|
99 | + public function single_row($item) { |
|
100 | 100 | $message_type = $item->message_type_obj(); |
101 | 101 | $messenger = $item->messenger_obj(); |
102 | 102 | |
103 | - if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) { |
|
103 | + if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
104 | 104 | echo ''; |
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
108 | - parent::single_row( $item ); |
|
108 | + parent::single_row($item); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | ); |
124 | 124 | |
125 | 125 | //set filters to select inputs if they aren't empty |
126 | - foreach ( $select_inputs as $select_input ) { |
|
127 | - if ( $select_input ) { |
|
126 | + foreach ($select_inputs as $select_input) { |
|
127 | + if ($select_input) { |
|
128 | 128 | $filters[] = $select_input; |
129 | 129 | } |
130 | 130 | } |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | * we're just removing the search box for message templates, not needed. |
136 | 136 | * @return string (empty); |
137 | 137 | */ |
138 | - function search_box( $text, $input_id ) { |
|
138 | + function search_box($text, $input_id) { |
|
139 | 139 | return ''; |
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | 143 | protected function _add_view_counts() { |
144 | - foreach ( $this->_views as $view => $args ) { |
|
145 | - $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE, FALSE ); |
|
144 | + foreach ($this->_views as $view => $args) { |
|
145 | + $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE, FALSE); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | * @return string |
157 | 157 | */ |
158 | 158 | public function no_items() { |
159 | - if ( $this->_view !== 'trashed' ) |
|
160 | - printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
159 | + if ($this->_view !== 'trashed') |
|
160 | + printf(__('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>'); |
|
161 | 161 | else |
162 | 162 | parent::no_items(); |
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | |
167 | - public function column_cb( $item ) { |
|
168 | - return sprintf( '<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID() ); |
|
167 | + public function column_cb($item) { |
|
168 | + return sprintf('<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID()); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -173,29 +173,29 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | |
176 | - function column_name( $item ) { |
|
177 | - return '<p>' . $item->name() . '</p>'; |
|
176 | + function column_name($item) { |
|
177 | + return '<p>'.$item->name().'</p>'; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
181 | 181 | |
182 | 182 | |
183 | - function column_description( $item ) { |
|
184 | - return '<p>' . $item->description() . '</p>'; |
|
183 | + function column_description($item) { |
|
184 | + return '<p>'.$item->description().'</p>'; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
188 | 188 | |
189 | - function column_actions( $item ) { |
|
190 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) { |
|
189 | + function column_actions($item) { |
|
190 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) { |
|
191 | 191 | $create_args = array( |
192 | 192 | 'GRP_ID' => $item->ID(), |
193 | 193 | 'messenger' => $item->messenger(), |
194 | 194 | 'message_type' => $item->message_type(), |
195 | 195 | 'action' => 'add_new_message_template' |
196 | 196 | ); |
197 | - $create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL ); |
|
198 | - return sprintf( '<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso') ); |
|
197 | + $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
198 | + return sprintf('<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso')); |
|
199 | 199 | } |
200 | 200 | return ''; |
201 | 201 | } |
@@ -212,27 +212,27 @@ discard block |
||
212 | 212 | $actions = array(); |
213 | 213 | |
214 | 214 | // edit link but only if item isn't trashed. |
215 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) { |
|
216 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL ); |
|
217 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
215 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) { |
|
216 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL); |
|
217 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
218 | 218 | } |
219 | 219 | |
220 | - $name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() )? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] ); |
|
221 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
220 | + $name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']); |
|
221 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
222 | 222 | // restore link |
223 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
223 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
224 | 224 | // delete price link |
225 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
225 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
226 | 226 | |
227 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_trash_message_template', $item->ID() ) ) { |
|
228 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Template Group to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
227 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_trash_message_template', $item->ID())) { |
|
228 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Template Group to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
229 | 229 | } else { |
230 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_restore_message_template', $item->ID() ) ) { |
|
231 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Message Template', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
230 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_restore_message_template', $item->ID())) { |
|
231 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Message Template', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
232 | 232 | } |
233 | 233 | |
234 | - if ( $this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_delete_message_template', $item->ID() ) ) { |
|
235 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Template Group Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
234 | + if ($this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_delete_message_template', $item->ID())) { |
|
235 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Template Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
@@ -241,15 +241,15 @@ discard block |
||
241 | 241 | $c_configs = $item->contexts_config(); |
242 | 242 | $ctxt = array(); |
243 | 243 | $context_templates = $item->context_templates(); |
244 | - foreach ( $context_templates as $context => $template_fields ) { |
|
245 | - $mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
246 | - $inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : ''; |
|
244 | + foreach ($context_templates as $context => $template_fields) { |
|
245 | + $mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
246 | + $inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : ''; |
|
247 | 247 | $context_title = ucwords($c_configs[$context]['label']); |
248 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL ); |
|
249 | - $ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title; |
|
248 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL); |
|
249 | + $ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title; |
|
250 | 250 | } |
251 | 251 | |
252 | - $ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : ''; |
|
252 | + $ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : ''; |
|
253 | 253 | |
254 | 254 | |
255 | 255 | //Return the name contents |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | /* $1%s */ $name_link, |
258 | 258 | /* $2%s */ $item->GRP_ID(), |
259 | 259 | /* %4$s */ $ctx_content, |
260 | - /* $3%s */ $this->row_actions( $actions ) |
|
260 | + /* $3%s */ $this->row_actions($actions) |
|
261 | 261 | ); |
262 | 262 | } |
263 | 263 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @return string message_type name |
279 | 279 | */ |
280 | 280 | function column_message_type($item) { |
281 | - return ucwords($item->message_type_obj()->label['singular'] ); |
|
281 | + return ucwords($item->message_type_obj()->label['singular']); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | ) |
306 | 306 | ); |
307 | 307 | |
308 | - foreach ( $active_message_template_groups_grouped_by_messenger as $active_message_template_group ) { |
|
309 | - if ( $active_message_template_group instanceof EE_Message_Template_Group ) { |
|
308 | + foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) { |
|
309 | + if ($active_message_template_group instanceof EE_Message_Template_Group) { |
|
310 | 310 | $messenger = $active_message_template_group->messenger_obj(); |
311 | 311 | $messenger_label = $messenger instanceof EE_messenger |
312 | 312 | ? $messenger->label['singular'] |
313 | 313 | : $active_message_template_group->messenger(); |
314 | - $messenger_options[ $active_message_template_group->messenger() ] = ucwords( $messenger_label ); |
|
314 | + $messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label); |
|
315 | 315 | } |
316 | 316 | } |
317 | - return $this->get_admin_page()->get_messengers_select_input( $messenger_options ); |
|
317 | + return $this->get_admin_page()->get_messengers_select_input($messenger_options); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -334,16 +334,16 @@ discard block |
||
334 | 334 | ) |
335 | 335 | ); |
336 | 336 | |
337 | - foreach ( $active_message_template_groups_grouped_by_message_type as $active_message_template_group ) { |
|
338 | - if ( $active_message_template_group instanceof EE_Message_Template_Group ) { |
|
337 | + foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) { |
|
338 | + if ($active_message_template_group instanceof EE_Message_Template_Group) { |
|
339 | 339 | $message_type = $active_message_template_group->message_type_obj(); |
340 | 340 | $message_type_label = $message_type instanceof EE_message_type |
341 | 341 | ? $message_type->label['singular'] |
342 | 342 | : $active_message_template_group->message_type(); |
343 | - $message_type_options[ $active_message_template_group->message_type() ] = ucwords( $message_type_label ); |
|
343 | + $message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label); |
|
344 | 344 | } |
345 | 345 | } |
346 | - return $this->get_admin_page()->get_message_types_select_input( $message_type_options ); |
|
346 | + return $this->get_admin_page()->get_message_types_select_input($message_type_options); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -156,10 +157,11 @@ discard block |
||
156 | 157 | * @return string |
157 | 158 | */ |
158 | 159 | public function no_items() { |
159 | - if ( $this->_view !== 'trashed' ) |
|
160 | - printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
161 | - else |
|
162 | - parent::no_items(); |
|
160 | + if ( $this->_view !== 'trashed' ) { |
|
161 | + printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
162 | + } else { |
|
163 | + parent::no_items(); |
|
164 | + } |
|
163 | 165 | } |
164 | 166 | |
165 | 167 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * |
103 | 103 | * @throws EE_Error |
104 | - */ |
|
104 | + */ |
|
105 | 105 | protected function _load_message_resource_manager() { |
106 | 106 | $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
107 | 107 | } |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | public function get_messengers_select_input( $messenger_options ) { |
203 | 203 | //if empty or just one value then just return an empty string |
204 | 204 | if ( empty( $messenger_options ) |
205 | - || ! is_array( $messenger_options ) |
|
206 | - || count( $messenger_options ) === 1 |
|
205 | + || ! is_array( $messenger_options ) |
|
206 | + || count( $messenger_options ) === 1 |
|
207 | 207 | ) { |
208 | 208 | return ''; |
209 | 209 | } |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | |
334 | 334 | /** |
335 | 335 | * an array for storing key => value pairs of request actions and their corresponding methods |
336 | - * @access protected |
|
337 | - * @return void |
|
338 | - */ |
|
336 | + * @access protected |
|
337 | + * @return void |
|
338 | + */ |
|
339 | 339 | protected function _set_page_routes() { |
340 | 340 | $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) |
341 | 341 | ? $this->_req_data['GRP_ID'] |
@@ -644,8 +644,8 @@ discard block |
||
644 | 644 | protected function _add_screen_options_global_mtps() { |
645 | 645 | /** |
646 | 646 | * Note: the reason for the value swap here on $this->_admin_page_title is because $this->_per_page_screen_options |
647 | - * uses the $_admin_page_title property and we want different outputs in the different spots. |
|
648 | - */ |
|
647 | + * uses the $_admin_page_title property and we want different outputs in the different spots. |
|
648 | + */ |
|
649 | 649 | $page_title = $this->_admin_page_title; |
650 | 650 | $this->_admin_page_title = __('Global Message Templates', 'event_espresso'); |
651 | 651 | $this->_per_page_screen_option(); |
@@ -848,9 +848,9 @@ discard block |
||
848 | 848 | $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' ) |
849 | 849 | ? array( |
850 | 850 | 'generate_now' => __( 'Generate Now', 'event_espresso' ), |
851 | - 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
852 | - 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
853 | - 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
851 | + 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
852 | + 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
853 | + 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
854 | 854 | ) |
855 | 855 | : array(); |
856 | 856 | |
@@ -861,10 +861,10 @@ discard block |
||
861 | 861 | |
862 | 862 | $this->_views = array( |
863 | 863 | 'all' => array( |
864 | - 'slug' => 'all', |
|
865 | - 'label' => __( 'All', 'event_espresso' ), |
|
866 | - 'count' => 0, |
|
867 | - 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
864 | + 'slug' => 'all', |
|
865 | + 'label' => __( 'All', 'event_espresso' ), |
|
866 | + 'count' => 0, |
|
867 | + 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
868 | 868 | ) |
869 | 869 | ); |
870 | 870 | |
@@ -1254,9 +1254,9 @@ discard block |
||
1254 | 1254 | && in_array($extra_field, $v_fields) |
1255 | 1255 | && |
1256 | 1256 | ( |
1257 | - is_array($validators[$extra_field] ) |
|
1257 | + is_array($validators[$extra_field] ) |
|
1258 | 1258 | && isset( $validators[$extra_field]['msg'] ) |
1259 | - ) |
|
1259 | + ) |
|
1260 | 1260 | ? 'validate-error ' . $css_class |
1261 | 1261 | : $css_class; |
1262 | 1262 | |
@@ -1541,8 +1541,8 @@ discard block |
||
1541 | 1541 | $GRP_ID, |
1542 | 1542 | false, |
1543 | 1543 | add_query_arg( |
1544 | - array( 'action' => 'global_mtps' ), |
|
1545 | - $this->_admin_base_url |
|
1544 | + array( 'action' => 'global_mtps' ), |
|
1545 | + $this->_admin_base_url |
|
1546 | 1546 | ) |
1547 | 1547 | ); |
1548 | 1548 | |
@@ -2017,14 +2017,14 @@ discard block |
||
2017 | 2017 | |
2018 | 2018 | |
2019 | 2019 | /** |
2020 | - * This returns the shortcode selector skeleton for a given context and field. |
|
2021 | - * |
|
2022 | - * @since 4.9.rc.000 |
|
2023 | - * |
|
2020 | + * This returns the shortcode selector skeleton for a given context and field. |
|
2021 | + * |
|
2022 | + * @since 4.9.rc.000 |
|
2023 | + * |
|
2024 | 2024 | * @param string $field The name of the field retrieving shortcodes for. |
2025 | - * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
|
2026 | - * @return string |
|
2027 | - */ |
|
2025 | + * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
|
2026 | + * @return string |
|
2027 | + */ |
|
2028 | 2028 | protected function _get_shortcode_selector( $field, $linked_input_id ) { |
2029 | 2029 | $template_args = array( |
2030 | 2030 | 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
@@ -2622,9 +2622,9 @@ discard block |
||
2622 | 2622 | |
2623 | 2623 | /** |
2624 | 2624 | * _learn_more_about_message_templates_link |
2625 | - * @access protected |
|
2626 | - * @return string |
|
2627 | - */ |
|
2625 | + * @access protected |
|
2626 | + * @return string |
|
2627 | + */ |
|
2628 | 2628 | protected function _learn_more_about_message_templates_link() { |
2629 | 2629 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
2630 | 2630 | } |
@@ -3268,7 +3268,7 @@ discard block |
||
3268 | 3268 | /** @var EE_message_type $message_type */ |
3269 | 3269 | $message_type = $this->_message_resource_manager->get_message_type( $message_type_name ); |
3270 | 3270 | if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
3271 | - && $message_type instanceof EE_message_type |
|
3271 | + && $message_type instanceof EE_message_type |
|
3272 | 3272 | ) { |
3273 | 3273 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3274 | 3274 | if ( $message_type->get_admin_settings_fields() ) { |
@@ -3604,10 +3604,10 @@ discard block |
||
3604 | 3604 | |
3605 | 3605 | /** |
3606 | 3606 | * This immediately generates any EE_Message ID's that are selected that are EEM_Message::status_incomplete |
3607 | - * However, this does not send immediately, it just queues for sending. |
|
3608 | - * |
|
3609 | - * @since 4.9.0 |
|
3610 | - */ |
|
3607 | + * However, this does not send immediately, it just queues for sending. |
|
3608 | + * |
|
3609 | + * @since 4.9.0 |
|
3610 | + */ |
|
3611 | 3611 | protected function _generate_now() { |
3612 | 3612 | $msg_ids = $this->_get_msg_ids_from_request(); |
3613 | 3613 | EED_Messages::generate_now( $msg_ids ); |
@@ -3618,11 +3618,11 @@ discard block |
||
3618 | 3618 | |
3619 | 3619 | /** |
3620 | 3620 | * This immediately generates AND sends any EE_Message's selected that are EEM_Message::status_incomplete or that are |
3621 | - * EEM_Message::status_resend or EEM_Message::status_idle |
|
3622 | - * |
|
3623 | - * @since 4.9.0 |
|
3624 | - * |
|
3625 | - */ |
|
3621 | + * EEM_Message::status_resend or EEM_Message::status_idle |
|
3622 | + * |
|
3623 | + * @since 4.9.0 |
|
3624 | + * |
|
3625 | + */ |
|
3626 | 3626 | protected function _generate_and_send_now() { |
3627 | 3627 | $this->_generate_now(); |
3628 | 3628 | $this->_send_now(); |
@@ -3635,9 +3635,9 @@ discard block |
||
3635 | 3635 | |
3636 | 3636 | /** |
3637 | 3637 | * This queues any EEM_Message::status_sent EE_Message ids in the request for resending. |
3638 | - * |
|
3639 | - * @since 4.9.0 |
|
3640 | - */ |
|
3638 | + * |
|
3639 | + * @since 4.9.0 |
|
3640 | + */ |
|
3641 | 3641 | protected function _queue_for_resending() { |
3642 | 3642 | $msg_ids = $this->_get_msg_ids_from_request(); |
3643 | 3643 | EED_Messages::queue_for_resending( $msg_ids ); |
@@ -3649,9 +3649,9 @@ discard block |
||
3649 | 3649 | |
3650 | 3650 | /** |
3651 | 3651 | * This sends immediately any EEM_Message::status_idle or EEM_Message::status_resend messages in the queue |
3652 | - * |
|
3653 | - * @since 4.9.0 |
|
3654 | - */ |
|
3652 | + * |
|
3653 | + * @since 4.9.0 |
|
3654 | + */ |
|
3655 | 3655 | protected function _send_now() { |
3656 | 3656 | $msg_ids = $this->_get_msg_ids_from_request(); |
3657 | 3657 | EED_Messages::send_now( $msg_ids ); |
@@ -3663,9 +3663,9 @@ discard block |
||
3663 | 3663 | |
3664 | 3664 | /** |
3665 | 3665 | * Deletes EE_messages for IDs in the request. |
3666 | - * |
|
3667 | - * @since 4.9.0 |
|
3668 | - */ |
|
3666 | + * |
|
3667 | + * @since 4.9.0 |
|
3668 | + */ |
|
3669 | 3669 | protected function _delete_ee_messages() { |
3670 | 3670 | $msg_ids = $this->_get_msg_ids_from_request(); |
3671 | 3671 | $deleted_count = 0; |
@@ -3694,9 +3694,9 @@ discard block |
||
3694 | 3694 | |
3695 | 3695 | /** |
3696 | 3696 | * This looks for 'MSG_ID' key in the request and returns an array of MSG_ID's if present. |
3697 | - * @since 4.9.0 |
|
3698 | - * @return array |
|
3699 | - */ |
|
3697 | + * @since 4.9.0 |
|
3698 | + * @return array |
|
3699 | + */ |
|
3700 | 3700 | protected function _get_msg_ids_from_request() { |
3701 | 3701 | if ( ! isset( $this->_req_data['MSG_ID'] ) ) { |
3702 | 3702 | return array(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | - {exit('NO direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
2 | + {exit('NO direct script access allowed'); } |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * @param bool $routing |
76 | 76 | */ |
77 | - public function __construct( $routing = true ) { |
|
77 | + public function __construct($routing = true) { |
|
78 | 78 | //make sure messages autoloader is running |
79 | 79 | EED_Messages::set_autoloaders(); |
80 | - parent::__construct( $routing ); |
|
80 | + parent::__construct($routing); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array(); |
93 | 93 | |
94 | - $this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null; |
|
94 | + $this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null; |
|
95 | 95 | $this->_load_message_resource_manager(); |
96 | 96 | } |
97 | 97 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @throws EE_Error |
106 | 106 | */ |
107 | 107 | protected function _load_message_resource_manager() { |
108 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
108 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -116,21 +116,21 @@ discard block |
||
116 | 116 | public function get_messengers_for_list_table() { |
117 | 117 | EE_Error::doing_it_wrong( |
118 | 118 | __METHOD__, |
119 | - __( 'This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
119 | + __('This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
120 | 120 | values for use in creating a messenger filter dropdown which is now generated differently via |
121 | - Messages_Admin_Page::get_messengers_select_input', 'event_espresso' ), |
|
121 | + Messages_Admin_Page::get_messengers_select_input', 'event_espresso'), |
|
122 | 122 | '4.9.9.rc.014' |
123 | 123 | ); |
124 | 124 | |
125 | 125 | $m_values = array(); |
126 | - $active_messengers = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) ); |
|
126 | + $active_messengers = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger')); |
|
127 | 127 | //setup messengers for selects |
128 | 128 | $i = 1; |
129 | - foreach ( $active_messengers as $active_messenger ) { |
|
130 | - if ( $active_messenger instanceof EE_Message ) { |
|
131 | - $m_values[ $i ]['id'] = $active_messenger->messenger(); |
|
132 | - $m_values[ $i ]['text'] = ucwords( $active_messenger->messenger_label() ); |
|
133 | - $i ++; |
|
129 | + foreach ($active_messengers as $active_messenger) { |
|
130 | + if ($active_messenger instanceof EE_Message) { |
|
131 | + $m_values[$i]['id'] = $active_messenger->messenger(); |
|
132 | + $m_values[$i]['text'] = ucwords($active_messenger->messenger_label()); |
|
133 | + $i++; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | return $m_values; |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | public function get_message_types_for_list_table() { |
145 | 145 | EE_Error::doing_it_wrong( |
146 | 146 | __METHOD__, |
147 | - __( 'This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
147 | + __('This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
148 | 148 | values for use in creating a message type filter dropdown which is now generated differently via |
149 | - Messages_Admin_Page::get_message_types_select_input', 'event_espresso' ), |
|
149 | + Messages_Admin_Page::get_message_types_select_input', 'event_espresso'), |
|
150 | 150 | '4.9.9.rc.014' |
151 | 151 | ); |
152 | 152 | |
153 | 153 | $mt_values = array(); |
154 | - $active_messages = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) ); |
|
154 | + $active_messages = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type')); |
|
155 | 155 | $i = 1; |
156 | - foreach ( $active_messages as $active_message ) { |
|
157 | - if ( $active_message instanceof EE_Message ) { |
|
158 | - $mt_values[ $i ]['id'] = $active_message->message_type(); |
|
159 | - $mt_values[ $i ]['text'] = ucwords( $active_message->message_type_label() ); |
|
160 | - $i ++; |
|
156 | + foreach ($active_messages as $active_message) { |
|
157 | + if ($active_message instanceof EE_Message) { |
|
158 | + $mt_values[$i]['id'] = $active_message->message_type(); |
|
159 | + $mt_values[$i]['text'] = ucwords($active_message->message_type_label()); |
|
160 | + $i++; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | return $mt_values; |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | public function get_contexts_for_message_types_for_list_table() { |
172 | 172 | EE_Error::doing_it_wrong( |
173 | 173 | __METHOD__, |
174 | - __( 'This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
174 | + __('This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
175 | 175 | values for use in creating a message type context filter dropdown which is now generated differently via |
176 | - Messages_Admin_Page::get_contexts_for_message_types_select_input', 'event_espresso' ), |
|
176 | + Messages_Admin_Page::get_contexts_for_message_types_select_input', 'event_espresso'), |
|
177 | 177 | '4.9.9.rc.014' |
178 | 178 | ); |
179 | 179 | |
180 | 180 | $contexts = array(); |
181 | - $active_message_contexts = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) ); |
|
182 | - foreach ( $active_message_contexts as $active_message ) { |
|
183 | - if ( $active_message instanceof EE_Message ) { |
|
181 | + $active_message_contexts = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context')); |
|
182 | + foreach ($active_message_contexts as $active_message) { |
|
183 | + if ($active_message instanceof EE_Message) { |
|
184 | 184 | $message_type = $active_message->message_type_object(); |
185 | - if ( $message_type instanceof EE_message_type ) { |
|
185 | + if ($message_type instanceof EE_message_type) { |
|
186 | 186 | $message_type_contexts = $message_type->get_contexts(); |
187 | - foreach ( $message_type_contexts as $context => $context_details ) { |
|
188 | - $contexts[ $context ] = $context_details['label']; |
|
187 | + foreach ($message_type_contexts as $context => $context_details) { |
|
188 | + $contexts[$context] = $context_details['label']; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
@@ -201,17 +201,17 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function get_messengers_select_input( $messenger_options ) { |
|
204 | + public function get_messengers_select_input($messenger_options) { |
|
205 | 205 | //if empty or just one value then just return an empty string |
206 | - if ( empty( $messenger_options ) |
|
207 | - || ! is_array( $messenger_options ) |
|
208 | - || count( $messenger_options ) === 1 |
|
206 | + if (empty($messenger_options) |
|
207 | + || ! is_array($messenger_options) |
|
208 | + || count($messenger_options) === 1 |
|
209 | 209 | ) { |
210 | 210 | return ''; |
211 | 211 | } |
212 | 212 | //merge in default |
213 | 213 | $messenger_options = array_merge( |
214 | - array( 'none_selected' => __( 'Show All Messengers', 'event_espresso' ) ), |
|
214 | + array('none_selected' => __('Show All Messengers', 'event_espresso')), |
|
215 | 215 | $messenger_options |
216 | 216 | ); |
217 | 217 | $input = new EE_Select_Input( |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | 'html_name' => 'ee_messenger_filter_by', |
221 | 221 | 'html_id' => 'ee_messenger_filter_by', |
222 | 222 | 'html_class' => 'wide', |
223 | - 'default' => isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
224 | - ? sanitize_title( $this->_req_data['ee_messenger_filter_by'] ) |
|
223 | + 'default' => isset($this->_req_data['ee_messenger_filter_by']) |
|
224 | + ? sanitize_title($this->_req_data['ee_messenger_filter_by']) |
|
225 | 225 | : 'none_selected' |
226 | 226 | ) |
227 | 227 | ); |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function get_message_types_select_input( $message_type_options ) { |
|
240 | + public function get_message_types_select_input($message_type_options) { |
|
241 | 241 | //if empty or count of options is 1 then just return an empty string |
242 | - if ( empty( $message_type_options ) |
|
243 | - || ! is_array( $message_type_options ) |
|
244 | - || count( $message_type_options ) === 1 |
|
242 | + if (empty($message_type_options) |
|
243 | + || ! is_array($message_type_options) |
|
244 | + || count($message_type_options) === 1 |
|
245 | 245 | ) { |
246 | 246 | return ''; |
247 | 247 | } |
248 | 248 | //merge in default |
249 | 249 | $message_type_options = array_merge( |
250 | - array( 'none_selected' => __( 'Show All Message Types', 'event_espresso' ) ), |
|
250 | + array('none_selected' => __('Show All Message Types', 'event_espresso')), |
|
251 | 251 | $message_type_options |
252 | 252 | ); |
253 | 253 | $input = new EE_Select_Input( |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | 'html_name' => 'ee_message_type_filter_by', |
257 | 257 | 'html_id' => 'ee_message_type_filter_by', |
258 | 258 | 'html_class' => 'wide', |
259 | - 'default' => isset( $this->_req_data['ee_message_type_filter_by'] ) |
|
260 | - ? sanitize_title( $this->_req_data['ee_message_type_filter_by'] ) |
|
259 | + 'default' => isset($this->_req_data['ee_message_type_filter_by']) |
|
260 | + ? sanitize_title($this->_req_data['ee_message_type_filter_by']) |
|
261 | 261 | : 'none_selected', |
262 | 262 | ) |
263 | 263 | ); |
@@ -273,17 +273,17 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return string |
275 | 275 | */ |
276 | - public function get_contexts_for_message_types_select_input( $context_options ) { |
|
276 | + public function get_contexts_for_message_types_select_input($context_options) { |
|
277 | 277 | //if empty or count of options is one then just return empty string |
278 | - if ( empty( $context_options ) |
|
279 | - || ! is_array( $context_options ) |
|
280 | - || count( $context_options ) === 1 |
|
278 | + if (empty($context_options) |
|
279 | + || ! is_array($context_options) |
|
280 | + || count($context_options) === 1 |
|
281 | 281 | ) { |
282 | 282 | return ''; |
283 | 283 | } |
284 | 284 | //merge in default |
285 | 285 | $context_options = array_merge( |
286 | - array( 'none_selected' => __( 'Show all Contexts', 'event_espresso' ) ), |
|
286 | + array('none_selected' => __('Show all Contexts', 'event_espresso')), |
|
287 | 287 | $context_options |
288 | 288 | ); |
289 | 289 | $input = new EE_Select_Input( |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | 'html_name' => 'ee_context_filter_by', |
293 | 293 | 'html_id' => 'ee_context_filter_by', |
294 | 294 | 'html_class' => 'wide', |
295 | - 'default' => isset( $this->_req_data['ee_context_filter_by'] ) |
|
296 | - ? sanitize_title( $this->_req_data['ee_context_filter_by'] ) |
|
295 | + 'default' => isset($this->_req_data['ee_context_filter_by']) |
|
296 | + ? sanitize_title($this->_req_data['ee_context_filter_by']) |
|
297 | 297 | : 'none_selected', |
298 | 298 | ) |
299 | 299 | ); |
@@ -303,11 +303,11 @@ discard block |
||
303 | 303 | |
304 | 304 | |
305 | 305 | protected function _ajax_hooks() { |
306 | - add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) ); |
|
307 | - add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') ); |
|
308 | - add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') ); |
|
309 | - add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) ); |
|
310 | - add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) ); |
|
306 | + add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle')); |
|
307 | + add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle')); |
|
308 | + add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings')); |
|
309 | + add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form')); |
|
310 | + add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack')); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | * @return void |
340 | 340 | */ |
341 | 341 | protected function _set_page_routes() { |
342 | - $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) |
|
342 | + $grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) |
|
343 | 343 | ? $this->_req_data['GRP_ID'] |
344 | 344 | : 0; |
345 | - $grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) |
|
345 | + $grp_id = empty($grp_id) && ! empty($this->_req_data['id']) |
|
346 | 346 | ? $this->_req_data['id'] |
347 | 347 | : $grp_id; |
348 | - $msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] ) |
|
348 | + $msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID']) |
|
349 | 349 | ? $this->_req_data['MSG_ID'] |
350 | 350 | : 0; |
351 | 351 | |
@@ -387,35 +387,35 @@ discard block |
||
387 | 387 | 'insert_message_template' => array( |
388 | 388 | 'func' => '_insert_or_update_message_template', |
389 | 389 | 'capability' => 'ee_edit_messages', |
390 | - 'args' => array( 'new_template' => true ), |
|
390 | + 'args' => array('new_template' => true), |
|
391 | 391 | 'noheader' => true |
392 | 392 | ), |
393 | 393 | 'update_message_template' => array( |
394 | 394 | 'func' => '_insert_or_update_message_template', |
395 | 395 | 'capability' => 'ee_edit_message', |
396 | 396 | 'obj_id' => $grp_id, |
397 | - 'args' => array( 'new_template' => false ), |
|
397 | + 'args' => array('new_template' => false), |
|
398 | 398 | 'noheader' => true |
399 | 399 | ), |
400 | 400 | 'trash_message_template' => array( |
401 | 401 | 'func' => '_trash_or_restore_message_template', |
402 | 402 | 'capability' => 'ee_delete_message', |
403 | 403 | 'obj_id' => $grp_id, |
404 | - 'args' => array( 'trash' => true, 'all' => true ), |
|
404 | + 'args' => array('trash' => true, 'all' => true), |
|
405 | 405 | 'noheader' => true |
406 | 406 | ), |
407 | 407 | 'trash_message_template_context' => array( |
408 | 408 | 'func' => '_trash_or_restore_message_template', |
409 | 409 | 'capability' => 'ee_delete_message', |
410 | 410 | 'obj_id' => $grp_id, |
411 | - 'args' => array( 'trash' => true ), |
|
411 | + 'args' => array('trash' => true), |
|
412 | 412 | 'noheader' => true |
413 | 413 | ), |
414 | 414 | 'restore_message_template' => array( |
415 | 415 | 'func' => '_trash_or_restore_message_template', |
416 | 416 | 'capability' => 'ee_delete_message', |
417 | 417 | 'obj_id' => $grp_id, |
418 | - 'args' => array( 'trash' => false, 'all' => true ), |
|
418 | + 'args' => array('trash' => false, 'all' => true), |
|
419 | 419 | 'noheader' => true |
420 | 420 | ), |
421 | 421 | 'restore_message_template_context' => array( |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | 'filename' => 'messages_overview_other', |
535 | 535 | ), |
536 | 536 | ), |
537 | - 'help_tour' => array( 'Messages_Overview_Help_Tour' ), |
|
537 | + 'help_tour' => array('Messages_Overview_Help_Tour'), |
|
538 | 538 | 'require_nonce' => false |
539 | 539 | ), |
540 | 540 | 'custom_mtps' => array( |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | ), |
570 | 570 | 'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'), |
571 | 571 | 'has_metaboxes' => true, |
572 | - 'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ), |
|
572 | + 'help_tour' => array('Message_Templates_Edit_Help_Tour'), |
|
573 | 573 | 'help_tabs' => array( |
574 | 574 | 'edit_message_template' => array( |
575 | 575 | 'title' => __('Message Template Editor', 'event_espresso'), |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | 'filename' => 'messages_settings_messengers' |
626 | 626 | ), |
627 | 627 | ), |
628 | - 'help_tour' => array( 'Messages_Settings_Help_Tour' ), |
|
628 | + 'help_tour' => array('Messages_Settings_Help_Tour'), |
|
629 | 629 | 'require_nonce' => false |
630 | 630 | ) |
631 | 631 | ); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | |
660 | 660 | protected function _add_screen_options_default() { |
661 | - $this->_admin_page_title = __( 'Message Activity', 'event_espresso' ); |
|
661 | + $this->_admin_page_title = __('Message Activity', 'event_espresso'); |
|
662 | 662 | $this->_per_page_screen_option(); |
663 | 663 | } |
664 | 664 | |
@@ -680,37 +680,37 @@ discard block |
||
680 | 680 | |
681 | 681 | |
682 | 682 | public function messages_help_tab() { |
683 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php' ); |
|
683 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php'); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | |
687 | 687 | public function messengers_help_tab() { |
688 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php' ); |
|
688 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php'); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
692 | 692 | public function message_types_help_tab() { |
693 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php' ); |
|
693 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php'); |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | |
697 | 697 | public function messages_overview_help_tab() { |
698 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php' ); |
|
698 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php'); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
702 | 702 | public function message_templates_help_tab() { |
703 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php' ); |
|
703 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php'); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | |
707 | 707 | public function edit_message_template_help_tab() { |
708 | - $args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />'; |
|
709 | - $args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />'; |
|
710 | - $args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />'; |
|
711 | - $args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />'; |
|
712 | - $args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />'; |
|
713 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
708 | + $args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />'; |
|
709 | + $args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />'; |
|
710 | + $args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />'; |
|
711 | + $args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />'; |
|
712 | + $args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />'; |
|
713 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | |
@@ -718,22 +718,22 @@ discard block |
||
718 | 718 | public function message_template_shortcodes_help_tab() { |
719 | 719 | $this->_set_shortcodes(); |
720 | 720 | $args['shortcodes'] = $this->_shortcodes; |
721 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php', $args ); |
|
721 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php', $args); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
725 | 725 | |
726 | 726 | public function preview_message_help_tab() { |
727 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php' ); |
|
727 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php'); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | |
731 | 731 | public function settings_help_tab() { |
732 | - $args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'; |
|
733 | - $args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'; |
|
732 | + $args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />'; |
|
733 | + $args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />'; |
|
734 | 734 | $args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>'; |
735 | 735 | $args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>'; |
736 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php', $args); |
|
736 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php', $args); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | |
@@ -741,31 +741,31 @@ discard block |
||
741 | 741 | |
742 | 742 | |
743 | 743 | public function load_scripts_styles() { |
744 | - wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION ); |
|
744 | + wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION); |
|
745 | 745 | wp_enqueue_style('espresso_ee_msg'); |
746 | 746 | |
747 | - wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true ); |
|
748 | - wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION ); |
|
747 | + wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true); |
|
748 | + wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION); |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | |
752 | 752 | |
753 | 753 | public function load_scripts_styles_default() { |
754 | - wp_enqueue_script( 'ee-msg-list-table-js' ); |
|
754 | + wp_enqueue_script('ee-msg-list-table-js'); |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | |
758 | 758 | |
759 | 759 | |
760 | 760 | |
761 | - public function wp_editor_css( $mce_css ) { |
|
761 | + public function wp_editor_css($mce_css) { |
|
762 | 762 | //if we're on the edit_message_template route |
763 | - if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger ) { |
|
763 | + if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) { |
|
764 | 764 | $message_type_name = $this->_active_message_type_name; |
765 | 765 | |
766 | 766 | //we're going to REPLACE the existing mce css |
767 | 767 | //we need to get the css file location from the active messenger |
768 | - $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation ); |
|
768 | + $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | return $mce_css; |
@@ -783,15 +783,15 @@ discard block |
||
783 | 783 | $this->_message_template_group->messenger_obj()->label['singular'], |
784 | 784 | $this->_message_template_group->message_type_obj()->label['singular'] |
785 | 785 | ); |
786 | - EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' ); |
|
786 | + EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso'); |
|
787 | 787 | |
788 | - wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION ); |
|
788 | + wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION); |
|
789 | 789 | |
790 | 790 | wp_enqueue_script('ee_admin_js'); |
791 | 791 | wp_enqueue_script('ee_msgs_edit_js'); |
792 | 792 | |
793 | 793 | //add in special css for tiny_mce |
794 | - add_filter( 'mce_css', array( $this, 'wp_editor_css' ) ); |
|
794 | + add_filter('mce_css', array($this, 'wp_editor_css')); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | |
@@ -800,22 +800,22 @@ discard block |
||
800 | 800 | |
801 | 801 | $this->_set_message_template_group(); |
802 | 802 | |
803 | - if ( isset( $this->_req_data['messenger'] ) ) { |
|
804 | - $this->_active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
803 | + if (isset($this->_req_data['messenger'])) { |
|
804 | + $this->_active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
805 | 805 | } |
806 | 806 | |
807 | - $message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : ''; |
|
807 | + $message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : ''; |
|
808 | 808 | |
809 | 809 | |
810 | - wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) ); |
|
810 | + wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation)); |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | |
814 | 814 | |
815 | 815 | public function load_scripts_styles_settings() { |
816 | - wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION ); |
|
817 | - wp_enqueue_style( 'ee-text-links' ); |
|
818 | - wp_enqueue_style( 'ee-message-settings' ); |
|
816 | + wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION); |
|
817 | + wp_enqueue_style('ee-text-links'); |
|
818 | + wp_enqueue_style('ee-message-settings'); |
|
819 | 819 | |
820 | 820 | wp_enqueue_script('ee-messages-settings'); |
821 | 821 | } |
@@ -845,40 +845,40 @@ discard block |
||
845 | 845 | * set views array for message queue list table |
846 | 846 | */ |
847 | 847 | public function _set_list_table_views_default() { |
848 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
848 | + EE_Registry::instance()->load_helper('Template'); |
|
849 | 849 | |
850 | - $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' ) |
|
850 | + $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions') |
|
851 | 851 | ? array( |
852 | - 'generate_now' => __( 'Generate Now', 'event_espresso' ), |
|
853 | - 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
854 | - 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
855 | - 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
852 | + 'generate_now' => __('Generate Now', 'event_espresso'), |
|
853 | + 'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'), |
|
854 | + 'queue_for_resending' => __('Queue for Resending', 'event_espresso'), |
|
855 | + 'send_now' => __('Send Now', 'event_espresso') |
|
856 | 856 | ) |
857 | 857 | : array(); |
858 | 858 | |
859 | - $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' ) |
|
860 | - ? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) ) |
|
859 | + $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions') |
|
860 | + ? array('delete_ee_messages' => __('Delete Messages', 'event_espresso')) |
|
861 | 861 | : array(); |
862 | 862 | |
863 | 863 | |
864 | 864 | $this->_views = array( |
865 | 865 | 'all' => array( |
866 | 866 | 'slug' => 'all', |
867 | - 'label' => __( 'All', 'event_espresso' ), |
|
867 | + 'label' => __('All', 'event_espresso'), |
|
868 | 868 | 'count' => 0, |
869 | - 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
869 | + 'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action) |
|
870 | 870 | ) |
871 | 871 | ); |
872 | 872 | |
873 | 873 | |
874 | - foreach ( EEM_Message::instance()->all_statuses() as $status ) { |
|
875 | - if ( $status === EEM_Message::status_debug_only && ! EEM_Message::debug() ) { |
|
874 | + foreach (EEM_Message::instance()->all_statuses() as $status) { |
|
875 | + if ($status === EEM_Message::status_debug_only && ! EEM_Message::debug()) { |
|
876 | 876 | continue; |
877 | 877 | } |
878 | 878 | $status_bulk_actions = $common_bulk_actions; |
879 | 879 | //unset bulk actions not applying to status |
880 | - if ( ! empty( $status_bulk_actions ) ) { |
|
881 | - switch ( $status ) { |
|
880 | + if ( ! empty($status_bulk_actions)) { |
|
881 | + switch ($status) { |
|
882 | 882 | case EEM_Message::status_idle : |
883 | 883 | case EEM_Message::status_resend : |
884 | 884 | $status_bulk_actions['send_now'] = $common_bulk_actions['send_now']; |
@@ -890,21 +890,21 @@ discard block |
||
890 | 890 | break; |
891 | 891 | |
892 | 892 | case EEM_Message::status_incomplete : |
893 | - unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] ); |
|
893 | + unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']); |
|
894 | 894 | break; |
895 | 895 | |
896 | 896 | case EEM_Message::status_retry : |
897 | 897 | case EEM_Message::status_sent : |
898 | - unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] ); |
|
898 | + unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']); |
|
899 | 899 | break; |
900 | 900 | } |
901 | 901 | } |
902 | 902 | |
903 | - $this->_views[ strtolower( $status ) ] = array( |
|
904 | - 'slug' => strtolower( $status ), |
|
905 | - 'label' => EEH_Template::pretty_status( $status, false, 'sentence' ), |
|
903 | + $this->_views[strtolower($status)] = array( |
|
904 | + 'slug' => strtolower($status), |
|
905 | + 'label' => EEH_Template::pretty_status($status, false, 'sentence'), |
|
906 | 906 | 'count' => 0, |
907 | - 'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action ) |
|
907 | + 'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action) |
|
908 | 908 | ); |
909 | 909 | } |
910 | 910 | } |
@@ -923,8 +923,8 @@ discard block |
||
923 | 923 | protected function _message_queue_list_table() { |
924 | 924 | $this->_search_btn_label = __('Message Activity', 'event_espresso'); |
925 | 925 | $this->_template_args['per_column'] = 6; |
926 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() ); |
|
927 | - $this->_template_args['before_list_table'] = '<h3>' . EEM_Message::instance()->get_pretty_label_for_results() . '</h3>'; |
|
926 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items()); |
|
927 | + $this->_template_args['before_list_table'] = '<h3>'.EEM_Message::instance()->get_pretty_label_for_results().'</h3>'; |
|
928 | 928 | $this->display_admin_list_table_page_with_no_sidebar(); |
929 | 929 | } |
930 | 930 | |
@@ -937,8 +937,8 @@ discard block |
||
937 | 937 | $action_css_classes = EEH_MSG_Template::get_message_action_icons(); |
938 | 938 | $action_items = array(); |
939 | 939 | |
940 | - foreach( $action_css_classes as $action_item => $action_details ) { |
|
941 | - if ( $action_item === 'see_notifications_for' ) { |
|
940 | + foreach ($action_css_classes as $action_item => $action_details) { |
|
941 | + if ($action_item === 'see_notifications_for') { |
|
942 | 942 | continue; |
943 | 943 | } |
944 | 944 | $action_items[$action_item] = array( |
@@ -950,37 +950,37 @@ discard block |
||
950 | 950 | /** @type array $status_items status legend setup*/ |
951 | 951 | $status_items = array( |
952 | 952 | 'sent_status' => array( |
953 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent, |
|
954 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, false, 'sentence' ) |
|
953 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent, |
|
954 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, false, 'sentence') |
|
955 | 955 | ), |
956 | 956 | 'idle_status' => array( |
957 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle, |
|
958 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, false, 'sentence' ) |
|
957 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle, |
|
958 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, false, 'sentence') |
|
959 | 959 | ), |
960 | 960 | 'failed_status' => array( |
961 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed, |
|
962 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, false, 'sentence' ) |
|
961 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed, |
|
962 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, false, 'sentence') |
|
963 | 963 | ), |
964 | 964 | 'resend_status' => array( |
965 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend, |
|
966 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, false, 'sentence' ) |
|
965 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend, |
|
966 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, false, 'sentence') |
|
967 | 967 | ), |
968 | 968 | 'incomplete_status' => array( |
969 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete, |
|
970 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, false, 'sentence' ) |
|
969 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete, |
|
970 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, false, 'sentence') |
|
971 | 971 | ), |
972 | 972 | 'retry_status' => array( |
973 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry, |
|
974 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, false, 'sentence' ) |
|
973 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry, |
|
974 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, false, 'sentence') |
|
975 | 975 | ) |
976 | 976 | ); |
977 | - if ( EEM_Message::debug() ) { |
|
977 | + if (EEM_Message::debug()) { |
|
978 | 978 | $status_items['debug_only_status'] = array( |
979 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_debug_only, |
|
980 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_debug_only, false, 'sentence' ) |
|
979 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_debug_only, |
|
980 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_debug_only, false, 'sentence') |
|
981 | 981 | ); |
982 | 982 | } |
983 | - return array_merge( $action_items, $status_items ); |
|
983 | + return array_merge($action_items, $status_items); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | |
@@ -990,9 +990,9 @@ discard block |
||
990 | 990 | |
991 | 991 | protected function _custom_mtps_preview() { |
992 | 992 | $this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso'); |
993 | - $this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />'; |
|
993 | + $this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />'; |
|
994 | 994 | $this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso. With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>'; |
995 | - $this->display_admin_caf_preview_page( 'custom_message_types', false ); |
|
995 | + $this->display_admin_caf_preview_page('custom_message_types', false); |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | |
@@ -1016,31 +1016,31 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @return array |
1018 | 1018 | */ |
1019 | - public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) { |
|
1019 | + public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) { |
|
1020 | 1020 | |
1021 | 1021 | $MTP = EEM_Message_Template_Group::instance(); |
1022 | 1022 | |
1023 | 1023 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby']; |
1024 | 1024 | $orderby = $this->_req_data['orderby']; |
1025 | 1025 | |
1026 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC'; |
|
1026 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1027 | 1027 | |
1028 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1029 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage; |
|
1028 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1029 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage; |
|
1030 | 1030 | |
1031 | - $offset = ($current_page-1)*$per_page; |
|
1032 | - $limit = $all ? null : array( $offset, $per_page ); |
|
1031 | + $offset = ($current_page - 1) * $per_page; |
|
1032 | + $limit = $all ? null : array($offset, $per_page); |
|
1033 | 1033 | |
1034 | 1034 | |
1035 | 1035 | //options will match what is in the _views array property |
1036 | - switch( $type ) { |
|
1036 | + switch ($type) { |
|
1037 | 1037 | |
1038 | 1038 | case 'in_use': |
1039 | - $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true ); |
|
1039 | + $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true); |
|
1040 | 1040 | break; |
1041 | 1041 | |
1042 | 1042 | default: |
1043 | - $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global ); |
|
1043 | + $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global); |
|
1044 | 1044 | |
1045 | 1045 | } |
1046 | 1046 | |
@@ -1059,8 +1059,8 @@ discard block |
||
1059 | 1059 | $installed_message_types = $this->_message_resource_manager->installed_message_types(); |
1060 | 1060 | $installed = array(); |
1061 | 1061 | |
1062 | - foreach ( $installed_message_types as $message_type ) { |
|
1063 | - $installed[ $message_type->name ] = $message_type; |
|
1062 | + foreach ($installed_message_types as $message_type) { |
|
1063 | + $installed[$message_type->name] = $message_type; |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | return $installed; |
@@ -1079,24 +1079,24 @@ discard block |
||
1079 | 1079 | * |
1080 | 1080 | * @throws EE_error |
1081 | 1081 | */ |
1082 | - protected function _add_message_template( $message_type = '', $messenger='', $GRP_ID = '' ) { |
|
1082 | + protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') { |
|
1083 | 1083 | //set values override any request data |
1084 | - $message_type = !empty( $message_type ) ? $message_type : ''; |
|
1085 | - $message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type; |
|
1084 | + $message_type = ! empty($message_type) ? $message_type : ''; |
|
1085 | + $message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type; |
|
1086 | 1086 | |
1087 | - $messenger = !empty( $messenger ) ? $messenger : ''; |
|
1088 | - $messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger; |
|
1087 | + $messenger = ! empty($messenger) ? $messenger : ''; |
|
1088 | + $messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger; |
|
1089 | 1089 | |
1090 | - $GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : ''; |
|
1091 | - $GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
1090 | + $GRP_ID = ! empty($GRP_ID) ? $GRP_ID : ''; |
|
1091 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
1092 | 1092 | |
1093 | 1093 | //we need messenger and message type. They should be coming from the event editor. If not here then return error |
1094 | - if ( empty( $message_type ) || empty( $messenger ) ) |
|
1095 | - {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));} |
|
1094 | + if (empty($message_type) || empty($messenger)) |
|
1095 | + {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); } |
|
1096 | 1096 | |
1097 | 1097 | //we need the GRP_ID for the template being used as the base for the new template |
1098 | - if ( empty( $GRP_ID ) ) |
|
1099 | - {throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );} |
|
1098 | + if (empty($GRP_ID)) |
|
1099 | + {throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); } |
|
1100 | 1100 | |
1101 | 1101 | //let's just make sure the template gets generated! |
1102 | 1102 | |
@@ -1117,8 +1117,8 @@ discard block |
||
1117 | 1117 | * @param int $GRP_ID GRP_ID for the related message template group this new template will be based |
1118 | 1118 | * off of. |
1119 | 1119 | */ |
1120 | - public function add_message_template( $message_type, $messenger, $GRP_ID ) { |
|
1121 | - $this->_add_message_template( $message_type, $messenger, $GRP_ID ); |
|
1120 | + public function add_message_template($message_type, $messenger, $GRP_ID) { |
|
1121 | + $this->_add_message_template($message_type, $messenger, $GRP_ID); |
|
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | |
@@ -1129,14 +1129,14 @@ discard block |
||
1129 | 1129 | * @return void |
1130 | 1130 | */ |
1131 | 1131 | protected function _edit_message_template() { |
1132 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1132 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1133 | 1133 | $template_fields = ''; |
1134 | 1134 | $sidebar_fields = ''; |
1135 | 1135 | //we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates. |
1136 | - add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 ); |
|
1136 | + add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2); |
|
1137 | 1137 | |
1138 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) |
|
1139 | - ? absint( $this->_req_data['id'] ) |
|
1138 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) |
|
1139 | + ? absint($this->_req_data['id']) |
|
1140 | 1140 | : false; |
1141 | 1141 | |
1142 | 1142 | $this->_set_shortcodes(); //this also sets the _message_template property. |
@@ -1144,20 +1144,20 @@ discard block |
||
1144 | 1144 | $c_label = $message_template_group->context_label(); |
1145 | 1145 | $c_config = $message_template_group->contexts_config(); |
1146 | 1146 | |
1147 | - reset( $c_config ); |
|
1148 | - $context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) |
|
1147 | + reset($c_config); |
|
1148 | + $context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) |
|
1149 | 1149 | ? strtolower($this->_req_data['context']) |
1150 | 1150 | : key($c_config); |
1151 | 1151 | |
1152 | 1152 | |
1153 | - if ( empty($GRP_ID) ) { |
|
1153 | + if (empty($GRP_ID)) { |
|
1154 | 1154 | $action = 'insert_message_template'; |
1155 | 1155 | //$button_both = false; |
1156 | 1156 | //$button_text = array( __( 'Save','event_espresso') ); |
1157 | 1157 | //$button_actions = array('something_different'); |
1158 | 1158 | //$referrer = false; |
1159 | 1159 | $edit_message_template_form_url = add_query_arg( |
1160 | - array( 'action' => $action, 'noheader' => true ), |
|
1160 | + array('action' => $action, 'noheader' => true), |
|
1161 | 1161 | EE_MSG_ADMIN_URL |
1162 | 1162 | ); |
1163 | 1163 | } else { |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | //$button_actions = array(); |
1168 | 1168 | //$referrer = $this->_admin_base_url; |
1169 | 1169 | $edit_message_template_form_url = add_query_arg( |
1170 | - array( 'action' => $action, 'noheader' => true ), |
|
1170 | + array('action' => $action, 'noheader' => true), |
|
1171 | 1171 | EE_MSG_ADMIN_URL |
1172 | 1172 | ); |
1173 | 1173 | } |
@@ -1181,14 +1181,14 @@ discard block |
||
1181 | 1181 | |
1182 | 1182 | //Do we have any validation errors? |
1183 | 1183 | $validators = $this->_get_transient(); |
1184 | - $v_fields = !empty($validators) ? array_keys($validators) : array(); |
|
1184 | + $v_fields = ! empty($validators) ? array_keys($validators) : array(); |
|
1185 | 1185 | |
1186 | 1186 | |
1187 | 1187 | //we need to assemble the title from Various details |
1188 | 1188 | $context_label = sprintf( |
1189 | 1189 | __('(%s %s)', 'event_espresso'), |
1190 | 1190 | $c_config[$context]['label'], |
1191 | - ucwords($c_label['label'] ) |
|
1191 | + ucwords($c_label['label']) |
|
1192 | 1192 | ); |
1193 | 1193 | |
1194 | 1194 | $title = sprintf( |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | $message_template_group->message_type() |
1210 | 1210 | ); |
1211 | 1211 | |
1212 | - if ( !$template_field_structure ) { |
|
1212 | + if ( ! $template_field_structure) { |
|
1213 | 1213 | $template_field_structure = false; |
1214 | 1214 | $template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso'); |
1215 | 1215 | } |
@@ -1219,51 +1219,51 @@ discard block |
||
1219 | 1219 | |
1220 | 1220 | |
1221 | 1221 | //if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array. |
1222 | - if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) { |
|
1223 | - foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) { |
|
1224 | - unset( $template_field_structure[$context][$reference_field] ); |
|
1222 | + if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) { |
|
1223 | + foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) { |
|
1224 | + unset($template_field_structure[$context][$reference_field]); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
1228 | 1228 | //let's loop through the template_field_structure and actually assemble the input fields! |
1229 | - if ( !empty($template_field_structure) ) { |
|
1230 | - foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) { |
|
1229 | + if ( ! empty($template_field_structure)) { |
|
1230 | + foreach ($template_field_structure[$context] as $template_field => $field_setup_array) { |
|
1231 | 1231 | //if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them. |
1232 | - if ( $template_field == 'extra' ) { |
|
1232 | + if ($template_field == 'extra') { |
|
1233 | 1233 | $this->_template_args['is_extra_fields'] = true; |
1234 | - foreach ( $field_setup_array as $reference_field => $new_fields_array ) { |
|
1235 | - $message_template = $message_templates[ $context ][ $reference_field ]; |
|
1234 | + foreach ($field_setup_array as $reference_field => $new_fields_array) { |
|
1235 | + $message_template = $message_templates[$context][$reference_field]; |
|
1236 | 1236 | $content = $message_template instanceof EE_Message_Template |
1237 | - ? $message_template->get( 'MTP_content' ) |
|
1237 | + ? $message_template->get('MTP_content') |
|
1238 | 1238 | : ''; |
1239 | - foreach ( $new_fields_array as $extra_field => $extra_array ) { |
|
1239 | + foreach ($new_fields_array as $extra_field => $extra_array) { |
|
1240 | 1240 | //let's verify if we need this extra field via the shortcodes parameter. |
1241 | 1241 | $continue = false; |
1242 | - if ( isset( $extra_array['shortcodes_required'] ) ) { |
|
1243 | - foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) { |
|
1244 | - if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) |
|
1245 | - {$continue = true;} |
|
1242 | + if (isset($extra_array['shortcodes_required'])) { |
|
1243 | + foreach ((array) $extra_array['shortcodes_required'] as $shortcode) { |
|
1244 | + if ( ! array_key_exists($shortcode, $this->_shortcodes)) |
|
1245 | + {$continue = true; } |
|
1246 | 1246 | } |
1247 | - if ( $continue ) {continue;} |
|
1247 | + if ($continue) {continue; } |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | - $field_id = $reference_field . '-' . $extra_field . '-content'; |
|
1250 | + $field_id = $reference_field.'-'.$extra_field.'-content'; |
|
1251 | 1251 | $template_form_fields[$field_id] = $extra_array; |
1252 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']'; |
|
1253 | - $css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : ''; |
|
1252 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']'; |
|
1253 | + $css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : ''; |
|
1254 | 1254 | |
1255 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1255 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1256 | 1256 | && in_array($extra_field, $v_fields) |
1257 | 1257 | && |
1258 | 1258 | ( |
1259 | - is_array($validators[$extra_field] ) |
|
1260 | - && isset( $validators[$extra_field]['msg'] ) |
|
1259 | + is_array($validators[$extra_field]) |
|
1260 | + && isset($validators[$extra_field]['msg']) |
|
1261 | 1261 | ) |
1262 | - ? 'validate-error ' . $css_class |
|
1262 | + ? 'validate-error '.$css_class |
|
1263 | 1263 | : $css_class; |
1264 | 1264 | |
1265 | - $template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) |
|
1266 | - ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) |
|
1265 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) |
|
1266 | + ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) |
|
1267 | 1267 | : ''; |
1268 | 1268 | |
1269 | 1269 | //do we have a validation error? if we do then let's use that value instead |
@@ -1279,32 +1279,32 @@ discard block |
||
1279 | 1279 | $field_id |
1280 | 1280 | ); |
1281 | 1281 | |
1282 | - if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) { |
|
1282 | + if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') { |
|
1283 | 1283 | //we want to decode the entities |
1284 | 1284 | $template_form_fields[$field_id]['value'] = stripslashes( |
1285 | - html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1285 | + html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1286 | 1286 | ); |
1287 | 1287 | |
1288 | 1288 | }/**/ |
1289 | 1289 | } |
1290 | - $templatefield_MTP_id = $reference_field . '-MTP_ID'; |
|
1291 | - $templatefield_templatename_id = $reference_field . '-name'; |
|
1290 | + $templatefield_MTP_id = $reference_field.'-MTP_ID'; |
|
1291 | + $templatefield_templatename_id = $reference_field.'-name'; |
|
1292 | 1292 | |
1293 | 1293 | $template_form_fields[$templatefield_MTP_id] = array( |
1294 | - 'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]', |
|
1294 | + 'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]', |
|
1295 | 1295 | 'label' => null, |
1296 | 1296 | 'input' => 'hidden', |
1297 | 1297 | 'type' => 'int', |
1298 | 1298 | 'required' => false, |
1299 | 1299 | 'validation' => false, |
1300 | - 'value' => !empty($message_templates) ? $message_template->ID() : '', |
|
1300 | + 'value' => ! empty($message_templates) ? $message_template->ID() : '', |
|
1301 | 1301 | 'css_class' => '', |
1302 | 1302 | 'format' => '%d', |
1303 | 1303 | 'db-col' => 'MTP_ID' |
1304 | 1304 | ); |
1305 | 1305 | |
1306 | 1306 | $template_form_fields[$templatefield_templatename_id] = array( |
1307 | - 'name' => 'MTP_template_fields[' . $reference_field . '][name]', |
|
1307 | + 'name' => 'MTP_template_fields['.$reference_field.'][name]', |
|
1308 | 1308 | 'label' => null, |
1309 | 1309 | 'input' => 'hidden', |
1310 | 1310 | 'type' => 'string', |
@@ -1318,14 +1318,14 @@ discard block |
||
1318 | 1318 | } |
1319 | 1319 | continue; //skip the next stuff, we got the necessary fields here for this dataset. |
1320 | 1320 | } else { |
1321 | - $field_id = $template_field . '-content'; |
|
1321 | + $field_id = $template_field.'-content'; |
|
1322 | 1322 | $template_form_fields[$field_id] = $field_setup_array; |
1323 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]'; |
|
1324 | - $message_template = isset( $message_templates[ $context ][ $template_field ] ) |
|
1325 | - ? $message_templates[ $context ][ $template_field ] |
|
1323 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]'; |
|
1324 | + $message_template = isset($message_templates[$context][$template_field]) |
|
1325 | + ? $message_templates[$context][$template_field] |
|
1326 | 1326 | : null; |
1327 | - $template_form_fields[$field_id]['value'] = ! empty( $message_templates ) |
|
1328 | - && is_array( $message_templates[$context] ) |
|
1327 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) |
|
1328 | + && is_array($message_templates[$context]) |
|
1329 | 1329 | && $message_template instanceof EE_Message_Template |
1330 | 1330 | ? $message_template->get('MTP_content') |
1331 | 1331 | : ''; |
@@ -1338,10 +1338,10 @@ discard block |
||
1338 | 1338 | |
1339 | 1339 | $template_form_fields[$field_id]['db-col'] = 'MTP_content'; |
1340 | 1340 | $css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : ''; |
1341 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1342 | - && in_array( $template_field, $v_fields ) |
|
1343 | - && isset( $validators[$template_field]['msg'] ) |
|
1344 | - ? 'validate-error ' . $css_class |
|
1341 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1342 | + && in_array($template_field, $v_fields) |
|
1343 | + && isset($validators[$template_field]['msg']) |
|
1344 | + ? 'validate-error '.$css_class |
|
1345 | 1345 | : $css_class; |
1346 | 1346 | |
1347 | 1347 | //shortcode selector |
@@ -1352,12 +1352,12 @@ discard block |
||
1352 | 1352 | |
1353 | 1353 | //k took care of content field(s) now let's take care of others. |
1354 | 1354 | |
1355 | - $templatefield_MTP_id = $template_field . '-MTP_ID'; |
|
1356 | - $templatefield_field_templatename_id = $template_field . '-name'; |
|
1355 | + $templatefield_MTP_id = $template_field.'-MTP_ID'; |
|
1356 | + $templatefield_field_templatename_id = $template_field.'-name'; |
|
1357 | 1357 | |
1358 | 1358 | //foreach template field there are actually two form fields created |
1359 | 1359 | $template_form_fields[$templatefield_MTP_id] = array( |
1360 | - 'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]', |
|
1360 | + 'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]', |
|
1361 | 1361 | 'label' => null, |
1362 | 1362 | 'input' => 'hidden', |
1363 | 1363 | 'type' => 'int', |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | ); |
1371 | 1371 | |
1372 | 1372 | $template_form_fields[$templatefield_field_templatename_id] = array( |
1373 | - 'name' => 'MTP_template_fields[' . $template_field . '][name]', |
|
1373 | + 'name' => 'MTP_template_fields['.$template_field.'][name]', |
|
1374 | 1374 | 'label' => null, |
1375 | 1375 | 'input' => 'hidden', |
1376 | 1376 | 'type' => 'string', |
@@ -1514,13 +1514,13 @@ discard block |
||
1514 | 1514 | 'value' => $GRP_ID |
1515 | 1515 | ); |
1516 | 1516 | $sidebar_form_fields['ee-msg-evt-nonce'] = array( |
1517 | - 'name' => $action . '_nonce', |
|
1517 | + 'name' => $action.'_nonce', |
|
1518 | 1518 | 'input' => 'hidden', |
1519 | 1519 | 'type' => 'string', |
1520 | - 'value' => wp_create_nonce( $action . '_nonce') |
|
1520 | + 'value' => wp_create_nonce($action.'_nonce') |
|
1521 | 1521 | ); |
1522 | 1522 | |
1523 | - if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) { |
|
1523 | + if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) { |
|
1524 | 1524 | $sidebar_form_fields['ee-msg-template-switch'] = array( |
1525 | 1525 | 'name' => 'template_switch', |
1526 | 1526 | 'input' => 'hidden', |
@@ -1530,8 +1530,8 @@ discard block |
||
1530 | 1530 | } |
1531 | 1531 | |
1532 | 1532 | |
1533 | - $template_fields = $this->_generate_admin_form_fields( $template_form_fields ); |
|
1534 | - $sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields ); |
|
1533 | + $template_fields = $this->_generate_admin_form_fields($template_form_fields); |
|
1534 | + $sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields); |
|
1535 | 1535 | |
1536 | 1536 | |
1537 | 1537 | } //end if ( !empty($template_field_structure) ) |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | $GRP_ID, |
1544 | 1544 | false, |
1545 | 1545 | add_query_arg( |
1546 | - array( 'action' => 'global_mtps' ), |
|
1546 | + array('action' => 'global_mtps'), |
|
1547 | 1547 | $this->_admin_base_url |
1548 | 1548 | ) |
1549 | 1549 | ); |
@@ -1559,7 +1559,7 @@ discard block |
||
1559 | 1559 | ), |
1560 | 1560 | $this->_admin_base_url |
1561 | 1561 | ); |
1562 | - $preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>'; |
|
1562 | + $preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>'; |
|
1563 | 1563 | |
1564 | 1564 | |
1565 | 1565 | //setup context switcher |
@@ -1587,17 +1587,17 @@ discard block |
||
1587 | 1587 | $this->_template_args['after_admin_page_content'] = $this->_add_form_element_after(); |
1588 | 1588 | |
1589 | 1589 | $this->_template_path = $this->_template_args['GRP_ID'] |
1590 | - ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' |
|
1591 | - : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php'; |
|
1590 | + ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' |
|
1591 | + : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php'; |
|
1592 | 1592 | |
1593 | 1593 | //send along EE_Message_Template_Group object for further template use. |
1594 | 1594 | $this->_template_args['MTP'] = $message_template_group; |
1595 | 1595 | |
1596 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true ); |
|
1596 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true); |
|
1597 | 1597 | |
1598 | 1598 | |
1599 | 1599 | //finally, let's set the admin_page title |
1600 | - $this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title ); |
|
1600 | + $this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title); |
|
1601 | 1601 | |
1602 | 1602 | |
1603 | 1603 | //we need to take care of setting the shortcodes property for use elsewhere. |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | } |
1611 | 1611 | |
1612 | 1612 | |
1613 | - public function filter_tinymce_init( $mceInit, $editor_id ) { |
|
1613 | + public function filter_tinymce_init($mceInit, $editor_id) { |
|
1614 | 1614 | return $mceInit; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | } |
1622 | 1622 | |
1623 | 1623 | public function _add_form_element_before() { |
1624 | - return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">'; |
|
1624 | + return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">'; |
|
1625 | 1625 | } |
1626 | 1626 | |
1627 | 1627 | public function _add_form_element_after() { |
@@ -1638,25 +1638,25 @@ discard block |
||
1638 | 1638 | * |
1639 | 1639 | */ |
1640 | 1640 | public function switch_template_pack() { |
1641 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1642 | - $template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : ''; |
|
1641 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1642 | + $template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : ''; |
|
1643 | 1643 | |
1644 | 1644 | //verify we have needed values. |
1645 | - if ( empty( $GRP_ID ) || empty( $template_pack ) ) { |
|
1645 | + if (empty($GRP_ID) || empty($template_pack)) { |
|
1646 | 1646 | $this->_template_args['error'] = true; |
1647 | - EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1647 | + EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1648 | 1648 | } else { |
1649 | 1649 | //get template, set the new template_pack and then reset to default |
1650 | 1650 | /** @type EE_Message_Template_Group $message_template_group */ |
1651 | - $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
1651 | + $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
1652 | 1652 | |
1653 | - $message_template_group->set_template_pack_name( $template_pack ); |
|
1653 | + $message_template_group->set_template_pack_name($template_pack); |
|
1654 | 1654 | $this->_req_data['msgr'] = $message_template_group->messenger(); |
1655 | 1655 | $this->_req_data['mt'] = $message_template_group->message_type(); |
1656 | 1656 | |
1657 | 1657 | $query_args = $this->_reset_to_default_template(); |
1658 | 1658 | |
1659 | - if ( empty( $query_args['id'] ) ) { |
|
1659 | + if (empty($query_args['id'])) { |
|
1660 | 1660 | EE_Error::add_error( |
1661 | 1661 | __( |
1662 | 1662 | 'Something went wrong with switching the template pack. Please try again or contact EE support', |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | ); |
1667 | 1667 | $this->_template_args['error'] = true; |
1668 | 1668 | } else { |
1669 | - $template_label =$message_template_group->get_template_pack()->label; |
|
1669 | + $template_label = $message_template_group->get_template_pack()->label; |
|
1670 | 1670 | $template_pack_labels = $message_template_group->messenger_obj()->get_supports_labels(); |
1671 | 1671 | EE_Error::add_success( |
1672 | 1672 | sprintf( |
@@ -1679,7 +1679,7 @@ discard block |
||
1679 | 1679 | ) |
1680 | 1680 | ); |
1681 | 1681 | //generate the redirect url for js. |
1682 | - $url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1682 | + $url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1683 | 1683 | $this->_template_args['data']['redirect_url'] = $url; |
1684 | 1684 | $this->_template_args['success'] = true; |
1685 | 1685 | } |
@@ -1701,9 +1701,9 @@ discard block |
||
1701 | 1701 | protected function _reset_to_default_template() { |
1702 | 1702 | |
1703 | 1703 | $templates = array(); |
1704 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1704 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1705 | 1705 | //we need to make sure we've got the info we need. |
1706 | - if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) { |
|
1706 | + if ( ! isset($this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'])) { |
|
1707 | 1707 | EE_Error::add_error( |
1708 | 1708 | __( |
1709 | 1709 | 'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset. At least one of these is missing.', |
@@ -1715,9 +1715,9 @@ discard block |
||
1715 | 1715 | |
1716 | 1716 | // all templates will be reset to whatever the defaults are |
1717 | 1717 | // for the global template matching the messenger and message type. |
1718 | - $success = !empty( $GRP_ID ) ? true : false; |
|
1718 | + $success = ! empty($GRP_ID) ? true : false; |
|
1719 | 1719 | |
1720 | - if ( $success ) { |
|
1720 | + if ($success) { |
|
1721 | 1721 | |
1722 | 1722 | //let's first determine if the incoming template is a global template, |
1723 | 1723 | // if it isn't then we need to get the global template matching messenger and message type. |
@@ -1725,9 +1725,9 @@ discard block |
||
1725 | 1725 | |
1726 | 1726 | |
1727 | 1727 | //note this is ONLY deleting the template fields (Message Template rows) NOT the message template group. |
1728 | - $success = $this->_delete_mtp_permanently( $GRP_ID, false ); |
|
1728 | + $success = $this->_delete_mtp_permanently($GRP_ID, false); |
|
1729 | 1729 | |
1730 | - if ( $success ) { |
|
1730 | + if ($success) { |
|
1731 | 1731 | // if successfully deleted, lets generate the new ones. |
1732 | 1732 | // Note. We set GLOBAL to true, because resets on ANY template |
1733 | 1733 | // will use the related global template defaults for regeneration. |
@@ -1745,32 +1745,32 @@ discard block |
||
1745 | 1745 | } |
1746 | 1746 | |
1747 | 1747 | //any error messages? |
1748 | - if ( !$success ) { |
|
1748 | + if ( ! $success) { |
|
1749 | 1749 | EE_Error::add_error( |
1750 | - __( 'Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso' ), |
|
1750 | + __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), |
|
1751 | 1751 | __FILE__, __FUNCTION__, __LINE__ |
1752 | 1752 | ); |
1753 | 1753 | } |
1754 | 1754 | |
1755 | 1755 | //all good, let's add a success message! |
1756 | - if ( $success && ! empty( $templates ) ) { |
|
1756 | + if ($success && ! empty($templates)) { |
|
1757 | 1757 | $templates = $templates[0]; //the info for the template we generated is the first element in the returned array. |
1758 | 1758 | EE_Error::overwrite_success(); |
1759 | - EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') ); |
|
1759 | + EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso')); |
|
1760 | 1760 | } |
1761 | 1761 | |
1762 | 1762 | |
1763 | 1763 | $query_args = array( |
1764 | - 'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null, |
|
1765 | - 'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null, |
|
1766 | - 'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps' |
|
1764 | + 'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null, |
|
1765 | + 'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null, |
|
1766 | + 'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps' |
|
1767 | 1767 | ); |
1768 | 1768 | |
1769 | 1769 | //if called via ajax then we return query args otherwise redirect |
1770 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
1770 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1771 | 1771 | return $query_args; |
1772 | 1772 | } else { |
1773 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
1773 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1774 | 1774 | return null; |
1775 | 1775 | } |
1776 | 1776 | } |
@@ -1783,7 +1783,7 @@ discard block |
||
1783 | 1783 | * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview. |
1784 | 1784 | * @return string |
1785 | 1785 | */ |
1786 | - public function _preview_message( $send = false ) { |
|
1786 | + public function _preview_message($send = false) { |
|
1787 | 1787 | //first make sure we've got the necessary parameters |
1788 | 1788 | if ( |
1789 | 1789 | ! isset( |
@@ -1799,13 +1799,13 @@ discard block |
||
1799 | 1799 | ); |
1800 | 1800 | } |
1801 | 1801 | |
1802 | - EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] ); |
|
1802 | + EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']); |
|
1803 | 1803 | |
1804 | 1804 | |
1805 | 1805 | //get the preview! |
1806 | - $preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send ); |
|
1806 | + $preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send); |
|
1807 | 1807 | |
1808 | - if ( $send ) { |
|
1808 | + if ($send) { |
|
1809 | 1809 | return $preview; |
1810 | 1810 | } |
1811 | 1811 | |
@@ -1815,22 +1815,22 @@ discard block |
||
1815 | 1815 | 'context' => $this->_req_data['context'], |
1816 | 1816 | 'action' => 'edit_message_template' |
1817 | 1817 | ); |
1818 | - $go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1819 | - $preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>'; |
|
1818 | + $go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1819 | + $preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>'; |
|
1820 | 1820 | $message_types = $this->get_installed_message_types(); |
1821 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
1821 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
1822 | 1822 | $active_messenger_label = $active_messenger instanceof EE_messenger |
1823 | - ? ucwords( $active_messenger->label['singular'] ) |
|
1824 | - : esc_html__( 'Unknown Messenger', 'event_espresso' ); |
|
1823 | + ? ucwords($active_messenger->label['singular']) |
|
1824 | + : esc_html__('Unknown Messenger', 'event_espresso'); |
|
1825 | 1825 | //let's provide a helpful title for context |
1826 | 1826 | $preview_title = sprintf( |
1827 | - __( 'Viewing Preview for %s %s Message Template', 'event_espresso' ), |
|
1827 | + __('Viewing Preview for %s %s Message Template', 'event_espresso'), |
|
1828 | 1828 | $active_messenger_label, |
1829 | - ucwords( $message_types[ $this->_req_data[ 'message_type' ] ]->label[ 'singular' ] ) |
|
1829 | + ucwords($message_types[$this->_req_data['message_type']]->label['singular']) |
|
1830 | 1830 | ); |
1831 | 1831 | //setup display of preview. |
1832 | 1832 | $this->_admin_page_title = $preview_title; |
1833 | - $this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview); |
|
1833 | + $this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview); |
|
1834 | 1834 | $this->_template_args['data']['force_json'] = true; |
1835 | 1835 | return ''; |
1836 | 1836 | } |
@@ -1860,9 +1860,9 @@ discard block |
||
1860 | 1860 | * @return void |
1861 | 1861 | */ |
1862 | 1862 | protected function _register_edit_meta_boxes() { |
1863 | - add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' ); |
|
1864 | - add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1865 | - add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1863 | + add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default'); |
|
1864 | + add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1865 | + add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1866 | 1866 | } |
1867 | 1867 | |
1868 | 1868 | |
@@ -1881,14 +1881,14 @@ discard block |
||
1881 | 1881 | |
1882 | 1882 | $tp_select_values = array(); |
1883 | 1883 | |
1884 | - foreach ( $tp_collection as $tp ) { |
|
1884 | + foreach ($tp_collection as $tp) { |
|
1885 | 1885 | //only include template packs that support this messenger and message type! |
1886 | 1886 | $supports = $tp->get_supports(); |
1887 | 1887 | if ( |
1888 | - ! isset( $supports[ $this->_message_template_group->messenger() ] ) |
|
1888 | + ! isset($supports[$this->_message_template_group->messenger()]) |
|
1889 | 1889 | || ! in_array( |
1890 | 1890 | $this->_message_template_group->message_type(), |
1891 | - $supports[ $this->_message_template_group->messenger() ] |
|
1891 | + $supports[$this->_message_template_group->messenger()] |
|
1892 | 1892 | ) |
1893 | 1893 | ) { |
1894 | 1894 | //not supported |
@@ -1902,7 +1902,7 @@ discard block |
||
1902 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | //if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack. This still allows for the odd template pack to override. |
1905 | - if ( empty( $tp_select_values ) ) { |
|
1905 | + if (empty($tp_select_values)) { |
|
1906 | 1906 | $tp_select_values[] = array( |
1907 | 1907 | 'text' => __('Default', 'event_espresso'), |
1908 | 1908 | 'id' => 'default' |
@@ -1915,14 +1915,14 @@ discard block |
||
1915 | 1915 | $this->_message_template_group->message_type() |
1916 | 1916 | ); |
1917 | 1917 | $variations_select_values = array(); |
1918 | - foreach ( $variations as $variation => $label ) { |
|
1918 | + foreach ($variations as $variation => $label) { |
|
1919 | 1919 | $variations_select_values[] = array( |
1920 | 1920 | 'text' => $label, |
1921 | 1921 | 'id' => $variation |
1922 | 1922 | ); |
1923 | 1923 | } |
1924 | 1924 | |
1925 | - $template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1925 | + $template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1926 | 1926 | |
1927 | 1927 | $template_args['template_packs_selector'] = EEH_Form_Fields::select_input( |
1928 | 1928 | 'MTP_template_pack', |
@@ -1939,9 +1939,9 @@ discard block |
||
1939 | 1939 | $template_args['template_pack_description'] = $template_pack_labels->template_pack_description; |
1940 | 1940 | $template_args['template_variation_description'] = $template_pack_labels->template_variation_description; |
1941 | 1941 | |
1942 | - $template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php'; |
|
1942 | + $template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php'; |
|
1943 | 1943 | |
1944 | - EEH_Template::display_template( $template, $template_args ); |
|
1944 | + EEH_Template::display_template($template, $template_args); |
|
1945 | 1945 | } |
1946 | 1946 | |
1947 | 1947 | |
@@ -1965,46 +1965,46 @@ discard block |
||
1965 | 1965 | //first we need to see if there are any fields |
1966 | 1966 | $fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields(); |
1967 | 1967 | |
1968 | - if ( !empty( $fields ) ) { |
|
1968 | + if ( ! empty($fields)) { |
|
1969 | 1969 | //yup there be fields |
1970 | - foreach ( $fields as $field => $config ) { |
|
1971 | - $field_id = $this->_message_template_group->messenger() . '_' . $field; |
|
1970 | + foreach ($fields as $field => $config) { |
|
1971 | + $field_id = $this->_message_template_group->messenger().'_'.$field; |
|
1972 | 1972 | $existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings(); |
1973 | - $default = isset( $config['default'] ) ? $config['default'] : ''; |
|
1974 | - $default = isset( $config['value'] ) ? $config['value'] : $default; |
|
1973 | + $default = isset($config['default']) ? $config['default'] : ''; |
|
1974 | + $default = isset($config['value']) ? $config['value'] : $default; |
|
1975 | 1975 | |
1976 | 1976 | // if type is hidden and the value is empty |
1977 | 1977 | // something may have gone wrong so let's correct with the defaults |
1978 | 1978 | $fix = $config['input'] === 'hidden' && isset($existing[$field]) && empty($existing[$field]) |
1979 | 1979 | ? $default |
1980 | 1980 | : ''; |
1981 | - $existing[$field] = isset( $existing[$field] ) && empty( $fix ) |
|
1981 | + $existing[$field] = isset($existing[$field]) && empty($fix) |
|
1982 | 1982 | ? $existing[$field] |
1983 | 1983 | : $fix; |
1984 | 1984 | |
1985 | 1985 | $template_form_fields[$field_id] = array( |
1986 | - 'name' => 'test_settings_fld[' . $field . ']', |
|
1986 | + 'name' => 'test_settings_fld['.$field.']', |
|
1987 | 1987 | 'label' => $config['label'], |
1988 | 1988 | 'input' => $config['input'], |
1989 | 1989 | 'type' => $config['type'], |
1990 | 1990 | 'required' => $config['required'], |
1991 | 1991 | 'validation' => $config['validation'], |
1992 | - 'value' => isset( $existing[ $field ] ) ? $existing[ $field ] : $default, |
|
1992 | + 'value' => isset($existing[$field]) ? $existing[$field] : $default, |
|
1993 | 1993 | 'css_class' => $config['css_class'], |
1994 | - 'options' => isset( $config['options'] ) ? $config['options'] : array(), |
|
1994 | + 'options' => isset($config['options']) ? $config['options'] : array(), |
|
1995 | 1995 | 'default' => $default, |
1996 | 1996 | 'format' => $config['format'] |
1997 | 1997 | ); |
1998 | 1998 | } |
1999 | 1999 | } |
2000 | 2000 | |
2001 | - $test_settings_fields = !empty( $template_form_fields) |
|
2002 | - ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) |
|
2001 | + $test_settings_fields = ! empty($template_form_fields) |
|
2002 | + ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') |
|
2003 | 2003 | : ''; |
2004 | 2004 | |
2005 | 2005 | $test_settings_html = ''; |
2006 | 2006 | //print out $test_settings_fields |
2007 | - if ( !empty( $test_settings_fields ) ) { |
|
2007 | + if ( ! empty($test_settings_fields)) { |
|
2008 | 2008 | echo $test_settings_fields; |
2009 | 2009 | $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" '; |
2010 | 2010 | $test_settings_html .= 'name="test_button" value="'; |
@@ -2013,7 +2013,7 @@ discard block |
||
2013 | 2013 | } |
2014 | 2014 | |
2015 | 2015 | //and button |
2016 | - $test_settings_html .= '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>'; |
|
2016 | + $test_settings_html .= '<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'; |
|
2017 | 2017 | $test_settings_html .= '<div class="publishing-action alignright resetbutton">'; |
2018 | 2018 | $test_settings_html .= $this->get_action_link_or_button( |
2019 | 2019 | 'reset_to_default', |
@@ -2037,13 +2037,13 @@ discard block |
||
2037 | 2037 | * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
2038 | 2038 | * @return string |
2039 | 2039 | */ |
2040 | - protected function _get_shortcode_selector( $field, $linked_input_id ) { |
|
2040 | + protected function _get_shortcode_selector($field, $linked_input_id) { |
|
2041 | 2041 | $template_args = array( |
2042 | - 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
|
2042 | + 'shortcodes' => $this->_get_shortcodes(array($field), true), |
|
2043 | 2043 | 'fieldname' => $field, |
2044 | 2044 | 'linked_input_id' => $linked_input_id |
2045 | 2045 | ); |
2046 | - return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true ); |
|
2046 | + return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true); |
|
2047 | 2047 | } |
2048 | 2048 | |
2049 | 2049 | |
@@ -2058,13 +2058,13 @@ discard block |
||
2058 | 2058 | $shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set |
2059 | 2059 | //$messenger = $this->_message_template_group->messenger_obj(); |
2060 | 2060 | //now let's set the content depending on the status of the shortcodes array |
2061 | - if ( empty( $shortcodes ) ) { |
|
2062 | - $content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>'; |
|
2061 | + if (empty($shortcodes)) { |
|
2062 | + $content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>'; |
|
2063 | 2063 | echo $content; |
2064 | 2064 | } else { |
2065 | 2065 | //$alt = 0; |
2066 | 2066 | ?> |
2067 | - <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p> |
|
2067 | + <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p> |
|
2068 | 2068 | <?php |
2069 | 2069 | } |
2070 | 2070 | |
@@ -2081,7 +2081,7 @@ discard block |
||
2081 | 2081 | protected function _set_shortcodes() { |
2082 | 2082 | |
2083 | 2083 | //no need to run this if the property is already set |
2084 | - if ( !empty($this->_shortcodes ) ) {return;} |
|
2084 | + if ( ! empty($this->_shortcodes)) {return; } |
|
2085 | 2085 | |
2086 | 2086 | $this->_shortcodes = $this->_get_shortcodes(); |
2087 | 2087 | } |
@@ -2103,14 +2103,14 @@ discard block |
||
2103 | 2103 | * @return array Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true |
2104 | 2104 | * just an array of shortcode/label pairs. |
2105 | 2105 | */ |
2106 | - protected function _get_shortcodes( $fields = array(), $merged = true ) { |
|
2106 | + protected function _get_shortcodes($fields = array(), $merged = true) { |
|
2107 | 2107 | $this->_set_message_template_group(); |
2108 | 2108 | |
2109 | 2109 | //we need the messenger and message template to retrieve the valid shortcodes array. |
2110 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false; |
|
2111 | - $context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() ); |
|
2110 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false; |
|
2111 | + $context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config()); |
|
2112 | 2112 | |
2113 | - return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array(); |
|
2113 | + return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array(); |
|
2114 | 2114 | } |
2115 | 2115 | |
2116 | 2116 | |
@@ -2123,19 +2123,19 @@ discard block |
||
2123 | 2123 | */ |
2124 | 2124 | protected function _set_message_template_group() { |
2125 | 2125 | |
2126 | - if ( !empty( $this->_message_template_group ) ) |
|
2127 | - {return;} //get out if this is already set. |
|
2126 | + if ( ! empty($this->_message_template_group)) |
|
2127 | + {return; } //get out if this is already set. |
|
2128 | 2128 | |
2129 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false; |
|
2130 | - $GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID; |
|
2129 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false; |
|
2130 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID; |
|
2131 | 2131 | |
2132 | 2132 | //let's get the message templates |
2133 | 2133 | $MTP = EEM_Message_Template_Group::instance(); |
2134 | 2134 | |
2135 | - if ( empty($GRP_ID) ) |
|
2136 | - {$this->_message_template_group = $MTP->create_default_object();} |
|
2135 | + if (empty($GRP_ID)) |
|
2136 | + {$this->_message_template_group = $MTP->create_default_object(); } |
|
2137 | 2137 | else |
2138 | - {$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );} |
|
2138 | + {$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); } |
|
2139 | 2139 | |
2140 | 2140 | $this->_template_pack = $this->_message_template_group->get_template_pack(); |
2141 | 2141 | $this->_variation = $this->_message_template_group->get_template_pack_variation(); |
@@ -2154,7 +2154,7 @@ discard block |
||
2154 | 2154 | * @param array $args various things the context switcher needs. |
2155 | 2155 | * |
2156 | 2156 | */ |
2157 | - protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) { |
|
2157 | + protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) { |
|
2158 | 2158 | $context_details = $template_group_object->contexts_config(); |
2159 | 2159 | $context_label = $template_group_object->context_label(); |
2160 | 2160 | ob_start(); |
@@ -2162,20 +2162,20 @@ discard block |
||
2162 | 2162 | <div class="ee-msg-switcher-container"> |
2163 | 2163 | <form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm"> |
2164 | 2164 | <?php |
2165 | - foreach ( $args as $name => $value ) { |
|
2166 | - if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;} |
|
2165 | + foreach ($args as $name => $value) { |
|
2166 | + if ($name == 'context' || empty($value) || $name == 'extra') {continue; } |
|
2167 | 2167 | ?> |
2168 | 2168 | <input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" /> |
2169 | 2169 | <?php |
2170 | 2170 | } |
2171 | 2171 | //setup nonce_url |
2172 | - wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false); |
|
2172 | + wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false); |
|
2173 | 2173 | ?> |
2174 | 2174 | <select name="context"> |
2175 | 2175 | <?php |
2176 | 2176 | $context_templates = $template_group_object->context_templates(); |
2177 | - if ( is_array($context_templates) ) : |
|
2178 | - foreach ( $context_templates as $context => $template_fields ) : |
|
2177 | + if (is_array($context_templates)) : |
|
2178 | + foreach ($context_templates as $context => $template_fields) : |
|
2179 | 2179 | $checked = ($context == $args['context']) ? 'selected="selected"' : ''; |
2180 | 2180 | ?> |
2181 | 2181 | <option value="<?php echo $context; ?>" <?php echo $checked; ?>> |
@@ -2183,7 +2183,7 @@ discard block |
||
2183 | 2183 | </option> |
2184 | 2184 | <?php endforeach; endif; ?> |
2185 | 2185 | </select> |
2186 | - <?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?> |
|
2186 | + <?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?> |
|
2187 | 2187 | <input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>"> |
2188 | 2188 | </form> |
2189 | 2189 | <?php echo $args['extra']; ?> |
@@ -2210,8 +2210,8 @@ discard block |
||
2210 | 2210 | * @return array |
2211 | 2211 | */ |
2212 | 2212 | protected function _set_message_template_column_values($index) { |
2213 | - if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) { |
|
2214 | - foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) { |
|
2213 | + if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) { |
|
2214 | + foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) { |
|
2215 | 2215 | $this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value; |
2216 | 2216 | } |
2217 | 2217 | } /*else { |
@@ -2220,22 +2220,22 @@ discard block |
||
2220 | 2220 | |
2221 | 2221 | |
2222 | 2222 | $set_column_values = array( |
2223 | - 'MTP_ID' => absint( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'MTP_ID' ] ), |
|
2224 | - 'GRP_ID' => absint( $this->_req_data[ 'GRP_ID' ] ), |
|
2225 | - 'MTP_user_id' => absint( $this->_req_data[ 'MTP_user_id' ] ), |
|
2226 | - 'MTP_messenger' => strtolower( $this->_req_data[ 'MTP_messenger' ] ), |
|
2227 | - 'MTP_message_type' => strtolower( $this->_req_data[ 'MTP_message_type' ] ), |
|
2228 | - 'MTP_template_field' => strtolower( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'name' ] ), |
|
2229 | - 'MTP_context' => strtolower( $this->_req_data[ 'MTP_context' ] ), |
|
2230 | - 'MTP_content' => $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'content' ], |
|
2231 | - 'MTP_is_global' => isset( $this->_req_data[ 'MTP_is_global' ] ) |
|
2232 | - ? absint( $this->_req_data[ 'MTP_is_global' ] ) |
|
2223 | + 'MTP_ID' => absint($this->_req_data['MTP_template_fields'][$index]['MTP_ID']), |
|
2224 | + 'GRP_ID' => absint($this->_req_data['GRP_ID']), |
|
2225 | + 'MTP_user_id' => absint($this->_req_data['MTP_user_id']), |
|
2226 | + 'MTP_messenger' => strtolower($this->_req_data['MTP_messenger']), |
|
2227 | + 'MTP_message_type' => strtolower($this->_req_data['MTP_message_type']), |
|
2228 | + 'MTP_template_field' => strtolower($this->_req_data['MTP_template_fields'][$index]['name']), |
|
2229 | + 'MTP_context' => strtolower($this->_req_data['MTP_context']), |
|
2230 | + 'MTP_content' => $this->_req_data['MTP_template_fields'][$index]['content'], |
|
2231 | + 'MTP_is_global' => isset($this->_req_data['MTP_is_global']) |
|
2232 | + ? absint($this->_req_data['MTP_is_global']) |
|
2233 | 2233 | : 0, |
2234 | - 'MTP_is_override' => isset( $this->_req_data[ 'MTP_is_override' ] ) |
|
2235 | - ? absint( $this->_req_data[ 'MTP_is_override' ] ) |
|
2234 | + 'MTP_is_override' => isset($this->_req_data['MTP_is_override']) |
|
2235 | + ? absint($this->_req_data['MTP_is_override']) |
|
2236 | 2236 | : 0, |
2237 | - 'MTP_deleted' => absint( $this->_req_data[ 'MTP_deleted' ] ), |
|
2238 | - 'MTP_is_active' => absint( $this->_req_data[ 'MTP_is_active' ] ) |
|
2237 | + 'MTP_deleted' => absint($this->_req_data['MTP_deleted']), |
|
2238 | + 'MTP_is_active' => absint($this->_req_data['MTP_is_active']) |
|
2239 | 2239 | ); |
2240 | 2240 | |
2241 | 2241 | |
@@ -2247,36 +2247,36 @@ discard block |
||
2247 | 2247 | |
2248 | 2248 | |
2249 | 2249 | |
2250 | - protected function _insert_or_update_message_template($new = false ) { |
|
2250 | + protected function _insert_or_update_message_template($new = false) { |
|
2251 | 2251 | |
2252 | - do_action ( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2252 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2253 | 2253 | $success = 0; |
2254 | 2254 | $override = false; |
2255 | 2255 | |
2256 | 2256 | //setup notices description |
2257 | - $messenger = ! empty( $this->_req_data['MTP_messenger'] ) |
|
2258 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_messenger'] ) ) |
|
2257 | + $messenger = ! empty($this->_req_data['MTP_messenger']) |
|
2258 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) |
|
2259 | 2259 | : false; |
2260 | 2260 | |
2261 | - $message_type = ! empty( $this->_req_data['MTP_message_type'] ) |
|
2262 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_message_type'] ) ) |
|
2261 | + $message_type = ! empty($this->_req_data['MTP_message_type']) |
|
2262 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) |
|
2263 | 2263 | : false; |
2264 | 2264 | |
2265 | - $context = ! empty( $this->_req_data['MTP_context'] ) |
|
2266 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_context'] ) ) |
|
2265 | + $context = ! empty($this->_req_data['MTP_context']) |
|
2266 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) |
|
2267 | 2267 | : false; |
2268 | 2268 | |
2269 | - $item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : ''; |
|
2269 | + $item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : ''; |
|
2270 | 2270 | $item_desc .= 'Message Template'; |
2271 | 2271 | $query_args = array(); |
2272 | 2272 | $edit_array = array(); |
2273 | 2273 | $action_desc = ''; |
2274 | 2274 | |
2275 | 2275 | //if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit. |
2276 | - if ( $new ) { |
|
2277 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
2278 | - if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) { |
|
2279 | - if ( empty($edit_array) ) { |
|
2276 | + if ($new) { |
|
2277 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
2278 | + if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) { |
|
2279 | + if (empty($edit_array)) { |
|
2280 | 2280 | $success = 0; |
2281 | 2281 | } else { |
2282 | 2282 | $success = 1; |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | |
2296 | 2296 | |
2297 | 2297 | //run update for each template field in displayed context |
2298 | - if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) { |
|
2298 | + if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) { |
|
2299 | 2299 | EE_Error::add_error( |
2300 | 2300 | __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), |
2301 | 2301 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2304,25 +2304,25 @@ discard block |
||
2304 | 2304 | |
2305 | 2305 | } else { |
2306 | 2306 | //first validate all fields! |
2307 | - $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2307 | + $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2308 | 2308 | |
2309 | 2309 | //if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array. WE need to make sure there is no actual error messages in validates. |
2310 | - if ( is_array($validates) && !empty($validates) ) { |
|
2310 | + if (is_array($validates) && ! empty($validates)) { |
|
2311 | 2311 | //add the transient so when the form loads we know which fields to highlight |
2312 | - $this->_add_transient( 'edit_message_template', $validates ); |
|
2312 | + $this->_add_transient('edit_message_template', $validates); |
|
2313 | 2313 | |
2314 | 2314 | $success = 0; |
2315 | 2315 | |
2316 | 2316 | //setup notices |
2317 | - foreach ( $validates as $field => $error ) { |
|
2318 | - if ( isset($error['msg'] ) ) { |
|
2319 | - EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ ); |
|
2317 | + foreach ($validates as $field => $error) { |
|
2318 | + if (isset($error['msg'])) { |
|
2319 | + EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__); |
|
2320 | 2320 | } |
2321 | 2321 | } |
2322 | 2322 | |
2323 | 2323 | } else { |
2324 | 2324 | $set_column_values = array(); |
2325 | - foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) { |
|
2325 | + foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) { |
|
2326 | 2326 | $set_column_values = $this->_set_message_template_column_values($template_field); |
2327 | 2327 | |
2328 | 2328 | $where_cols_n_values = array( |
@@ -2335,11 +2335,11 @@ discard block |
||
2335 | 2335 | 'MTP_context' => $set_column_values['MTP_context'], |
2336 | 2336 | 'MTP_content' => $set_column_values['MTP_content'] |
2337 | 2337 | ); |
2338 | - if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) { |
|
2339 | - if ( $updated === false ) { |
|
2338 | + if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) { |
|
2339 | + if ($updated === false) { |
|
2340 | 2340 | EE_Error::add_error( |
2341 | 2341 | sprintf( |
2342 | - __( '%s field was NOT updated for some reason', 'event_espresso' ), |
|
2342 | + __('%s field was NOT updated for some reason', 'event_espresso'), |
|
2343 | 2343 | $template_field |
2344 | 2344 | ), |
2345 | 2345 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2353,46 +2353,46 @@ discard block |
||
2353 | 2353 | |
2354 | 2354 | //we can use the last set_column_values for the MTPG update (because its the same for all of these specific MTPs) |
2355 | 2355 | $mtpg_fields = array( |
2356 | - 'MTP_user_id' => $set_column_values[ 'MTP_user_id' ], |
|
2357 | - 'MTP_messenger' => $set_column_values[ 'MTP_messenger' ], |
|
2358 | - 'MTP_message_type' => $set_column_values[ 'MTP_message_type' ], |
|
2359 | - 'MTP_is_global' => $set_column_values[ 'MTP_is_global' ], |
|
2360 | - 'MTP_is_override' => $set_column_values[ 'MTP_is_override' ], |
|
2361 | - 'MTP_deleted' => $set_column_values[ 'MTP_deleted' ], |
|
2362 | - 'MTP_is_active' => $set_column_values[ 'MTP_is_active' ], |
|
2363 | - 'MTP_name' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] ) |
|
2364 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] |
|
2356 | + 'MTP_user_id' => $set_column_values['MTP_user_id'], |
|
2357 | + 'MTP_messenger' => $set_column_values['MTP_messenger'], |
|
2358 | + 'MTP_message_type' => $set_column_values['MTP_message_type'], |
|
2359 | + 'MTP_is_global' => $set_column_values['MTP_is_global'], |
|
2360 | + 'MTP_is_override' => $set_column_values['MTP_is_override'], |
|
2361 | + 'MTP_deleted' => $set_column_values['MTP_deleted'], |
|
2362 | + 'MTP_is_active' => $set_column_values['MTP_is_active'], |
|
2363 | + 'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) |
|
2364 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] |
|
2365 | 2365 | : '', |
2366 | - 'MTP_description' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] ) |
|
2367 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] |
|
2366 | + 'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) |
|
2367 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] |
|
2368 | 2368 | : '' |
2369 | 2369 | ); |
2370 | 2370 | |
2371 | - $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] ); |
|
2372 | - $updated = $MTPG->update( $mtpg_fields, array($mtpg_where) ); |
|
2371 | + $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']); |
|
2372 | + $updated = $MTPG->update($mtpg_fields, array($mtpg_where)); |
|
2373 | 2373 | |
2374 | - if ( $updated === false ) { |
|
2374 | + if ($updated === false) { |
|
2375 | 2375 | EE_Error::add_error( |
2376 | 2376 | sprintf( |
2377 | - __( 'The Message Template Group (%d) was NOT updated for some reason', 'event_espresso' ), |
|
2378 | - $set_column_values[ 'GRP_ID' ] |
|
2377 | + __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), |
|
2378 | + $set_column_values['GRP_ID'] |
|
2379 | 2379 | ), |
2380 | 2380 | __FILE__, __FUNCTION__, __LINE__ |
2381 | 2381 | ); |
2382 | 2382 | } else { |
2383 | 2383 | //k now we need to ensure the template_pack and template_variation fields are set. |
2384 | - $template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) |
|
2384 | + $template_pack = ! empty($this->_req_data['MTP_template_pack']) |
|
2385 | 2385 | ? $this->_req_data['MTP_template_pack'] |
2386 | 2386 | : 'default'; |
2387 | 2387 | |
2388 | - $template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) |
|
2388 | + $template_variation = ! empty($this->_req_data['MTP_template_variation']) |
|
2389 | 2389 | ? $this->_req_data['MTP_template_variation'] |
2390 | 2390 | : 'default'; |
2391 | 2391 | |
2392 | - $mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] ); |
|
2393 | - if ( $mtpg_obj instanceof EE_Message_Template_Group ) { |
|
2394 | - $mtpg_obj->set_template_pack_name( $template_pack ); |
|
2395 | - $mtpg_obj->set_template_pack_variation( $template_variation ); |
|
2392 | + $mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']); |
|
2393 | + if ($mtpg_obj instanceof EE_Message_Template_Group) { |
|
2394 | + $mtpg_obj->set_template_pack_name($template_pack); |
|
2395 | + $mtpg_obj->set_template_pack_variation($template_variation); |
|
2396 | 2396 | } |
2397 | 2397 | $success = 1; |
2398 | 2398 | } |
@@ -2402,7 +2402,7 @@ discard block |
||
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | //we return things differently if doing ajax |
2405 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2405 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2406 | 2406 | $this->_template_args['success'] = $success; |
2407 | 2407 | $this->_template_args['error'] = ! $success ? true : false; |
2408 | 2408 | $this->_template_args['content'] = ''; |
@@ -2410,9 +2410,9 @@ discard block |
||
2410 | 2410 | 'grpID' => $edit_array['GRP_ID'], |
2411 | 2411 | 'templateName' => $edit_array['template_name'] |
2412 | 2412 | ); |
2413 | - if ( $success ) { |
|
2413 | + if ($success) { |
|
2414 | 2414 | EE_Error::overwrite_success(); |
2415 | - EE_Error::add_success( __('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso') ); |
|
2415 | + EE_Error::add_success(__('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso')); |
|
2416 | 2416 | } |
2417 | 2417 | |
2418 | 2418 | $this->_return_json(); |
@@ -2420,13 +2420,13 @@ discard block |
||
2420 | 2420 | |
2421 | 2421 | |
2422 | 2422 | //was a test send triggered? |
2423 | - if ( isset( $this->_req_data['test_button'] ) ) { |
|
2423 | + if (isset($this->_req_data['test_button'])) { |
|
2424 | 2424 | EE_Error::overwrite_success(); |
2425 | - $this->_do_test_send( $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] ); |
|
2425 | + $this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2426 | 2426 | $override = true; |
2427 | 2427 | } |
2428 | 2428 | |
2429 | - if ( empty( $query_args ) ) { |
|
2429 | + if (empty($query_args)) { |
|
2430 | 2430 | $query_args = array( |
2431 | 2431 | 'id' => $this->_req_data['GRP_ID'], |
2432 | 2432 | 'context' => $this->_req_data['MTP_context'], |
@@ -2434,7 +2434,7 @@ discard block |
||
2434 | 2434 | ); |
2435 | 2435 | } |
2436 | 2436 | |
2437 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override ); |
|
2437 | + $this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override); |
|
2438 | 2438 | } |
2439 | 2439 | |
2440 | 2440 | |
@@ -2448,28 +2448,28 @@ discard block |
||
2448 | 2448 | * @param string $message_type message type being tested |
2449 | 2449 | * |
2450 | 2450 | */ |
2451 | - protected function _do_test_send( $context, $messenger, $message_type ) { |
|
2451 | + protected function _do_test_send($context, $messenger, $message_type) { |
|
2452 | 2452 | //set things up for preview |
2453 | 2453 | $this->_req_data['messenger'] = $messenger; |
2454 | 2454 | $this->_req_data['message_type'] = $message_type; |
2455 | 2455 | $this->_req_data['context'] = $context; |
2456 | - $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : ''; |
|
2457 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
2456 | + $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : ''; |
|
2457 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($messenger); |
|
2458 | 2458 | |
2459 | 2459 | //let's save any existing fields that might be required by the messenger |
2460 | 2460 | if ( |
2461 | - isset( $this->_req_data['test_settings_fld'] ) |
|
2461 | + isset($this->_req_data['test_settings_fld']) |
|
2462 | 2462 | && $active_messenger instanceof EE_messenger |
2463 | 2463 | ) { |
2464 | - $active_messenger->set_existing_test_settings( $this->_req_data['test_settings_fld'] ); |
|
2464 | + $active_messenger->set_existing_test_settings($this->_req_data['test_settings_fld']); |
|
2465 | 2465 | } |
2466 | 2466 | |
2467 | 2467 | $success = $this->_preview_message(true); |
2468 | 2468 | |
2469 | - if ( $success ) { |
|
2470 | - EE_Error::add_success( __('Test message sent', 'event_espresso') ); |
|
2469 | + if ($success) { |
|
2470 | + EE_Error::add_success(__('Test message sent', 'event_espresso')); |
|
2471 | 2471 | } else { |
2472 | - EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
2472 | + EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2473 | 2473 | } |
2474 | 2474 | } |
2475 | 2475 | |
@@ -2495,11 +2495,11 @@ discard block |
||
2495 | 2495 | protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) { |
2496 | 2496 | |
2497 | 2497 | //if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates. |
2498 | - if ( empty( $message_types ) ) { |
|
2498 | + if (empty($message_types)) { |
|
2499 | 2499 | return true; |
2500 | 2500 | } |
2501 | 2501 | |
2502 | - return EEH_MSG_Template::generate_new_templates( $messenger, $message_types, $GRP_ID, $global ); |
|
2502 | + return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global); |
|
2503 | 2503 | } |
2504 | 2504 | |
2505 | 2505 | |
@@ -2515,33 +2515,33 @@ discard block |
||
2515 | 2515 | * |
2516 | 2516 | * @return void |
2517 | 2517 | */ |
2518 | - protected function _trash_or_restore_message_template($trash = true, $all = false ) { |
|
2519 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2518 | + protected function _trash_or_restore_message_template($trash = true, $all = false) { |
|
2519 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2520 | 2520 | $MTP = EEM_Message_Template_Group::instance(); |
2521 | 2521 | |
2522 | 2522 | $success = 1; |
2523 | 2523 | |
2524 | 2524 | //incoming GRP_IDs |
2525 | - if ( $all ) { |
|
2525 | + if ($all) { |
|
2526 | 2526 | //Checkboxes |
2527 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) { |
|
2527 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2528 | 2528 | //if array has more than one element then success message should be plural. |
2529 | 2529 | //todo: what about nonce? |
2530 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2530 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2531 | 2531 | |
2532 | 2532 | //cycle through checkboxes |
2533 | - while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) { |
|
2534 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2535 | - if ( ! $trashed_or_restored ) { |
|
2533 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2534 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2535 | + if ( ! $trashed_or_restored) { |
|
2536 | 2536 | $success = 0; |
2537 | 2537 | } |
2538 | 2538 | } |
2539 | 2539 | } else { |
2540 | 2540 | //grab single GRP_ID and handle |
2541 | - $GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
2542 | - if ( ! empty( $GRP_ID ) ) { |
|
2543 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2544 | - if ( ! $trashed_or_restored ) { |
|
2541 | + $GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
2542 | + if ( ! empty($GRP_ID)) { |
|
2543 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2544 | + if ( ! $trashed_or_restored) { |
|
2545 | 2545 | $success = 0; |
2546 | 2546 | } |
2547 | 2547 | } else { |
@@ -2553,13 +2553,13 @@ discard block |
||
2553 | 2553 | |
2554 | 2554 | $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
2555 | 2555 | |
2556 | - $action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc; |
|
2556 | + $action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc; |
|
2557 | 2557 | |
2558 | 2558 | $item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso'); |
2559 | 2559 | |
2560 | - $item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2560 | + $item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2561 | 2561 | |
2562 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, array() ); |
|
2562 | + $this->_redirect_after_action($success, $item_desc, $action_desc, array()); |
|
2563 | 2563 | |
2564 | 2564 | } |
2565 | 2565 | |
@@ -2575,24 +2575,24 @@ discard block |
||
2575 | 2575 | * @return void |
2576 | 2576 | */ |
2577 | 2577 | protected function _delete_message_template() { |
2578 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2578 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2579 | 2579 | |
2580 | 2580 | //checkboxes |
2581 | - if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) { |
|
2581 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2582 | 2582 | //if array has more than one element then success message should be plural |
2583 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2583 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2584 | 2584 | |
2585 | 2585 | //cycle through bulk action checkboxes |
2586 | - while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) { |
|
2587 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2586 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2587 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2588 | 2588 | } |
2589 | 2589 | } else { |
2590 | 2590 | //grab single grp_id and delete |
2591 | - $GRP_ID = absint($this->_req_data['id'] ); |
|
2592 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2591 | + $GRP_ID = absint($this->_req_data['id']); |
|
2592 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2593 | 2593 | } |
2594 | 2594 | |
2595 | - $this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() ); |
|
2595 | + $this->_redirect_after_action($success, 'Message Templates', 'deleted', array()); |
|
2596 | 2596 | |
2597 | 2597 | } |
2598 | 2598 | |
@@ -2607,20 +2607,20 @@ discard block |
||
2607 | 2607 | * |
2608 | 2608 | * @return bool boolean to indicate the success of the deletes or not. |
2609 | 2609 | */ |
2610 | - private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) { |
|
2610 | + private function _delete_mtp_permanently($GRP_ID, $include_group = true) { |
|
2611 | 2611 | $success = 1; |
2612 | 2612 | $MTPG = EEM_Message_Template_Group::instance(); |
2613 | 2613 | //first let's GET this group |
2614 | - $MTG = $MTPG->get_one_by_ID( $GRP_ID ); |
|
2614 | + $MTG = $MTPG->get_one_by_ID($GRP_ID); |
|
2615 | 2615 | //then delete permanently all the related Message Templates |
2616 | - $deleted = $MTG->delete_related_permanently( 'Message_Template' ); |
|
2616 | + $deleted = $MTG->delete_related_permanently('Message_Template'); |
|
2617 | 2617 | |
2618 | - if ( $deleted === 0 ) |
|
2619 | - {$success = 0;} |
|
2618 | + if ($deleted === 0) |
|
2619 | + {$success = 0; } |
|
2620 | 2620 | |
2621 | 2621 | //now delete permanently this particular group |
2622 | 2622 | |
2623 | - if ( $include_group && ! $MTG->delete_permanently() ) { |
|
2623 | + if ($include_group && ! $MTG->delete_permanently()) { |
|
2624 | 2624 | $success = 0; |
2625 | 2625 | } |
2626 | 2626 | return $success; |
@@ -2638,7 +2638,7 @@ discard block |
||
2638 | 2638 | * @return string |
2639 | 2639 | */ |
2640 | 2640 | protected function _learn_more_about_message_templates_link() { |
2641 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
|
2641 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>'; |
|
2642 | 2642 | } |
2643 | 2643 | |
2644 | 2644 | |
@@ -2656,10 +2656,10 @@ discard block |
||
2656 | 2656 | |
2657 | 2657 | $this->_set_m_mt_settings(); |
2658 | 2658 | |
2659 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2659 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2660 | 2660 | |
2661 | 2661 | //let's setup the messenger tabs |
2662 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger ); |
|
2662 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger); |
|
2663 | 2663 | $this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">'; |
2664 | 2664 | $this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->'; |
2665 | 2665 | |
@@ -2678,7 +2678,7 @@ discard block |
||
2678 | 2678 | */ |
2679 | 2679 | protected function _set_m_mt_settings() { |
2680 | 2680 | //first if this is already set then lets get out no need to regenerate data. |
2681 | - if ( !empty($this->_m_mt_settings) ) { |
|
2681 | + if ( ! empty($this->_m_mt_settings)) { |
|
2682 | 2682 | return; |
2683 | 2683 | } |
2684 | 2684 | |
@@ -2693,10 +2693,10 @@ discard block |
||
2693 | 2693 | |
2694 | 2694 | //assemble the array for the _tab_text_links helper |
2695 | 2695 | |
2696 | - foreach ( $messengers as $messenger ) { |
|
2696 | + foreach ($messengers as $messenger) { |
|
2697 | 2697 | $this->_m_mt_settings['messenger_tabs'][$messenger->name] = array( |
2698 | 2698 | 'label' => ucwords($messenger->label['singular']), |
2699 | - 'class' => $this->_message_resource_manager->is_messenger_active( $messenger->name ) ? 'messenger-active' : '', |
|
2699 | + 'class' => $this->_message_resource_manager->is_messenger_active($messenger->name) ? 'messenger-active' : '', |
|
2700 | 2700 | 'href' => $messenger->name, |
2701 | 2701 | 'title' => __('Modify this Messenger', 'event_espresso'), |
2702 | 2702 | 'slug' => $messenger->name, |
@@ -2706,26 +2706,26 @@ discard block |
||
2706 | 2706 | |
2707 | 2707 | $message_types_for_messenger = $messenger->get_valid_message_types(); |
2708 | 2708 | |
2709 | - foreach ( $message_types as $message_type ) { |
|
2709 | + foreach ($message_types as $message_type) { |
|
2710 | 2710 | //first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox. |
2711 | - if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) { |
|
2711 | + if ( ! in_array($message_type->name, $message_types_for_messenger)) { |
|
2712 | 2712 | continue; |
2713 | 2713 | } |
2714 | 2714 | |
2715 | - $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) ? 'active' : 'inactive'; |
|
2715 | + $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger($messenger->name, $message_type->name) ? 'active' : 'inactive'; |
|
2716 | 2716 | |
2717 | 2717 | $this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array( |
2718 | - 'label' => ucwords( $message_type->label[ 'singular' ] ), |
|
2719 | - 'class' => 'message-type-' . $a_or_i, |
|
2720 | - 'slug_id' => $message_type->name . '-messagetype-' . $messenger->name, |
|
2721 | - 'mt_nonce' => wp_create_nonce( $message_type->name . '_nonce' ), |
|
2722 | - 'href' => 'espresso_' . $message_type->name . '_message_type_settings', |
|
2718 | + 'label' => ucwords($message_type->label['singular']), |
|
2719 | + 'class' => 'message-type-'.$a_or_i, |
|
2720 | + 'slug_id' => $message_type->name.'-messagetype-'.$messenger->name, |
|
2721 | + 'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'), |
|
2722 | + 'href' => 'espresso_'.$message_type->name.'_message_type_settings', |
|
2723 | 2723 | 'title' => $a_or_i == 'active' |
2724 | - ? __( 'Drag this message type to the Inactive window to deactivate', 'event_espresso' ) |
|
2725 | - : __( 'Drag this message type to the messenger to activate', 'event_espresso' ), |
|
2724 | + ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') |
|
2725 | + : __('Drag this message type to the messenger to activate', 'event_espresso'), |
|
2726 | 2726 | 'content' => $a_or_i == 'active' |
2727 | - ? $this->_message_type_settings_content( $message_type, $messenger, true ) |
|
2728 | - : $this->_message_type_settings_content( $message_type, $messenger ), |
|
2727 | + ? $this->_message_type_settings_content($message_type, $messenger, true) |
|
2728 | + : $this->_message_type_settings_content($message_type, $messenger), |
|
2729 | 2729 | 'slug' => $message_type->name, |
2730 | 2730 | 'active' => $a_or_i == 'active' ? true : false, |
2731 | 2731 | 'obj' => $message_type |
@@ -2744,34 +2744,34 @@ discard block |
||
2744 | 2744 | * |
2745 | 2745 | * @return string html output for the content |
2746 | 2746 | */ |
2747 | - protected function _message_type_settings_content( $message_type, $messenger, $active = false ) { |
|
2747 | + protected function _message_type_settings_content($message_type, $messenger, $active = false) { |
|
2748 | 2748 | //get message type fields |
2749 | 2749 | $fields = $message_type->get_admin_settings_fields(); |
2750 | - $settings_template_args['template_form_fields']= ''; |
|
2750 | + $settings_template_args['template_form_fields'] = ''; |
|
2751 | 2751 | |
2752 | - if ( !empty( $fields ) && $active ) { |
|
2752 | + if ( ! empty($fields) && $active) { |
|
2753 | 2753 | |
2754 | - $existing_settings = $message_type->get_existing_admin_settings( $messenger->name ); |
|
2754 | + $existing_settings = $message_type->get_existing_admin_settings($messenger->name); |
|
2755 | 2755 | |
2756 | - foreach( $fields as $fldname => $fldprops ) { |
|
2757 | - $field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname; |
|
2756 | + foreach ($fields as $fldname => $fldprops) { |
|
2757 | + $field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname; |
|
2758 | 2758 | $template_form_field[$field_id] = array( |
2759 | - 'name' => 'message_type_settings[' . $fldname . ']', |
|
2759 | + 'name' => 'message_type_settings['.$fldname.']', |
|
2760 | 2760 | 'label' => $fldprops['label'], |
2761 | 2761 | 'input' => $fldprops['field_type'], |
2762 | 2762 | 'type' => $fldprops['value_type'], |
2763 | 2763 | 'required' => $fldprops['required'], |
2764 | 2764 | 'validation' => $fldprops['validation'], |
2765 | - 'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2766 | - 'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(), |
|
2767 | - 'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2765 | + 'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2766 | + 'options' => isset($fldprops['options']) ? $fldprops['options'] : array(), |
|
2767 | + 'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2768 | 2768 | 'css_class' => 'no-drag', |
2769 | 2769 | 'format' => $fldprops['format'] |
2770 | 2770 | ); |
2771 | 2771 | } |
2772 | 2772 | |
2773 | 2773 | |
2774 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : ''; |
|
2774 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : ''; |
|
2775 | 2775 | } |
2776 | 2776 | |
2777 | 2777 | $settings_template_args['description'] = $message_type->description; |
@@ -2791,13 +2791,13 @@ discard block |
||
2791 | 2791 | ) |
2792 | 2792 | ); |
2793 | 2793 | |
2794 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' ); |
|
2795 | - $settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : ''; |
|
2794 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array'); |
|
2795 | + $settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : ''; |
|
2796 | 2796 | |
2797 | 2797 | |
2798 | 2798 | |
2799 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php'; |
|
2800 | - $content = EEH_Template::display_template( $template, $settings_template_args, true ); |
|
2799 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php'; |
|
2800 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
2801 | 2801 | return $content; |
2802 | 2802 | } |
2803 | 2803 | |
@@ -2814,27 +2814,27 @@ discard block |
||
2814 | 2814 | $m_boxes = $mt_boxes = array(); |
2815 | 2815 | $m_template_args = $mt_template_args = array(); |
2816 | 2816 | |
2817 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2817 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2818 | 2818 | |
2819 | - if ( isset( $this->_m_mt_settings[ 'messenger_tabs' ] ) ) { |
|
2820 | - foreach ( $this->_m_mt_settings[ 'messenger_tabs' ] as $messenger => $tab_array ) { |
|
2821 | - $hide_on_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? '' : 'hidden'; |
|
2822 | - $hide_off_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? 'hidden' : ''; |
|
2819 | + if (isset($this->_m_mt_settings['messenger_tabs'])) { |
|
2820 | + foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) { |
|
2821 | + $hide_on_message = $this->_message_resource_manager->is_messenger_active($messenger) ? '' : 'hidden'; |
|
2822 | + $hide_off_message = $this->_message_resource_manager->is_messenger_active($messenger) ? 'hidden' : ''; |
|
2823 | 2823 | //messenger meta boxes |
2824 | 2824 | $active = $selected_messenger == $messenger ? true : false; |
2825 | - $active_mt_tabs = isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] ) |
|
2826 | - ? $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] |
|
2825 | + $active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) |
|
2826 | + ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] |
|
2827 | 2827 | : ''; |
2828 | - $m_boxes[ $messenger . '_a_box' ] = sprintf( |
|
2829 | - __( '%s Settings', 'event_espresso' ), |
|
2830 | - $tab_array[ 'label' ] |
|
2828 | + $m_boxes[$messenger.'_a_box'] = sprintf( |
|
2829 | + __('%s Settings', 'event_espresso'), |
|
2830 | + $tab_array['label'] |
|
2831 | 2831 | ); |
2832 | - $m_template_args[ $messenger . '_a_box' ] = array( |
|
2833 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2834 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2835 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2832 | + $m_template_args[$messenger.'_a_box'] = array( |
|
2833 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2834 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2835 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2836 | 2836 | : '', |
2837 | - 'content' => $this->_get_messenger_box_content( $tab_array[ 'obj' ] ), |
|
2837 | + 'content' => $this->_get_messenger_box_content($tab_array['obj']), |
|
2838 | 2838 | 'hidden' => $active ? '' : ' hidden', |
2839 | 2839 | 'hide_on_message' => $hide_on_message, |
2840 | 2840 | 'messenger' => $messenger, |
@@ -2843,11 +2843,11 @@ discard block |
||
2843 | 2843 | // message type meta boxes |
2844 | 2844 | // (which is really just the inactive container for each messenger |
2845 | 2845 | // showing inactive message types for that messenger) |
2846 | - $mt_boxes[ $messenger . '_i_box' ] = __( 'Inactive Message Types', 'event_espresso' ); |
|
2847 | - $mt_template_args[ $messenger . '_i_box' ] = array( |
|
2848 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2849 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2850 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2846 | + $mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso'); |
|
2847 | + $mt_template_args[$messenger.'_i_box'] = array( |
|
2848 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2849 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2850 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2851 | 2851 | : '', |
2852 | 2852 | 'hidden' => $active ? '' : ' hidden', |
2853 | 2853 | 'hide_on_message' => $hide_on_message, |
@@ -2860,15 +2860,15 @@ discard block |
||
2860 | 2860 | |
2861 | 2861 | |
2862 | 2862 | //register messenger metaboxes |
2863 | - $m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2864 | - foreach ( $m_boxes as $box => $label ) { |
|
2865 | - $callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] ); |
|
2866 | - $msgr = str_replace( '_a_box', '', $box ); |
|
2863 | + $m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2864 | + foreach ($m_boxes as $box => $label) { |
|
2865 | + $callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]); |
|
2866 | + $msgr = str_replace('_a_box', '', $box); |
|
2867 | 2867 | add_meta_box( |
2868 | - 'espresso_' . $msgr . '_settings', |
|
2868 | + 'espresso_'.$msgr.'_settings', |
|
2869 | 2869 | $label, |
2870 | - function( $post, $metabox ) { |
|
2871 | - echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE ); |
|
2870 | + function($post, $metabox) { |
|
2871 | + echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE); |
|
2872 | 2872 | }, |
2873 | 2873 | $this->_current_screen->id, |
2874 | 2874 | 'normal', |
@@ -2878,17 +2878,17 @@ discard block |
||
2878 | 2878 | } |
2879 | 2879 | |
2880 | 2880 | //register message type metaboxes |
2881 | - $mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php'; |
|
2882 | - foreach ( $mt_boxes as $box => $label ) { |
|
2881 | + $mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php'; |
|
2882 | + foreach ($mt_boxes as $box => $label) { |
|
2883 | 2883 | $callback_args = array( |
2884 | - 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[ $box ] |
|
2884 | + 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] |
|
2885 | 2885 | ); |
2886 | - $mt = str_replace( '_i_box', '', $box ); |
|
2886 | + $mt = str_replace('_i_box', '', $box); |
|
2887 | 2887 | add_meta_box( |
2888 | - 'espresso_' . $mt . '_inactive_mts', |
|
2888 | + 'espresso_'.$mt.'_inactive_mts', |
|
2889 | 2889 | $label, |
2890 | - function( $post, $metabox ) { |
|
2891 | - echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE ); |
|
2890 | + function($post, $metabox) { |
|
2891 | + echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE); |
|
2892 | 2892 | }, |
2893 | 2893 | $this->_current_screen->id, |
2894 | 2894 | 'side', |
@@ -2899,11 +2899,11 @@ discard block |
||
2899 | 2899 | |
2900 | 2900 | //register metabox for global messages settings but only when on the main site. On single site installs this will |
2901 | 2901 | //always result in the metabox showing, on multisite installs the metabox will only show on the main site. |
2902 | - if ( is_main_site() ) { |
|
2902 | + if (is_main_site()) { |
|
2903 | 2903 | add_meta_box( |
2904 | 2904 | 'espresso_global_message_settings', |
2905 | - __( 'Global Message Settings', 'event_espresso' ), |
|
2906 | - array( $this, 'global_messages_settings_metabox_content' ), |
|
2905 | + __('Global Message Settings', 'event_espresso'), |
|
2906 | + array($this, 'global_messages_settings_metabox_content'), |
|
2907 | 2907 | $this->_current_screen->id, |
2908 | 2908 | 'normal', |
2909 | 2909 | 'low', |
@@ -2923,7 +2923,7 @@ discard block |
||
2923 | 2923 | public function global_messages_settings_metabox_content() { |
2924 | 2924 | $form = $this->_generate_global_settings_form(); |
2925 | 2925 | echo $form->form_open( |
2926 | - $this->add_query_args_and_nonce( array( 'action' => 'update_global_settings' ), EE_MSG_ADMIN_URL ), |
|
2926 | + $this->add_query_args_and_nonce(array('action' => 'update_global_settings'), EE_MSG_ADMIN_URL), |
|
2927 | 2927 | 'POST' |
2928 | 2928 | ) |
2929 | 2929 | . $form->get_html() |
@@ -2936,7 +2936,7 @@ discard block |
||
2936 | 2936 | * @return EE_Form_Section_Proper |
2937 | 2937 | */ |
2938 | 2938 | protected function _generate_global_settings_form() { |
2939 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
2939 | + EE_Registry::instance()->load_helper('HTML'); |
|
2940 | 2940 | /** @var EE_Network_Core_Config $network_config */ |
2941 | 2941 | $network_config = EE_Registry::instance()->NET_CFG->core; |
2942 | 2942 | return new EE_Form_Section_Proper( |
@@ -2955,13 +2955,13 @@ discard block |
||
2955 | 2955 | ), |
2956 | 2956 | array( |
2957 | 2957 | 'default' => $network_config->do_messages_on_same_request, |
2958 | - 'html_label_text' => __( 'Generate and send all messages:', 'event_espresso' ), |
|
2959 | - 'html_help_text' => __( 'By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system. This makes things execute faster for people registering for your events. However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso' ), |
|
2958 | + 'html_label_text' => __('Generate and send all messages:', 'event_espresso'), |
|
2959 | + 'html_help_text' => __('By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system. This makes things execute faster for people registering for your events. However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso'), |
|
2960 | 2960 | ) |
2961 | 2961 | ), |
2962 | 2962 | 'update_settings' => new EE_Submit_Input( |
2963 | 2963 | array( |
2964 | - 'default' => __( 'Update', 'event_espresso' ), |
|
2964 | + 'default' => __('Update', 'event_espresso'), |
|
2965 | 2965 | 'html_label_text' => ' ' |
2966 | 2966 | ) |
2967 | 2967 | ) |
@@ -2980,28 +2980,28 @@ discard block |
||
2980 | 2980 | /** @var EE_Network_Core_Config $network_config */ |
2981 | 2981 | $network_config = EE_Registry::instance()->NET_CFG->core; |
2982 | 2982 | $form = $this->_generate_global_settings_form(); |
2983 | - if ( $form->was_submitted() ) { |
|
2983 | + if ($form->was_submitted()) { |
|
2984 | 2984 | $form->receive_form_submission(); |
2985 | - if ( $form->is_valid() ) { |
|
2985 | + if ($form->is_valid()) { |
|
2986 | 2986 | $valid_data = $form->valid_data(); |
2987 | - foreach( $valid_data as $property => $value ) { |
|
2988 | - $setter = 'set_' . $property; |
|
2989 | - if ( method_exists( $network_config, $setter ) ) { |
|
2990 | - $network_config->{$setter}( $value ); |
|
2987 | + foreach ($valid_data as $property => $value) { |
|
2988 | + $setter = 'set_'.$property; |
|
2989 | + if (method_exists($network_config, $setter)) { |
|
2990 | + $network_config->{$setter}($value); |
|
2991 | 2991 | } else if ( |
2992 | - property_exists( $network_config, $property ) |
|
2992 | + property_exists($network_config, $property) |
|
2993 | 2993 | && $network_config->{$property} !== $value |
2994 | 2994 | ) { |
2995 | 2995 | $network_config->{$property} = $value; |
2996 | 2996 | } |
2997 | 2997 | } |
2998 | 2998 | //only update if the form submission was valid! |
2999 | - EE_Registry::instance()->NET_CFG->update_config( true, false ); |
|
2999 | + EE_Registry::instance()->NET_CFG->update_config(true, false); |
|
3000 | 3000 | EE_Error::overwrite_success(); |
3001 | - EE_Error::add_success( __( 'Global message settings were updated', 'event_espresso' ) ); |
|
3001 | + EE_Error::add_success(__('Global message settings were updated', 'event_espresso')); |
|
3002 | 3002 | } |
3003 | 3003 | } |
3004 | - $this->_redirect_after_action( 0, '', '', array( 'action' => 'settings' ), true ); |
|
3004 | + $this->_redirect_after_action(0, '', '', array('action' => 'settings'), true); |
|
3005 | 3005 | } |
3006 | 3006 | |
3007 | 3007 | |
@@ -3012,13 +3012,13 @@ discard block |
||
3012 | 3012 | * |
3013 | 3013 | * @return string html formatted tabs |
3014 | 3014 | */ |
3015 | - protected function _get_mt_tabs( $tab_array ) { |
|
3015 | + protected function _get_mt_tabs($tab_array) { |
|
3016 | 3016 | $tab_array = (array) $tab_array; |
3017 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php'; |
|
3017 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php'; |
|
3018 | 3018 | $tabs = ''; |
3019 | 3019 | |
3020 | - foreach ( $tab_array as $tab ) { |
|
3021 | - $tabs .= EEH_Template::display_template( $template, $tab, true ); |
|
3020 | + foreach ($tab_array as $tab) { |
|
3021 | + $tabs .= EEH_Template::display_template($template, $tab, true); |
|
3022 | 3022 | } |
3023 | 3023 | |
3024 | 3024 | return $tabs; |
@@ -3034,29 +3034,29 @@ discard block |
||
3034 | 3034 | * |
3035 | 3035 | * @return string html formatted content |
3036 | 3036 | */ |
3037 | - protected function _get_messenger_box_content( EE_messenger $messenger ) { |
|
3037 | + protected function _get_messenger_box_content(EE_messenger $messenger) { |
|
3038 | 3038 | |
3039 | 3039 | $fields = $messenger->get_admin_settings_fields(); |
3040 | 3040 | $settings_template_args['template_form_fields'] = ''; |
3041 | 3041 | |
3042 | 3042 | //is $messenger active? |
3043 | - $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
3043 | + $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
3044 | 3044 | |
3045 | 3045 | |
3046 | - if ( ! empty( $fields ) ) { |
|
3046 | + if ( ! empty($fields)) { |
|
3047 | 3047 | |
3048 | 3048 | $existing_settings = $messenger->get_existing_admin_settings(); |
3049 | 3049 | |
3050 | - foreach( $fields as $fldname => $fldprops ) { |
|
3051 | - $field_id = $messenger->name . '-' . $fldname; |
|
3050 | + foreach ($fields as $fldname => $fldprops) { |
|
3051 | + $field_id = $messenger->name.'-'.$fldname; |
|
3052 | 3052 | $template_form_field[$field_id] = array( |
3053 | - 'name' => 'messenger_settings[' . $field_id . ']', |
|
3053 | + 'name' => 'messenger_settings['.$field_id.']', |
|
3054 | 3054 | 'label' => $fldprops['label'], |
3055 | 3055 | 'input' => $fldprops['field_type'], |
3056 | 3056 | 'type' => $fldprops['value_type'], |
3057 | 3057 | 'required' => $fldprops['required'], |
3058 | 3058 | 'validation' => $fldprops['validation'], |
3059 | - 'value' => isset( $existing_settings[$field_id]) |
|
3059 | + 'value' => isset($existing_settings[$field_id]) |
|
3060 | 3060 | ? $existing_settings[$field_id] |
3061 | 3061 | : $fldprops['default'], |
3062 | 3062 | 'css_class' => '', |
@@ -3065,8 +3065,8 @@ discard block |
||
3065 | 3065 | } |
3066 | 3066 | |
3067 | 3067 | |
3068 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) |
|
3069 | - ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) |
|
3068 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) |
|
3069 | + ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') |
|
3070 | 3070 | : ''; |
3071 | 3071 | } |
3072 | 3072 | |
@@ -3083,39 +3083,39 @@ discard block |
||
3083 | 3083 | ); |
3084 | 3084 | |
3085 | 3085 | //make sure any active message types that are existing are included in the hidden fields |
3086 | - if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) { |
|
3087 | - foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) { |
|
3086 | + if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) { |
|
3087 | + foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) { |
|
3088 | 3088 | $settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array( |
3089 | 3089 | 'type' => 'hidden', |
3090 | 3090 | 'value' => $mt |
3091 | 3091 | ); |
3092 | 3092 | } |
3093 | 3093 | } |
3094 | - $settings_template_args[ 'hidden_fields' ] = $this->_generate_admin_form_fields( |
|
3095 | - $settings_template_args[ 'hidden_fields' ], |
|
3094 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( |
|
3095 | + $settings_template_args['hidden_fields'], |
|
3096 | 3096 | 'array' |
3097 | 3097 | ); |
3098 | - $active = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
3098 | + $active = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
3099 | 3099 | |
3100 | 3100 | $settings_template_args['messenger'] = $messenger->name; |
3101 | 3101 | $settings_template_args['description'] = $messenger->description; |
3102 | 3102 | $settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden'; |
3103 | 3103 | |
3104 | 3104 | |
3105 | - $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ) |
|
3105 | + $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name) |
|
3106 | 3106 | ? $settings_template_args['show_hide_edit_form'] |
3107 | 3107 | : ' hidden'; |
3108 | 3108 | |
3109 | - $settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) |
|
3109 | + $settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) |
|
3110 | 3110 | ? ' hidden' |
3111 | 3111 | : $settings_template_args['show_hide_edit_form']; |
3112 | 3112 | |
3113 | 3113 | |
3114 | 3114 | $settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on'; |
3115 | - $settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce'); |
|
3115 | + $settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce'); |
|
3116 | 3116 | $settings_template_args['on_off_status'] = $active ? true : false; |
3117 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php'; |
|
3118 | - $content = EEH_Template::display_template( $template, $settings_template_args, true); |
|
3117 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php'; |
|
3118 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
3119 | 3119 | return $content; |
3120 | 3120 | } |
3121 | 3121 | |
@@ -3129,9 +3129,9 @@ discard block |
||
3129 | 3129 | $success = true; |
3130 | 3130 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
3131 | 3131 | //let's check that we have required data |
3132 | - if ( !isset( $this->_req_data[ 'messenger' ] ) ) { |
|
3132 | + if ( ! isset($this->_req_data['messenger'])) { |
|
3133 | 3133 | EE_Error::add_error( |
3134 | - __( 'Messenger name needed to toggle activation. None given', 'event_espresso' ), |
|
3134 | + __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
|
3135 | 3135 | __FILE__, |
3136 | 3136 | __FUNCTION__, |
3137 | 3137 | __LINE__ |
@@ -3140,14 +3140,14 @@ discard block |
||
3140 | 3140 | } |
3141 | 3141 | |
3142 | 3142 | //do a nonce check here since we're not arriving via a normal route |
3143 | - $nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : ''; |
|
3144 | - $nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce'; |
|
3143 | + $nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : ''; |
|
3144 | + $nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce'; |
|
3145 | 3145 | |
3146 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3146 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3147 | 3147 | |
3148 | 3148 | |
3149 | 3149 | |
3150 | - if ( !isset( $this->_req_data[ 'status' ])) { |
|
3150 | + if ( ! isset($this->_req_data['status'])) { |
|
3151 | 3151 | EE_Error::add_error( |
3152 | 3152 | __( |
3153 | 3153 | 'Messenger status needed to know whether activation or deactivation is happening. No status is given', |
@@ -3163,11 +3163,11 @@ discard block |
||
3163 | 3163 | //do check to verify we have a valid status. |
3164 | 3164 | $status = $this->_req_data['status']; |
3165 | 3165 | |
3166 | - if ( $status != 'off' && $status != 'on' ) { |
|
3166 | + if ($status != 'off' && $status != 'on') { |
|
3167 | 3167 | EE_Error::add_error( |
3168 | 3168 | sprintf( |
3169 | - __( 'The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso' ), |
|
3170 | - $this->_req_data[ 'status' ] |
|
3169 | + __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), |
|
3170 | + $this->_req_data['status'] |
|
3171 | 3171 | ), |
3172 | 3172 | __FILE__, |
3173 | 3173 | __FUNCTION__, |
@@ -3176,11 +3176,11 @@ discard block |
||
3176 | 3176 | $success = false; |
3177 | 3177 | } |
3178 | 3178 | |
3179 | - if ( $success ) { |
|
3179 | + if ($success) { |
|
3180 | 3180 | //made it here? Stop dawdling then!! |
3181 | 3181 | $success = $status == 'off' |
3182 | - ? $this->_deactivate_messenger( $this->_req_data['messenger'] ) |
|
3183 | - : $this->_activate_messenger( $this->_req_data['messenger'] ); |
|
3182 | + ? $this->_deactivate_messenger($this->_req_data['messenger']) |
|
3183 | + : $this->_activate_messenger($this->_req_data['messenger']); |
|
3184 | 3184 | } |
3185 | 3185 | |
3186 | 3186 | $this->_template_args['success'] = $success; |
@@ -3203,7 +3203,7 @@ discard block |
||
3203 | 3203 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
3204 | 3204 | |
3205 | 3205 | //let's make sure we have the necessary data |
3206 | - if ( ! isset( $this->_req_data[ 'message_type' ] ) ) { |
|
3206 | + if ( ! isset($this->_req_data['message_type'])) { |
|
3207 | 3207 | EE_Error::add_error( |
3208 | 3208 | __('Message Type name needed to toggle activation. None given', 'event_espresso'), |
3209 | 3209 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3211,7 +3211,7 @@ discard block |
||
3211 | 3211 | $success = false; |
3212 | 3212 | } |
3213 | 3213 | |
3214 | - if ( ! isset( $this->_req_data[ 'messenger' ] ) ) { |
|
3214 | + if ( ! isset($this->_req_data['messenger'])) { |
|
3215 | 3215 | EE_Error::add_error( |
3216 | 3216 | __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
3217 | 3217 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3219,7 +3219,7 @@ discard block |
||
3219 | 3219 | $success = false; |
3220 | 3220 | } |
3221 | 3221 | |
3222 | - if ( ! isset( $this->_req_data[ 'status' ])) { |
|
3222 | + if ( ! isset($this->_req_data['status'])) { |
|
3223 | 3223 | EE_Error::add_error( |
3224 | 3224 | __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), |
3225 | 3225 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3231,7 +3231,7 @@ discard block |
||
3231 | 3231 | //do check to verify we have a valid status. |
3232 | 3232 | $status = $this->_req_data['status']; |
3233 | 3233 | |
3234 | - if ( $status != 'activate' && $status != 'deactivate' ) { |
|
3234 | + if ($status != 'activate' && $status != 'deactivate') { |
|
3235 | 3235 | EE_Error::add_error( |
3236 | 3236 | sprintf( |
3237 | 3237 | __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), |
@@ -3244,16 +3244,16 @@ discard block |
||
3244 | 3244 | |
3245 | 3245 | |
3246 | 3246 | //do a nonce check here since we're not arriving via a normal route |
3247 | - $nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : ''; |
|
3248 | - $nonce_ref = $this->_req_data['message_type'] . '_nonce'; |
|
3247 | + $nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : ''; |
|
3248 | + $nonce_ref = $this->_req_data['message_type'].'_nonce'; |
|
3249 | 3249 | |
3250 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3250 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3251 | 3251 | |
3252 | - if ( $success ) { |
|
3252 | + if ($success) { |
|
3253 | 3253 | //made it here? um, what are you waiting for then? |
3254 | 3254 | $success = $status == 'deactivate' |
3255 | - ? $this->_deactivate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ) |
|
3256 | - : $this->_activate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ); |
|
3255 | + ? $this->_deactivate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']) |
|
3256 | + : $this->_activate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']); |
|
3257 | 3257 | } |
3258 | 3258 | |
3259 | 3259 | $this->_template_args['success'] = $success; |
@@ -3267,30 +3267,30 @@ discard block |
||
3267 | 3267 | * @param string $messenger_name The name of the messenger being activated |
3268 | 3268 | * @return bool |
3269 | 3269 | */ |
3270 | - protected function _activate_messenger( $messenger_name ) { |
|
3270 | + protected function _activate_messenger($messenger_name) { |
|
3271 | 3271 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3272 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3272 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3273 | 3273 | $message_types_to_activate = $active_messenger instanceof EE_Messenger ? $active_messenger->get_default_message_types() : array(); |
3274 | 3274 | |
3275 | 3275 | //ensure is active |
3276 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_types_to_activate ); |
|
3276 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_types_to_activate); |
|
3277 | 3277 | |
3278 | 3278 | //set response_data for reload |
3279 | - foreach( $message_types_to_activate as $message_type_name ) { |
|
3279 | + foreach ($message_types_to_activate as $message_type_name) { |
|
3280 | 3280 | /** @var EE_message_type $message_type */ |
3281 | - $message_type = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3282 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
|
3281 | + $message_type = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3282 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name) |
|
3283 | 3283 | && $message_type instanceof EE_message_type |
3284 | 3284 | ) { |
3285 | 3285 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3286 | - if ( $message_type->get_admin_settings_fields() ) { |
|
3286 | + if ($message_type->get_admin_settings_fields()) { |
|
3287 | 3287 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3288 | 3288 | } |
3289 | 3289 | } |
3290 | 3290 | } |
3291 | 3291 | |
3292 | 3292 | //add success message for activating messenger |
3293 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger ); |
|
3293 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger); |
|
3294 | 3294 | |
3295 | 3295 | } |
3296 | 3296 | |
@@ -3301,11 +3301,11 @@ discard block |
||
3301 | 3301 | * @param string $messenger_name The name of the messenger being activated |
3302 | 3302 | * @return bool |
3303 | 3303 | */ |
3304 | - protected function _deactivate_messenger( $messenger_name ) { |
|
3304 | + protected function _deactivate_messenger($messenger_name) { |
|
3305 | 3305 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3306 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3307 | - $this->_message_resource_manager->deactivate_messenger( $messenger_name ); |
|
3308 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger ); |
|
3306 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3307 | + $this->_message_resource_manager->deactivate_messenger($messenger_name); |
|
3308 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger); |
|
3309 | 3309 | } |
3310 | 3310 | |
3311 | 3311 | |
@@ -3316,23 +3316,23 @@ discard block |
||
3316 | 3316 | * @param string $message_type_name The name of the message type being activated for the messenger |
3317 | 3317 | * @return bool |
3318 | 3318 | */ |
3319 | - protected function _activate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3319 | + protected function _activate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3320 | 3320 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3321 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3321 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3322 | 3322 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3323 | - $message_type_to_activate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3323 | + $message_type_to_activate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3324 | 3324 | |
3325 | 3325 | //ensure is active |
3326 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_type_name ); |
|
3326 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_type_name); |
|
3327 | 3327 | |
3328 | 3328 | //set response for load |
3329 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
3329 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
3330 | 3330 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3331 | - if ( $message_type_to_activate->get_admin_settings_fields() ) { |
|
3331 | + if ($message_type_to_activate->get_admin_settings_fields()) { |
|
3332 | 3332 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3333 | 3333 | } |
3334 | 3334 | } |
3335 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger, $message_type_to_activate ); |
|
3335 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger, $message_type_to_activate); |
|
3336 | 3336 | } |
3337 | 3337 | |
3338 | 3338 | |
@@ -3344,13 +3344,13 @@ discard block |
||
3344 | 3344 | * @param string $message_type_name The name of the message type being deactivated for the messenger |
3345 | 3345 | * @return bool |
3346 | 3346 | */ |
3347 | - protected function _deactivate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3347 | + protected function _deactivate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3348 | 3348 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3349 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3349 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3350 | 3350 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3351 | - $message_type_to_deactivate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3352 | - $this->_message_resource_manager->deactivate_message_type_for_messenger( $message_type_name, $messenger_name ); |
|
3353 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger, $message_type_to_deactivate ); |
|
3351 | + $message_type_to_deactivate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3352 | + $this->_message_resource_manager->deactivate_message_type_for_messenger($message_type_name, $messenger_name); |
|
3353 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger, $message_type_to_deactivate); |
|
3354 | 3354 | } |
3355 | 3355 | |
3356 | 3356 | |
@@ -3381,9 +3381,9 @@ discard block |
||
3381 | 3381 | EE_Message_Type $message_type = null |
3382 | 3382 | ) { |
3383 | 3383 | //if $messenger isn't a valid messenger object then get out. |
3384 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3384 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3385 | 3385 | EE_Error::add_error( |
3386 | - __( 'The messenger being activated is not a valid messenger', 'event_espresso' ), |
|
3386 | + __('The messenger being activated is not a valid messenger', 'event_espresso'), |
|
3387 | 3387 | __FILE__, |
3388 | 3388 | __FUNCTION__, |
3389 | 3389 | __LINE__ |
@@ -3391,32 +3391,32 @@ discard block |
||
3391 | 3391 | return false; |
3392 | 3392 | } |
3393 | 3393 | //activated |
3394 | - if ( $this->_template_args['data']['active_mts'] ) { |
|
3394 | + if ($this->_template_args['data']['active_mts']) { |
|
3395 | 3395 | EE_Error::overwrite_success(); |
3396 | 3396 | //activated a message type with the messenger |
3397 | - if ( $message_type instanceof EE_message_type ) { |
|
3397 | + if ($message_type instanceof EE_message_type) { |
|
3398 | 3398 | EE_Error::add_success( |
3399 | 3399 | sprintf( |
3400 | 3400 | __('%s message type has been successfully activated with the %s messenger', 'event_espresso'), |
3401 | - ucwords( $message_type->label['singular'] ), |
|
3402 | - ucwords( $messenger->label['singular'] ) |
|
3401 | + ucwords($message_type->label['singular']), |
|
3402 | + ucwords($messenger->label['singular']) |
|
3403 | 3403 | ) |
3404 | 3404 | ); |
3405 | 3405 | |
3406 | 3406 | //if message type was invoice then let's make sure we activate the invoice payment method. |
3407 | - if ( $message_type->name == 'invoice' ) { |
|
3408 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3409 | - $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
3410 | - if ( $pm instanceof EE_Payment_Method ) { |
|
3411 | - EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) ); |
|
3407 | + if ($message_type->name == 'invoice') { |
|
3408 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3409 | + $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
3410 | + if ($pm instanceof EE_Payment_Method) { |
|
3411 | + EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso')); |
|
3412 | 3412 | } |
3413 | 3413 | } |
3414 | 3414 | //just toggles the entire messenger |
3415 | 3415 | } else { |
3416 | 3416 | EE_Error::add_success( |
3417 | 3417 | sprintf( |
3418 | - __( '%s messenger has been successfully activated', 'event_espresso' ), |
|
3419 | - ucwords( $messenger->label[ 'singular' ] ) |
|
3418 | + __('%s messenger has been successfully activated', 'event_espresso'), |
|
3419 | + ucwords($messenger->label['singular']) |
|
3420 | 3420 | ) |
3421 | 3421 | ); |
3422 | 3422 | } |
@@ -3426,12 +3426,12 @@ discard block |
||
3426 | 3426 | //message types after the activation process. However its possible some messengers don't HAVE any default_message_types |
3427 | 3427 | //in which case we just give a success message for the messenger being successfully activated. |
3428 | 3428 | } else { |
3429 | - if ( ! $messenger->get_default_message_types() ) { |
|
3429 | + if ( ! $messenger->get_default_message_types()) { |
|
3430 | 3430 | //messenger doesn't have any default message types so still a success. |
3431 | 3431 | EE_Error::add_success( |
3432 | 3432 | sprintf( |
3433 | - __('%s messenger was successfully activated.', 'event_espresso' ), |
|
3434 | - ucwords( $messenger->label['singular'] ) |
|
3433 | + __('%s messenger was successfully activated.', 'event_espresso'), |
|
3434 | + ucwords($messenger->label['singular']) |
|
3435 | 3435 | ) |
3436 | 3436 | ); |
3437 | 3437 | return true; |
@@ -3439,13 +3439,13 @@ discard block |
||
3439 | 3439 | EE_Error::add_error( |
3440 | 3440 | $message_type instanceof EE_message_type |
3441 | 3441 | ? sprintf( |
3442 | - __( '%s message type was not successfully activated with the %s messenger', 'event_espresso' ), |
|
3443 | - ucwords( $message_type->label['singular'] ), |
|
3444 | - ucwords( $messenger->label['singular'] ) |
|
3442 | + __('%s message type was not successfully activated with the %s messenger', 'event_espresso'), |
|
3443 | + ucwords($message_type->label['singular']), |
|
3444 | + ucwords($messenger->label['singular']) |
|
3445 | 3445 | ) |
3446 | 3446 | : sprintf( |
3447 | - __( '%s messenger was not successfully activated', 'event_espresso' ), |
|
3448 | - ucwords( $messenger->label['singular'] ) |
|
3447 | + __('%s messenger was not successfully activated', 'event_espresso'), |
|
3448 | + ucwords($messenger->label['singular']) |
|
3449 | 3449 | ), |
3450 | 3450 | __FILE__, |
3451 | 3451 | __FUNCTION__, |
@@ -3473,9 +3473,9 @@ discard block |
||
3473 | 3473 | EE_Error::overwrite_success(); |
3474 | 3474 | |
3475 | 3475 | //if $messenger isn't a valid messenger object then get out. |
3476 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3476 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3477 | 3477 | EE_Error::add_error( |
3478 | - __( 'The messenger being deactivated is not a valid messenger', 'event_espresso' ), |
|
3478 | + __('The messenger being deactivated is not a valid messenger', 'event_espresso'), |
|
3479 | 3479 | __FILE__, |
3480 | 3480 | __FUNCTION__, |
3481 | 3481 | __LINE__ |
@@ -3483,13 +3483,13 @@ discard block |
||
3483 | 3483 | return false; |
3484 | 3484 | } |
3485 | 3485 | |
3486 | - if ( $message_type instanceof EE_message_type ) { |
|
3486 | + if ($message_type instanceof EE_message_type) { |
|
3487 | 3487 | $message_type_name = $message_type->name; |
3488 | 3488 | EE_Error::add_success( |
3489 | 3489 | sprintf( |
3490 | 3490 | __('%s message type has been successfully deactivated for the %s messenger.', 'event_espresso'), |
3491 | - ucwords( $message_type->label['singular'] ), |
|
3492 | - ucwords ( $messenger->label['singular'] ) |
|
3491 | + ucwords($message_type->label['singular']), |
|
3492 | + ucwords($messenger->label['singular']) |
|
3493 | 3493 | ) |
3494 | 3494 | ); |
3495 | 3495 | } else { |
@@ -3497,20 +3497,20 @@ discard block |
||
3497 | 3497 | EE_Error::add_success( |
3498 | 3498 | sprintf( |
3499 | 3499 | __('%s messenger has been successfully deactivated.', 'event_espresso'), |
3500 | - ucwords( $messenger->label['singular'] ) |
|
3500 | + ucwords($messenger->label['singular']) |
|
3501 | 3501 | ) |
3502 | 3502 | ); |
3503 | 3503 | } |
3504 | 3504 | |
3505 | 3505 | //if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method. |
3506 | - if ( $messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3507 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3508 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' ); |
|
3509 | - if ( $count_updated > 0 ) { |
|
3506 | + if ($messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3507 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3508 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice'); |
|
3509 | + if ($count_updated > 0) { |
|
3510 | 3510 | $msg = $message_type_name == 'invoice' |
3511 | - ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) |
|
3512 | - : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ); |
|
3513 | - EE_Error::add_attention( $msg ); |
|
3511 | + ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') |
|
3512 | + : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso'); |
|
3513 | + EE_Error::add_attention($msg); |
|
3514 | 3514 | } |
3515 | 3515 | } |
3516 | 3516 | return true; |
@@ -3521,17 +3521,17 @@ discard block |
||
3521 | 3521 | * handles updating a message type form on messenger activation IF the message type has settings fields. (via ajax) |
3522 | 3522 | */ |
3523 | 3523 | public function update_mt_form() { |
3524 | - if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) { |
|
3525 | - EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3524 | + if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) { |
|
3525 | + EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__); |
|
3526 | 3526 | $this->_return_json(); |
3527 | 3527 | } |
3528 | 3528 | |
3529 | 3529 | $message_types = $this->get_installed_message_types(); |
3530 | 3530 | |
3531 | - $message_type = $message_types[ $this->_req_data['message_type'] ]; |
|
3532 | - $messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
3531 | + $message_type = $message_types[$this->_req_data['message_type']]; |
|
3532 | + $messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
3533 | 3533 | |
3534 | - $content = $this->_message_type_settings_content ( $message_type, $messenger, true ); |
|
3534 | + $content = $this->_message_type_settings_content($message_type, $messenger, true); |
|
3535 | 3535 | $this->_template_args['success'] = true; |
3536 | 3536 | $this->_template_args['content'] = $content; |
3537 | 3537 | $this->_return_json(); |
@@ -3545,45 +3545,45 @@ discard block |
||
3545 | 3545 | * |
3546 | 3546 | */ |
3547 | 3547 | public function save_settings() { |
3548 | - if ( !isset( $this->_req_data['type'] ) ) { |
|
3549 | - EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3548 | + if ( ! isset($this->_req_data['type'])) { |
|
3549 | + EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3550 | 3550 | $this->_template_args['error'] = true; |
3551 | 3551 | $this->_return_json(); |
3552 | 3552 | } |
3553 | 3553 | |
3554 | 3554 | |
3555 | - if ( $this->_req_data['type'] == 'messenger' ) { |
|
3555 | + if ($this->_req_data['type'] == 'messenger') { |
|
3556 | 3556 | $settings = $this->_req_data['messenger_settings']; //this should be an array. |
3557 | 3557 | $messenger = $settings['messenger']; |
3558 | 3558 | //let's setup the settings data |
3559 | - foreach ( $settings as $key => $value ) { |
|
3560 | - switch ( $key ) { |
|
3559 | + foreach ($settings as $key => $value) { |
|
3560 | + switch ($key) { |
|
3561 | 3561 | case 'messenger' : |
3562 | - unset( $settings['messenger'] ); |
|
3562 | + unset($settings['messenger']); |
|
3563 | 3563 | break; |
3564 | 3564 | case 'message_types' : |
3565 | - unset( $settings['message_types'] ); |
|
3565 | + unset($settings['message_types']); |
|
3566 | 3566 | break; |
3567 | 3567 | default : |
3568 | 3568 | $settings[$key] = $value; |
3569 | 3569 | break; |
3570 | 3570 | } |
3571 | 3571 | } |
3572 | - $this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings ); |
|
3572 | + $this->_message_resource_manager->add_settings_for_messenger($messenger, $settings); |
|
3573 | 3573 | } |
3574 | 3574 | |
3575 | - else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3575 | + else if ($this->_req_data['type'] == 'message_type') { |
|
3576 | 3576 | $settings = $this->_req_data['message_type_settings']; |
3577 | 3577 | $messenger = $settings['messenger']; |
3578 | 3578 | $message_type = $settings['message_type']; |
3579 | 3579 | |
3580 | - foreach ( $settings as $key => $value ) { |
|
3581 | - switch ( $key ) { |
|
3580 | + foreach ($settings as $key => $value) { |
|
3581 | + switch ($key) { |
|
3582 | 3582 | case 'messenger' : |
3583 | - unset( $settings['messenger'] ); |
|
3583 | + unset($settings['messenger']); |
|
3584 | 3584 | break; |
3585 | 3585 | case 'message_type' : |
3586 | - unset( $settings['message_type'] ); |
|
3586 | + unset($settings['message_type']); |
|
3587 | 3587 | break; |
3588 | 3588 | default : |
3589 | 3589 | $settings[$key] = $value; |
@@ -3591,16 +3591,16 @@ discard block |
||
3591 | 3591 | } |
3592 | 3592 | } |
3593 | 3593 | |
3594 | - $this->_message_resource_manager->add_settings_for_message_type( $messenger, $message_type, $settings ); |
|
3594 | + $this->_message_resource_manager->add_settings_for_message_type($messenger, $message_type, $settings); |
|
3595 | 3595 | } |
3596 | 3596 | |
3597 | 3597 | //okay we should have the data all setup. Now we just update! |
3598 | 3598 | $success = $this->_message_resource_manager->update_active_messengers_option(); |
3599 | 3599 | |
3600 | - if ( $success ) { |
|
3601 | - EE_Error::add_success( __('Settings updated', 'event_espresso') ); |
|
3600 | + if ($success) { |
|
3601 | + EE_Error::add_success(__('Settings updated', 'event_espresso')); |
|
3602 | 3602 | } else { |
3603 | - EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3603 | + EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3604 | 3604 | } |
3605 | 3605 | |
3606 | 3606 | $this->_template_args['success'] = $success; |
@@ -3622,8 +3622,8 @@ discard block |
||
3622 | 3622 | */ |
3623 | 3623 | protected function _generate_now() { |
3624 | 3624 | $msg_ids = $this->_get_msg_ids_from_request(); |
3625 | - EED_Messages::generate_now( $msg_ids ); |
|
3626 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3625 | + EED_Messages::generate_now($msg_ids); |
|
3626 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3627 | 3627 | } |
3628 | 3628 | |
3629 | 3629 | |
@@ -3638,7 +3638,7 @@ discard block |
||
3638 | 3638 | protected function _generate_and_send_now() { |
3639 | 3639 | $this->_generate_now(); |
3640 | 3640 | $this->_send_now(); |
3641 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3641 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3642 | 3642 | } |
3643 | 3643 | |
3644 | 3644 | |
@@ -3652,8 +3652,8 @@ discard block |
||
3652 | 3652 | */ |
3653 | 3653 | protected function _queue_for_resending() { |
3654 | 3654 | $msg_ids = $this->_get_msg_ids_from_request(); |
3655 | - EED_Messages::queue_for_resending( $msg_ids ); |
|
3656 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3655 | + EED_Messages::queue_for_resending($msg_ids); |
|
3656 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3657 | 3657 | } |
3658 | 3658 | |
3659 | 3659 | |
@@ -3666,8 +3666,8 @@ discard block |
||
3666 | 3666 | */ |
3667 | 3667 | protected function _send_now() { |
3668 | 3668 | $msg_ids = $this->_get_msg_ids_from_request(); |
3669 | - EED_Messages::send_now( $msg_ids ); |
|
3670 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3669 | + EED_Messages::send_now($msg_ids); |
|
3670 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3671 | 3671 | } |
3672 | 3672 | |
3673 | 3673 | |
@@ -3681,23 +3681,23 @@ discard block |
||
3681 | 3681 | protected function _delete_ee_messages() { |
3682 | 3682 | $msg_ids = $this->_get_msg_ids_from_request(); |
3683 | 3683 | $deleted_count = 0; |
3684 | - foreach ( $msg_ids as $msg_id ) { |
|
3685 | - if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) { |
|
3684 | + foreach ($msg_ids as $msg_id) { |
|
3685 | + if (EEM_Message::instance()->delete_by_ID($msg_id)) { |
|
3686 | 3686 | $deleted_count++; |
3687 | 3687 | } |
3688 | 3688 | } |
3689 | - if ( $deleted_count ) { |
|
3689 | + if ($deleted_count) { |
|
3690 | 3690 | $this->_redirect_after_action( |
3691 | 3691 | true, |
3692 | - _n( 'message', 'messages', $deleted_count, 'event_espresso' ), |
|
3692 | + _n('message', 'messages', $deleted_count, 'event_espresso'), |
|
3693 | 3693 | __('deleted', 'event_espresso') |
3694 | 3694 | ); |
3695 | 3695 | } else { |
3696 | 3696 | EE_Error::add_error( |
3697 | - _n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ), |
|
3697 | + _n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'), |
|
3698 | 3698 | __FILE__, __FUNCTION__, __LINE__ |
3699 | 3699 | ); |
3700 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3700 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3701 | 3701 | } |
3702 | 3702 | } |
3703 | 3703 | |
@@ -3710,10 +3710,10 @@ discard block |
||
3710 | 3710 | * @return array |
3711 | 3711 | */ |
3712 | 3712 | protected function _get_msg_ids_from_request() { |
3713 | - if ( ! isset( $this->_req_data['MSG_ID'] ) ) { |
|
3713 | + if ( ! isset($this->_req_data['MSG_ID'])) { |
|
3714 | 3714 | return array(); |
3715 | 3715 | } |
3716 | - return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] ); |
|
3716 | + return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']); |
|
3717 | 3717 | } |
3718 | 3718 | |
3719 | 3719 |