@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class Registration_List_Table_Tips extends EE_Qtip_Config |
17 | 17 | { |
18 | - protected function _set_tips_array() |
|
19 | - { |
|
20 | - $this->_qtipsa = array( |
|
21 | - 0 => array( |
|
22 | - 'content_id' => 'registration-trash-lock', |
|
23 | - 'target' => '.ee-lock-icon', |
|
24 | - 'content' => $this->_registration_trash_message(), |
|
25 | - ), |
|
26 | - /** removing status strips for now because they are triggered anywhere on the row. */ |
|
27 | - /**1 => array( |
|
18 | + protected function _set_tips_array() |
|
19 | + { |
|
20 | + $this->_qtipsa = array( |
|
21 | + 0 => array( |
|
22 | + 'content_id' => 'registration-trash-lock', |
|
23 | + 'target' => '.ee-lock-icon', |
|
24 | + 'content' => $this->_registration_trash_message(), |
|
25 | + ), |
|
26 | + /** removing status strips for now because they are triggered anywhere on the row. */ |
|
27 | + /**1 => array( |
|
28 | 28 | * 'content_id' => 'registration-status-' . RegStatus::APPROVED, |
29 | 29 | * 'target' => '.reg-status-' . RegStatus::APPROVED, |
30 | 30 | * 'content' => $this->_registration_status_legend(RegStatus::APPROVED), |
@@ -74,37 +74,37 @@ discard block |
||
74 | 74 | * ) |
75 | 75 | * ) |
76 | 76 | * )/**/ |
77 | - ); |
|
78 | - } |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - private function _registration_trash_message() |
|
82 | - { |
|
83 | - return '<p>' |
|
84 | - . esc_html__( |
|
85 | - 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
86 | - 'event_espresso' |
|
87 | - ) . '</p>'; |
|
88 | - } |
|
81 | + private function _registration_trash_message() |
|
82 | + { |
|
83 | + return '<p>' |
|
84 | + . esc_html__( |
|
85 | + 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
86 | + 'event_espresso' |
|
87 | + ) . '</p>'; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * output the relevant ee-status-legend with the designated status highlighted. |
|
93 | - * |
|
94 | - * @param EEM_Registration constant $status What status is set (by class) |
|
95 | - * @return string The status legend with the related status highlighted |
|
96 | - */ |
|
97 | - private function _registration_status_legend($status) |
|
98 | - { |
|
91 | + /** |
|
92 | + * output the relevant ee-status-legend with the designated status highlighted. |
|
93 | + * |
|
94 | + * @param EEM_Registration constant $status What status is set (by class) |
|
95 | + * @return string The status legend with the related status highlighted |
|
96 | + */ |
|
97 | + private function _registration_status_legend($status) |
|
98 | + { |
|
99 | 99 | |
100 | - $status_array = array( |
|
101 | - 'approved_status' => RegStatus::APPROVED, |
|
102 | - 'pending_status' => RegStatus::PENDING_PAYMENT, |
|
103 | - 'not_approved' => RegStatus::AWAITING_REVIEW, |
|
104 | - 'declined_status' => RegStatus::DECLINED, |
|
105 | - 'cancelled_status' => RegStatus::CANCELLED, |
|
106 | - ); |
|
100 | + $status_array = array( |
|
101 | + 'approved_status' => RegStatus::APPROVED, |
|
102 | + 'pending_status' => RegStatus::PENDING_PAYMENT, |
|
103 | + 'not_approved' => RegStatus::AWAITING_REVIEW, |
|
104 | + 'declined_status' => RegStatus::DECLINED, |
|
105 | + 'cancelled_status' => RegStatus::CANCELLED, |
|
106 | + ); |
|
107 | 107 | |
108 | - return EEH_Template::status_legend($status_array, $status); |
|
109 | - } |
|
108 | + return EEH_Template::status_legend($status_array, $status); |
|
109 | + } |
|
110 | 110 | } |
@@ -19,49 +19,49 @@ |
||
19 | 19 | <strong><?php esc_html_e('Filter by Status', 'event_espresso'); ?></strong> |
20 | 20 | <br /> |
21 | 21 | <?php esc_html_e( |
22 | - 'The following statuses are available: Approved, Cancelled, Declined, Not Approved / Awaiting Review, Pending Payment.', |
|
23 | - 'event_espresso' |
|
24 | - ); ?> |
|
22 | + 'The following statuses are available: Approved, Cancelled, Declined, Not Approved / Awaiting Review, Pending Payment.', |
|
23 | + 'event_espresso' |
|
24 | + ); ?> |
|
25 | 25 | <ul> |
26 | 26 | <li style="list-style-type: none;"> |
27 | 27 | <strong><?php esc_html_e('Approved', 'event_espresso'); ?></strong> |
28 | 28 | <br /> |
29 | 29 | <?php esc_html_e( |
30 | - 'An approved registration allows payments and may have a transaction status of complete or incomplete. The registration is marked as active and a space is reserved for the registrant.', |
|
31 | - 'event_espresso' |
|
32 | - ); ?> |
|
30 | + 'An approved registration allows payments and may have a transaction status of complete or incomplete. The registration is marked as active and a space is reserved for the registrant.', |
|
31 | + 'event_espresso' |
|
32 | + ); ?> |
|
33 | 33 | </li> |
34 | 34 | <li style="list-style-type: none;"> |
35 | 35 | <strong><?php esc_html_e('Cancelled', 'event_espresso'); ?></strong> |
36 | 36 | <br /> |
37 | 37 | <?php esc_html_e( |
38 | - 'A cancelled registration is performed by the registrant. Payments are not allowed, the registration is inactive, and no space is reserved.', |
|
39 | - 'event_espresso' |
|
40 | - ); ?> |
|
38 | + 'A cancelled registration is performed by the registrant. Payments are not allowed, the registration is inactive, and no space is reserved.', |
|
39 | + 'event_espresso' |
|
40 | + ); ?> |
|
41 | 41 | </li> |
42 | 42 | <li style="list-style-type: none;"> |
43 | 43 | <strong><?php esc_html_e('Declined', 'event_espresso'); ?></strong> |
44 | 44 | <br /> |
45 | 45 | <?php esc_html_e( |
46 | - 'A declined registration is performed by the event admin. Payments are not allowed, the registration is inactive, and not space is reserved.', |
|
47 | - 'event_espresso' |
|
48 | - ); ?> |
|
46 | + 'A declined registration is performed by the event admin. Payments are not allowed, the registration is inactive, and not space is reserved.', |
|
47 | + 'event_espresso' |
|
48 | + ); ?> |
|
49 | 49 | </li> |
50 | 50 | <li style="list-style-type: none;"> |
51 | 51 | <strong><?php esc_html_e('Awaiting Review', 'event_espresso'); ?></strong> |
52 | 52 | <br /> |
53 | 53 | <?php esc_html_e( |
54 | - 'Registration is awaiting review from the event admin. Payments are not allowed, the registration is active, and no space is reserved.', |
|
55 | - 'event_espresso' |
|
56 | - ); ?> |
|
54 | + 'Registration is awaiting review from the event admin. Payments are not allowed, the registration is active, and no space is reserved.', |
|
55 | + 'event_espresso' |
|
56 | + ); ?> |
|
57 | 57 | </li> |
58 | 58 | <li style="list-style-type: none;"> |
59 | 59 | <strong><?php esc_html_e('Pending Payment', 'event_espresso'); ?></strong> |
60 | 60 | <br /> |
61 | 61 | <?php esc_html_e( |
62 | - 'A pending registration allows payments. The status will be automatically toggled to approved if the payment is made in full by registrant.', |
|
63 | - 'event_espresso' |
|
64 | - ); ?> |
|
62 | + 'A pending registration allows payments. The status will be automatically toggled to approved if the payment is made in full by registrant.', |
|
63 | + 'event_espresso' |
|
64 | + ); ?> |
|
65 | 65 | </li> |
66 | 66 | </ul> |
67 | 67 | </ul> |
@@ -6,64 +6,64 @@ |
||
6 | 6 | </p> |
7 | 7 | <p> |
8 | 8 | <?php esc_html_e( |
9 | - 'The number for the registration is shown along with the date of the registration. Next the status of the registration is shown. A registration may have one of the following statuses: Approved, Pending Payment, Not Approved / Awaiting Review, Declined, or Cancelled.', |
|
10 | - 'event_espresso' |
|
11 | - ); ?> |
|
9 | + 'The number for the registration is shown along with the date of the registration. Next the status of the registration is shown. A registration may have one of the following statuses: Approved, Pending Payment, Not Approved / Awaiting Review, Declined, or Cancelled.', |
|
10 | + 'event_espresso' |
|
11 | + ); ?> |
|
12 | 12 | <ul> |
13 | 13 | <li style="list-style-type: none;"> |
14 | 14 | <strong><?php esc_html_e('Approved', 'event_espresso'); ?></strong> |
15 | 15 | <br /> |
16 | 16 | <?php esc_html_e( |
17 | - 'An approved registration allows payments and may have a transaction status of incomplete or complete. The registration is marked as active and a space is reserved for the registrant.', |
|
18 | - 'event_espresso' |
|
19 | - ); ?> |
|
17 | + 'An approved registration allows payments and may have a transaction status of incomplete or complete. The registration is marked as active and a space is reserved for the registrant.', |
|
18 | + 'event_espresso' |
|
19 | + ); ?> |
|
20 | 20 | </li> |
21 | 21 | <li style="list-style-type: none;"> |
22 | 22 | <strong><?php esc_html_e('Cancelled', 'event_espresso'); ?></strong> |
23 | 23 | <br /> |
24 | 24 | <?php esc_html_e( |
25 | - 'A cancelled registration is performed by the registrant. Payments are not allowed, the registration is inactive, and no space is reserved.', |
|
26 | - 'event_espresso' |
|
27 | - ); ?> |
|
25 | + 'A cancelled registration is performed by the registrant. Payments are not allowed, the registration is inactive, and no space is reserved.', |
|
26 | + 'event_espresso' |
|
27 | + ); ?> |
|
28 | 28 | </li> |
29 | 29 | <li style="list-style-type: none;"> |
30 | 30 | <strong><?php esc_html_e('Declined', 'event_espresso'); ?></strong> |
31 | 31 | <br /> |
32 | 32 | <?php esc_html_e( |
33 | - 'A declined registration is performed by the event admin. Payments are not allowed, the registration is inactive, and not space is reserved.', |
|
34 | - 'event_espresso' |
|
35 | - ); ?> |
|
33 | + 'A declined registration is performed by the event admin. Payments are not allowed, the registration is inactive, and not space is reserved.', |
|
34 | + 'event_espresso' |
|
35 | + ); ?> |
|
36 | 36 | </li> |
37 | 37 | <li style="list-style-type: none;"> |
38 | 38 | <strong><?php esc_html_e('Awaiting Review', 'event_espresso'); ?></strong> |
39 | 39 | <br /> |
40 | 40 | <?php esc_html_e( |
41 | - 'Registration is awaiting review from the event admin. Payments are not allowed, the registration is active, and no space is reserved.', |
|
42 | - 'event_espresso' |
|
43 | - ); ?> |
|
41 | + 'Registration is awaiting review from the event admin. Payments are not allowed, the registration is active, and no space is reserved.', |
|
42 | + 'event_espresso' |
|
43 | + ); ?> |
|
44 | 44 | </li> |
45 | 45 | <li style="list-style-type: none;"> |
46 | 46 | <strong><?php esc_html_e('Pending Payment', 'event_espresso'); ?></strong> |
47 | 47 | <br /> |
48 | 48 | <?php esc_html_e( |
49 | - 'A pending registration allows payments. The status will be automatically toggled to approved if the payment is made in full by registrant.', |
|
50 | - 'event_espresso' |
|
51 | - ); ?> |
|
49 | + 'A pending registration allows payments. The status will be automatically toggled to approved if the payment is made in full by registrant.', |
|
50 | + 'event_espresso' |
|
51 | + ); ?> |
|
52 | 52 | </li> |
53 | 53 | </ul> |
54 | 54 | <p> |
55 | 55 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong> |
56 | 56 | <br /> |
57 | 57 | <?php esc_html_e( |
58 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
59 | - 'event_espresso' |
|
60 | - ); ?> |
|
58 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
59 | + 'event_espresso' |
|
60 | + ); ?> |
|
61 | 61 | </p> |
62 | 62 | <p> |
63 | 63 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
64 | 64 | <br /> |
65 | 65 | <?php esc_html_e( |
66 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
67 | - 'event_espresso' |
|
68 | - ); ?> |
|
66 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
67 | + 'event_espresso' |
|
68 | + ); ?> |
|
69 | 69 | </p> |
@@ -3,16 +3,16 @@ |
||
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php esc_html_e( |
6 | - 'Bulk actions allow you to perform an action to multiple registrations at once. The following bulk actions are supported: Approve Registrations, Decline Registrations, Set Registrations to Pending Payment, Set Registrations to Not Approved / Awaiting Review, Cancel Registrations, Trash Registrations. To use the bulk action feature, place a checkmark next to the registrations that you want to include. Then select a bulk action from the menu and click on the Apply button.', |
|
7 | - 'event_espresso' |
|
8 | - ); ?> |
|
6 | + 'Bulk actions allow you to perform an action to multiple registrations at once. The following bulk actions are supported: Approve Registrations, Decline Registrations, Set Registrations to Pending Payment, Set Registrations to Not Approved / Awaiting Review, Cancel Registrations, Trash Registrations. To use the bulk action feature, place a checkmark next to the registrations that you want to include. Then select a bulk action from the menu and click on the Apply button.', |
|
7 | + 'event_espresso' |
|
8 | + ); ?> |
|
9 | 9 | </p> |
10 | 10 | <p> |
11 | 11 | <strong><?php esc_html_e('Registrations Search', 'event_espresso'); ?></strong> |
12 | 12 | </p> |
13 | 13 | <p> |
14 | 14 | <?php esc_html_e( |
15 | - 'You can perform a search to find certain registrations. The following sources will be searched: Event Name (title), Event Description, First Name, Last Name, Bio, Email, Address, Comments, Notes, Registration Final Price, Registration Code, Registration Group Size, Ticket Name, and Ticket Description. To use the search feature, enter a value into the search box and click on the Search Registrations button.', |
|
16 | - 'event_espresso' |
|
17 | - ); ?> |
|
15 | + 'You can perform a search to find certain registrations. The following sources will be searched: Event Name (title), Event Description, First Name, Last Name, Bio, Email, Address, Comments, Notes, Registration Final Price, Registration Code, Registration Group Size, Ticket Name, and Ticket Description. To use the search feature, enter a value into the search box and click on the Search Registrations button.', |
|
16 | + 'event_espresso' |
|
17 | + ); ?> |
|
18 | 18 | </p> |
@@ -19,620 +19,620 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class EE_Registrations_List_Table extends EE_Admin_List_Table |
21 | 21 | { |
22 | - /** |
|
23 | - * @var Registrations_Admin_Page |
|
24 | - */ |
|
25 | - protected EE_Admin_Page $_admin_page; |
|
26 | - |
|
27 | - protected RegistrationsListTableUserCapabilities $caps_handler; |
|
28 | - |
|
29 | - private array $_status; |
|
30 | - |
|
31 | - /** |
|
32 | - * An array of transaction details for the related transaction to the registration being processed. |
|
33 | - * This is set via the _set_related_details method. |
|
34 | - * |
|
35 | - * @var array |
|
36 | - */ |
|
37 | - protected array $_transaction_details = []; |
|
38 | - |
|
39 | - /** |
|
40 | - * An array of event details for the related event to the registration being processed. |
|
41 | - * This is set via the _set_related_details method. |
|
42 | - * |
|
43 | - * @var array |
|
44 | - */ |
|
45 | - protected array $_event_details = []; |
|
46 | - |
|
47 | - private array $filters = []; |
|
48 | - |
|
49 | - private int $EVT_ID = 0; |
|
50 | - |
|
51 | - private int $DTT_ID = 0; |
|
52 | - |
|
53 | - private int $TKT_ID = 0; |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * @param Registrations_Admin_Page $admin_page |
|
58 | - */ |
|
59 | - public function __construct(Registrations_Admin_Page $admin_page) |
|
60 | - { |
|
61 | - $this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP); |
|
62 | - $this->request = $this->request ?? LoaderFactory::getShared(RequestInterface::class); |
|
63 | - $this->setupFilters(); |
|
64 | - parent::__construct($admin_page); |
|
65 | - $this->_status = $this->_admin_page->get_registration_status_array(); |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - private function setupFilters() |
|
70 | - { |
|
71 | - // for event filtering |
|
72 | - $this->EVT_ID = $this->request->getRequestParam('EVT_ID', 0, DataType::INTEGER); |
|
73 | - $this->EVT_ID = $this->request->getRequestParam('event_id', $this->EVT_ID, DataType::INTEGER); |
|
74 | - // for datetime filtering |
|
75 | - $this->DTT_ID = $this->request->getRequestParam('DTT_ID', 0, DataType::INTEGER); |
|
76 | - $this->DTT_ID = $this->request->getRequestParam('datetime_id', $this->DTT_ID, DataType::INTEGER); |
|
77 | - // for ticket filtering |
|
78 | - $this->TKT_ID = $this->request->getRequestParam('TKT_ID', 0, DataType::INTEGER); |
|
79 | - $this->TKT_ID = $this->request->getRequestParam('ticket_id', $this->TKT_ID, DataType::INTEGER); |
|
80 | - |
|
81 | - $filters = [ |
|
82 | - 'event_id' => $this->EVT_ID, |
|
83 | - 'datetime_id' => $this->DTT_ID, |
|
84 | - 'ticket_id' => $this->TKT_ID, |
|
85 | - ]; |
|
86 | - foreach ($filters as $filter_key => $filter_value) { |
|
87 | - if ($filter_value) { |
|
88 | - $this->filters[ $filter_key ] = $filter_value; |
|
89 | - } |
|
90 | - } |
|
91 | - |
|
92 | - add_filter( |
|
93 | - 'FHEE__EE_Admin_Page__get_list_table_view_RLs__extra_query_args', |
|
94 | - [$this, 'filterExtraQueryArgs'], |
|
95 | - 10, |
|
96 | - 2 |
|
97 | - ); |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * @param array $extra_query_args |
|
103 | - * @param EE_Admin_Page $admin_page |
|
104 | - * @return void |
|
105 | - * @since 5.0.13.p |
|
106 | - */ |
|
107 | - public function filterExtraQueryArgs(array $extra_query_args, EE_Admin_Page $admin_page): array |
|
108 | - { |
|
109 | - if ($admin_page instanceof Registrations_Admin_Page) { |
|
110 | - foreach ($admin_page->get_views() as $view_details) { |
|
111 | - foreach ($this->filters as $filter_key => $filter_value) { |
|
112 | - $extra_query_args[ $view_details['slug'] ][ $filter_key ] = $filter_value; |
|
113 | - } |
|
114 | - } |
|
115 | - } |
|
116 | - return $extra_query_args; |
|
117 | - } |
|
118 | - |
|
119 | - |
|
120 | - /** |
|
121 | - * @return void |
|
122 | - * @throws EE_Error |
|
123 | - * @throws ReflectionException |
|
124 | - */ |
|
125 | - protected function _setup_data() |
|
126 | - { |
|
127 | - $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
128 | - $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true); |
|
129 | - } |
|
130 | - |
|
131 | - |
|
132 | - /** |
|
133 | - * @return void |
|
134 | - */ |
|
135 | - protected function _set_properties() |
|
136 | - { |
|
137 | - $this->_wp_list_args = [ |
|
138 | - 'singular' => esc_html__('registration', 'event_espresso'), |
|
139 | - 'plural' => esc_html__('registrations', 'event_espresso'), |
|
140 | - 'ajax' => true, |
|
141 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
142 | - ]; |
|
143 | - |
|
144 | - if ($this->EVT_ID) { |
|
145 | - $this->_columns = [ |
|
146 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
147 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
148 | - 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
149 | - 'ATT_email' => esc_html__('Email', 'event_espresso'), |
|
150 | - '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
151 | - 'REG_ticket' => esc_html__('Ticket', 'event_espresso'), |
|
152 | - '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
153 | - '_REG_paid' => esc_html__('REG Paid', 'event_espresso'), |
|
154 | - 'TXN_total' => esc_html__('TXN Paid/Total', 'event_espresso'), |
|
155 | - 'actions' => $this->actionsColumnHeader(), |
|
156 | - ]; |
|
157 | - } elseif ($this->TKT_ID) { |
|
158 | - $this->_columns = [ |
|
159 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
160 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
161 | - 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
162 | - 'ATT_email' => esc_html__('Email', 'event_espresso'), |
|
163 | - '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
164 | - '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
165 | - '_REG_paid' => esc_html__('REG Paid', 'event_espresso'), |
|
166 | - 'TXN_total' => esc_html__('TXN Paid/Total', 'event_espresso'), |
|
167 | - 'actions' => $this->actionsColumnHeader(), |
|
168 | - ]; |
|
169 | - } else { |
|
170 | - $this->_columns = [ |
|
171 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
172 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
173 | - 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
174 | - '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
175 | - 'event_name' => esc_html__('Event', 'event_espresso'), |
|
176 | - 'DTT_EVT_start' => esc_html__('Event Date', 'event_espresso'), |
|
177 | - 'REG_ticket' => esc_html__('Ticket', 'event_espresso'), |
|
178 | - '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
179 | - '_REG_paid' => esc_html__('REG Paid', 'event_espresso'), |
|
180 | - 'TXN_total' => esc_html__('TXN Paid/Total', 'event_espresso'), |
|
181 | - 'actions' => $this->actionsColumnHeader(), |
|
182 | - ]; |
|
183 | - } |
|
184 | - |
|
185 | - $this->_primary_column = 'id'; |
|
186 | - $this->_sortable_columns = [ |
|
187 | - '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
188 | - /** |
|
189 | - * Allows users to change the default sort if they wish. |
|
190 | - * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
191 | - * name. |
|
192 | - */ |
|
193 | - 'ATT_fname' => [ |
|
194 | - 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
195 | - true, |
|
196 | - $this, |
|
197 | - ] |
|
198 | - ? ['ATT_lname' => false] |
|
199 | - : ['ATT_fname' => false], |
|
200 | - 'event_name' => ['event_name' => false], |
|
201 | - 'DTT_EVT_start' => ['DTT_EVT_start' => false], |
|
202 | - 'id' => ['REG_ID' => false], |
|
203 | - ]; |
|
204 | - $this->_hidden_columns = []; |
|
205 | - |
|
206 | - $csv_report = RegistrationsCsvReportParams::getRequestParams( |
|
207 | - $this->getReturnUrl(), |
|
208 | - $this->_admin_page->get_request_data(), |
|
209 | - $this->EVT_ID, |
|
210 | - $this->DTT_ID |
|
211 | - ); |
|
212 | - if (! empty($csv_report)) { |
|
213 | - $this->_bottom_buttons['csv_reg_report'] = $csv_report; |
|
214 | - } |
|
215 | - } |
|
216 | - |
|
217 | - |
|
218 | - /** |
|
219 | - * This simply sets up the row class for the table rows. |
|
220 | - * Allows for easier overriding of child methods for setting up sorting. |
|
221 | - * |
|
222 | - * @param EE_Registration $item the current item |
|
223 | - * @return string |
|
224 | - */ |
|
225 | - protected function _get_row_class($item): string |
|
226 | - { |
|
227 | - $class = parent::_get_row_class($item); |
|
228 | - if ($this->_has_checkbox_column) { |
|
229 | - $class .= ' has-checkbox-column'; |
|
230 | - } |
|
231 | - return $class; |
|
232 | - } |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * Set the $_transaction_details property if not set yet. |
|
237 | - * |
|
238 | - * @param EE_Registration $registration |
|
239 | - * @throws EE_Error |
|
240 | - * @throws InvalidArgumentException |
|
241 | - * @throws ReflectionException |
|
242 | - * @throws InvalidDataTypeException |
|
243 | - * @throws InvalidInterfaceException |
|
244 | - */ |
|
245 | - protected function _set_related_details(EE_Registration $registration) |
|
246 | - { |
|
247 | - $transaction = $registration->transaction(); |
|
248 | - $status = $transaction->status_ID(); |
|
249 | - $this->_transaction_details = [ |
|
250 | - 'transaction' => $transaction, |
|
251 | - 'status' => $status, |
|
252 | - 'id' => $transaction->ID(), |
|
253 | - 'title_attr' => sprintf( |
|
254 | - esc_html__('View Transaction Details (%s)', 'event_espresso'), |
|
255 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
256 | - ), |
|
257 | - ]; |
|
258 | - try { |
|
259 | - $event = $registration->event(); |
|
260 | - } catch (EntityNotFoundException $e) { |
|
261 | - $event = null; |
|
262 | - } |
|
263 | - $status = $event instanceof EE_Event |
|
264 | - ? $event->get_active_status() |
|
265 | - : EE_Datetime::inactive; |
|
266 | - $this->_event_details = [ |
|
267 | - 'event' => $event, |
|
268 | - 'status' => $status, |
|
269 | - 'id' => $event instanceof EE_Event |
|
270 | - ? $event->ID() |
|
271 | - : 0, |
|
272 | - 'title_attr' => sprintf( |
|
273 | - esc_html__('Edit Event (%s)', 'event_espresso'), |
|
274 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
275 | - ), |
|
276 | - ]; |
|
277 | - } |
|
278 | - |
|
279 | - |
|
280 | - /** |
|
281 | - * @return array |
|
282 | - * @throws EE_Error |
|
283 | - * @throws ReflectionException |
|
284 | - */ |
|
285 | - protected function _get_table_filters() |
|
286 | - { |
|
287 | - $filters = []; |
|
288 | - // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
289 | - // methods. |
|
290 | - $cur_date = $this->request->getRequestParam('month_range', ''); |
|
291 | - $cur_category = $this->request->getRequestParam('EVT_CAT', -1, DataType::INTEGER); |
|
292 | - $reg_status = $this->request->getRequestParam('_reg_status', ''); |
|
293 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
294 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
295 | - $status = []; |
|
296 | - $status[] = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')]; |
|
297 | - foreach ($this->_status as $key => $value) { |
|
298 | - $status[] = ['id' => $key, 'text' => $value]; |
|
299 | - } |
|
300 | - if ($this->_view !== 'incomplete') { |
|
301 | - $filters[] = EEH_Form_Fields::select_input( |
|
302 | - '_reg_status', |
|
303 | - $status, |
|
304 | - $reg_status ? strtoupper($reg_status) : '' |
|
305 | - ); |
|
306 | - } |
|
307 | - foreach ($this->filters as $filter_key => $filter_value) { |
|
308 | - $filters[] = EEH_Form_Fields::hidden_input($filter_key, $filter_value, 'reg_' . $filter_key); |
|
309 | - } |
|
310 | - return $filters; |
|
311 | - } |
|
312 | - |
|
313 | - |
|
314 | - /** |
|
315 | - * @return void |
|
316 | - * @throws EE_Error |
|
317 | - * @throws InvalidArgumentException |
|
318 | - * @throws InvalidDataTypeException |
|
319 | - * @throws InvalidInterfaceException |
|
320 | - * @throws ReflectionException |
|
321 | - */ |
|
322 | - protected function _add_view_counts() |
|
323 | - { |
|
324 | - $this->_views['all']['count'] = $this->_total_registrations(); |
|
325 | - $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
326 | - $this->_views['yesterday']['count'] = $this->totalRegistrationsYesterday(); |
|
327 | - $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
328 | - if ($this->caps_handler->userCanTrashRegistrations()) { |
|
329 | - $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
330 | - $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
331 | - } |
|
332 | - } |
|
333 | - |
|
334 | - |
|
335 | - private function addWhereParamsForFilters(array $where = []): array |
|
336 | - { |
|
337 | - if ($this->EVT_ID) { |
|
338 | - $where['EVT_ID'] = $this->EVT_ID; |
|
339 | - } |
|
340 | - if ($this->DTT_ID) { |
|
341 | - $where['Ticket.Datetime.DTT_ID'] = $this->DTT_ID; |
|
342 | - } |
|
343 | - if ($this->TKT_ID) { |
|
344 | - $where['TKT_ID'] = $this->TKT_ID; |
|
345 | - } |
|
346 | - return $where; |
|
347 | - } |
|
348 | - |
|
349 | - |
|
350 | - /** |
|
351 | - * @param string $view |
|
352 | - * @return int |
|
353 | - * @throws EE_Error |
|
354 | - * @throws ReflectionException |
|
355 | - */ |
|
356 | - protected function _total_registrations(string $view = ''): int |
|
357 | - { |
|
358 | - $where = $this->addWhereParamsForFilters(); |
|
359 | - switch ($view) { |
|
360 | - case 'trash': |
|
361 | - return EEM_Registration::instance()->count_deleted([$where]); |
|
362 | - case 'incomplete': |
|
363 | - $where['STS_ID'] = RegStatus::INCOMPLETE; |
|
364 | - break; |
|
365 | - default: |
|
366 | - $where['STS_ID'] = ['!=', RegStatus::INCOMPLETE]; |
|
367 | - } |
|
368 | - return EEM_Registration::instance()->count([$where]); |
|
369 | - } |
|
370 | - |
|
371 | - |
|
372 | - /** |
|
373 | - * @return int |
|
374 | - * @throws EE_Error |
|
375 | - * @throws ReflectionException |
|
376 | - */ |
|
377 | - protected function _total_registrations_this_month(): int |
|
378 | - { |
|
379 | - $current_time = current_time('timestamp'); |
|
380 | - $year_and_month = date('Y-m', $current_time); |
|
381 | - $days_in_month = date('t', $current_time); |
|
382 | - |
|
383 | - $start_date = "$year_and_month-01"; |
|
384 | - $end_date = "$year_and_month-$days_in_month"; |
|
385 | - |
|
386 | - return $this->totalRegistrationsForDateRange($start_date, $end_date); |
|
387 | - } |
|
388 | - |
|
389 | - |
|
390 | - /** |
|
391 | - * @return int |
|
392 | - * @throws EE_Error |
|
393 | - * @throws ReflectionException |
|
394 | - */ |
|
395 | - protected function _total_registrations_today(): int |
|
396 | - { |
|
397 | - $today = date('Y-m-d', current_time('timestamp')); |
|
398 | - return $this->totalRegistrationsForDateRange($today, $today); |
|
399 | - } |
|
400 | - |
|
401 | - |
|
402 | - /** |
|
403 | - * @return int |
|
404 | - * @throws EE_Error |
|
405 | - * @throws ReflectionException |
|
406 | - */ |
|
407 | - protected function totalRegistrationsYesterday(): int |
|
408 | - { |
|
409 | - $yesterday = date('Y-m-d', current_time('timestamp') - DAY_IN_SECONDS); |
|
410 | - return $this->totalRegistrationsForDateRange($yesterday, $yesterday); |
|
411 | - } |
|
412 | - |
|
413 | - |
|
414 | - /** |
|
415 | - * @param string $start_date earlier date string in format 'Y-m-d' |
|
416 | - * @param string $end_date later date string in format 'Y-m-d' |
|
417 | - * @return int |
|
418 | - * @throws EE_Error |
|
419 | - * @throws ReflectionException |
|
420 | - */ |
|
421 | - private function totalRegistrationsForDateRange(string $start_date, string $end_date): int |
|
422 | - { |
|
423 | - $where = $this->addWhereParamsForFilters( |
|
424 | - [ |
|
425 | - 'REG_date' => [ |
|
426 | - 'BETWEEN', |
|
427 | - [ |
|
428 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
429 | - 'REG_date', |
|
430 | - "$start_date 00:00:00", |
|
431 | - 'Y-m-d H:i:s' |
|
432 | - ), |
|
433 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
434 | - 'REG_date', |
|
435 | - "$end_date 23:59:59", |
|
436 | - 'Y-m-d H:i:s' |
|
437 | - ), |
|
438 | - ], |
|
439 | - ], |
|
440 | - 'STS_ID' => ['!=', RegStatus::INCOMPLETE], |
|
441 | - ] |
|
442 | - ); |
|
443 | - return EEM_Registration::instance()->count([$where]); |
|
444 | - } |
|
445 | - |
|
446 | - |
|
447 | - /** |
|
448 | - * @param EE_Registration $item |
|
449 | - * @return string |
|
450 | - * @throws EE_Error |
|
451 | - * @throws InvalidArgumentException |
|
452 | - * @throws InvalidDataTypeException |
|
453 | - * @throws InvalidInterfaceException |
|
454 | - * @throws ReflectionException |
|
455 | - */ |
|
456 | - public function column_cb($item): string |
|
457 | - { |
|
458 | - /** checkbox/lock **/ |
|
459 | - $REG_ID = $item->ID(); |
|
460 | - $transaction = $item->transaction(); |
|
461 | - $payment_count = $transaction->count_related('Payment'); |
|
462 | - |
|
463 | - $content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />'; |
|
464 | - $content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item) |
|
465 | - ? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box" |
|
22 | + /** |
|
23 | + * @var Registrations_Admin_Page |
|
24 | + */ |
|
25 | + protected EE_Admin_Page $_admin_page; |
|
26 | + |
|
27 | + protected RegistrationsListTableUserCapabilities $caps_handler; |
|
28 | + |
|
29 | + private array $_status; |
|
30 | + |
|
31 | + /** |
|
32 | + * An array of transaction details for the related transaction to the registration being processed. |
|
33 | + * This is set via the _set_related_details method. |
|
34 | + * |
|
35 | + * @var array |
|
36 | + */ |
|
37 | + protected array $_transaction_details = []; |
|
38 | + |
|
39 | + /** |
|
40 | + * An array of event details for the related event to the registration being processed. |
|
41 | + * This is set via the _set_related_details method. |
|
42 | + * |
|
43 | + * @var array |
|
44 | + */ |
|
45 | + protected array $_event_details = []; |
|
46 | + |
|
47 | + private array $filters = []; |
|
48 | + |
|
49 | + private int $EVT_ID = 0; |
|
50 | + |
|
51 | + private int $DTT_ID = 0; |
|
52 | + |
|
53 | + private int $TKT_ID = 0; |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * @param Registrations_Admin_Page $admin_page |
|
58 | + */ |
|
59 | + public function __construct(Registrations_Admin_Page $admin_page) |
|
60 | + { |
|
61 | + $this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP); |
|
62 | + $this->request = $this->request ?? LoaderFactory::getShared(RequestInterface::class); |
|
63 | + $this->setupFilters(); |
|
64 | + parent::__construct($admin_page); |
|
65 | + $this->_status = $this->_admin_page->get_registration_status_array(); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + private function setupFilters() |
|
70 | + { |
|
71 | + // for event filtering |
|
72 | + $this->EVT_ID = $this->request->getRequestParam('EVT_ID', 0, DataType::INTEGER); |
|
73 | + $this->EVT_ID = $this->request->getRequestParam('event_id', $this->EVT_ID, DataType::INTEGER); |
|
74 | + // for datetime filtering |
|
75 | + $this->DTT_ID = $this->request->getRequestParam('DTT_ID', 0, DataType::INTEGER); |
|
76 | + $this->DTT_ID = $this->request->getRequestParam('datetime_id', $this->DTT_ID, DataType::INTEGER); |
|
77 | + // for ticket filtering |
|
78 | + $this->TKT_ID = $this->request->getRequestParam('TKT_ID', 0, DataType::INTEGER); |
|
79 | + $this->TKT_ID = $this->request->getRequestParam('ticket_id', $this->TKT_ID, DataType::INTEGER); |
|
80 | + |
|
81 | + $filters = [ |
|
82 | + 'event_id' => $this->EVT_ID, |
|
83 | + 'datetime_id' => $this->DTT_ID, |
|
84 | + 'ticket_id' => $this->TKT_ID, |
|
85 | + ]; |
|
86 | + foreach ($filters as $filter_key => $filter_value) { |
|
87 | + if ($filter_value) { |
|
88 | + $this->filters[ $filter_key ] = $filter_value; |
|
89 | + } |
|
90 | + } |
|
91 | + |
|
92 | + add_filter( |
|
93 | + 'FHEE__EE_Admin_Page__get_list_table_view_RLs__extra_query_args', |
|
94 | + [$this, 'filterExtraQueryArgs'], |
|
95 | + 10, |
|
96 | + 2 |
|
97 | + ); |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * @param array $extra_query_args |
|
103 | + * @param EE_Admin_Page $admin_page |
|
104 | + * @return void |
|
105 | + * @since 5.0.13.p |
|
106 | + */ |
|
107 | + public function filterExtraQueryArgs(array $extra_query_args, EE_Admin_Page $admin_page): array |
|
108 | + { |
|
109 | + if ($admin_page instanceof Registrations_Admin_Page) { |
|
110 | + foreach ($admin_page->get_views() as $view_details) { |
|
111 | + foreach ($this->filters as $filter_key => $filter_value) { |
|
112 | + $extra_query_args[ $view_details['slug'] ][ $filter_key ] = $filter_value; |
|
113 | + } |
|
114 | + } |
|
115 | + } |
|
116 | + return $extra_query_args; |
|
117 | + } |
|
118 | + |
|
119 | + |
|
120 | + /** |
|
121 | + * @return void |
|
122 | + * @throws EE_Error |
|
123 | + * @throws ReflectionException |
|
124 | + */ |
|
125 | + protected function _setup_data() |
|
126 | + { |
|
127 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
128 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true); |
|
129 | + } |
|
130 | + |
|
131 | + |
|
132 | + /** |
|
133 | + * @return void |
|
134 | + */ |
|
135 | + protected function _set_properties() |
|
136 | + { |
|
137 | + $this->_wp_list_args = [ |
|
138 | + 'singular' => esc_html__('registration', 'event_espresso'), |
|
139 | + 'plural' => esc_html__('registrations', 'event_espresso'), |
|
140 | + 'ajax' => true, |
|
141 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
142 | + ]; |
|
143 | + |
|
144 | + if ($this->EVT_ID) { |
|
145 | + $this->_columns = [ |
|
146 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
147 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
148 | + 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
149 | + 'ATT_email' => esc_html__('Email', 'event_espresso'), |
|
150 | + '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
151 | + 'REG_ticket' => esc_html__('Ticket', 'event_espresso'), |
|
152 | + '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
153 | + '_REG_paid' => esc_html__('REG Paid', 'event_espresso'), |
|
154 | + 'TXN_total' => esc_html__('TXN Paid/Total', 'event_espresso'), |
|
155 | + 'actions' => $this->actionsColumnHeader(), |
|
156 | + ]; |
|
157 | + } elseif ($this->TKT_ID) { |
|
158 | + $this->_columns = [ |
|
159 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
160 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
161 | + 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
162 | + 'ATT_email' => esc_html__('Email', 'event_espresso'), |
|
163 | + '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
164 | + '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
165 | + '_REG_paid' => esc_html__('REG Paid', 'event_espresso'), |
|
166 | + 'TXN_total' => esc_html__('TXN Paid/Total', 'event_espresso'), |
|
167 | + 'actions' => $this->actionsColumnHeader(), |
|
168 | + ]; |
|
169 | + } else { |
|
170 | + $this->_columns = [ |
|
171 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
172 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
173 | + 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
174 | + '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
175 | + 'event_name' => esc_html__('Event', 'event_espresso'), |
|
176 | + 'DTT_EVT_start' => esc_html__('Event Date', 'event_espresso'), |
|
177 | + 'REG_ticket' => esc_html__('Ticket', 'event_espresso'), |
|
178 | + '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
179 | + '_REG_paid' => esc_html__('REG Paid', 'event_espresso'), |
|
180 | + 'TXN_total' => esc_html__('TXN Paid/Total', 'event_espresso'), |
|
181 | + 'actions' => $this->actionsColumnHeader(), |
|
182 | + ]; |
|
183 | + } |
|
184 | + |
|
185 | + $this->_primary_column = 'id'; |
|
186 | + $this->_sortable_columns = [ |
|
187 | + '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
188 | + /** |
|
189 | + * Allows users to change the default sort if they wish. |
|
190 | + * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
191 | + * name. |
|
192 | + */ |
|
193 | + 'ATT_fname' => [ |
|
194 | + 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
195 | + true, |
|
196 | + $this, |
|
197 | + ] |
|
198 | + ? ['ATT_lname' => false] |
|
199 | + : ['ATT_fname' => false], |
|
200 | + 'event_name' => ['event_name' => false], |
|
201 | + 'DTT_EVT_start' => ['DTT_EVT_start' => false], |
|
202 | + 'id' => ['REG_ID' => false], |
|
203 | + ]; |
|
204 | + $this->_hidden_columns = []; |
|
205 | + |
|
206 | + $csv_report = RegistrationsCsvReportParams::getRequestParams( |
|
207 | + $this->getReturnUrl(), |
|
208 | + $this->_admin_page->get_request_data(), |
|
209 | + $this->EVT_ID, |
|
210 | + $this->DTT_ID |
|
211 | + ); |
|
212 | + if (! empty($csv_report)) { |
|
213 | + $this->_bottom_buttons['csv_reg_report'] = $csv_report; |
|
214 | + } |
|
215 | + } |
|
216 | + |
|
217 | + |
|
218 | + /** |
|
219 | + * This simply sets up the row class for the table rows. |
|
220 | + * Allows for easier overriding of child methods for setting up sorting. |
|
221 | + * |
|
222 | + * @param EE_Registration $item the current item |
|
223 | + * @return string |
|
224 | + */ |
|
225 | + protected function _get_row_class($item): string |
|
226 | + { |
|
227 | + $class = parent::_get_row_class($item); |
|
228 | + if ($this->_has_checkbox_column) { |
|
229 | + $class .= ' has-checkbox-column'; |
|
230 | + } |
|
231 | + return $class; |
|
232 | + } |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * Set the $_transaction_details property if not set yet. |
|
237 | + * |
|
238 | + * @param EE_Registration $registration |
|
239 | + * @throws EE_Error |
|
240 | + * @throws InvalidArgumentException |
|
241 | + * @throws ReflectionException |
|
242 | + * @throws InvalidDataTypeException |
|
243 | + * @throws InvalidInterfaceException |
|
244 | + */ |
|
245 | + protected function _set_related_details(EE_Registration $registration) |
|
246 | + { |
|
247 | + $transaction = $registration->transaction(); |
|
248 | + $status = $transaction->status_ID(); |
|
249 | + $this->_transaction_details = [ |
|
250 | + 'transaction' => $transaction, |
|
251 | + 'status' => $status, |
|
252 | + 'id' => $transaction->ID(), |
|
253 | + 'title_attr' => sprintf( |
|
254 | + esc_html__('View Transaction Details (%s)', 'event_espresso'), |
|
255 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
256 | + ), |
|
257 | + ]; |
|
258 | + try { |
|
259 | + $event = $registration->event(); |
|
260 | + } catch (EntityNotFoundException $e) { |
|
261 | + $event = null; |
|
262 | + } |
|
263 | + $status = $event instanceof EE_Event |
|
264 | + ? $event->get_active_status() |
|
265 | + : EE_Datetime::inactive; |
|
266 | + $this->_event_details = [ |
|
267 | + 'event' => $event, |
|
268 | + 'status' => $status, |
|
269 | + 'id' => $event instanceof EE_Event |
|
270 | + ? $event->ID() |
|
271 | + : 0, |
|
272 | + 'title_attr' => sprintf( |
|
273 | + esc_html__('Edit Event (%s)', 'event_espresso'), |
|
274 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
275 | + ), |
|
276 | + ]; |
|
277 | + } |
|
278 | + |
|
279 | + |
|
280 | + /** |
|
281 | + * @return array |
|
282 | + * @throws EE_Error |
|
283 | + * @throws ReflectionException |
|
284 | + */ |
|
285 | + protected function _get_table_filters() |
|
286 | + { |
|
287 | + $filters = []; |
|
288 | + // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
289 | + // methods. |
|
290 | + $cur_date = $this->request->getRequestParam('month_range', ''); |
|
291 | + $cur_category = $this->request->getRequestParam('EVT_CAT', -1, DataType::INTEGER); |
|
292 | + $reg_status = $this->request->getRequestParam('_reg_status', ''); |
|
293 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
294 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
295 | + $status = []; |
|
296 | + $status[] = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')]; |
|
297 | + foreach ($this->_status as $key => $value) { |
|
298 | + $status[] = ['id' => $key, 'text' => $value]; |
|
299 | + } |
|
300 | + if ($this->_view !== 'incomplete') { |
|
301 | + $filters[] = EEH_Form_Fields::select_input( |
|
302 | + '_reg_status', |
|
303 | + $status, |
|
304 | + $reg_status ? strtoupper($reg_status) : '' |
|
305 | + ); |
|
306 | + } |
|
307 | + foreach ($this->filters as $filter_key => $filter_value) { |
|
308 | + $filters[] = EEH_Form_Fields::hidden_input($filter_key, $filter_value, 'reg_' . $filter_key); |
|
309 | + } |
|
310 | + return $filters; |
|
311 | + } |
|
312 | + |
|
313 | + |
|
314 | + /** |
|
315 | + * @return void |
|
316 | + * @throws EE_Error |
|
317 | + * @throws InvalidArgumentException |
|
318 | + * @throws InvalidDataTypeException |
|
319 | + * @throws InvalidInterfaceException |
|
320 | + * @throws ReflectionException |
|
321 | + */ |
|
322 | + protected function _add_view_counts() |
|
323 | + { |
|
324 | + $this->_views['all']['count'] = $this->_total_registrations(); |
|
325 | + $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
326 | + $this->_views['yesterday']['count'] = $this->totalRegistrationsYesterday(); |
|
327 | + $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
328 | + if ($this->caps_handler->userCanTrashRegistrations()) { |
|
329 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
330 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
331 | + } |
|
332 | + } |
|
333 | + |
|
334 | + |
|
335 | + private function addWhereParamsForFilters(array $where = []): array |
|
336 | + { |
|
337 | + if ($this->EVT_ID) { |
|
338 | + $where['EVT_ID'] = $this->EVT_ID; |
|
339 | + } |
|
340 | + if ($this->DTT_ID) { |
|
341 | + $where['Ticket.Datetime.DTT_ID'] = $this->DTT_ID; |
|
342 | + } |
|
343 | + if ($this->TKT_ID) { |
|
344 | + $where['TKT_ID'] = $this->TKT_ID; |
|
345 | + } |
|
346 | + return $where; |
|
347 | + } |
|
348 | + |
|
349 | + |
|
350 | + /** |
|
351 | + * @param string $view |
|
352 | + * @return int |
|
353 | + * @throws EE_Error |
|
354 | + * @throws ReflectionException |
|
355 | + */ |
|
356 | + protected function _total_registrations(string $view = ''): int |
|
357 | + { |
|
358 | + $where = $this->addWhereParamsForFilters(); |
|
359 | + switch ($view) { |
|
360 | + case 'trash': |
|
361 | + return EEM_Registration::instance()->count_deleted([$where]); |
|
362 | + case 'incomplete': |
|
363 | + $where['STS_ID'] = RegStatus::INCOMPLETE; |
|
364 | + break; |
|
365 | + default: |
|
366 | + $where['STS_ID'] = ['!=', RegStatus::INCOMPLETE]; |
|
367 | + } |
|
368 | + return EEM_Registration::instance()->count([$where]); |
|
369 | + } |
|
370 | + |
|
371 | + |
|
372 | + /** |
|
373 | + * @return int |
|
374 | + * @throws EE_Error |
|
375 | + * @throws ReflectionException |
|
376 | + */ |
|
377 | + protected function _total_registrations_this_month(): int |
|
378 | + { |
|
379 | + $current_time = current_time('timestamp'); |
|
380 | + $year_and_month = date('Y-m', $current_time); |
|
381 | + $days_in_month = date('t', $current_time); |
|
382 | + |
|
383 | + $start_date = "$year_and_month-01"; |
|
384 | + $end_date = "$year_and_month-$days_in_month"; |
|
385 | + |
|
386 | + return $this->totalRegistrationsForDateRange($start_date, $end_date); |
|
387 | + } |
|
388 | + |
|
389 | + |
|
390 | + /** |
|
391 | + * @return int |
|
392 | + * @throws EE_Error |
|
393 | + * @throws ReflectionException |
|
394 | + */ |
|
395 | + protected function _total_registrations_today(): int |
|
396 | + { |
|
397 | + $today = date('Y-m-d', current_time('timestamp')); |
|
398 | + return $this->totalRegistrationsForDateRange($today, $today); |
|
399 | + } |
|
400 | + |
|
401 | + |
|
402 | + /** |
|
403 | + * @return int |
|
404 | + * @throws EE_Error |
|
405 | + * @throws ReflectionException |
|
406 | + */ |
|
407 | + protected function totalRegistrationsYesterday(): int |
|
408 | + { |
|
409 | + $yesterday = date('Y-m-d', current_time('timestamp') - DAY_IN_SECONDS); |
|
410 | + return $this->totalRegistrationsForDateRange($yesterday, $yesterday); |
|
411 | + } |
|
412 | + |
|
413 | + |
|
414 | + /** |
|
415 | + * @param string $start_date earlier date string in format 'Y-m-d' |
|
416 | + * @param string $end_date later date string in format 'Y-m-d' |
|
417 | + * @return int |
|
418 | + * @throws EE_Error |
|
419 | + * @throws ReflectionException |
|
420 | + */ |
|
421 | + private function totalRegistrationsForDateRange(string $start_date, string $end_date): int |
|
422 | + { |
|
423 | + $where = $this->addWhereParamsForFilters( |
|
424 | + [ |
|
425 | + 'REG_date' => [ |
|
426 | + 'BETWEEN', |
|
427 | + [ |
|
428 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
429 | + 'REG_date', |
|
430 | + "$start_date 00:00:00", |
|
431 | + 'Y-m-d H:i:s' |
|
432 | + ), |
|
433 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
434 | + 'REG_date', |
|
435 | + "$end_date 23:59:59", |
|
436 | + 'Y-m-d H:i:s' |
|
437 | + ), |
|
438 | + ], |
|
439 | + ], |
|
440 | + 'STS_ID' => ['!=', RegStatus::INCOMPLETE], |
|
441 | + ] |
|
442 | + ); |
|
443 | + return EEM_Registration::instance()->count([$where]); |
|
444 | + } |
|
445 | + |
|
446 | + |
|
447 | + /** |
|
448 | + * @param EE_Registration $item |
|
449 | + * @return string |
|
450 | + * @throws EE_Error |
|
451 | + * @throws InvalidArgumentException |
|
452 | + * @throws InvalidDataTypeException |
|
453 | + * @throws InvalidInterfaceException |
|
454 | + * @throws ReflectionException |
|
455 | + */ |
|
456 | + public function column_cb($item): string |
|
457 | + { |
|
458 | + /** checkbox/lock **/ |
|
459 | + $REG_ID = $item->ID(); |
|
460 | + $transaction = $item->transaction(); |
|
461 | + $payment_count = $transaction->count_related('Payment'); |
|
462 | + |
|
463 | + $content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />'; |
|
464 | + $content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item) |
|
465 | + ? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box" |
|
466 | 466 | aria-label="' . $this->lockedRegMessage() . '"></span>' |
467 | - : ''; |
|
468 | - return $this->columnContent('cb', $content, 'center'); |
|
469 | - } |
|
470 | - |
|
471 | - |
|
472 | - private function lockedRegMessage(): string |
|
473 | - { |
|
474 | - return esc_html__( |
|
475 | - 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
476 | - 'event_espresso' |
|
477 | - ); |
|
478 | - } |
|
479 | - |
|
480 | - |
|
481 | - /** |
|
482 | - * @param EE_Registration $registration |
|
483 | - * @return string |
|
484 | - * @throws EE_Error |
|
485 | - * @throws InvalidArgumentException |
|
486 | - * @throws InvalidDataTypeException |
|
487 | - * @throws InvalidInterfaceException |
|
488 | - * @throws ReflectionException |
|
489 | - */ |
|
490 | - public function column_id(EE_Registration $registration): string |
|
491 | - { |
|
492 | - $content = '<span class="ee-entity-id">' . $registration->ID() . '</span>'; |
|
493 | - $content .= '<span class="show-on-mobile-view-only">'; |
|
494 | - $content .= $this->column_ATT_fname($registration, false); |
|
495 | - $content .= '</span>'; |
|
496 | - |
|
497 | - return $this->columnContent('id', $content, 'end'); |
|
498 | - } |
|
499 | - |
|
500 | - |
|
501 | - /** |
|
502 | - * @param EE_Registration $registration |
|
503 | - * @param bool $prep_content |
|
504 | - * @return string |
|
505 | - * @throws EE_Error |
|
506 | - * @throws ReflectionException |
|
507 | - */ |
|
508 | - public function column_ATT_fname(EE_Registration $registration, bool $prep_content = true): string |
|
509 | - { |
|
510 | - $status = esc_attr($registration->status_ID()); |
|
511 | - $pretty_status = EEH_Template::pretty_status($status, false, 'sentence'); |
|
512 | - $prime_reg_star = $registration->count() === 1 |
|
513 | - ? '<sup><span class="dashicons dashicons-star-filled gold-icon"></span></sup>' |
|
514 | - : ''; |
|
515 | - |
|
516 | - $group_count = ' |
|
467 | + : ''; |
|
468 | + return $this->columnContent('cb', $content, 'center'); |
|
469 | + } |
|
470 | + |
|
471 | + |
|
472 | + private function lockedRegMessage(): string |
|
473 | + { |
|
474 | + return esc_html__( |
|
475 | + 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
476 | + 'event_espresso' |
|
477 | + ); |
|
478 | + } |
|
479 | + |
|
480 | + |
|
481 | + /** |
|
482 | + * @param EE_Registration $registration |
|
483 | + * @return string |
|
484 | + * @throws EE_Error |
|
485 | + * @throws InvalidArgumentException |
|
486 | + * @throws InvalidDataTypeException |
|
487 | + * @throws InvalidInterfaceException |
|
488 | + * @throws ReflectionException |
|
489 | + */ |
|
490 | + public function column_id(EE_Registration $registration): string |
|
491 | + { |
|
492 | + $content = '<span class="ee-entity-id">' . $registration->ID() . '</span>'; |
|
493 | + $content .= '<span class="show-on-mobile-view-only">'; |
|
494 | + $content .= $this->column_ATT_fname($registration, false); |
|
495 | + $content .= '</span>'; |
|
496 | + |
|
497 | + return $this->columnContent('id', $content, 'end'); |
|
498 | + } |
|
499 | + |
|
500 | + |
|
501 | + /** |
|
502 | + * @param EE_Registration $registration |
|
503 | + * @param bool $prep_content |
|
504 | + * @return string |
|
505 | + * @throws EE_Error |
|
506 | + * @throws ReflectionException |
|
507 | + */ |
|
508 | + public function column_ATT_fname(EE_Registration $registration, bool $prep_content = true): string |
|
509 | + { |
|
510 | + $status = esc_attr($registration->status_ID()); |
|
511 | + $pretty_status = EEH_Template::pretty_status($status, false, 'sentence'); |
|
512 | + $prime_reg_star = $registration->count() === 1 |
|
513 | + ? '<sup><span class="dashicons dashicons-star-filled gold-icon"></span></sup>' |
|
514 | + : ''; |
|
515 | + |
|
516 | + $group_count = ' |
|
517 | 517 | <span class="reg-count-group-size" > |
518 | 518 | ' . sprintf( |
519 | - esc_html__('(%1$s / %2$s)', 'event_espresso'), |
|
520 | - $registration->count(), |
|
521 | - $registration->group_size() |
|
522 | - ) . ' |
|
519 | + esc_html__('(%1$s / %2$s)', 'event_espresso'), |
|
520 | + $registration->count(), |
|
521 | + $registration->group_size() |
|
522 | + ) . ' |
|
523 | 523 | </span >'; |
524 | 524 | |
525 | - $content = ' |
|
525 | + $content = ' |
|
526 | 526 | <div class="ee-layout-row"> |
527 | 527 | <span aria-label="' . $pretty_status . '" |
528 | 528 | class="ee-status-dot ee-status-bg--' . $status . ' ee-aria-tooltip" |
529 | 529 | ></span> |
530 | 530 | ' . $this->viewRegistrationLink($registration, $status) |
531 | - . $prime_reg_star |
|
532 | - . $group_count . ' |
|
531 | + . $prime_reg_star |
|
532 | + . $group_count . ' |
|
533 | 533 | <span class="spacer"></span> |
534 | 534 | <span> |
535 | 535 | ' . sprintf( |
536 | - esc_html__('Reg Code: %s', 'event_espresso'), |
|
537 | - $registration->get('REG_code') |
|
538 | - ) . ' |
|
536 | + esc_html__('Reg Code: %s', 'event_espresso'), |
|
537 | + $registration->get('REG_code') |
|
538 | + ) . ' |
|
539 | 539 | </span> |
540 | 540 | </div>'; |
541 | 541 | |
542 | - $url_params = ['_REG_ID' => $registration->ID()]; |
|
543 | - if ($this->EVT_ID) { |
|
544 | - $url_params['event_id'] = $this->EVT_ID; |
|
545 | - } |
|
546 | - // trash/restore/delete actions |
|
547 | - $actions = $this->trashRegistrationLink($registration, $url_params); |
|
548 | - $actions = $this->restoreRegistrationLink($registration, $url_params, $actions); |
|
549 | - $actions = $this->deleteRegistrationLink($registration, $url_params, $actions); |
|
550 | - |
|
551 | - $content .= $this->row_actions($actions); |
|
552 | - |
|
553 | - return $prep_content ? $this->columnContent('ATT_fname', $content) : $content; |
|
554 | - } |
|
555 | - |
|
556 | - |
|
557 | - /** |
|
558 | - * @param EE_Registration $registration |
|
559 | - * @param bool $prep_content |
|
560 | - * @return string |
|
561 | - * @throws EE_Error |
|
562 | - * @throws ReflectionException |
|
563 | - */ |
|
564 | - public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string |
|
565 | - { |
|
566 | - $this->_set_related_details($registration); |
|
567 | - // Build row actions |
|
568 | - $content = $this->viewTransactionLink( |
|
569 | - $registration->transaction(), |
|
570 | - $registration->get_i18n_datetime('REG_date', 'M jS Y g:i a') |
|
571 | - ); |
|
572 | - return $prep_content ? $this->columnContent('_REG_date', $content) : $content; |
|
573 | - } |
|
574 | - |
|
575 | - |
|
576 | - /** |
|
577 | - * @param EE_Registration $registration |
|
578 | - * @return string |
|
579 | - * @throws EE_Error |
|
580 | - * @throws InvalidArgumentException |
|
581 | - * @throws InvalidDataTypeException |
|
582 | - * @throws InvalidInterfaceException |
|
583 | - * @throws ReflectionException |
|
584 | - */ |
|
585 | - public function column_event_name(EE_Registration $registration): string |
|
586 | - { |
|
587 | - $this->_set_related_details($registration); |
|
588 | - $edit_event = $this->editEventLink($registration); |
|
589 | - $actions['event_filter'] = $this->eventFilterLink($registration); |
|
590 | - return $this->columnContent( |
|
591 | - 'event_name', |
|
592 | - $edit_event . $this->row_actions($actions) |
|
593 | - ); |
|
594 | - } |
|
595 | - |
|
596 | - |
|
597 | - /** |
|
598 | - * @param EE_Registration $registration |
|
599 | - * @return string |
|
600 | - * @throws EE_Error |
|
601 | - * @throws InvalidArgumentException |
|
602 | - * @throws InvalidDataTypeException |
|
603 | - * @throws InvalidInterfaceException |
|
604 | - * @throws ReflectionException |
|
605 | - */ |
|
606 | - public function column_DTT_EVT_start(EE_Registration $registration): string |
|
607 | - { |
|
608 | - $datetime_strings = []; |
|
609 | - $ticket = $registration->ticket(); |
|
610 | - if ($ticket instanceof EE_Ticket) { |
|
611 | - $remove_defaults = ['default_where_conditions' => 'none']; |
|
612 | - $datetimes = $ticket->datetimes($remove_defaults); |
|
613 | - foreach ($datetimes as $datetime) { |
|
614 | - $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a'); |
|
615 | - } |
|
616 | - $content = $this->generateDisplayForDatetimes($datetime_strings); |
|
617 | - } else { |
|
618 | - $content = esc_html__('There is no ticket on this registration', 'event_espresso'); |
|
619 | - } |
|
620 | - return $this->columnContent('DTT_EVT_start', $content); |
|
621 | - } |
|
622 | - |
|
623 | - |
|
624 | - /** |
|
625 | - * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
626 | - * |
|
627 | - * @param array $datetime_strings |
|
628 | - * @return string |
|
629 | - */ |
|
630 | - public function generateDisplayForDatetimes(array $datetime_strings): string |
|
631 | - { |
|
632 | - // get first item for initial visibility |
|
633 | - $content = (string) array_shift($datetime_strings); |
|
634 | - if (! empty($datetime_strings)) { |
|
635 | - $content .= ' |
|
542 | + $url_params = ['_REG_ID' => $registration->ID()]; |
|
543 | + if ($this->EVT_ID) { |
|
544 | + $url_params['event_id'] = $this->EVT_ID; |
|
545 | + } |
|
546 | + // trash/restore/delete actions |
|
547 | + $actions = $this->trashRegistrationLink($registration, $url_params); |
|
548 | + $actions = $this->restoreRegistrationLink($registration, $url_params, $actions); |
|
549 | + $actions = $this->deleteRegistrationLink($registration, $url_params, $actions); |
|
550 | + |
|
551 | + $content .= $this->row_actions($actions); |
|
552 | + |
|
553 | + return $prep_content ? $this->columnContent('ATT_fname', $content) : $content; |
|
554 | + } |
|
555 | + |
|
556 | + |
|
557 | + /** |
|
558 | + * @param EE_Registration $registration |
|
559 | + * @param bool $prep_content |
|
560 | + * @return string |
|
561 | + * @throws EE_Error |
|
562 | + * @throws ReflectionException |
|
563 | + */ |
|
564 | + public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string |
|
565 | + { |
|
566 | + $this->_set_related_details($registration); |
|
567 | + // Build row actions |
|
568 | + $content = $this->viewTransactionLink( |
|
569 | + $registration->transaction(), |
|
570 | + $registration->get_i18n_datetime('REG_date', 'M jS Y g:i a') |
|
571 | + ); |
|
572 | + return $prep_content ? $this->columnContent('_REG_date', $content) : $content; |
|
573 | + } |
|
574 | + |
|
575 | + |
|
576 | + /** |
|
577 | + * @param EE_Registration $registration |
|
578 | + * @return string |
|
579 | + * @throws EE_Error |
|
580 | + * @throws InvalidArgumentException |
|
581 | + * @throws InvalidDataTypeException |
|
582 | + * @throws InvalidInterfaceException |
|
583 | + * @throws ReflectionException |
|
584 | + */ |
|
585 | + public function column_event_name(EE_Registration $registration): string |
|
586 | + { |
|
587 | + $this->_set_related_details($registration); |
|
588 | + $edit_event = $this->editEventLink($registration); |
|
589 | + $actions['event_filter'] = $this->eventFilterLink($registration); |
|
590 | + return $this->columnContent( |
|
591 | + 'event_name', |
|
592 | + $edit_event . $this->row_actions($actions) |
|
593 | + ); |
|
594 | + } |
|
595 | + |
|
596 | + |
|
597 | + /** |
|
598 | + * @param EE_Registration $registration |
|
599 | + * @return string |
|
600 | + * @throws EE_Error |
|
601 | + * @throws InvalidArgumentException |
|
602 | + * @throws InvalidDataTypeException |
|
603 | + * @throws InvalidInterfaceException |
|
604 | + * @throws ReflectionException |
|
605 | + */ |
|
606 | + public function column_DTT_EVT_start(EE_Registration $registration): string |
|
607 | + { |
|
608 | + $datetime_strings = []; |
|
609 | + $ticket = $registration->ticket(); |
|
610 | + if ($ticket instanceof EE_Ticket) { |
|
611 | + $remove_defaults = ['default_where_conditions' => 'none']; |
|
612 | + $datetimes = $ticket->datetimes($remove_defaults); |
|
613 | + foreach ($datetimes as $datetime) { |
|
614 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a'); |
|
615 | + } |
|
616 | + $content = $this->generateDisplayForDatetimes($datetime_strings); |
|
617 | + } else { |
|
618 | + $content = esc_html__('There is no ticket on this registration', 'event_espresso'); |
|
619 | + } |
|
620 | + return $this->columnContent('DTT_EVT_start', $content); |
|
621 | + } |
|
622 | + |
|
623 | + |
|
624 | + /** |
|
625 | + * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
626 | + * |
|
627 | + * @param array $datetime_strings |
|
628 | + * @return string |
|
629 | + */ |
|
630 | + public function generateDisplayForDatetimes(array $datetime_strings): string |
|
631 | + { |
|
632 | + // get first item for initial visibility |
|
633 | + $content = (string) array_shift($datetime_strings); |
|
634 | + if (! empty($datetime_strings)) { |
|
635 | + $content .= ' |
|
636 | 636 | <div class="ee-registration-event-datetimes-container-wrap"> |
637 | 637 | <div class="ee-registration-event-datetimes-container__control"> |
638 | 638 | <span class="tiny-text">' . esc_html__('Click to view additional dates', 'event_espresso') . '</span> |
@@ -646,637 +646,637 @@ discard block |
||
646 | 646 | ' . implode("", $datetime_strings) . ' |
647 | 647 | </div> |
648 | 648 | </div>'; |
649 | - } |
|
650 | - return $content; |
|
651 | - } |
|
652 | - |
|
653 | - |
|
654 | - /** |
|
655 | - * @param EE_Registration $registration |
|
656 | - * @return string |
|
657 | - * @throws EE_Error |
|
658 | - * @throws InvalidArgumentException |
|
659 | - * @throws InvalidDataTypeException |
|
660 | - * @throws InvalidInterfaceException |
|
661 | - * @throws ReflectionException |
|
662 | - */ |
|
663 | - public function column_ATT_email(EE_Registration $registration): string |
|
664 | - { |
|
665 | - $attendee = $registration->get_first_related('Attendee'); |
|
666 | - $content = ! $attendee instanceof EE_Attendee |
|
667 | - ? esc_html__('No attached contact record.', 'event_espresso') |
|
668 | - : $attendee->email(); |
|
669 | - return $this->columnContent('ATT_email', $content); |
|
670 | - } |
|
671 | - |
|
672 | - |
|
673 | - /** |
|
674 | - * @param EE_Registration $registration |
|
675 | - * @return string |
|
676 | - * @throws EE_Error |
|
677 | - * @throws ReflectionException |
|
678 | - */ |
|
679 | - public function column__REG_count(EE_Registration $registration): string |
|
680 | - { |
|
681 | - $content = sprintf( |
|
682 | - esc_html__('%1$s / %2$s', 'event_espresso'), |
|
683 | - $registration->count(), |
|
684 | - $registration->group_size() |
|
685 | - ); |
|
686 | - return $this->columnContent('_REG_count', $content); |
|
687 | - } |
|
688 | - |
|
689 | - |
|
690 | - /** |
|
691 | - * @param EE_Registration $registration |
|
692 | - * @return string |
|
693 | - * @throws EE_Error |
|
694 | - * @throws ReflectionException |
|
695 | - */ |
|
696 | - public function column_REG_ticket(EE_Registration $registration): string |
|
697 | - { |
|
698 | - $ticket = $registration->ticket(); |
|
699 | - $ticket_name = $this->ticketName($ticket); |
|
700 | - $actions['ticket_filter'] = $this->ticketFilterLink($ticket); |
|
701 | - return $this->columnContent( |
|
702 | - 'REG_ticket', |
|
703 | - $ticket_name . $this->row_actions($actions) |
|
704 | - ); |
|
705 | - } |
|
706 | - |
|
707 | - |
|
708 | - /** |
|
709 | - * @param EE_Registration $registration |
|
710 | - * @return string |
|
711 | - * @throws EE_Error |
|
712 | - * @throws ReflectionException |
|
713 | - */ |
|
714 | - public function column__REG_final_price(EE_Registration $registration): string |
|
715 | - { |
|
716 | - // free ticket? |
|
717 | - $content = $registration->final_price() > 0 |
|
718 | - ? '<span class="reg-overview-paid-event-spn">' . $registration->pretty_final_price() . '</span>' |
|
719 | - : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>'; |
|
720 | - return $this->columnContent( '_REG_final_price', $content, 'end' ); |
|
721 | - } |
|
722 | - |
|
723 | - |
|
724 | - /** |
|
725 | - * @param EE_Registration $registration |
|
726 | - * @return string |
|
727 | - * @throws EE_Error |
|
728 | - * @throws ReflectionException |
|
729 | - */ |
|
730 | - public function column__REG_paid(EE_Registration $registration): string |
|
731 | - { |
|
732 | - $payment_method = $registration->payment_method(); |
|
733 | - $payment_method_name = $payment_method instanceof EE_Payment_Method |
|
734 | - ? $payment_method->admin_name() |
|
735 | - : esc_html__('Unknown', 'event_espresso'); |
|
736 | - |
|
737 | - $payment_status = RegStatus::PENDING_PAYMENT; |
|
738 | - $content = '<span>'; |
|
739 | - $icon = ''; |
|
740 | - $label = esc_attr__('pending payment', 'event_espresso'); |
|
741 | - if ($registration->paid() == $registration->final_price()) { |
|
742 | - $icon = '<span class="dashicons dashicons-yes green-icon"></span> '; |
|
743 | - $label = esc_attr__('paid in full', 'event_espresso'); |
|
744 | - $payment_status = RegStatus::APPROVED; |
|
745 | - } |
|
746 | - if ($registration->paid() > $registration->final_price()) { |
|
747 | - $icon = '<span class="dashicons dashicons-warning orange-icon"></span> '; |
|
748 | - $label = esc_attr__('overpaid', 'event_espresso'); |
|
749 | - $payment_status = EEM_Transaction::overpaid_status_code; |
|
750 | - } |
|
751 | - $content .= ' |
|
649 | + } |
|
650 | + return $content; |
|
651 | + } |
|
652 | + |
|
653 | + |
|
654 | + /** |
|
655 | + * @param EE_Registration $registration |
|
656 | + * @return string |
|
657 | + * @throws EE_Error |
|
658 | + * @throws InvalidArgumentException |
|
659 | + * @throws InvalidDataTypeException |
|
660 | + * @throws InvalidInterfaceException |
|
661 | + * @throws ReflectionException |
|
662 | + */ |
|
663 | + public function column_ATT_email(EE_Registration $registration): string |
|
664 | + { |
|
665 | + $attendee = $registration->get_first_related('Attendee'); |
|
666 | + $content = ! $attendee instanceof EE_Attendee |
|
667 | + ? esc_html__('No attached contact record.', 'event_espresso') |
|
668 | + : $attendee->email(); |
|
669 | + return $this->columnContent('ATT_email', $content); |
|
670 | + } |
|
671 | + |
|
672 | + |
|
673 | + /** |
|
674 | + * @param EE_Registration $registration |
|
675 | + * @return string |
|
676 | + * @throws EE_Error |
|
677 | + * @throws ReflectionException |
|
678 | + */ |
|
679 | + public function column__REG_count(EE_Registration $registration): string |
|
680 | + { |
|
681 | + $content = sprintf( |
|
682 | + esc_html__('%1$s / %2$s', 'event_espresso'), |
|
683 | + $registration->count(), |
|
684 | + $registration->group_size() |
|
685 | + ); |
|
686 | + return $this->columnContent('_REG_count', $content); |
|
687 | + } |
|
688 | + |
|
689 | + |
|
690 | + /** |
|
691 | + * @param EE_Registration $registration |
|
692 | + * @return string |
|
693 | + * @throws EE_Error |
|
694 | + * @throws ReflectionException |
|
695 | + */ |
|
696 | + public function column_REG_ticket(EE_Registration $registration): string |
|
697 | + { |
|
698 | + $ticket = $registration->ticket(); |
|
699 | + $ticket_name = $this->ticketName($ticket); |
|
700 | + $actions['ticket_filter'] = $this->ticketFilterLink($ticket); |
|
701 | + return $this->columnContent( |
|
702 | + 'REG_ticket', |
|
703 | + $ticket_name . $this->row_actions($actions) |
|
704 | + ); |
|
705 | + } |
|
706 | + |
|
707 | + |
|
708 | + /** |
|
709 | + * @param EE_Registration $registration |
|
710 | + * @return string |
|
711 | + * @throws EE_Error |
|
712 | + * @throws ReflectionException |
|
713 | + */ |
|
714 | + public function column__REG_final_price(EE_Registration $registration): string |
|
715 | + { |
|
716 | + // free ticket? |
|
717 | + $content = $registration->final_price() > 0 |
|
718 | + ? '<span class="reg-overview-paid-event-spn">' . $registration->pretty_final_price() . '</span>' |
|
719 | + : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>'; |
|
720 | + return $this->columnContent( '_REG_final_price', $content, 'end' ); |
|
721 | + } |
|
722 | + |
|
723 | + |
|
724 | + /** |
|
725 | + * @param EE_Registration $registration |
|
726 | + * @return string |
|
727 | + * @throws EE_Error |
|
728 | + * @throws ReflectionException |
|
729 | + */ |
|
730 | + public function column__REG_paid(EE_Registration $registration): string |
|
731 | + { |
|
732 | + $payment_method = $registration->payment_method(); |
|
733 | + $payment_method_name = $payment_method instanceof EE_Payment_Method |
|
734 | + ? $payment_method->admin_name() |
|
735 | + : esc_html__('Unknown', 'event_espresso'); |
|
736 | + |
|
737 | + $payment_status = RegStatus::PENDING_PAYMENT; |
|
738 | + $content = '<span>'; |
|
739 | + $icon = ''; |
|
740 | + $label = esc_attr__('pending payment', 'event_espresso'); |
|
741 | + if ($registration->paid() == $registration->final_price()) { |
|
742 | + $icon = '<span class="dashicons dashicons-yes green-icon"></span> '; |
|
743 | + $label = esc_attr__('paid in full', 'event_espresso'); |
|
744 | + $payment_status = RegStatus::APPROVED; |
|
745 | + } |
|
746 | + if ($registration->paid() > $registration->final_price()) { |
|
747 | + $icon = '<span class="dashicons dashicons-warning orange-icon"></span> '; |
|
748 | + $label = esc_attr__('overpaid', 'event_espresso'); |
|
749 | + $payment_status = EEM_Transaction::overpaid_status_code; |
|
750 | + } |
|
751 | + $content .= ' |
|
752 | 752 | <span class="reg-overview-paid-event-spn ee-aria-tooltip ee-status-color--' . $payment_status . '" |
753 | 753 | aria-label="' . $label . '" |
754 | 754 | > |
755 | 755 | ' . $icon . $registration->pretty_paid('no_currency_code') . ' |
756 | 756 | </span> |
757 | 757 | </span>'; |
758 | - if ($registration->paid() > 0) { |
|
759 | - $content .= ' |
|
758 | + if ($registration->paid() > 0) { |
|
759 | + $content .= ' |
|
760 | 760 | <span class="ee-status-text-small"> |
761 | 761 | ' . sprintf( |
762 | - esc_html__('...via %s', 'event_espresso'), |
|
763 | - $payment_method_name |
|
764 | - ) . ' |
|
762 | + esc_html__('...via %s', 'event_espresso'), |
|
763 | + $payment_method_name |
|
764 | + ) . ' |
|
765 | 765 | </span>'; |
766 | - } |
|
767 | - return $this->columnContent('_REG_paid', $content, 'end', 'stack'); |
|
768 | - } |
|
769 | - |
|
770 | - |
|
771 | - /** |
|
772 | - * @param EE_Registration $registration |
|
773 | - * @return string |
|
774 | - * @throws EE_Error |
|
775 | - * @throws EntityNotFoundException |
|
776 | - * @throws InvalidArgumentException |
|
777 | - * @throws InvalidDataTypeException |
|
778 | - * @throws InvalidInterfaceException |
|
779 | - * @throws ReflectionException |
|
780 | - */ |
|
781 | - public function column_TXN_total(EE_Registration $registration): string |
|
782 | - { |
|
783 | - $content = ''; |
|
784 | - if ($registration->count() === 1) { |
|
785 | - $transaction = $registration->transaction(); |
|
786 | - $content = ' |
|
766 | + } |
|
767 | + return $this->columnContent('_REG_paid', $content, 'end', 'stack'); |
|
768 | + } |
|
769 | + |
|
770 | + |
|
771 | + /** |
|
772 | + * @param EE_Registration $registration |
|
773 | + * @return string |
|
774 | + * @throws EE_Error |
|
775 | + * @throws EntityNotFoundException |
|
776 | + * @throws InvalidArgumentException |
|
777 | + * @throws InvalidDataTypeException |
|
778 | + * @throws InvalidInterfaceException |
|
779 | + * @throws ReflectionException |
|
780 | + */ |
|
781 | + public function column_TXN_total(EE_Registration $registration): string |
|
782 | + { |
|
783 | + $content = ''; |
|
784 | + if ($registration->count() === 1) { |
|
785 | + $transaction = $registration->transaction(); |
|
786 | + $content = ' |
|
787 | 787 | <span class="ee-status-color--' . $transaction->status_ID() . '"> |
788 | 788 | ' . $transaction->pretty_paid('no_currency_code') . ' |
789 | 789 | <span class="separator">/</span> |
790 | 790 | ' . $transaction->pretty_total('no_currency_code') . ' |
791 | 791 | </span>'; |
792 | 792 | |
793 | - $content .= '<span class="row-actions">' . $this->viewTransactionLink($transaction) . '</span>'; |
|
794 | - } |
|
795 | - return $this->columnContent('TXN_total', $content, 'end', 'stack'); |
|
796 | - } |
|
797 | - |
|
798 | - |
|
799 | - /** |
|
800 | - * @param EE_Registration $registration |
|
801 | - * @return string |
|
802 | - * @throws EE_Error |
|
803 | - * @throws InvalidArgumentException |
|
804 | - * @throws InvalidDataTypeException |
|
805 | - * @throws InvalidInterfaceException |
|
806 | - * @throws ReflectionException |
|
807 | - */ |
|
808 | - public function column_actions(EE_Registration $registration): string |
|
809 | - { |
|
810 | - $attendee = $registration->attendee(); |
|
811 | - $this->_set_related_details($registration); |
|
812 | - |
|
813 | - // Build and filter row actions |
|
814 | - $actions = apply_filters( |
|
815 | - 'FHEE__EE_Registrations_List_Table__column_actions__actions', |
|
816 | - [ |
|
817 | - 'view_lnk' => $this->viewRegistrationAction($registration), |
|
818 | - 'edit_lnk' => $this->editContactAction($registration, $attendee), |
|
819 | - 'resend_reg_lnk' => $this->resendRegistrationMessageAction($registration, $attendee), |
|
820 | - 'view_txn_lnk' => $this->viewTransactionAction($registration->transaction()), |
|
821 | - 'dl_invoice_lnk' => $this->viewTransactionInvoiceAction($registration, $attendee), |
|
822 | - 'filtered_messages_link' => $this->viewNotificationsAction($registration), |
|
823 | - ], |
|
824 | - $registration, |
|
825 | - $this |
|
826 | - ); |
|
827 | - |
|
828 | - $content = $this->_action_string( |
|
829 | - implode('', $actions), |
|
830 | - $registration, |
|
831 | - 'div', |
|
832 | - 'reg-overview-actions ee-list-table-actions' |
|
833 | - ); |
|
834 | - |
|
835 | - return $this->columnContent('actions', $this->actionsModalMenu($content)); |
|
836 | - } |
|
837 | - |
|
838 | - |
|
839 | - /** |
|
840 | - * @throws EE_Error |
|
841 | - * @throws ReflectionException |
|
842 | - */ |
|
843 | - protected function viewRegistrationUrl(EE_Registration $registration): string |
|
844 | - { |
|
845 | - return EE_Admin_Page::add_query_args_and_nonce( |
|
846 | - [ |
|
847 | - 'action' => 'view_registration', |
|
848 | - '_REG_ID' => $registration->ID(), |
|
849 | - ], |
|
850 | - REG_ADMIN_URL |
|
851 | - ); |
|
852 | - } |
|
853 | - |
|
854 | - |
|
855 | - /** |
|
856 | - * @throws EE_Error |
|
857 | - * @throws ReflectionException |
|
858 | - */ |
|
859 | - protected function viewRegistrationLink( |
|
860 | - EE_Registration $registration, |
|
861 | - string $status |
|
862 | - ): string { |
|
863 | - $attendee = $registration->attendee(); |
|
864 | - $attendee_name = $attendee instanceof EE_Attendee |
|
865 | - ? $attendee->full_name() |
|
866 | - : ''; |
|
867 | - return $this->caps_handler->userCanReadRegistration($registration) |
|
868 | - ? ' |
|
793 | + $content .= '<span class="row-actions">' . $this->viewTransactionLink($transaction) . '</span>'; |
|
794 | + } |
|
795 | + return $this->columnContent('TXN_total', $content, 'end', 'stack'); |
|
796 | + } |
|
797 | + |
|
798 | + |
|
799 | + /** |
|
800 | + * @param EE_Registration $registration |
|
801 | + * @return string |
|
802 | + * @throws EE_Error |
|
803 | + * @throws InvalidArgumentException |
|
804 | + * @throws InvalidDataTypeException |
|
805 | + * @throws InvalidInterfaceException |
|
806 | + * @throws ReflectionException |
|
807 | + */ |
|
808 | + public function column_actions(EE_Registration $registration): string |
|
809 | + { |
|
810 | + $attendee = $registration->attendee(); |
|
811 | + $this->_set_related_details($registration); |
|
812 | + |
|
813 | + // Build and filter row actions |
|
814 | + $actions = apply_filters( |
|
815 | + 'FHEE__EE_Registrations_List_Table__column_actions__actions', |
|
816 | + [ |
|
817 | + 'view_lnk' => $this->viewRegistrationAction($registration), |
|
818 | + 'edit_lnk' => $this->editContactAction($registration, $attendee), |
|
819 | + 'resend_reg_lnk' => $this->resendRegistrationMessageAction($registration, $attendee), |
|
820 | + 'view_txn_lnk' => $this->viewTransactionAction($registration->transaction()), |
|
821 | + 'dl_invoice_lnk' => $this->viewTransactionInvoiceAction($registration, $attendee), |
|
822 | + 'filtered_messages_link' => $this->viewNotificationsAction($registration), |
|
823 | + ], |
|
824 | + $registration, |
|
825 | + $this |
|
826 | + ); |
|
827 | + |
|
828 | + $content = $this->_action_string( |
|
829 | + implode('', $actions), |
|
830 | + $registration, |
|
831 | + 'div', |
|
832 | + 'reg-overview-actions ee-list-table-actions' |
|
833 | + ); |
|
834 | + |
|
835 | + return $this->columnContent('actions', $this->actionsModalMenu($content)); |
|
836 | + } |
|
837 | + |
|
838 | + |
|
839 | + /** |
|
840 | + * @throws EE_Error |
|
841 | + * @throws ReflectionException |
|
842 | + */ |
|
843 | + protected function viewRegistrationUrl(EE_Registration $registration): string |
|
844 | + { |
|
845 | + return EE_Admin_Page::add_query_args_and_nonce( |
|
846 | + [ |
|
847 | + 'action' => 'view_registration', |
|
848 | + '_REG_ID' => $registration->ID(), |
|
849 | + ], |
|
850 | + REG_ADMIN_URL |
|
851 | + ); |
|
852 | + } |
|
853 | + |
|
854 | + |
|
855 | + /** |
|
856 | + * @throws EE_Error |
|
857 | + * @throws ReflectionException |
|
858 | + */ |
|
859 | + protected function viewRegistrationLink( |
|
860 | + EE_Registration $registration, |
|
861 | + string $status |
|
862 | + ): string { |
|
863 | + $attendee = $registration->attendee(); |
|
864 | + $attendee_name = $attendee instanceof EE_Attendee |
|
865 | + ? $attendee->full_name() |
|
866 | + : ''; |
|
867 | + return $this->caps_handler->userCanReadRegistration($registration) |
|
868 | + ? ' |
|
869 | 869 | <a href="' . $this->viewRegistrationUrl($registration) . '" |
870 | 870 | class="row-title ee-status-color--' . $status . ' ee-aria-tooltip" |
871 | 871 | aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '" |
872 | 872 | > |
873 | 873 | ' . $attendee_name . ' |
874 | 874 | </a>' |
875 | - : $attendee_name; |
|
876 | - } |
|
877 | - |
|
878 | - |
|
879 | - /** |
|
880 | - * @throws EE_Error |
|
881 | - * @throws ReflectionException |
|
882 | - */ |
|
883 | - protected function viewRegistrationAction(EE_Registration $registration): string |
|
884 | - { |
|
885 | - return $this->caps_handler->userCanReadRegistration($registration) |
|
886 | - ? ' |
|
875 | + : $attendee_name; |
|
876 | + } |
|
877 | + |
|
878 | + |
|
879 | + /** |
|
880 | + * @throws EE_Error |
|
881 | + * @throws ReflectionException |
|
882 | + */ |
|
883 | + protected function viewRegistrationAction(EE_Registration $registration): string |
|
884 | + { |
|
885 | + return $this->caps_handler->userCanReadRegistration($registration) |
|
886 | + ? ' |
|
887 | 887 | <a href="' . $this->viewRegistrationUrl($registration) . '" |
888 | 888 | class="ee-aria-tooltip button button--icon-only" |
889 | 889 | aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '" |
890 | 890 | > |
891 | 891 | <span class="dashicons dashicons-clipboard"></span> |
892 | 892 | </a>' |
893 | - : ''; |
|
894 | - } |
|
895 | - |
|
896 | - |
|
897 | - protected function editContactAction(EE_Registration $registration, ?EE_Attendee $attendee = null): string |
|
898 | - { |
|
899 | - if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanEditContacts()) { |
|
900 | - $edit_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
901 | - [ |
|
902 | - 'action' => 'edit_attendee', |
|
903 | - 'post' => $registration->attendee_ID(), |
|
904 | - ], |
|
905 | - REG_ADMIN_URL |
|
906 | - ); |
|
907 | - return ' |
|
893 | + : ''; |
|
894 | + } |
|
895 | + |
|
896 | + |
|
897 | + protected function editContactAction(EE_Registration $registration, ?EE_Attendee $attendee = null): string |
|
898 | + { |
|
899 | + if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanEditContacts()) { |
|
900 | + $edit_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
901 | + [ |
|
902 | + 'action' => 'edit_attendee', |
|
903 | + 'post' => $registration->attendee_ID(), |
|
904 | + ], |
|
905 | + REG_ADMIN_URL |
|
906 | + ); |
|
907 | + return ' |
|
908 | 908 | <a href="' . $edit_link_url . '" |
909 | 909 | aria-label="' . esc_attr__('Edit Contact Details', 'event_espresso') . '" |
910 | 910 | class="ee-aria-tooltip button button--secondary button--icon-only" |
911 | 911 | > |
912 | 912 | <span class="dashicons dashicons-admin-users"></span> |
913 | 913 | </a>'; |
914 | - } |
|
915 | - return ''; |
|
916 | - } |
|
917 | - |
|
918 | - |
|
919 | - /** |
|
920 | - * @throws EE_Error |
|
921 | - * @throws ReflectionException |
|
922 | - */ |
|
923 | - protected function resendRegistrationMessageAction( |
|
924 | - EE_Registration $registration, |
|
925 | - ?EE_Attendee $attendee = null |
|
926 | - ): string { |
|
927 | - if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanResendMessage($registration)) { |
|
928 | - $resend_reg_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
929 | - [ |
|
930 | - 'action' => 'resend_registration', |
|
931 | - '_REG_ID' => $registration->ID(), |
|
932 | - ], |
|
933 | - REG_ADMIN_URL, |
|
934 | - true |
|
935 | - ); |
|
936 | - return ' |
|
914 | + } |
|
915 | + return ''; |
|
916 | + } |
|
917 | + |
|
918 | + |
|
919 | + /** |
|
920 | + * @throws EE_Error |
|
921 | + * @throws ReflectionException |
|
922 | + */ |
|
923 | + protected function resendRegistrationMessageAction( |
|
924 | + EE_Registration $registration, |
|
925 | + ?EE_Attendee $attendee = null |
|
926 | + ): string { |
|
927 | + if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanResendMessage($registration)) { |
|
928 | + $resend_reg_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
929 | + [ |
|
930 | + 'action' => 'resend_registration', |
|
931 | + '_REG_ID' => $registration->ID(), |
|
932 | + ], |
|
933 | + REG_ADMIN_URL, |
|
934 | + true |
|
935 | + ); |
|
936 | + return ' |
|
937 | 937 | <a href="' . $resend_reg_link_url . '" aria-label="' |
938 | - . esc_attr__('Resend Registration Details', 'event_espresso') |
|
939 | - . '" class="ee-aria-tooltip button button--icon-only"> |
|
938 | + . esc_attr__('Resend Registration Details', 'event_espresso') |
|
939 | + . '" class="ee-aria-tooltip button button--icon-only"> |
|
940 | 940 | <span class="dashicons dashicons-email-alt"></span> |
941 | 941 | </a>'; |
942 | - } |
|
943 | - return ''; |
|
944 | - } |
|
945 | - |
|
946 | - |
|
947 | - /** |
|
948 | - * @param EE_Transaction $transaction |
|
949 | - * @return string |
|
950 | - * @throws EE_Error |
|
951 | - * @throws ReflectionException |
|
952 | - */ |
|
953 | - protected function viewTransactionUrl(EE_Transaction $transaction): string |
|
954 | - { |
|
955 | - return EE_Admin_Page::add_query_args_and_nonce( |
|
956 | - [ |
|
957 | - 'action' => 'view_transaction', |
|
958 | - 'TXN_ID' => $transaction->ID(), |
|
959 | - ], |
|
960 | - TXN_ADMIN_URL |
|
961 | - ); |
|
962 | - } |
|
963 | - |
|
964 | - |
|
965 | - /** |
|
966 | - * @param EE_Transaction $transaction |
|
967 | - * @param string $link_text |
|
968 | - * @return string |
|
969 | - * @throws EE_Error |
|
970 | - * @throws ReflectionException |
|
971 | - * @since 5.0.18.p |
|
972 | - */ |
|
973 | - protected function viewTransactionLink(EE_Transaction $transaction, string $link_text = ''): string |
|
974 | - { |
|
975 | - if ($this->caps_handler->userCanViewTransaction()) { |
|
976 | - $link_text = $link_text ?: '<span class="dashicons dashicons-cart"></span> ' |
|
977 | - . esc_html__('View Transaction', 'event_espresso'); |
|
978 | - return ' |
|
942 | + } |
|
943 | + return ''; |
|
944 | + } |
|
945 | + |
|
946 | + |
|
947 | + /** |
|
948 | + * @param EE_Transaction $transaction |
|
949 | + * @return string |
|
950 | + * @throws EE_Error |
|
951 | + * @throws ReflectionException |
|
952 | + */ |
|
953 | + protected function viewTransactionUrl(EE_Transaction $transaction): string |
|
954 | + { |
|
955 | + return EE_Admin_Page::add_query_args_and_nonce( |
|
956 | + [ |
|
957 | + 'action' => 'view_transaction', |
|
958 | + 'TXN_ID' => $transaction->ID(), |
|
959 | + ], |
|
960 | + TXN_ADMIN_URL |
|
961 | + ); |
|
962 | + } |
|
963 | + |
|
964 | + |
|
965 | + /** |
|
966 | + * @param EE_Transaction $transaction |
|
967 | + * @param string $link_text |
|
968 | + * @return string |
|
969 | + * @throws EE_Error |
|
970 | + * @throws ReflectionException |
|
971 | + * @since 5.0.18.p |
|
972 | + */ |
|
973 | + protected function viewTransactionLink(EE_Transaction $transaction, string $link_text = ''): string |
|
974 | + { |
|
975 | + if ($this->caps_handler->userCanViewTransaction()) { |
|
976 | + $link_text = $link_text ?: '<span class="dashicons dashicons-cart"></span> ' |
|
977 | + . esc_html__('View Transaction', 'event_espresso'); |
|
978 | + return ' |
|
979 | 979 | <a class="ee-reg-list-txn-link ee-aria-tooltip ee-status-color--' . $transaction->status_ID() . '" |
980 | 980 | href="' . $this->viewTransactionUrl($transaction) . '" |
981 | 981 | aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '" |
982 | 982 | > |
983 | 983 | ' . $link_text . ' |
984 | 984 | </a>'; |
985 | - } |
|
986 | - return $link_text; |
|
987 | - } |
|
988 | - |
|
989 | - |
|
990 | - /** |
|
991 | - * @param EE_Transaction $transaction |
|
992 | - * @return string |
|
993 | - * @throws EE_Error |
|
994 | - * @throws ReflectionException |
|
995 | - */ |
|
996 | - protected function viewTransactionAction(EE_Transaction $transaction): string |
|
997 | - { |
|
998 | - if ($this->caps_handler->userCanViewTransaction()) { |
|
999 | - return ' |
|
985 | + } |
|
986 | + return $link_text; |
|
987 | + } |
|
988 | + |
|
989 | + |
|
990 | + /** |
|
991 | + * @param EE_Transaction $transaction |
|
992 | + * @return string |
|
993 | + * @throws EE_Error |
|
994 | + * @throws ReflectionException |
|
995 | + */ |
|
996 | + protected function viewTransactionAction(EE_Transaction $transaction): string |
|
997 | + { |
|
998 | + if ($this->caps_handler->userCanViewTransaction()) { |
|
999 | + return ' |
|
1000 | 1000 | <a class="ee-aria-tooltip button button--icon-only" |
1001 | 1001 | href="' . $this->viewTransactionUrl($transaction) . '" |
1002 | 1002 | aria-label="' . sprintf( |
1003 | - esc_html__('View Transaction Details (%s)', 'event_espresso'), |
|
1004 | - EEH_Template::pretty_status($transaction->status_ID(), false, 'sentence') |
|
1005 | - ) . '" |
|
1003 | + esc_html__('View Transaction Details (%s)', 'event_espresso'), |
|
1004 | + EEH_Template::pretty_status($transaction->status_ID(), false, 'sentence') |
|
1005 | + ) . '" |
|
1006 | 1006 | > |
1007 | 1007 | <span class="dashicons dashicons-cart"></span> |
1008 | 1008 | </a>'; |
1009 | - } |
|
1010 | - return ''; |
|
1011 | - } |
|
1012 | - |
|
1013 | - |
|
1014 | - /** |
|
1015 | - * @throws EE_Error |
|
1016 | - * @throws ReflectionException |
|
1017 | - */ |
|
1018 | - protected function viewTransactionInvoiceAction( |
|
1019 | - EE_Registration $registration, |
|
1020 | - ?EE_Attendee $attendee = null |
|
1021 | - ): string { |
|
1022 | - // only show invoice link if message type is active. |
|
1023 | - if ( |
|
1024 | - $attendee instanceof EE_Attendee |
|
1025 | - && $registration->is_primary_registrant() |
|
1026 | - && EEH_MSG_Template::is_mt_active('invoice') |
|
1027 | - ) { |
|
1028 | - return ' |
|
1009 | + } |
|
1010 | + return ''; |
|
1011 | + } |
|
1012 | + |
|
1013 | + |
|
1014 | + /** |
|
1015 | + * @throws EE_Error |
|
1016 | + * @throws ReflectionException |
|
1017 | + */ |
|
1018 | + protected function viewTransactionInvoiceAction( |
|
1019 | + EE_Registration $registration, |
|
1020 | + ?EE_Attendee $attendee = null |
|
1021 | + ): string { |
|
1022 | + // only show invoice link if message type is active. |
|
1023 | + if ( |
|
1024 | + $attendee instanceof EE_Attendee |
|
1025 | + && $registration->is_primary_registrant() |
|
1026 | + && EEH_MSG_Template::is_mt_active('invoice') |
|
1027 | + ) { |
|
1028 | + return ' |
|
1029 | 1029 | <a aria-label="' . esc_attr__('View Transaction Invoice', 'event_espresso') |
1030 | - . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only"> |
|
1030 | + . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only"> |
|
1031 | 1031 | <span class="dashicons dashicons-media-spreadsheet"></span> |
1032 | 1032 | </a>'; |
1033 | - } |
|
1034 | - return ''; |
|
1035 | - } |
|
1036 | - |
|
1037 | - |
|
1038 | - /** |
|
1039 | - * @throws ReflectionException |
|
1040 | - * @throws EE_Error |
|
1041 | - */ |
|
1042 | - protected function viewNotificationsAction(EE_Registration $registration): string |
|
1043 | - { |
|
1044 | - // message list table link (filtered by REG_ID |
|
1045 | - return $this->caps_handler->userCanReadGlobalMessages() |
|
1046 | - ? EEH_MSG_Template::get_message_action_link( |
|
1047 | - 'see_notifications_for', |
|
1048 | - null, |
|
1049 | - ['_REG_ID' => $registration->ID()] |
|
1050 | - ) |
|
1051 | - : ''; |
|
1052 | - } |
|
1053 | - |
|
1054 | - |
|
1055 | - /** |
|
1056 | - * @throws EE_Error |
|
1057 | - * @throws ReflectionException |
|
1058 | - */ |
|
1059 | - protected function trashRegistrationLink( |
|
1060 | - EE_Registration $registration, |
|
1061 | - array $url_params |
|
1062 | - ): array { |
|
1063 | - $actions = []; |
|
1064 | - // can't trash what's already trashed |
|
1065 | - if ($this->_view === 'trash') { |
|
1066 | - return $actions; |
|
1067 | - } |
|
1068 | - |
|
1069 | - // check caps |
|
1070 | - if (! $this->caps_handler->userCanTrashRegistration($registration)) { |
|
1071 | - return $actions; |
|
1072 | - } |
|
1073 | - |
|
1074 | - // don't delete registrations that have payments applied |
|
1075 | - $transaction = $registration->transaction(); |
|
1076 | - $payment_count = $transaction instanceof EE_Transaction |
|
1077 | - ? $transaction->count_related('Payment') |
|
1078 | - : 0; |
|
1079 | - |
|
1080 | - if ($payment_count > 0) { |
|
1081 | - return $actions; |
|
1082 | - } |
|
1083 | - |
|
1084 | - $url_params['action'] = 'trash_registrations'; |
|
1085 | - $trash_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1086 | - $actions['trash'] = ' |
|
1033 | + } |
|
1034 | + return ''; |
|
1035 | + } |
|
1036 | + |
|
1037 | + |
|
1038 | + /** |
|
1039 | + * @throws ReflectionException |
|
1040 | + * @throws EE_Error |
|
1041 | + */ |
|
1042 | + protected function viewNotificationsAction(EE_Registration $registration): string |
|
1043 | + { |
|
1044 | + // message list table link (filtered by REG_ID |
|
1045 | + return $this->caps_handler->userCanReadGlobalMessages() |
|
1046 | + ? EEH_MSG_Template::get_message_action_link( |
|
1047 | + 'see_notifications_for', |
|
1048 | + null, |
|
1049 | + ['_REG_ID' => $registration->ID()] |
|
1050 | + ) |
|
1051 | + : ''; |
|
1052 | + } |
|
1053 | + |
|
1054 | + |
|
1055 | + /** |
|
1056 | + * @throws EE_Error |
|
1057 | + * @throws ReflectionException |
|
1058 | + */ |
|
1059 | + protected function trashRegistrationLink( |
|
1060 | + EE_Registration $registration, |
|
1061 | + array $url_params |
|
1062 | + ): array { |
|
1063 | + $actions = []; |
|
1064 | + // can't trash what's already trashed |
|
1065 | + if ($this->_view === 'trash') { |
|
1066 | + return $actions; |
|
1067 | + } |
|
1068 | + |
|
1069 | + // check caps |
|
1070 | + if (! $this->caps_handler->userCanTrashRegistration($registration)) { |
|
1071 | + return $actions; |
|
1072 | + } |
|
1073 | + |
|
1074 | + // don't delete registrations that have payments applied |
|
1075 | + $transaction = $registration->transaction(); |
|
1076 | + $payment_count = $transaction instanceof EE_Transaction |
|
1077 | + ? $transaction->count_related('Payment') |
|
1078 | + : 0; |
|
1079 | + |
|
1080 | + if ($payment_count > 0) { |
|
1081 | + return $actions; |
|
1082 | + } |
|
1083 | + |
|
1084 | + $url_params['action'] = 'trash_registrations'; |
|
1085 | + $trash_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1086 | + $actions['trash'] = ' |
|
1087 | 1087 | <a class="ee-aria-tooltip" |
1088 | 1088 | href="' . $trash_link_url . '" |
1089 | 1089 | aria-label="' . esc_attr__('Trash Registration', 'event_espresso') . '" |
1090 | 1090 | > |
1091 | 1091 | ' . esc_html__('Trash', 'event_espresso') . ' |
1092 | 1092 | </a>'; |
1093 | - return $actions; |
|
1094 | - } |
|
1095 | - |
|
1096 | - |
|
1097 | - /** |
|
1098 | - * @throws EE_Error |
|
1099 | - * @throws ReflectionException |
|
1100 | - */ |
|
1101 | - protected function restoreRegistrationLink( |
|
1102 | - EE_Registration $registration, |
|
1103 | - array $url_params, |
|
1104 | - array $actions |
|
1105 | - ): array { |
|
1106 | - // can't restore what's not trashed |
|
1107 | - if ($this->_view !== 'trash') { |
|
1108 | - return $actions; |
|
1109 | - } |
|
1110 | - |
|
1111 | - // restore registration link |
|
1112 | - if ($this->caps_handler->userCanRestoreRegistration($registration)) { |
|
1113 | - $url_params['action'] = 'restore_registrations'; |
|
1114 | - $restore_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1115 | - $actions['restore'] = ' |
|
1093 | + return $actions; |
|
1094 | + } |
|
1095 | + |
|
1096 | + |
|
1097 | + /** |
|
1098 | + * @throws EE_Error |
|
1099 | + * @throws ReflectionException |
|
1100 | + */ |
|
1101 | + protected function restoreRegistrationLink( |
|
1102 | + EE_Registration $registration, |
|
1103 | + array $url_params, |
|
1104 | + array $actions |
|
1105 | + ): array { |
|
1106 | + // can't restore what's not trashed |
|
1107 | + if ($this->_view !== 'trash') { |
|
1108 | + return $actions; |
|
1109 | + } |
|
1110 | + |
|
1111 | + // restore registration link |
|
1112 | + if ($this->caps_handler->userCanRestoreRegistration($registration)) { |
|
1113 | + $url_params['action'] = 'restore_registrations'; |
|
1114 | + $restore_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1115 | + $actions['restore'] = ' |
|
1116 | 1116 | <a class="ee-aria-tooltip" |
1117 | 1117 | href="' . $restore_link_url . '" |
1118 | 1118 | aria-label="' . esc_attr__('Restore Registration', 'event_espresso') . '" |
1119 | 1119 | > |
1120 | 1120 | ' . esc_html__('Restore', 'event_espresso') . ' |
1121 | 1121 | </a>'; |
1122 | - } |
|
1123 | - |
|
1124 | - return $actions; |
|
1125 | - } |
|
1126 | - |
|
1127 | - |
|
1128 | - /** |
|
1129 | - * @throws EE_Error |
|
1130 | - * @throws ReflectionException |
|
1131 | - */ |
|
1132 | - protected function deleteRegistrationLink( |
|
1133 | - EE_Registration $registration, |
|
1134 | - array $url_params, |
|
1135 | - array $actions |
|
1136 | - ): array { |
|
1137 | - if ($this->_view === 'trash' && $this->caps_handler->userCanDeleteRegistration($registration)) { |
|
1138 | - $url_params['action'] = 'delete_registrations'; |
|
1139 | - $delete_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1140 | - $actions['delete'] = ' |
|
1122 | + } |
|
1123 | + |
|
1124 | + return $actions; |
|
1125 | + } |
|
1126 | + |
|
1127 | + |
|
1128 | + /** |
|
1129 | + * @throws EE_Error |
|
1130 | + * @throws ReflectionException |
|
1131 | + */ |
|
1132 | + protected function deleteRegistrationLink( |
|
1133 | + EE_Registration $registration, |
|
1134 | + array $url_params, |
|
1135 | + array $actions |
|
1136 | + ): array { |
|
1137 | + if ($this->_view === 'trash' && $this->caps_handler->userCanDeleteRegistration($registration)) { |
|
1138 | + $url_params['action'] = 'delete_registrations'; |
|
1139 | + $delete_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1140 | + $actions['delete'] = ' |
|
1141 | 1141 | <a class="ee-aria-tooltip" |
1142 | 1142 | href="' . $delete_link_url . '" |
1143 | 1143 | aria-label="' . esc_attr__('Delete Registration Permanently', 'event_espresso') . '" |
1144 | 1144 | > |
1145 | 1145 | ' . esc_html__('Delete', 'event_espresso') . ' |
1146 | 1146 | </a>'; |
1147 | - } |
|
1148 | - return $actions; |
|
1149 | - } |
|
1150 | - |
|
1151 | - |
|
1152 | - protected function editEventLink(EE_Registration $registration): string |
|
1153 | - { |
|
1154 | - $EVT_ID = $registration->event_ID(); |
|
1155 | - $event_name = $this->eventName($registration); |
|
1156 | - if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) { |
|
1157 | - return $event_name; |
|
1158 | - } |
|
1159 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1160 | - ['action' => 'edit', 'post' => $EVT_ID], |
|
1161 | - EVENTS_ADMIN_URL |
|
1162 | - ); |
|
1163 | - return ' |
|
1147 | + } |
|
1148 | + return $actions; |
|
1149 | + } |
|
1150 | + |
|
1151 | + |
|
1152 | + protected function editEventLink(EE_Registration $registration): string |
|
1153 | + { |
|
1154 | + $EVT_ID = $registration->event_ID(); |
|
1155 | + $event_name = $this->eventName($registration); |
|
1156 | + if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) { |
|
1157 | + return $event_name; |
|
1158 | + } |
|
1159 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1160 | + ['action' => 'edit', 'post' => $EVT_ID], |
|
1161 | + EVENTS_ADMIN_URL |
|
1162 | + ); |
|
1163 | + return ' |
|
1164 | 1164 | <a class="ee-aria-tooltip ee-status-color--' . $this->_event_details['status'] . '" |
1165 | 1165 | href="' . $edit_event_url . '" |
1166 | 1166 | aria-label="' . esc_attr($this->_event_details['title_attr']) . '" |
1167 | 1167 | > |
1168 | 1168 | ' . $event_name . ' |
1169 | 1169 | </a>'; |
1170 | - } |
|
1170 | + } |
|
1171 | 1171 | |
1172 | 1172 | |
1173 | - protected function eventName(EE_Registration $registration): string |
|
1174 | - { |
|
1175 | - $event_name = $registration->event_name(); |
|
1176 | - $event_name = $event_name ?: esc_html__("No Associated Event", 'event_espresso'); |
|
1177 | - return wp_trim_words($event_name, 30, '...'); |
|
1178 | - } |
|
1173 | + protected function eventName(EE_Registration $registration): string |
|
1174 | + { |
|
1175 | + $event_name = $registration->event_name(); |
|
1176 | + $event_name = $event_name ?: esc_html__("No Associated Event", 'event_espresso'); |
|
1177 | + return wp_trim_words($event_name, 30, '...'); |
|
1178 | + } |
|
1179 | 1179 | |
1180 | 1180 | |
1181 | - protected function eventFilterLink(EE_Registration $registration): string |
|
1182 | - { |
|
1183 | - $event_filter_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1184 | - ['event_id' => $registration->event_ID()], |
|
1185 | - REG_ADMIN_URL |
|
1186 | - ); |
|
1187 | - return ' |
|
1181 | + protected function eventFilterLink(EE_Registration $registration): string |
|
1182 | + { |
|
1183 | + $event_filter_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1184 | + ['event_id' => $registration->event_ID()], |
|
1185 | + REG_ADMIN_URL |
|
1186 | + ); |
|
1187 | + return ' |
|
1188 | 1188 | <a class="ee-aria-tooltip ee-event-filter-link" |
1189 | 1189 | href="' . $event_filter_url . '" |
1190 | 1190 | aria-label="' . sprintf( |
1191 | - esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
1192 | - $this->eventName($registration) |
|
1193 | - ) . '" |
|
1191 | + esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
1192 | + $this->eventName($registration) |
|
1193 | + ) . '" |
|
1194 | 1194 | > |
1195 | 1195 | <span class="dashicons dashicons-groups dashicons--small"></span>' |
1196 | - . esc_html__('View Registrations', 'event_espresso') . ' |
|
1196 | + . esc_html__('View Registrations', 'event_espresso') . ' |
|
1197 | 1197 | </a>'; |
1198 | - } |
|
1199 | - |
|
1200 | - |
|
1201 | - /** |
|
1202 | - * @param EE_Ticket $ticket |
|
1203 | - * @return string |
|
1204 | - * @throws EE_Error |
|
1205 | - * @throws ReflectionException |
|
1206 | - * @since 5.0.18.p |
|
1207 | - */ |
|
1208 | - protected function ticketName(EE_Ticket $ticket): string |
|
1209 | - { |
|
1210 | - return '<span class="TKT_name ee-status-color--' . $ticket->ticket_status() . '">' . $ticket->name() . '</span>'; |
|
1211 | - } |
|
1212 | - |
|
1213 | - |
|
1214 | - /** |
|
1215 | - * @param EE_Ticket $ticket |
|
1216 | - * @return string |
|
1217 | - * @throws EE_Error |
|
1218 | - * @throws ReflectionException |
|
1219 | - * @since 5.0.18.p |
|
1220 | - */ |
|
1221 | - protected function ticketFilterLink(EE_Ticket $ticket): string |
|
1222 | - { |
|
1223 | - $ticket_filter_url = EE_Admin_Page::add_query_args_and_nonce(['ticket_id' => $ticket->ID()], REG_ADMIN_URL); |
|
1224 | - return ' |
|
1198 | + } |
|
1199 | + |
|
1200 | + |
|
1201 | + /** |
|
1202 | + * @param EE_Ticket $ticket |
|
1203 | + * @return string |
|
1204 | + * @throws EE_Error |
|
1205 | + * @throws ReflectionException |
|
1206 | + * @since 5.0.18.p |
|
1207 | + */ |
|
1208 | + protected function ticketName(EE_Ticket $ticket): string |
|
1209 | + { |
|
1210 | + return '<span class="TKT_name ee-status-color--' . $ticket->ticket_status() . '">' . $ticket->name() . '</span>'; |
|
1211 | + } |
|
1212 | + |
|
1213 | + |
|
1214 | + /** |
|
1215 | + * @param EE_Ticket $ticket |
|
1216 | + * @return string |
|
1217 | + * @throws EE_Error |
|
1218 | + * @throws ReflectionException |
|
1219 | + * @since 5.0.18.p |
|
1220 | + */ |
|
1221 | + protected function ticketFilterLink(EE_Ticket $ticket): string |
|
1222 | + { |
|
1223 | + $ticket_filter_url = EE_Admin_Page::add_query_args_and_nonce(['ticket_id' => $ticket->ID()], REG_ADMIN_URL); |
|
1224 | + return ' |
|
1225 | 1225 | <a class="ee-aria-tooltip ee-ticket-filter-link" |
1226 | 1226 | href="' . $ticket_filter_url . '" |
1227 | 1227 | aria-label="' . sprintf( |
1228 | - esc_attr__('Filter this list to only show registrations for ticket %s', 'event_espresso'), |
|
1229 | - $ticket->name() |
|
1230 | - ) . '" |
|
1228 | + esc_attr__('Filter this list to only show registrations for ticket %s', 'event_espresso'), |
|
1229 | + $ticket->name() |
|
1230 | + ) . '" |
|
1231 | 1231 | > |
1232 | 1232 | <span class="dashicons dashicons-groups dashicons--small"></span>' |
1233 | - . esc_html__('View Registrations', 'event_espresso') . ' |
|
1233 | + . esc_html__('View Registrations', 'event_espresso') . ' |
|
1234 | 1234 | </a>'; |
1235 | - } |
|
1236 | - |
|
1237 | - |
|
1238 | - /** |
|
1239 | - * @param EE_Registration $registration |
|
1240 | - * @return string |
|
1241 | - * @throws EE_Error |
|
1242 | - * @throws ReflectionException |
|
1243 | - * @deprecated 5.0.18.p |
|
1244 | - */ |
|
1245 | - public function column_TXN_paid(EE_Registration $registration): string |
|
1246 | - { |
|
1247 | - $transaction = $registration->transaction(); |
|
1248 | - $content = $transaction->pretty_paid(); |
|
1249 | - if ($transaction->paid() >= $transaction->total()) { |
|
1250 | - $content .= '<span class="dashicons dashicons-yes green-icon"></span>'; |
|
1251 | - } |
|
1252 | - $content .= $this->viewTransactionLink($transaction); |
|
1253 | - return $this->columnContent('TXN_paid', $content, 'end'); |
|
1254 | - } |
|
1255 | - |
|
1256 | - |
|
1257 | - /** |
|
1258 | - * @param EE_Registration $registration |
|
1259 | - * @return string |
|
1260 | - * @throws EE_Error |
|
1261 | - * @throws ReflectionException |
|
1262 | - * @deprecated 5.0.18.p |
|
1263 | - */ |
|
1264 | - public function column_PRC_amount(EE_Registration $registration): string |
|
1265 | - { |
|
1266 | - $ticket = $registration->ticket(); |
|
1267 | - |
|
1268 | - $content = $this->EVT_ID && $ticket instanceof EE_Ticket |
|
1269 | - ? '<div class="TKT_name">' . $ticket->name() . '</div>' |
|
1270 | - : ''; |
|
1271 | - |
|
1272 | - $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM'; |
|
1273 | - $content .= $registration->final_price() > 0 |
|
1274 | - ? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '"> |
|
1235 | + } |
|
1236 | + |
|
1237 | + |
|
1238 | + /** |
|
1239 | + * @param EE_Registration $registration |
|
1240 | + * @return string |
|
1241 | + * @throws EE_Error |
|
1242 | + * @throws ReflectionException |
|
1243 | + * @deprecated 5.0.18.p |
|
1244 | + */ |
|
1245 | + public function column_TXN_paid(EE_Registration $registration): string |
|
1246 | + { |
|
1247 | + $transaction = $registration->transaction(); |
|
1248 | + $content = $transaction->pretty_paid(); |
|
1249 | + if ($transaction->paid() >= $transaction->total()) { |
|
1250 | + $content .= '<span class="dashicons dashicons-yes green-icon"></span>'; |
|
1251 | + } |
|
1252 | + $content .= $this->viewTransactionLink($transaction); |
|
1253 | + return $this->columnContent('TXN_paid', $content, 'end'); |
|
1254 | + } |
|
1255 | + |
|
1256 | + |
|
1257 | + /** |
|
1258 | + * @param EE_Registration $registration |
|
1259 | + * @return string |
|
1260 | + * @throws EE_Error |
|
1261 | + * @throws ReflectionException |
|
1262 | + * @deprecated 5.0.18.p |
|
1263 | + */ |
|
1264 | + public function column_PRC_amount(EE_Registration $registration): string |
|
1265 | + { |
|
1266 | + $ticket = $registration->ticket(); |
|
1267 | + |
|
1268 | + $content = $this->EVT_ID && $ticket instanceof EE_Ticket |
|
1269 | + ? '<div class="TKT_name">' . $ticket->name() . '</div>' |
|
1270 | + : ''; |
|
1271 | + |
|
1272 | + $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM'; |
|
1273 | + $content .= $registration->final_price() > 0 |
|
1274 | + ? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '"> |
|
1275 | 1275 | ' . $registration->pretty_final_price() . ' |
1276 | 1276 | </span>' |
1277 | - // free event |
|
1278 | - : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>'; |
|
1277 | + // free event |
|
1278 | + : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>'; |
|
1279 | 1279 | |
1280 | - return $this->columnContent('PRC_amount', $content, 'end'); |
|
1281 | - } |
|
1280 | + return $this->columnContent('PRC_amount', $content, 'end'); |
|
1281 | + } |
|
1282 | 1282 | } |
@@ -3,67 +3,67 @@ discard block |
||
3 | 3 | use EventEspresso\core\services\request\sanitizers\AllowedTags; |
4 | 4 | |
5 | 5 | $tEEm_members = [ |
6 | - esc_html__('Founders', 'event_espresso') => [ |
|
7 | - 'garth-koyle' => [ |
|
8 | - 'email' => '[email protected]', |
|
9 | - 'name' => 'Garth Koyle', |
|
10 | - 'desc' => esc_html__('Co-Founder', 'event_espresso'), |
|
11 | - ], |
|
12 | - ], |
|
13 | - esc_html__('Core Developers', 'event_espresso') => [ |
|
14 | - 'brent-christensen' => [ |
|
15 | - 'email' => '[email protected]', |
|
16 | - 'name' => 'Brent Christensen', |
|
17 | - 'desc' => esc_html__('Lead Developer', 'event_espresso'), |
|
18 | - ], |
|
19 | - 'nazar-kolivoshka' => [ |
|
20 | - 'email' => '[email protected]', |
|
21 | - 'name' => 'Nazar Kolivoshka', |
|
22 | - 'desc' => esc_html__('Core Developer', 'event_espresso'), |
|
23 | - ], |
|
24 | - 'alex' => [ |
|
25 | - 'email' => '[email protected]', |
|
26 | - 'name' => 'Alexander Kucheryuk', |
|
27 | - 'desc' => esc_html__('Core Developer', 'event_espresso'), |
|
28 | - ], |
|
29 | - ], |
|
30 | - esc_html__('Support Staff', 'event_espresso') => [ |
|
31 | - 'tony-warwick' => [ |
|
32 | - 'email' => '[email protected]', |
|
33 | - 'name' => 'Tony Warwick', |
|
34 | - 'desc' => esc_html__('Support Lead', 'event_espresso'), |
|
35 | - ], |
|
36 | - 'janice-gutierrez' => [ |
|
37 | - 'email' => '[email protected]', |
|
38 | - 'name' => 'Janice Gutierrez', |
|
39 | - 'desc' => esc_html__('Support', 'event_espresso'), |
|
40 | - ], |
|
41 | - 'chinny-love-verana' => [ |
|
42 | - 'email' => '[email protected]', |
|
43 | - 'name' => 'Chinny Love Verana', |
|
44 | - 'desc' => esc_html__('Sales & Support', 'event_espresso'), |
|
45 | - ], |
|
46 | - 'kimiko-catherine-sy' => [ |
|
47 | - 'email' => '[email protected]', |
|
48 | - 'name' => 'Kimiko Catherine Sy', |
|
49 | - 'desc' => esc_html__('Sales & Support', 'event_espresso'), |
|
50 | - ], |
|
51 | - 'sam' => [ |
|
52 | - 'email' => '[email protected]', |
|
53 | - 'name' => 'Sam', |
|
54 | - 'desc' => esc_html__('Support & QA', 'event_espresso'), |
|
55 | - ], |
|
56 | - 'rio-michael-miranda' => [ |
|
57 | - 'email' => '[email protected]', |
|
58 | - 'name' => 'Rio Michael Miranda', |
|
59 | - 'desc' => esc_html__('Support & QA', 'event_espresso'), |
|
60 | - ], |
|
61 | - ], |
|
6 | + esc_html__('Founders', 'event_espresso') => [ |
|
7 | + 'garth-koyle' => [ |
|
8 | + 'email' => '[email protected]', |
|
9 | + 'name' => 'Garth Koyle', |
|
10 | + 'desc' => esc_html__('Co-Founder', 'event_espresso'), |
|
11 | + ], |
|
12 | + ], |
|
13 | + esc_html__('Core Developers', 'event_espresso') => [ |
|
14 | + 'brent-christensen' => [ |
|
15 | + 'email' => '[email protected]', |
|
16 | + 'name' => 'Brent Christensen', |
|
17 | + 'desc' => esc_html__('Lead Developer', 'event_espresso'), |
|
18 | + ], |
|
19 | + 'nazar-kolivoshka' => [ |
|
20 | + 'email' => '[email protected]', |
|
21 | + 'name' => 'Nazar Kolivoshka', |
|
22 | + 'desc' => esc_html__('Core Developer', 'event_espresso'), |
|
23 | + ], |
|
24 | + 'alex' => [ |
|
25 | + 'email' => '[email protected]', |
|
26 | + 'name' => 'Alexander Kucheryuk', |
|
27 | + 'desc' => esc_html__('Core Developer', 'event_espresso'), |
|
28 | + ], |
|
29 | + ], |
|
30 | + esc_html__('Support Staff', 'event_espresso') => [ |
|
31 | + 'tony-warwick' => [ |
|
32 | + 'email' => '[email protected]', |
|
33 | + 'name' => 'Tony Warwick', |
|
34 | + 'desc' => esc_html__('Support Lead', 'event_espresso'), |
|
35 | + ], |
|
36 | + 'janice-gutierrez' => [ |
|
37 | + 'email' => '[email protected]', |
|
38 | + 'name' => 'Janice Gutierrez', |
|
39 | + 'desc' => esc_html__('Support', 'event_espresso'), |
|
40 | + ], |
|
41 | + 'chinny-love-verana' => [ |
|
42 | + 'email' => '[email protected]', |
|
43 | + 'name' => 'Chinny Love Verana', |
|
44 | + 'desc' => esc_html__('Sales & Support', 'event_espresso'), |
|
45 | + ], |
|
46 | + 'kimiko-catherine-sy' => [ |
|
47 | + 'email' => '[email protected]', |
|
48 | + 'name' => 'Kimiko Catherine Sy', |
|
49 | + 'desc' => esc_html__('Sales & Support', 'event_espresso'), |
|
50 | + ], |
|
51 | + 'sam' => [ |
|
52 | + 'email' => '[email protected]', |
|
53 | + 'name' => 'Sam', |
|
54 | + 'desc' => esc_html__('Support & QA', 'event_espresso'), |
|
55 | + ], |
|
56 | + 'rio-michael-miranda' => [ |
|
57 | + 'email' => '[email protected]', |
|
58 | + 'name' => 'Rio Michael Miranda', |
|
59 | + 'desc' => esc_html__('Support & QA', 'event_espresso'), |
|
60 | + ], |
|
61 | + ], |
|
62 | 62 | ]; |
63 | 63 | |
64 | 64 | function espressoPerson(string $id, string $email, string $name, string $desc): string |
65 | 65 | { |
66 | - return ' |
|
66 | + return ' |
|
67 | 67 | <li class="ee-card ee-credits-person" id="ee-person-' . $id . '"> |
68 | 68 | <a href="' . esp_gravatar_profile($email) . '" target="_blank"> |
69 | 69 | ' . esp_gravatar_image($email, $name) . ' |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | |
78 | 78 | function esp_gravatar_profile(string $email): string |
79 | 79 | { |
80 | - return esc_url_raw('https://www.gravatar.com/' . md5($email)); |
|
80 | + return esc_url_raw('https://www.gravatar.com/' . md5($email)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | function esp_gravatar_image(string $email, string $name): string |
84 | 84 | { |
85 | - $email = md5($email); |
|
86 | - $name = esc_attr($name); |
|
87 | - $url = esc_url_raw("https://0.gravatar.com/avatar/{$email}?s=60"); |
|
88 | - return "<img src='{$url}' class='gravatar' alt='{$name}'/>"; |
|
85 | + $email = md5($email); |
|
86 | + $name = esc_attr($name); |
|
87 | + $url = esc_url_raw("https://0.gravatar.com/avatar/{$email}?s=60"); |
|
88 | + return "<img src='{$url}' class='gravatar' alt='{$name}'/>"; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | <h4> |
98 | 98 | <?php esc_html_e( |
99 | - 'Event Espresso is created by an international team of passionate individuals with a drive to empower your events!', |
|
100 | - 'event_espresso' |
|
101 | - ); ?> |
|
99 | + 'Event Espresso is created by an international team of passionate individuals with a drive to empower your events!', |
|
100 | + 'event_espresso' |
|
101 | + ); ?> |
|
102 | 102 | </h4> |
103 | 103 | |
104 | 104 | <div class='ee-credits-tEEm'> |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | <h3 class="wp-people-group"><?php echo esc_html($tEEm); ?></h3> |
107 | 107 | <ul class="ee-card-grid ee-card-grid-4-cols" id="' . sanitize_key($tEEm) . '"> |
108 | 108 | <?php foreach ($members as $id => $person) { |
109 | - echo wp_kses( |
|
110 | - espressoPerson($id, $person['email'], $person['name'], $person['desc']), |
|
111 | - AllowedTags::getAllowedTags() |
|
112 | - ); |
|
113 | - } |
|
114 | - ?> |
|
109 | + echo wp_kses( |
|
110 | + espressoPerson($id, $person['email'], $person['name'], $person['desc']), |
|
111 | + AllowedTags::getAllowedTags() |
|
112 | + ); |
|
113 | + } |
|
114 | + ?> |
|
115 | 115 | </ul> |
116 | 116 | <?php } ?> |
117 | 117 | </div> |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | <h3 class="wp-people-group"><?php esc_html_e('Contributor Recognition', 'event_espresso'); ?></h3> |
120 | 120 | <p class="description"> |
121 | 121 | <?php |
122 | - printf( |
|
123 | - esc_html__( |
|
124 | - 'For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', |
|
125 | - 'event_espresso' |
|
126 | - ), |
|
127 | - '<a href="https://github.com/eventespresso/event-espresso-core" aria-label="Contribute to Event Espresso by making a pull request via GitHub" target="_blank">', |
|
128 | - '</a>' |
|
129 | - ); |
|
130 | - ?> |
|
122 | + printf( |
|
123 | + esc_html__( |
|
124 | + 'For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', |
|
125 | + 'event_espresso' |
|
126 | + ), |
|
127 | + '<a href="https://github.com/eventespresso/event-espresso-core" aria-label="Contribute to Event Espresso by making a pull request via GitHub" target="_blank">', |
|
128 | + '</a>' |
|
129 | + ); |
|
130 | + ?> |
|
131 | 131 | </p> |
132 | 132 | |
133 | 133 | <ul class='wp-credits-list'> |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | <h3 class="wp-people-group"><?php esc_html_e('External Libraries', 'event_espresso'); ?></h3> |
142 | 142 | <p class="description"> |
143 | 143 | <?php |
144 | - printf( |
|
145 | - esc_html__( |
|
146 | - 'Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', |
|
147 | - 'event_espresso' |
|
148 | - ), |
|
149 | - '<a href="' . admin_url('credits.php') . '">', |
|
150 | - '</a>' |
|
151 | - ); |
|
152 | - ?> |
|
144 | + printf( |
|
145 | + esc_html__( |
|
146 | + 'Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', |
|
147 | + 'event_espresso' |
|
148 | + ), |
|
149 | + '<a href="' . admin_url('credits.php') . '">', |
|
150 | + '</a>' |
|
151 | + ); |
|
152 | + ?> |
|
153 | 153 | </p> |
154 | 154 | <ul class="wp-credits-list"> |
155 | 155 | <li><a href="https://openexchangerates.github.io/accounting.js/" target='_blank'>accounting.js</a>,</li> |
@@ -43,452 +43,452 @@ |
||
43 | 43 | */ |
44 | 44 | class OrganizationSettings extends FormHandler |
45 | 45 | { |
46 | - protected EE_Organization_Config $organization_config; |
|
46 | + protected EE_Organization_Config $organization_config; |
|
47 | 47 | |
48 | - protected EE_Core_Config $core_config; |
|
48 | + protected EE_Core_Config $core_config; |
|
49 | 49 | |
50 | - protected EE_Network_Core_Config $network_core_config; |
|
50 | + protected EE_Network_Core_Config $network_core_config; |
|
51 | 51 | |
52 | - protected CountrySubRegionDao $countrySubRegionDao; |
|
52 | + protected CountrySubRegionDao $countrySubRegionDao; |
|
53 | 53 | |
54 | - private FeatureFlags $feature; |
|
54 | + private FeatureFlags $feature; |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * Form constructor. |
|
59 | - * |
|
60 | - * @param EE_Registry $registry |
|
61 | - * @param EE_Organization_Config $organization_config |
|
62 | - * @param EE_Core_Config $core_config |
|
63 | - * @param EE_Network_Core_Config $network_core_config |
|
64 | - * @param CountrySubRegionDao $countrySubRegionDao |
|
65 | - * @param FeatureFlags $feature |
|
66 | - * @throws InvalidArgumentException |
|
67 | - * @throws InvalidDataTypeException |
|
68 | - * @throws DomainException |
|
69 | - */ |
|
70 | - public function __construct( |
|
71 | - EE_Registry $registry, |
|
72 | - EE_Organization_Config $organization_config, |
|
73 | - EE_Core_Config $core_config, |
|
74 | - EE_Network_Core_Config $network_core_config, |
|
75 | - CountrySubRegionDao $countrySubRegionDao, |
|
76 | - FeatureFlags $feature |
|
77 | - ) { |
|
78 | - $this->organization_config = $organization_config; |
|
79 | - $this->core_config = $core_config; |
|
80 | - $this->network_core_config = $network_core_config; |
|
81 | - $this->countrySubRegionDao = $countrySubRegionDao; |
|
82 | - $this->feature = $feature; |
|
83 | - parent::__construct( |
|
84 | - esc_html__('Your Organization Settings', 'event_espresso'), |
|
85 | - esc_html__('Your Organization Settings', 'event_espresso'), |
|
86 | - 'organization_settings', |
|
87 | - '', |
|
88 | - FormHandler::DO_NOT_SETUP_FORM, |
|
89 | - $registry |
|
90 | - ); |
|
91 | - } |
|
57 | + /** |
|
58 | + * Form constructor. |
|
59 | + * |
|
60 | + * @param EE_Registry $registry |
|
61 | + * @param EE_Organization_Config $organization_config |
|
62 | + * @param EE_Core_Config $core_config |
|
63 | + * @param EE_Network_Core_Config $network_core_config |
|
64 | + * @param CountrySubRegionDao $countrySubRegionDao |
|
65 | + * @param FeatureFlags $feature |
|
66 | + * @throws InvalidArgumentException |
|
67 | + * @throws InvalidDataTypeException |
|
68 | + * @throws DomainException |
|
69 | + */ |
|
70 | + public function __construct( |
|
71 | + EE_Registry $registry, |
|
72 | + EE_Organization_Config $organization_config, |
|
73 | + EE_Core_Config $core_config, |
|
74 | + EE_Network_Core_Config $network_core_config, |
|
75 | + CountrySubRegionDao $countrySubRegionDao, |
|
76 | + FeatureFlags $feature |
|
77 | + ) { |
|
78 | + $this->organization_config = $organization_config; |
|
79 | + $this->core_config = $core_config; |
|
80 | + $this->network_core_config = $network_core_config; |
|
81 | + $this->countrySubRegionDao = $countrySubRegionDao; |
|
82 | + $this->feature = $feature; |
|
83 | + parent::__construct( |
|
84 | + esc_html__('Your Organization Settings', 'event_espresso'), |
|
85 | + esc_html__('Your Organization Settings', 'event_espresso'), |
|
86 | + 'organization_settings', |
|
87 | + '', |
|
88 | + FormHandler::DO_NOT_SETUP_FORM, |
|
89 | + $registry |
|
90 | + ); |
|
91 | + } |
|
92 | 92 | |
93 | 93 | |
94 | - /** |
|
95 | - * creates and returns the actual form |
|
96 | - * |
|
97 | - * @return EE_Form_Section_Proper |
|
98 | - * @throws EE_Error |
|
99 | - * @throws InvalidArgumentException |
|
100 | - * @throws InvalidDataTypeException |
|
101 | - * @throws InvalidInterfaceException |
|
102 | - * @throws ReflectionException |
|
103 | - */ |
|
104 | - public function generate(): EE_Form_Section_Proper |
|
105 | - { |
|
106 | - $has_sub_regions = EEM_State::instance()->count([['Country.CNT_ISO' => $this->organization_config->CNT_ISO]]); |
|
107 | - $subsections = [ |
|
108 | - 'contact_information_hdr' => new EE_Form_Section_HTML( |
|
109 | - EEH_HTML::h2( |
|
110 | - esc_html__('Contact Information', 'event_espresso') |
|
111 | - . ' ' |
|
112 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')), |
|
113 | - '', |
|
114 | - 'contact-information-hdr' |
|
115 | - ) |
|
116 | - ), |
|
117 | - 'organization_name' => new EE_Text_Input( |
|
118 | - [ |
|
119 | - 'html_name' => 'organization_name', |
|
120 | - 'html_class' => 'ee-input-width--reg', |
|
121 | - 'html_label_text' => esc_html__('Organization Name', 'event_espresso'), |
|
122 | - 'html_help_text' => esc_html__( |
|
123 | - 'Displayed on all emails and invoices.', |
|
124 | - 'event_espresso' |
|
125 | - ), |
|
126 | - 'default' => $this->organization_config->get_pretty('name'), |
|
127 | - 'required' => false, |
|
128 | - ] |
|
129 | - ), |
|
130 | - 'organization_address_1' => new EE_Text_Input( |
|
131 | - [ |
|
132 | - 'html_name' => 'organization_address_1', |
|
133 | - 'html_class' => 'ee-input-width--reg', |
|
134 | - 'html_label_text' => esc_html__('Street Address', 'event_espresso'), |
|
135 | - 'default' => $this->organization_config->get_pretty('address_1'), |
|
136 | - 'required' => false, |
|
137 | - ] |
|
138 | - ), |
|
139 | - 'organization_address_2' => new EE_Text_Input( |
|
140 | - [ |
|
141 | - 'html_name' => 'organization_address_2', |
|
142 | - 'html_class' => 'ee-input-width--reg', |
|
143 | - 'html_label_text' => esc_html__('Street Address 2', 'event_espresso'), |
|
144 | - 'default' => $this->organization_config->get_pretty('address_2'), |
|
145 | - 'required' => false, |
|
146 | - ] |
|
147 | - ), |
|
148 | - 'organization_city' => new EE_Text_Input( |
|
149 | - [ |
|
150 | - 'html_name' => 'organization_city', |
|
151 | - 'html_class' => 'ee-input-width--reg', |
|
152 | - 'html_label_text' => esc_html__('City', 'event_espresso'), |
|
153 | - 'default' => $this->organization_config->get_pretty('city'), |
|
154 | - 'required' => false, |
|
155 | - ] |
|
156 | - ), |
|
157 | - 'organization_country' => new EE_Country_Select_Input( |
|
158 | - null, |
|
159 | - [ |
|
160 | - EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL, |
|
161 | - 'html_name' => 'organization_country', |
|
162 | - 'html_class' => 'ee-input-width--reg', |
|
163 | - 'html_label_text' => esc_html__('Country', 'event_espresso'), |
|
164 | - 'default' => $this->organization_config->CNT_ISO, |
|
165 | - 'required' => false, |
|
166 | - 'html_help_text' => sprintf( |
|
167 | - esc_html__( |
|
168 | - '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s', |
|
169 | - 'event_espresso' |
|
170 | - ), |
|
171 | - '<span class="reminder-spn">', |
|
172 | - '</span>' |
|
173 | - ), |
|
174 | - ] |
|
175 | - ), |
|
176 | - 'organization_state' => new EE_State_Select_Input( |
|
177 | - null, |
|
178 | - [ |
|
179 | - 'html_name' => 'organization_state', |
|
180 | - 'html_class' => 'ee-input-width--reg', |
|
181 | - 'html_label_text' => esc_html__('State/Province', 'event_espresso'), |
|
182 | - 'default' => $this->organization_config->STA_ID, |
|
183 | - 'required' => false, |
|
184 | - 'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions |
|
185 | - ? sprintf( |
|
186 | - esc_html__( |
|
187 | - 'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s', |
|
188 | - 'event_espresso' |
|
189 | - ), |
|
190 | - '<span class="reminder-spn">', |
|
191 | - '</span>', |
|
192 | - '<br />' |
|
193 | - ) |
|
194 | - : '', |
|
195 | - ] |
|
196 | - ), |
|
197 | - 'organization_zip' => new EE_Text_Input( |
|
198 | - [ |
|
199 | - 'html_name' => 'organization_zip', |
|
200 | - 'html_class' => 'ee-input-width--small', |
|
201 | - 'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'), |
|
202 | - 'default' => $this->organization_config->get_pretty('zip'), |
|
203 | - 'required' => false, |
|
204 | - ] |
|
205 | - ), |
|
206 | - 'organization_email' => new EE_Text_Input( |
|
207 | - [ |
|
208 | - 'html_name' => 'organization_email', |
|
209 | - 'html_class' => 'ee-input-width--reg', |
|
210 | - 'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'), |
|
211 | - 'html_help_text' => sprintf( |
|
212 | - esc_html__( |
|
213 | - 'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', |
|
214 | - 'event_espresso' |
|
215 | - ), |
|
216 | - '<code>[CO_FORMATTED_EMAIL]</code>', |
|
217 | - '<code>[CO_EMAIL]</code>' |
|
218 | - ), |
|
219 | - 'default' => $this->organization_config->get_pretty('email'), |
|
220 | - 'required' => false, |
|
221 | - ] |
|
222 | - ), |
|
223 | - 'organization_phone' => new EE_Text_Input( |
|
224 | - [ |
|
225 | - 'html_name' => 'organization_phone', |
|
226 | - 'html_class' => 'ee-input-width--reg', |
|
227 | - 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
|
228 | - 'html_help_text' => esc_html__( |
|
229 | - 'The phone number for your organization.', |
|
230 | - 'event_espresso' |
|
231 | - ), |
|
232 | - 'default' => $this->organization_config->get_pretty('phone'), |
|
233 | - 'required' => false, |
|
234 | - ] |
|
235 | - ), |
|
236 | - 'organization_vat' => new EE_Text_Input( |
|
237 | - [ |
|
238 | - 'html_name' => 'organization_vat', |
|
239 | - 'html_class' => 'ee-input-width--reg', |
|
240 | - 'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'), |
|
241 | - 'html_help_text' => esc_html__( |
|
242 | - 'The VAT/Tax Number may be displayed on invoices and receipts.', |
|
243 | - 'event_espresso' |
|
244 | - ), |
|
245 | - 'default' => $this->organization_config->get_pretty('vat'), |
|
246 | - 'required' => false, |
|
247 | - ] |
|
248 | - ), |
|
249 | - 'company_logo_hdr' => new EE_Form_Section_HTML( |
|
250 | - EEH_HTML::h2( |
|
251 | - esc_html__('Company Logo', 'event_espresso') |
|
252 | - . ' ' |
|
253 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')), |
|
254 | - '', |
|
255 | - 'company-logo-hdr' |
|
256 | - ) |
|
257 | - ), |
|
258 | - 'organization_logo_url' => new EE_Admin_File_Uploader_Input( |
|
259 | - [ |
|
260 | - 'html_name' => 'organization_logo_url', |
|
261 | - 'html_class' => 'ee-input-width--big', |
|
262 | - 'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'), |
|
263 | - 'html_help_text' => esc_html__( |
|
264 | - 'Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
|
265 | - 'event_espresso' |
|
266 | - ), |
|
267 | - 'default' => $this->organization_config->get_pretty('logo_url'), |
|
268 | - 'required' => false, |
|
269 | - ] |
|
270 | - ), |
|
271 | - 'social_links_hdr' => new EE_Form_Section_HTML( |
|
272 | - EEH_HTML::h2( |
|
273 | - esc_html__('Social Links', 'event_espresso') |
|
274 | - . ' ' |
|
275 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info')) |
|
276 | - . EEH_HTML::br() |
|
277 | - . EEH_HTML::p( |
|
278 | - esc_html__( |
|
279 | - 'Enter any links to social accounts for your organization here', |
|
280 | - 'event_espresso' |
|
281 | - ), |
|
282 | - '', |
|
283 | - 'description' |
|
284 | - ), |
|
285 | - '', |
|
286 | - 'social-links-hdr' |
|
287 | - ) |
|
288 | - ), |
|
289 | - 'organization_facebook' => new EE_Text_Input( |
|
290 | - [ |
|
291 | - 'html_name' => 'organization_facebook', |
|
292 | - 'html_class' => 'ee-input-width--reg', |
|
293 | - 'html_label_text' => esc_html__('Facebook', 'event_espresso'), |
|
294 | - 'other_html_attributes' => ' placeholder="facebook.com/profile.name"', |
|
295 | - 'default' => $this->organization_config->get_pretty('facebook'), |
|
296 | - 'required' => false, |
|
297 | - ] |
|
298 | - ), |
|
299 | - 'organization_twitter' => new EE_Text_Input( |
|
300 | - [ |
|
301 | - 'html_name' => 'organization_twitter', |
|
302 | - 'html_class' => 'ee-input-width--reg', |
|
303 | - 'html_label_text' => esc_html__('Twitter', 'event_espresso'), |
|
304 | - 'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"', |
|
305 | - 'default' => $this->organization_config->get_pretty('twitter'), |
|
306 | - 'required' => false, |
|
307 | - ] |
|
308 | - ), |
|
309 | - 'organization_linkedin' => new EE_Text_Input( |
|
310 | - [ |
|
311 | - 'html_name' => 'organization_linkedin', |
|
312 | - 'html_class' => 'ee-input-width--reg', |
|
313 | - 'html_label_text' => esc_html__('LinkedIn', 'event_espresso'), |
|
314 | - 'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"', |
|
315 | - 'default' => $this->organization_config->get_pretty('linkedin'), |
|
316 | - 'required' => false, |
|
317 | - ] |
|
318 | - ), |
|
319 | - 'organization_pinterest' => new EE_Text_Input( |
|
320 | - [ |
|
321 | - 'html_name' => 'organization_pinterest', |
|
322 | - 'html_class' => 'ee-input-width--reg', |
|
323 | - 'html_label_text' => esc_html__('Pinterest', 'event_espresso'), |
|
324 | - 'other_html_attributes' => ' placeholder="pinterest.com/profilename"', |
|
325 | - 'default' => $this->organization_config->get_pretty('pinterest'), |
|
326 | - 'required' => false, |
|
327 | - ] |
|
328 | - ), |
|
329 | - 'organization_instagram' => new EE_Text_Input( |
|
330 | - [ |
|
331 | - 'html_name' => 'organization_instagram', |
|
332 | - 'html_class' => 'ee-input-width--reg', |
|
333 | - 'html_label_text' => esc_html__('Instagram', 'event_espresso'), |
|
334 | - 'other_html_attributes' => ' placeholder="instagram.com/handle"', |
|
335 | - 'default' => $this->organization_config->get_pretty('instagram'), |
|
336 | - 'required' => false, |
|
337 | - ] |
|
338 | - ), |
|
339 | - ]; |
|
94 | + /** |
|
95 | + * creates and returns the actual form |
|
96 | + * |
|
97 | + * @return EE_Form_Section_Proper |
|
98 | + * @throws EE_Error |
|
99 | + * @throws InvalidArgumentException |
|
100 | + * @throws InvalidDataTypeException |
|
101 | + * @throws InvalidInterfaceException |
|
102 | + * @throws ReflectionException |
|
103 | + */ |
|
104 | + public function generate(): EE_Form_Section_Proper |
|
105 | + { |
|
106 | + $has_sub_regions = EEM_State::instance()->count([['Country.CNT_ISO' => $this->organization_config->CNT_ISO]]); |
|
107 | + $subsections = [ |
|
108 | + 'contact_information_hdr' => new EE_Form_Section_HTML( |
|
109 | + EEH_HTML::h2( |
|
110 | + esc_html__('Contact Information', 'event_espresso') |
|
111 | + . ' ' |
|
112 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')), |
|
113 | + '', |
|
114 | + 'contact-information-hdr' |
|
115 | + ) |
|
116 | + ), |
|
117 | + 'organization_name' => new EE_Text_Input( |
|
118 | + [ |
|
119 | + 'html_name' => 'organization_name', |
|
120 | + 'html_class' => 'ee-input-width--reg', |
|
121 | + 'html_label_text' => esc_html__('Organization Name', 'event_espresso'), |
|
122 | + 'html_help_text' => esc_html__( |
|
123 | + 'Displayed on all emails and invoices.', |
|
124 | + 'event_espresso' |
|
125 | + ), |
|
126 | + 'default' => $this->organization_config->get_pretty('name'), |
|
127 | + 'required' => false, |
|
128 | + ] |
|
129 | + ), |
|
130 | + 'organization_address_1' => new EE_Text_Input( |
|
131 | + [ |
|
132 | + 'html_name' => 'organization_address_1', |
|
133 | + 'html_class' => 'ee-input-width--reg', |
|
134 | + 'html_label_text' => esc_html__('Street Address', 'event_espresso'), |
|
135 | + 'default' => $this->organization_config->get_pretty('address_1'), |
|
136 | + 'required' => false, |
|
137 | + ] |
|
138 | + ), |
|
139 | + 'organization_address_2' => new EE_Text_Input( |
|
140 | + [ |
|
141 | + 'html_name' => 'organization_address_2', |
|
142 | + 'html_class' => 'ee-input-width--reg', |
|
143 | + 'html_label_text' => esc_html__('Street Address 2', 'event_espresso'), |
|
144 | + 'default' => $this->organization_config->get_pretty('address_2'), |
|
145 | + 'required' => false, |
|
146 | + ] |
|
147 | + ), |
|
148 | + 'organization_city' => new EE_Text_Input( |
|
149 | + [ |
|
150 | + 'html_name' => 'organization_city', |
|
151 | + 'html_class' => 'ee-input-width--reg', |
|
152 | + 'html_label_text' => esc_html__('City', 'event_espresso'), |
|
153 | + 'default' => $this->organization_config->get_pretty('city'), |
|
154 | + 'required' => false, |
|
155 | + ] |
|
156 | + ), |
|
157 | + 'organization_country' => new EE_Country_Select_Input( |
|
158 | + null, |
|
159 | + [ |
|
160 | + EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL, |
|
161 | + 'html_name' => 'organization_country', |
|
162 | + 'html_class' => 'ee-input-width--reg', |
|
163 | + 'html_label_text' => esc_html__('Country', 'event_espresso'), |
|
164 | + 'default' => $this->organization_config->CNT_ISO, |
|
165 | + 'required' => false, |
|
166 | + 'html_help_text' => sprintf( |
|
167 | + esc_html__( |
|
168 | + '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s', |
|
169 | + 'event_espresso' |
|
170 | + ), |
|
171 | + '<span class="reminder-spn">', |
|
172 | + '</span>' |
|
173 | + ), |
|
174 | + ] |
|
175 | + ), |
|
176 | + 'organization_state' => new EE_State_Select_Input( |
|
177 | + null, |
|
178 | + [ |
|
179 | + 'html_name' => 'organization_state', |
|
180 | + 'html_class' => 'ee-input-width--reg', |
|
181 | + 'html_label_text' => esc_html__('State/Province', 'event_espresso'), |
|
182 | + 'default' => $this->organization_config->STA_ID, |
|
183 | + 'required' => false, |
|
184 | + 'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions |
|
185 | + ? sprintf( |
|
186 | + esc_html__( |
|
187 | + 'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s', |
|
188 | + 'event_espresso' |
|
189 | + ), |
|
190 | + '<span class="reminder-spn">', |
|
191 | + '</span>', |
|
192 | + '<br />' |
|
193 | + ) |
|
194 | + : '', |
|
195 | + ] |
|
196 | + ), |
|
197 | + 'organization_zip' => new EE_Text_Input( |
|
198 | + [ |
|
199 | + 'html_name' => 'organization_zip', |
|
200 | + 'html_class' => 'ee-input-width--small', |
|
201 | + 'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'), |
|
202 | + 'default' => $this->organization_config->get_pretty('zip'), |
|
203 | + 'required' => false, |
|
204 | + ] |
|
205 | + ), |
|
206 | + 'organization_email' => new EE_Text_Input( |
|
207 | + [ |
|
208 | + 'html_name' => 'organization_email', |
|
209 | + 'html_class' => 'ee-input-width--reg', |
|
210 | + 'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'), |
|
211 | + 'html_help_text' => sprintf( |
|
212 | + esc_html__( |
|
213 | + 'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', |
|
214 | + 'event_espresso' |
|
215 | + ), |
|
216 | + '<code>[CO_FORMATTED_EMAIL]</code>', |
|
217 | + '<code>[CO_EMAIL]</code>' |
|
218 | + ), |
|
219 | + 'default' => $this->organization_config->get_pretty('email'), |
|
220 | + 'required' => false, |
|
221 | + ] |
|
222 | + ), |
|
223 | + 'organization_phone' => new EE_Text_Input( |
|
224 | + [ |
|
225 | + 'html_name' => 'organization_phone', |
|
226 | + 'html_class' => 'ee-input-width--reg', |
|
227 | + 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
|
228 | + 'html_help_text' => esc_html__( |
|
229 | + 'The phone number for your organization.', |
|
230 | + 'event_espresso' |
|
231 | + ), |
|
232 | + 'default' => $this->organization_config->get_pretty('phone'), |
|
233 | + 'required' => false, |
|
234 | + ] |
|
235 | + ), |
|
236 | + 'organization_vat' => new EE_Text_Input( |
|
237 | + [ |
|
238 | + 'html_name' => 'organization_vat', |
|
239 | + 'html_class' => 'ee-input-width--reg', |
|
240 | + 'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'), |
|
241 | + 'html_help_text' => esc_html__( |
|
242 | + 'The VAT/Tax Number may be displayed on invoices and receipts.', |
|
243 | + 'event_espresso' |
|
244 | + ), |
|
245 | + 'default' => $this->organization_config->get_pretty('vat'), |
|
246 | + 'required' => false, |
|
247 | + ] |
|
248 | + ), |
|
249 | + 'company_logo_hdr' => new EE_Form_Section_HTML( |
|
250 | + EEH_HTML::h2( |
|
251 | + esc_html__('Company Logo', 'event_espresso') |
|
252 | + . ' ' |
|
253 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')), |
|
254 | + '', |
|
255 | + 'company-logo-hdr' |
|
256 | + ) |
|
257 | + ), |
|
258 | + 'organization_logo_url' => new EE_Admin_File_Uploader_Input( |
|
259 | + [ |
|
260 | + 'html_name' => 'organization_logo_url', |
|
261 | + 'html_class' => 'ee-input-width--big', |
|
262 | + 'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'), |
|
263 | + 'html_help_text' => esc_html__( |
|
264 | + 'Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
|
265 | + 'event_espresso' |
|
266 | + ), |
|
267 | + 'default' => $this->organization_config->get_pretty('logo_url'), |
|
268 | + 'required' => false, |
|
269 | + ] |
|
270 | + ), |
|
271 | + 'social_links_hdr' => new EE_Form_Section_HTML( |
|
272 | + EEH_HTML::h2( |
|
273 | + esc_html__('Social Links', 'event_espresso') |
|
274 | + . ' ' |
|
275 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info')) |
|
276 | + . EEH_HTML::br() |
|
277 | + . EEH_HTML::p( |
|
278 | + esc_html__( |
|
279 | + 'Enter any links to social accounts for your organization here', |
|
280 | + 'event_espresso' |
|
281 | + ), |
|
282 | + '', |
|
283 | + 'description' |
|
284 | + ), |
|
285 | + '', |
|
286 | + 'social-links-hdr' |
|
287 | + ) |
|
288 | + ), |
|
289 | + 'organization_facebook' => new EE_Text_Input( |
|
290 | + [ |
|
291 | + 'html_name' => 'organization_facebook', |
|
292 | + 'html_class' => 'ee-input-width--reg', |
|
293 | + 'html_label_text' => esc_html__('Facebook', 'event_espresso'), |
|
294 | + 'other_html_attributes' => ' placeholder="facebook.com/profile.name"', |
|
295 | + 'default' => $this->organization_config->get_pretty('facebook'), |
|
296 | + 'required' => false, |
|
297 | + ] |
|
298 | + ), |
|
299 | + 'organization_twitter' => new EE_Text_Input( |
|
300 | + [ |
|
301 | + 'html_name' => 'organization_twitter', |
|
302 | + 'html_class' => 'ee-input-width--reg', |
|
303 | + 'html_label_text' => esc_html__('Twitter', 'event_espresso'), |
|
304 | + 'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"', |
|
305 | + 'default' => $this->organization_config->get_pretty('twitter'), |
|
306 | + 'required' => false, |
|
307 | + ] |
|
308 | + ), |
|
309 | + 'organization_linkedin' => new EE_Text_Input( |
|
310 | + [ |
|
311 | + 'html_name' => 'organization_linkedin', |
|
312 | + 'html_class' => 'ee-input-width--reg', |
|
313 | + 'html_label_text' => esc_html__('LinkedIn', 'event_espresso'), |
|
314 | + 'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"', |
|
315 | + 'default' => $this->organization_config->get_pretty('linkedin'), |
|
316 | + 'required' => false, |
|
317 | + ] |
|
318 | + ), |
|
319 | + 'organization_pinterest' => new EE_Text_Input( |
|
320 | + [ |
|
321 | + 'html_name' => 'organization_pinterest', |
|
322 | + 'html_class' => 'ee-input-width--reg', |
|
323 | + 'html_label_text' => esc_html__('Pinterest', 'event_espresso'), |
|
324 | + 'other_html_attributes' => ' placeholder="pinterest.com/profilename"', |
|
325 | + 'default' => $this->organization_config->get_pretty('pinterest'), |
|
326 | + 'required' => false, |
|
327 | + ] |
|
328 | + ), |
|
329 | + 'organization_instagram' => new EE_Text_Input( |
|
330 | + [ |
|
331 | + 'html_name' => 'organization_instagram', |
|
332 | + 'html_class' => 'ee-input-width--reg', |
|
333 | + 'html_label_text' => esc_html__('Instagram', 'event_espresso'), |
|
334 | + 'other_html_attributes' => ' placeholder="instagram.com/handle"', |
|
335 | + 'default' => $this->organization_config->get_pretty('instagram'), |
|
336 | + 'required' => false, |
|
337 | + ] |
|
338 | + ), |
|
339 | + ]; |
|
340 | 340 | |
341 | - if ($this->feature->allowed('use_edd_plugin_licensing')) { |
|
342 | - $subsections = EEH_Array::insert_into_array( |
|
343 | - $subsections, |
|
344 | - [ |
|
345 | - 'support_license_key_notice' => new EE_Form_Section_HTML( |
|
346 | - EEH_HTML::p( |
|
347 | - sprintf( |
|
348 | - esc_html__( |
|
349 | - 'Management for your Event Espresso Support License Key has been moved to the %1$sLicense Keys admin page%2$s', |
|
350 | - 'event_espresso' |
|
351 | - ), |
|
352 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
353 | - [], |
|
354 | - LICENSE_KEYS_ADMIN_URL |
|
355 | - ) . '">', |
|
356 | - '</a>' |
|
357 | - ), |
|
358 | - '', |
|
359 | - 'ee-status-outline ee-status-bg--info' |
|
360 | - ) |
|
361 | - ), |
|
362 | - ], |
|
363 | - 'contact_information_hdr' |
|
364 | - ); |
|
365 | - } |
|
366 | - return apply_filters( |
|
367 | - 'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form', |
|
368 | - new EE_Form_Section_Proper( |
|
369 | - [ |
|
370 | - 'name' => 'organization_settings', |
|
371 | - 'html_id' => 'organization_settings', |
|
372 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
373 | - 'subsections' => $subsections, |
|
374 | - ] |
|
375 | - ), |
|
376 | - $this, |
|
377 | - $has_sub_regions |
|
378 | - ); |
|
379 | - } |
|
341 | + if ($this->feature->allowed('use_edd_plugin_licensing')) { |
|
342 | + $subsections = EEH_Array::insert_into_array( |
|
343 | + $subsections, |
|
344 | + [ |
|
345 | + 'support_license_key_notice' => new EE_Form_Section_HTML( |
|
346 | + EEH_HTML::p( |
|
347 | + sprintf( |
|
348 | + esc_html__( |
|
349 | + 'Management for your Event Espresso Support License Key has been moved to the %1$sLicense Keys admin page%2$s', |
|
350 | + 'event_espresso' |
|
351 | + ), |
|
352 | + '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
353 | + [], |
|
354 | + LICENSE_KEYS_ADMIN_URL |
|
355 | + ) . '">', |
|
356 | + '</a>' |
|
357 | + ), |
|
358 | + '', |
|
359 | + 'ee-status-outline ee-status-bg--info' |
|
360 | + ) |
|
361 | + ), |
|
362 | + ], |
|
363 | + 'contact_information_hdr' |
|
364 | + ); |
|
365 | + } |
|
366 | + return apply_filters( |
|
367 | + 'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form', |
|
368 | + new EE_Form_Section_Proper( |
|
369 | + [ |
|
370 | + 'name' => 'organization_settings', |
|
371 | + 'html_id' => 'organization_settings', |
|
372 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
373 | + 'subsections' => $subsections, |
|
374 | + ] |
|
375 | + ), |
|
376 | + $this, |
|
377 | + $has_sub_regions |
|
378 | + ); |
|
379 | + } |
|
380 | 380 | |
381 | 381 | |
382 | - /** |
|
383 | - * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
384 | - * returns a string of HTML that can be directly echoed in a template |
|
385 | - * |
|
386 | - * @return string |
|
387 | - * @throws EE_Error |
|
388 | - * @throws InvalidArgumentException |
|
389 | - * @throws InvalidDataTypeException |
|
390 | - * @throws InvalidInterfaceException |
|
391 | - * @throws LogicException |
|
392 | - */ |
|
393 | - public function display() |
|
394 | - { |
|
395 | - $this->form()->enqueue_js(); |
|
396 | - return parent::display(); |
|
397 | - } |
|
382 | + /** |
|
383 | + * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
384 | + * returns a string of HTML that can be directly echoed in a template |
|
385 | + * |
|
386 | + * @return string |
|
387 | + * @throws EE_Error |
|
388 | + * @throws InvalidArgumentException |
|
389 | + * @throws InvalidDataTypeException |
|
390 | + * @throws InvalidInterfaceException |
|
391 | + * @throws LogicException |
|
392 | + */ |
|
393 | + public function display() |
|
394 | + { |
|
395 | + $this->form()->enqueue_js(); |
|
396 | + return parent::display(); |
|
397 | + } |
|
398 | 398 | |
399 | 399 | |
400 | - /** |
|
401 | - * handles processing the form submission |
|
402 | - * returns true or false depending on whether the form was processed successfully or not |
|
403 | - * |
|
404 | - * @param array $form_data |
|
405 | - * @return bool |
|
406 | - * @throws InvalidFormSubmissionException |
|
407 | - * @throws EE_Error |
|
408 | - * @throws LogicException |
|
409 | - * @throws InvalidArgumentException |
|
410 | - * @throws InvalidDataTypeException |
|
411 | - * @throws ReflectionException |
|
412 | - */ |
|
413 | - public function process($form_data = []): bool |
|
414 | - { |
|
415 | - // process form |
|
416 | - $valid_data = (array) parent::process($form_data); |
|
417 | - if (empty($valid_data)) { |
|
418 | - return false; |
|
419 | - } |
|
400 | + /** |
|
401 | + * handles processing the form submission |
|
402 | + * returns true or false depending on whether the form was processed successfully or not |
|
403 | + * |
|
404 | + * @param array $form_data |
|
405 | + * @return bool |
|
406 | + * @throws InvalidFormSubmissionException |
|
407 | + * @throws EE_Error |
|
408 | + * @throws LogicException |
|
409 | + * @throws InvalidArgumentException |
|
410 | + * @throws InvalidDataTypeException |
|
411 | + * @throws ReflectionException |
|
412 | + */ |
|
413 | + public function process($form_data = []): bool |
|
414 | + { |
|
415 | + // process form |
|
416 | + $valid_data = (array) parent::process($form_data); |
|
417 | + if (empty($valid_data)) { |
|
418 | + return false; |
|
419 | + } |
|
420 | 420 | |
421 | - if (is_main_site()) { |
|
422 | - $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key']) |
|
423 | - ? sanitize_text_field($form_data['ee_site_license_key']) |
|
424 | - : $this->network_core_config->site_license_key; |
|
425 | - } |
|
426 | - $this->organization_config->name = isset($form_data['organization_name']) |
|
427 | - ? sanitize_text_field($form_data['organization_name']) |
|
428 | - : $this->organization_config->name; |
|
429 | - $this->organization_config->address_1 = isset($form_data['organization_address_1']) |
|
430 | - ? sanitize_text_field($form_data['organization_address_1']) |
|
431 | - : $this->organization_config->address_1; |
|
432 | - $this->organization_config->address_2 = isset($form_data['organization_address_2']) |
|
433 | - ? sanitize_text_field($form_data['organization_address_2']) |
|
434 | - : $this->organization_config->address_2; |
|
435 | - $this->organization_config->city = isset($form_data['organization_city']) |
|
436 | - ? sanitize_text_field($form_data['organization_city']) |
|
437 | - : $this->organization_config->city; |
|
438 | - $this->organization_config->STA_ID = isset($form_data['organization_state']) |
|
439 | - ? absint($form_data['organization_state']) |
|
440 | - : $this->organization_config->STA_ID; |
|
441 | - $this->organization_config->CNT_ISO = isset($form_data['organization_country']) |
|
442 | - ? sanitize_text_field($form_data['organization_country']) |
|
443 | - : $this->organization_config->CNT_ISO; |
|
444 | - $this->organization_config->zip = isset($form_data['organization_zip']) |
|
445 | - ? sanitize_text_field($form_data['organization_zip']) |
|
446 | - : $this->organization_config->zip; |
|
447 | - $this->organization_config->email = isset($form_data['organization_email']) |
|
448 | - ? sanitize_email($form_data['organization_email']) |
|
449 | - : $this->organization_config->email; |
|
450 | - $this->organization_config->vat = isset($form_data['organization_vat']) |
|
451 | - ? sanitize_text_field($form_data['organization_vat']) |
|
452 | - : $this->organization_config->vat; |
|
453 | - $this->organization_config->phone = isset($form_data['organization_phone']) |
|
454 | - ? sanitize_text_field($form_data['organization_phone']) |
|
455 | - : $this->organization_config->phone; |
|
456 | - $this->organization_config->logo_url = isset($form_data['organization_logo_url']) |
|
457 | - ? esc_url_raw($form_data['organization_logo_url']) |
|
458 | - : $this->organization_config->logo_url; |
|
459 | - $this->organization_config->facebook = isset($form_data['organization_facebook']) |
|
460 | - ? esc_url_raw($form_data['organization_facebook']) |
|
461 | - : $this->organization_config->facebook; |
|
462 | - $this->organization_config->twitter = isset($form_data['organization_twitter']) |
|
463 | - ? esc_url_raw($form_data['organization_twitter']) |
|
464 | - : $this->organization_config->twitter; |
|
465 | - $this->organization_config->linkedin = isset($form_data['organization_linkedin']) |
|
466 | - ? esc_url_raw($form_data['organization_linkedin']) |
|
467 | - : $this->organization_config->linkedin; |
|
468 | - $this->organization_config->pinterest = isset($form_data['organization_pinterest']) |
|
469 | - ? esc_url_raw($form_data['organization_pinterest']) |
|
470 | - : $this->organization_config->pinterest; |
|
471 | - $this->organization_config->google = isset($form_data['organization_google']) |
|
472 | - ? esc_url_raw($form_data['organization_google']) |
|
473 | - : $this->organization_config->google; |
|
474 | - $this->organization_config->instagram = isset($form_data['organization_instagram']) |
|
475 | - ? esc_url_raw($form_data['organization_instagram']) |
|
476 | - : $this->organization_config->instagram; |
|
477 | - $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0]) |
|
478 | - ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN) |
|
479 | - : false; |
|
480 | - $this->core_config->ee_ueip_has_notified = true; |
|
421 | + if (is_main_site()) { |
|
422 | + $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key']) |
|
423 | + ? sanitize_text_field($form_data['ee_site_license_key']) |
|
424 | + : $this->network_core_config->site_license_key; |
|
425 | + } |
|
426 | + $this->organization_config->name = isset($form_data['organization_name']) |
|
427 | + ? sanitize_text_field($form_data['organization_name']) |
|
428 | + : $this->organization_config->name; |
|
429 | + $this->organization_config->address_1 = isset($form_data['organization_address_1']) |
|
430 | + ? sanitize_text_field($form_data['organization_address_1']) |
|
431 | + : $this->organization_config->address_1; |
|
432 | + $this->organization_config->address_2 = isset($form_data['organization_address_2']) |
|
433 | + ? sanitize_text_field($form_data['organization_address_2']) |
|
434 | + : $this->organization_config->address_2; |
|
435 | + $this->organization_config->city = isset($form_data['organization_city']) |
|
436 | + ? sanitize_text_field($form_data['organization_city']) |
|
437 | + : $this->organization_config->city; |
|
438 | + $this->organization_config->STA_ID = isset($form_data['organization_state']) |
|
439 | + ? absint($form_data['organization_state']) |
|
440 | + : $this->organization_config->STA_ID; |
|
441 | + $this->organization_config->CNT_ISO = isset($form_data['organization_country']) |
|
442 | + ? sanitize_text_field($form_data['organization_country']) |
|
443 | + : $this->organization_config->CNT_ISO; |
|
444 | + $this->organization_config->zip = isset($form_data['organization_zip']) |
|
445 | + ? sanitize_text_field($form_data['organization_zip']) |
|
446 | + : $this->organization_config->zip; |
|
447 | + $this->organization_config->email = isset($form_data['organization_email']) |
|
448 | + ? sanitize_email($form_data['organization_email']) |
|
449 | + : $this->organization_config->email; |
|
450 | + $this->organization_config->vat = isset($form_data['organization_vat']) |
|
451 | + ? sanitize_text_field($form_data['organization_vat']) |
|
452 | + : $this->organization_config->vat; |
|
453 | + $this->organization_config->phone = isset($form_data['organization_phone']) |
|
454 | + ? sanitize_text_field($form_data['organization_phone']) |
|
455 | + : $this->organization_config->phone; |
|
456 | + $this->organization_config->logo_url = isset($form_data['organization_logo_url']) |
|
457 | + ? esc_url_raw($form_data['organization_logo_url']) |
|
458 | + : $this->organization_config->logo_url; |
|
459 | + $this->organization_config->facebook = isset($form_data['organization_facebook']) |
|
460 | + ? esc_url_raw($form_data['organization_facebook']) |
|
461 | + : $this->organization_config->facebook; |
|
462 | + $this->organization_config->twitter = isset($form_data['organization_twitter']) |
|
463 | + ? esc_url_raw($form_data['organization_twitter']) |
|
464 | + : $this->organization_config->twitter; |
|
465 | + $this->organization_config->linkedin = isset($form_data['organization_linkedin']) |
|
466 | + ? esc_url_raw($form_data['organization_linkedin']) |
|
467 | + : $this->organization_config->linkedin; |
|
468 | + $this->organization_config->pinterest = isset($form_data['organization_pinterest']) |
|
469 | + ? esc_url_raw($form_data['organization_pinterest']) |
|
470 | + : $this->organization_config->pinterest; |
|
471 | + $this->organization_config->google = isset($form_data['organization_google']) |
|
472 | + ? esc_url_raw($form_data['organization_google']) |
|
473 | + : $this->organization_config->google; |
|
474 | + $this->organization_config->instagram = isset($form_data['organization_instagram']) |
|
475 | + ? esc_url_raw($form_data['organization_instagram']) |
|
476 | + : $this->organization_config->instagram; |
|
477 | + $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0]) |
|
478 | + ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN) |
|
479 | + : false; |
|
480 | + $this->core_config->ee_ueip_has_notified = true; |
|
481 | 481 | |
482 | - $this->registry->CFG->currency = new EE_Currency_Config( |
|
483 | - $this->organization_config->CNT_ISO |
|
484 | - ); |
|
485 | - /** @var EE_Country $country */ |
|
486 | - $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO); |
|
487 | - if ($country instanceof EE_Country) { |
|
488 | - $country->set('CNT_active', 1); |
|
489 | - $country->save(); |
|
490 | - $this->countrySubRegionDao->saveCountrySubRegions($country); |
|
491 | - } |
|
492 | - return true; |
|
493 | - } |
|
482 | + $this->registry->CFG->currency = new EE_Currency_Config( |
|
483 | + $this->organization_config->CNT_ISO |
|
484 | + ); |
|
485 | + /** @var EE_Country $country */ |
|
486 | + $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO); |
|
487 | + if ($country instanceof EE_Country) { |
|
488 | + $country->set('CNT_active', 1); |
|
489 | + $country->save(); |
|
490 | + $this->countrySubRegionDao->saveCountrySubRegions($country); |
|
491 | + } |
|
492 | + return true; |
|
493 | + } |
|
494 | 494 | } |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | 'Management for your Event Espresso Support License Key has been moved to the %1$sLicense Keys admin page%2$s', |
350 | 350 | 'event_espresso' |
351 | 351 | ), |
352 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
352 | + '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
353 | 353 | [], |
354 | 354 | LICENSE_KEYS_ADMIN_URL |
355 | - ) . '">', |
|
355 | + ).'">', |
|
356 | 356 | '</a>' |
357 | 357 | ), |
358 | 358 | '', |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | $this->organization_config->instagram = isset($form_data['organization_instagram']) |
475 | 475 | ? esc_url_raw($form_data['organization_instagram']) |
476 | 476 | : $this->organization_config->instagram; |
477 | - $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0]) |
|
478 | - ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN) |
|
477 | + $this->core_config->ee_ueip_optin = isset($form_data[EE_Core_Config::OPTION_NAME_UXIP][0]) |
|
478 | + ? filter_var($form_data[EE_Core_Config::OPTION_NAME_UXIP][0], FILTER_VALIDATE_BOOLEAN) |
|
479 | 479 | : false; |
480 | 480 | $this->core_config->ee_ueip_has_notified = true; |
481 | 481 |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function is_espresso_event($event = null): bool |
24 | 24 | { |
25 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
26 | - return false; |
|
27 | - } |
|
28 | - // extract EE_Event object from passed param regardless of what it is (within reason of course) |
|
29 | - $event = EEH_Event_View::get_event($event); |
|
30 | - // do we have a valid event ? |
|
31 | - return $event instanceof EE_Event; |
|
25 | + if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
26 | + return false; |
|
27 | + } |
|
28 | + // extract EE_Event object from passed param regardless of what it is (within reason of course) |
|
29 | + $event = EEH_Event_View::get_event($event); |
|
30 | + // do we have a valid event ? |
|
31 | + return $event instanceof EE_Event; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function is_espresso_event_single(): bool |
41 | 41 | { |
42 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
43 | - return false; |
|
44 | - } |
|
45 | - global $wp_query; |
|
46 | - // return conditionals set by CPTs |
|
47 | - return $wp_query instanceof WP_Query |
|
48 | - && isset($wp_query->is_espresso_event_single) |
|
49 | - && $wp_query->is_espresso_event_single; |
|
42 | + if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
43 | + return false; |
|
44 | + } |
|
45 | + global $wp_query; |
|
46 | + // return conditionals set by CPTs |
|
47 | + return $wp_query instanceof WP_Query |
|
48 | + && isset($wp_query->is_espresso_event_single) |
|
49 | + && $wp_query->is_espresso_event_single; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | */ |
58 | 58 | function is_espresso_event_archive(): bool |
59 | 59 | { |
60 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
61 | - return false; |
|
62 | - } |
|
63 | - global $wp_query; |
|
64 | - return $wp_query instanceof WP_Query |
|
65 | - && isset($wp_query->is_espresso_event_archive) |
|
66 | - && $wp_query->is_espresso_event_archive; |
|
60 | + if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
61 | + return false; |
|
62 | + } |
|
63 | + global $wp_query; |
|
64 | + return $wp_query instanceof WP_Query |
|
65 | + && isset($wp_query->is_espresso_event_archive) |
|
66 | + && $wp_query->is_espresso_event_archive; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function is_espresso_event_taxonomy(): bool |
76 | 76 | { |
77 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
78 | - return false; |
|
79 | - } |
|
80 | - global $wp_query; |
|
81 | - return $wp_query instanceof WP_Query |
|
82 | - && isset($wp_query->is_espresso_event_taxonomy) |
|
83 | - && $wp_query->is_espresso_event_taxonomy; |
|
77 | + if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
78 | + return false; |
|
79 | + } |
|
80 | + global $wp_query; |
|
81 | + return $wp_query instanceof WP_Query |
|
82 | + && isset($wp_query->is_espresso_event_taxonomy) |
|
83 | + && $wp_query->is_espresso_event_taxonomy; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function is_espresso_venue($venue = null): bool |
96 | 96 | { |
97 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
98 | - return false; |
|
99 | - } |
|
100 | - // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
|
101 | - $venue = EEH_Venue_View::get_venue($venue, false); |
|
102 | - // do we have a valid event ? |
|
103 | - return $venue instanceof EE_Venue; |
|
97 | + if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
98 | + return false; |
|
99 | + } |
|
100 | + // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
|
101 | + $venue = EEH_Venue_View::get_venue($venue, false); |
|
102 | + // do we have a valid event ? |
|
103 | + return $venue instanceof EE_Venue; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | */ |
112 | 112 | function is_espresso_venue_single(): bool |
113 | 113 | { |
114 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
115 | - return false; |
|
116 | - } |
|
117 | - global $wp_query; |
|
118 | - return $wp_query instanceof WP_Query |
|
119 | - && isset($wp_query->is_espresso_venue_single) |
|
120 | - && $wp_query->is_espresso_venue_single; |
|
114 | + if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
115 | + return false; |
|
116 | + } |
|
117 | + global $wp_query; |
|
118 | + return $wp_query instanceof WP_Query |
|
119 | + && isset($wp_query->is_espresso_venue_single) |
|
120 | + && $wp_query->is_espresso_venue_single; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function is_espresso_venue_archive(): bool |
130 | 130 | { |
131 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
132 | - return false; |
|
133 | - } |
|
134 | - global $wp_query; |
|
135 | - return $wp_query instanceof WP_Query |
|
136 | - && isset($wp_query->is_espresso_venue_archive) |
|
137 | - && $wp_query->is_espresso_venue_archive; |
|
131 | + if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
132 | + return false; |
|
133 | + } |
|
134 | + global $wp_query; |
|
135 | + return $wp_query instanceof WP_Query |
|
136 | + && isset($wp_query->is_espresso_venue_archive) |
|
137 | + && $wp_query->is_espresso_venue_archive; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function is_espresso_venue_taxonomy(): bool |
147 | 147 | { |
148 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
149 | - return false; |
|
150 | - } |
|
151 | - global $wp_query; |
|
152 | - return $wp_query instanceof WP_Query |
|
153 | - && isset($wp_query->is_espresso_venue_taxonomy) |
|
154 | - && $wp_query->is_espresso_venue_taxonomy; |
|
148 | + if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
149 | + return false; |
|
150 | + } |
|
151 | + global $wp_query; |
|
152 | + return $wp_query instanceof WP_Query |
|
153 | + && isset($wp_query->is_espresso_venue_taxonomy) |
|
154 | + && $wp_query->is_espresso_venue_taxonomy; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -163,62 +163,62 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function can_use_espresso_conditionals($conditional_tag): bool |
165 | 165 | { |
166 | - if (! did_action('AHEE__EE_System__initialize')) { |
|
167 | - EE_Error::doing_it_wrong( |
|
168 | - __FUNCTION__, |
|
169 | - sprintf( |
|
170 | - esc_html__( |
|
171 | - 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', |
|
172 | - 'event_espresso' |
|
173 | - ), |
|
174 | - $conditional_tag |
|
175 | - ), |
|
176 | - '4.4.0' |
|
177 | - ); |
|
178 | - return false; |
|
179 | - } |
|
180 | - return true; |
|
166 | + if (! did_action('AHEE__EE_System__initialize')) { |
|
167 | + EE_Error::doing_it_wrong( |
|
168 | + __FUNCTION__, |
|
169 | + sprintf( |
|
170 | + esc_html__( |
|
171 | + 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', |
|
172 | + 'event_espresso' |
|
173 | + ), |
|
174 | + $conditional_tag |
|
175 | + ), |
|
176 | + '4.4.0' |
|
177 | + ); |
|
178 | + return false; |
|
179 | + } |
|
180 | + return true; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | /*************************** Event Queries ***************************/ |
185 | 185 | |
186 | 186 | if (! function_exists('espresso_get_events')) { |
187 | - /** |
|
188 | - * espresso_get_events |
|
189 | - * |
|
190 | - * @param array $params |
|
191 | - * @return array |
|
192 | - */ |
|
193 | - function espresso_get_events($params = []) |
|
194 | - { |
|
195 | - //set default params |
|
196 | - $default_espresso_events_params = [ |
|
197 | - 'limit' => 10, |
|
198 | - 'show_expired' => false, |
|
199 | - 'month' => null, |
|
200 | - 'category_slug' => null, |
|
201 | - 'order_by' => 'start_date', |
|
202 | - 'sort' => 'ASC', |
|
203 | - ]; |
|
204 | - // allow the defaults to be filtered |
|
205 | - $default_espresso_events_params = apply_filters( |
|
206 | - 'espresso_get_events__default_espresso_events_params', |
|
207 | - $default_espresso_events_params |
|
208 | - ); |
|
209 | - // grab params and merge with defaults, then extract |
|
210 | - $params = array_merge($default_espresso_events_params, $params); |
|
211 | - // run the query |
|
212 | - $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params); |
|
213 | - // assign results to a variable so we can return it |
|
214 | - $events = $events_query->have_posts() ? $events_query->posts : []; |
|
215 | - // but first reset the query and postdata |
|
216 | - wp_reset_query(); |
|
217 | - wp_reset_postdata(); |
|
218 | - EED_Events_Archive::remove_all_events_archive_filters(); |
|
219 | - unset($events_query); |
|
220 | - return $events; |
|
221 | - } |
|
187 | + /** |
|
188 | + * espresso_get_events |
|
189 | + * |
|
190 | + * @param array $params |
|
191 | + * @return array |
|
192 | + */ |
|
193 | + function espresso_get_events($params = []) |
|
194 | + { |
|
195 | + //set default params |
|
196 | + $default_espresso_events_params = [ |
|
197 | + 'limit' => 10, |
|
198 | + 'show_expired' => false, |
|
199 | + 'month' => null, |
|
200 | + 'category_slug' => null, |
|
201 | + 'order_by' => 'start_date', |
|
202 | + 'sort' => 'ASC', |
|
203 | + ]; |
|
204 | + // allow the defaults to be filtered |
|
205 | + $default_espresso_events_params = apply_filters( |
|
206 | + 'espresso_get_events__default_espresso_events_params', |
|
207 | + $default_espresso_events_params |
|
208 | + ); |
|
209 | + // grab params and merge with defaults, then extract |
|
210 | + $params = array_merge($default_espresso_events_params, $params); |
|
211 | + // run the query |
|
212 | + $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params); |
|
213 | + // assign results to a variable so we can return it |
|
214 | + $events = $events_query->have_posts() ? $events_query->posts : []; |
|
215 | + // but first reset the query and postdata |
|
216 | + wp_reset_query(); |
|
217 | + wp_reset_postdata(); |
|
218 | + EED_Events_Archive::remove_all_events_archive_filters(); |
|
219 | + unset($events_query); |
|
220 | + return $events; |
|
221 | + } |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -233,115 +233,115 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function espresso_load_ticket_selector() |
235 | 235 | { |
236 | - EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
236 | + EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | if (! function_exists('espresso_ticket_selector')) { |
240 | - /** |
|
241 | - * espresso_ticket_selector |
|
242 | - * |
|
243 | - * @param null $event |
|
244 | - * @throws EE_Error |
|
245 | - * @throws ReflectionException |
|
246 | - */ |
|
247 | - function espresso_ticket_selector($event = null) |
|
248 | - { |
|
249 | - if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) { |
|
250 | - espresso_load_ticket_selector(); |
|
251 | - EED_Ticket_Selector::set_definitions(); |
|
252 | - echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped |
|
253 | - } |
|
254 | - } |
|
240 | + /** |
|
241 | + * espresso_ticket_selector |
|
242 | + * |
|
243 | + * @param null $event |
|
244 | + * @throws EE_Error |
|
245 | + * @throws ReflectionException |
|
246 | + */ |
|
247 | + function espresso_ticket_selector($event = null) |
|
248 | + { |
|
249 | + if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) { |
|
250 | + espresso_load_ticket_selector(); |
|
251 | + EED_Ticket_Selector::set_definitions(); |
|
252 | + echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped |
|
253 | + } |
|
254 | + } |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | 258 | if (! function_exists('espresso_view_details_btn')) { |
259 | - /** |
|
260 | - * espresso_view_details_btn |
|
261 | - * |
|
262 | - * @param null $event |
|
263 | - * @throws EE_Error |
|
264 | - * @throws ReflectionException |
|
265 | - */ |
|
266 | - function espresso_view_details_btn($event = null) |
|
267 | - { |
|
268 | - if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) { |
|
269 | - espresso_load_ticket_selector(); |
|
270 | - echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped |
|
271 | - } |
|
272 | - } |
|
259 | + /** |
|
260 | + * espresso_view_details_btn |
|
261 | + * |
|
262 | + * @param null $event |
|
263 | + * @throws EE_Error |
|
264 | + * @throws ReflectionException |
|
265 | + */ |
|
266 | + function espresso_view_details_btn($event = null) |
|
267 | + { |
|
268 | + if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) { |
|
269 | + espresso_load_ticket_selector(); |
|
270 | + echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped |
|
271 | + } |
|
272 | + } |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
276 | 276 | /*************************** EEH_Event_View ***************************/ |
277 | 277 | |
278 | 278 | if (! function_exists('espresso_load_event_list_assets')) { |
279 | - /** |
|
280 | - * espresso_load_event_list_assets |
|
281 | - * ensures that event list styles and scripts are loaded |
|
282 | - * |
|
283 | - * @return void |
|
284 | - */ |
|
285 | - function espresso_load_event_list_assets() |
|
286 | - { |
|
287 | - $event_list = EED_Events_Archive::instance(); |
|
288 | - add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10); |
|
289 | - add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
290 | - } |
|
279 | + /** |
|
280 | + * espresso_load_event_list_assets |
|
281 | + * ensures that event list styles and scripts are loaded |
|
282 | + * |
|
283 | + * @return void |
|
284 | + */ |
|
285 | + function espresso_load_event_list_assets() |
|
286 | + { |
|
287 | + $event_list = EED_Events_Archive::instance(); |
|
288 | + add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10); |
|
289 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
290 | + } |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
294 | 294 | if (! function_exists('espresso_event_reg_button')) { |
295 | - /** |
|
296 | - * espresso_event_reg_button |
|
297 | - * returns the "Register Now" button if event is active, |
|
298 | - * an inactive button like status banner if the event is not active |
|
299 | - * or a "Read More" button if so desired |
|
300 | - * |
|
301 | - * @param null $btn_text_if_active |
|
302 | - * @param bool $btn_text_if_inactive |
|
303 | - * @param bool $EVT_ID |
|
304 | - * @return void |
|
305 | - * @throws EE_Error |
|
306 | - * @throws ReflectionException |
|
307 | - */ |
|
308 | - function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false) |
|
309 | - { |
|
310 | - $event = EEH_Event_View::get_event($EVT_ID); |
|
311 | - if (! $event instanceof EE_Event) { |
|
312 | - return; |
|
313 | - } |
|
314 | - $event_status = $event->get_active_status(); |
|
315 | - switch ($event_status) { |
|
316 | - case EE_Datetime::sold_out : |
|
317 | - $btn_text = __('Sold Out', 'event_espresso'); |
|
318 | - $class = 'ee-pink'; |
|
319 | - break; |
|
320 | - case EE_Datetime::expired : |
|
321 | - $btn_text = __('Event is Over', 'event_espresso'); |
|
322 | - $class = 'ee-grey'; |
|
323 | - break; |
|
324 | - case EE_Datetime::inactive : |
|
325 | - $btn_text = __('Event Not Active', 'event_espresso'); |
|
326 | - $class = 'ee-grey'; |
|
327 | - break; |
|
328 | - case EE_Datetime::cancelled : |
|
329 | - $btn_text = __('Event was Cancelled', 'event_espresso'); |
|
330 | - $class = 'ee-red'; |
|
331 | - break; |
|
332 | - case EE_Datetime::upcoming : |
|
333 | - case EE_Datetime::active : |
|
334 | - default : |
|
335 | - $btn_text = ! empty($btn_text_if_active) |
|
336 | - ? $btn_text_if_active |
|
337 | - : __('Register Now', 'event_espresso'); |
|
338 | - $class = 'ee-green'; |
|
339 | - } |
|
340 | - if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
341 | - $btn_text = $btn_text_if_inactive; |
|
342 | - $class = 'ee-grey'; |
|
343 | - } |
|
344 | - ?> |
|
295 | + /** |
|
296 | + * espresso_event_reg_button |
|
297 | + * returns the "Register Now" button if event is active, |
|
298 | + * an inactive button like status banner if the event is not active |
|
299 | + * or a "Read More" button if so desired |
|
300 | + * |
|
301 | + * @param null $btn_text_if_active |
|
302 | + * @param bool $btn_text_if_inactive |
|
303 | + * @param bool $EVT_ID |
|
304 | + * @return void |
|
305 | + * @throws EE_Error |
|
306 | + * @throws ReflectionException |
|
307 | + */ |
|
308 | + function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false) |
|
309 | + { |
|
310 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
311 | + if (! $event instanceof EE_Event) { |
|
312 | + return; |
|
313 | + } |
|
314 | + $event_status = $event->get_active_status(); |
|
315 | + switch ($event_status) { |
|
316 | + case EE_Datetime::sold_out : |
|
317 | + $btn_text = __('Sold Out', 'event_espresso'); |
|
318 | + $class = 'ee-pink'; |
|
319 | + break; |
|
320 | + case EE_Datetime::expired : |
|
321 | + $btn_text = __('Event is Over', 'event_espresso'); |
|
322 | + $class = 'ee-grey'; |
|
323 | + break; |
|
324 | + case EE_Datetime::inactive : |
|
325 | + $btn_text = __('Event Not Active', 'event_espresso'); |
|
326 | + $class = 'ee-grey'; |
|
327 | + break; |
|
328 | + case EE_Datetime::cancelled : |
|
329 | + $btn_text = __('Event was Cancelled', 'event_espresso'); |
|
330 | + $class = 'ee-red'; |
|
331 | + break; |
|
332 | + case EE_Datetime::upcoming : |
|
333 | + case EE_Datetime::active : |
|
334 | + default : |
|
335 | + $btn_text = ! empty($btn_text_if_active) |
|
336 | + ? $btn_text_if_active |
|
337 | + : __('Register Now', 'event_espresso'); |
|
338 | + $class = 'ee-green'; |
|
339 | + } |
|
340 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
341 | + $btn_text = $btn_text_if_inactive; |
|
342 | + $class = 'ee-grey'; |
|
343 | + } |
|
344 | + ?> |
|
345 | 345 | <a class="ee-button ee-register-button <?php echo esc_attr($class); ?>" |
346 | 346 | href="<?php espresso_event_link_url($EVT_ID); ?>" |
347 | 347 | <?php echo AttributesSanitizer::clean(EED_Events_Archive::link_target(), AllowedTags::getAllowedTags(), 'a'); ?> |
@@ -349,244 +349,244 @@ discard block |
||
349 | 349 | <?php echo esc_html($btn_text); ?> |
350 | 350 | </a> |
351 | 351 | <?php |
352 | - } |
|
352 | + } |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | 356 | if (! function_exists('espresso_display_ticket_selector')) { |
357 | - /** |
|
358 | - * espresso_display_ticket_selector |
|
359 | - * whether or not to display the Ticket Selector for an event |
|
360 | - * |
|
361 | - * @param bool $EVT_ID |
|
362 | - * @return boolean |
|
363 | - * @throws EE_Error |
|
364 | - * @throws ReflectionException |
|
365 | - */ |
|
366 | - function espresso_display_ticket_selector($EVT_ID = false) |
|
367 | - { |
|
368 | - return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
369 | - } |
|
357 | + /** |
|
358 | + * espresso_display_ticket_selector |
|
359 | + * whether or not to display the Ticket Selector for an event |
|
360 | + * |
|
361 | + * @param bool $EVT_ID |
|
362 | + * @return boolean |
|
363 | + * @throws EE_Error |
|
364 | + * @throws ReflectionException |
|
365 | + */ |
|
366 | + function espresso_display_ticket_selector($EVT_ID = false) |
|
367 | + { |
|
368 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
369 | + } |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
373 | 373 | if (! function_exists('espresso_event_status_banner')) { |
374 | - /** |
|
375 | - * espresso_event_status |
|
376 | - * returns a banner showing the event status if it is sold out, expired, or inactive |
|
377 | - * |
|
378 | - * @param bool $EVT_ID |
|
379 | - * @return string |
|
380 | - * @throws EE_Error |
|
381 | - * @throws ReflectionException |
|
382 | - */ |
|
383 | - function espresso_event_status_banner($EVT_ID = false) |
|
384 | - { |
|
385 | - return EEH_Event_View::event_status($EVT_ID); |
|
386 | - } |
|
374 | + /** |
|
375 | + * espresso_event_status |
|
376 | + * returns a banner showing the event status if it is sold out, expired, or inactive |
|
377 | + * |
|
378 | + * @param bool $EVT_ID |
|
379 | + * @return string |
|
380 | + * @throws EE_Error |
|
381 | + * @throws ReflectionException |
|
382 | + */ |
|
383 | + function espresso_event_status_banner($EVT_ID = false) |
|
384 | + { |
|
385 | + return EEH_Event_View::event_status($EVT_ID); |
|
386 | + } |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
390 | 390 | if (! function_exists('espresso_event_status')) { |
391 | - /** |
|
392 | - * espresso_event_status |
|
393 | - * returns the event status if it is sold out, expired, or inactive |
|
394 | - * |
|
395 | - * @param int $EVT_ID |
|
396 | - * @param bool $echo |
|
397 | - * @return string |
|
398 | - * @throws EE_Error |
|
399 | - * @throws ReflectionException |
|
400 | - */ |
|
401 | - function espresso_event_status($EVT_ID = 0, $echo = true) |
|
402 | - { |
|
403 | - return EEH_Event_View::event_active_status($EVT_ID, $echo); |
|
404 | - } |
|
391 | + /** |
|
392 | + * espresso_event_status |
|
393 | + * returns the event status if it is sold out, expired, or inactive |
|
394 | + * |
|
395 | + * @param int $EVT_ID |
|
396 | + * @param bool $echo |
|
397 | + * @return string |
|
398 | + * @throws EE_Error |
|
399 | + * @throws ReflectionException |
|
400 | + */ |
|
401 | + function espresso_event_status($EVT_ID = 0, $echo = true) |
|
402 | + { |
|
403 | + return EEH_Event_View::event_active_status($EVT_ID, $echo); |
|
404 | + } |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
408 | 408 | if (! function_exists('espresso_event_categories')) { |
409 | - /** |
|
410 | - * espresso_event_categories |
|
411 | - * returns the terms associated with an event |
|
412 | - * |
|
413 | - * @param int $EVT_ID |
|
414 | - * @param bool $hide_uncategorized |
|
415 | - * @param bool $echo |
|
416 | - * @return string |
|
417 | - * @throws EE_Error |
|
418 | - * @throws ReflectionException |
|
419 | - */ |
|
420 | - function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true) |
|
421 | - { |
|
422 | - if ($echo) { |
|
423 | - echo wp_kses(EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized), AllowedTags::getWithFormTags()); |
|
424 | - return ''; |
|
425 | - } |
|
426 | - return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
427 | - } |
|
409 | + /** |
|
410 | + * espresso_event_categories |
|
411 | + * returns the terms associated with an event |
|
412 | + * |
|
413 | + * @param int $EVT_ID |
|
414 | + * @param bool $hide_uncategorized |
|
415 | + * @param bool $echo |
|
416 | + * @return string |
|
417 | + * @throws EE_Error |
|
418 | + * @throws ReflectionException |
|
419 | + */ |
|
420 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true) |
|
421 | + { |
|
422 | + if ($echo) { |
|
423 | + echo wp_kses(EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized), AllowedTags::getWithFormTags()); |
|
424 | + return ''; |
|
425 | + } |
|
426 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
427 | + } |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | |
431 | 431 | if (! function_exists('espresso_event_tickets_available')) { |
432 | - /** |
|
433 | - * espresso_event_tickets_available |
|
434 | - * returns the ticket types available for purchase for an event |
|
435 | - * |
|
436 | - * @param int $EVT_ID |
|
437 | - * @param bool $echo |
|
438 | - * @param bool $format |
|
439 | - * @return string |
|
440 | - * @throws EE_Error |
|
441 | - * @throws ReflectionException |
|
442 | - */ |
|
443 | - function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true) |
|
444 | - { |
|
445 | - $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
446 | - if (is_array($tickets) && ! empty($tickets)) { |
|
447 | - // if formatting then $html will be a string, else it will be an array of ticket objects |
|
448 | - $html = |
|
449 | - $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : []; |
|
450 | - foreach ($tickets as $ticket) { |
|
451 | - if ($ticket instanceof EE_Ticket) { |
|
452 | - if ($format) { |
|
453 | - $html .= '<li id="ee-event-tickets-li-' |
|
454 | - . esc_attr($ticket->ID()) |
|
455 | - . '" class="ee-event-tickets-li">'; |
|
456 | - $html .= esc_html($ticket->name()) . ' '; |
|
457 | - $html .= EEH_Template::format_currency( |
|
458 | - $ticket->get_ticket_total_with_taxes() |
|
459 | - ); // already escaped |
|
460 | - $html .= '</li>'; |
|
461 | - } else { |
|
462 | - $html[] = $ticket; |
|
463 | - } |
|
464 | - } |
|
465 | - } |
|
466 | - if ($format) { |
|
467 | - $html .= '</ul>'; |
|
468 | - } |
|
469 | - if ($echo && $format) { |
|
470 | - echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
471 | - return ''; |
|
472 | - } |
|
473 | - return $html; |
|
474 | - } |
|
475 | - return ''; |
|
476 | - } |
|
432 | + /** |
|
433 | + * espresso_event_tickets_available |
|
434 | + * returns the ticket types available for purchase for an event |
|
435 | + * |
|
436 | + * @param int $EVT_ID |
|
437 | + * @param bool $echo |
|
438 | + * @param bool $format |
|
439 | + * @return string |
|
440 | + * @throws EE_Error |
|
441 | + * @throws ReflectionException |
|
442 | + */ |
|
443 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true) |
|
444 | + { |
|
445 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
446 | + if (is_array($tickets) && ! empty($tickets)) { |
|
447 | + // if formatting then $html will be a string, else it will be an array of ticket objects |
|
448 | + $html = |
|
449 | + $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : []; |
|
450 | + foreach ($tickets as $ticket) { |
|
451 | + if ($ticket instanceof EE_Ticket) { |
|
452 | + if ($format) { |
|
453 | + $html .= '<li id="ee-event-tickets-li-' |
|
454 | + . esc_attr($ticket->ID()) |
|
455 | + . '" class="ee-event-tickets-li">'; |
|
456 | + $html .= esc_html($ticket->name()) . ' '; |
|
457 | + $html .= EEH_Template::format_currency( |
|
458 | + $ticket->get_ticket_total_with_taxes() |
|
459 | + ); // already escaped |
|
460 | + $html .= '</li>'; |
|
461 | + } else { |
|
462 | + $html[] = $ticket; |
|
463 | + } |
|
464 | + } |
|
465 | + } |
|
466 | + if ($format) { |
|
467 | + $html .= '</ul>'; |
|
468 | + } |
|
469 | + if ($echo && $format) { |
|
470 | + echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
471 | + return ''; |
|
472 | + } |
|
473 | + return $html; |
|
474 | + } |
|
475 | + return ''; |
|
476 | + } |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | if (! function_exists('espresso_event_date_obj')) { |
480 | - /** |
|
481 | - * espresso_event_date_obj |
|
482 | - * returns the primary date object for an event |
|
483 | - * |
|
484 | - * @param bool $EVT_ID |
|
485 | - * @return EE_Datetime|null |
|
486 | - * @throws EE_Error |
|
487 | - * @throws ReflectionException |
|
488 | - */ |
|
489 | - function espresso_event_date_obj($EVT_ID = false) |
|
490 | - { |
|
491 | - return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
492 | - } |
|
480 | + /** |
|
481 | + * espresso_event_date_obj |
|
482 | + * returns the primary date object for an event |
|
483 | + * |
|
484 | + * @param bool $EVT_ID |
|
485 | + * @return EE_Datetime|null |
|
486 | + * @throws EE_Error |
|
487 | + * @throws ReflectionException |
|
488 | + */ |
|
489 | + function espresso_event_date_obj($EVT_ID = false) |
|
490 | + { |
|
491 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
492 | + } |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | |
496 | 496 | if (! function_exists('espresso_event_date')) { |
497 | - /** |
|
498 | - * espresso_event_date |
|
499 | - * returns the primary date for an event |
|
500 | - * |
|
501 | - * @param string $date_format |
|
502 | - * @param string $time_format |
|
503 | - * @param bool $EVT_ID |
|
504 | - * @param bool $echo |
|
505 | - * @return string |
|
506 | - * @throws EE_Error |
|
507 | - * @throws ReflectionException |
|
508 | - */ |
|
509 | - function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
510 | - { |
|
511 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
512 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
513 | - $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
514 | - $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
515 | - if ($echo) { |
|
516 | - echo wp_kses(EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID), AllowedTags::getWithFormTags()); |
|
517 | - return ''; |
|
518 | - } |
|
519 | - return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
520 | - |
|
521 | - } |
|
497 | + /** |
|
498 | + * espresso_event_date |
|
499 | + * returns the primary date for an event |
|
500 | + * |
|
501 | + * @param string $date_format |
|
502 | + * @param string $time_format |
|
503 | + * @param bool $EVT_ID |
|
504 | + * @param bool $echo |
|
505 | + * @return string |
|
506 | + * @throws EE_Error |
|
507 | + * @throws ReflectionException |
|
508 | + */ |
|
509 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
510 | + { |
|
511 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
512 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
513 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
514 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
515 | + if ($echo) { |
|
516 | + echo wp_kses(EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID), AllowedTags::getWithFormTags()); |
|
517 | + return ''; |
|
518 | + } |
|
519 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
520 | + |
|
521 | + } |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | |
525 | 525 | if (! function_exists('espresso_list_of_event_dates')) { |
526 | - /** |
|
527 | - * espresso_list_of_event_dates |
|
528 | - * returns a unordered list of dates for an event |
|
529 | - * |
|
530 | - * @param int $EVT_ID |
|
531 | - * @param string $date_format |
|
532 | - * @param string $time_format |
|
533 | - * @param bool $echo |
|
534 | - * @param null $show_expired |
|
535 | - * @param bool $format |
|
536 | - * @param bool $add_breaks |
|
537 | - * @param null $limit |
|
538 | - * @return string |
|
539 | - * @throws EE_Error |
|
540 | - * @throws ReflectionException |
|
541 | - */ |
|
542 | - function espresso_list_of_event_dates( |
|
543 | - $EVT_ID = 0, |
|
544 | - $date_format = '', |
|
545 | - $time_format = '', |
|
546 | - $echo = true, |
|
547 | - $show_expired = null, |
|
548 | - $format = true, |
|
549 | - $add_breaks = true, |
|
550 | - $limit = null |
|
551 | - ) { |
|
552 | - $allowedtags = AllowedTags::getAllowedTags(); |
|
553 | - |
|
554 | - $DTT_ID = LoaderFactory::getShared(RequestInterface::class)->getRequestParam('datetime', 0, 'int'); |
|
555 | - $arguments = apply_filters( |
|
556 | - 'FHEE__espresso_list_of_event_dates__arguments', |
|
557 | - [ $EVT_ID, $date_format, $time_format, $echo, $show_expired, $format, $add_breaks, $limit, $DTT_ID ] |
|
558 | - ); |
|
559 | - [$EVT_ID, $date_format, $time_format, $echo, $show_expired, $format, $add_breaks, $limit, $DTT_ID] = $arguments; |
|
560 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
561 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
562 | - $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
563 | - $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
564 | - $datetimes = $DTT_ID |
|
565 | - ? [EEH_Event_View::get_date_obj($DTT_ID)] |
|
566 | - : EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, (int) $limit); |
|
567 | - if (! $format) { |
|
568 | - return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
569 | - } |
|
570 | - $newline = $add_breaks ? '<br />' : ''; |
|
571 | - if (is_array($datetimes) && ! empty($datetimes)) { |
|
572 | - global $post; |
|
526 | + /** |
|
527 | + * espresso_list_of_event_dates |
|
528 | + * returns a unordered list of dates for an event |
|
529 | + * |
|
530 | + * @param int $EVT_ID |
|
531 | + * @param string $date_format |
|
532 | + * @param string $time_format |
|
533 | + * @param bool $echo |
|
534 | + * @param null $show_expired |
|
535 | + * @param bool $format |
|
536 | + * @param bool $add_breaks |
|
537 | + * @param null $limit |
|
538 | + * @return string |
|
539 | + * @throws EE_Error |
|
540 | + * @throws ReflectionException |
|
541 | + */ |
|
542 | + function espresso_list_of_event_dates( |
|
543 | + $EVT_ID = 0, |
|
544 | + $date_format = '', |
|
545 | + $time_format = '', |
|
546 | + $echo = true, |
|
547 | + $show_expired = null, |
|
548 | + $format = true, |
|
549 | + $add_breaks = true, |
|
550 | + $limit = null |
|
551 | + ) { |
|
552 | + $allowedtags = AllowedTags::getAllowedTags(); |
|
553 | + |
|
554 | + $DTT_ID = LoaderFactory::getShared(RequestInterface::class)->getRequestParam('datetime', 0, 'int'); |
|
555 | + $arguments = apply_filters( |
|
556 | + 'FHEE__espresso_list_of_event_dates__arguments', |
|
557 | + [ $EVT_ID, $date_format, $time_format, $echo, $show_expired, $format, $add_breaks, $limit, $DTT_ID ] |
|
558 | + ); |
|
559 | + [$EVT_ID, $date_format, $time_format, $echo, $show_expired, $format, $add_breaks, $limit, $DTT_ID] = $arguments; |
|
560 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
561 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
562 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
563 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
564 | + $datetimes = $DTT_ID |
|
565 | + ? [EEH_Event_View::get_date_obj($DTT_ID)] |
|
566 | + : EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, (int) $limit); |
|
567 | + if (! $format) { |
|
568 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
569 | + } |
|
570 | + $newline = $add_breaks ? '<br />' : ''; |
|
571 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
572 | + global $post; |
|
573 | 573 | $cols = count($datetimes); |
574 | 574 | $cols = $cols >= 3 ? 'big' : 'small'; |
575 | 575 | $ul_class = "ee-event-datetimes-ul ee-event-datetimes-ul--{$cols}"; |
576 | 576 | $html = '<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="'. $ul_class.'">'; |
577 | - $datetime = null; |
|
578 | - foreach ($datetimes as $datetime) { |
|
579 | - if ($datetime instanceof EE_Datetime) { |
|
577 | + $datetime = null; |
|
578 | + foreach ($datetimes as $datetime) { |
|
579 | + if ($datetime instanceof EE_Datetime) { |
|
580 | 580 | |
581 | - $datetime_name = $datetime->name(); |
|
582 | - $datetime_html = ! empty($datetime_name) |
|
583 | - ? ' |
|
581 | + $datetime_name = $datetime->name(); |
|
582 | + $datetime_html = ! empty($datetime_name) |
|
583 | + ? ' |
|
584 | 584 | <strong class="ee-event-datetimes-li-date-name"> |
585 | 585 | ' . esc_html($datetime_name) . ' |
586 | 586 | </strong>' . $newline |
587 | - : ''; |
|
587 | + : ''; |
|
588 | 588 | |
589 | - $datetime_html .= ' |
|
589 | + $datetime_html .= ' |
|
590 | 590 | <span class="ee-event-datetimes-li-daterange"> |
591 | 591 | <span class="dashicons dashicons-calendar"></span> ' |
592 | 592 | . $datetime->date_range($date_format). ' |
@@ -598,501 +598,501 @@ discard block |
||
598 | 598 | </span> |
599 | 599 | '; |
600 | 600 | |
601 | - $venue = $datetime->venue(); |
|
602 | - if ($venue instanceof EE_Venue) { |
|
603 | - $venue_name = esc_html($venue->name()); |
|
604 | - $datetime_html .= '<br /><span class="ee-event-datetimes-li-venue">'; |
|
605 | - $datetime_html .= '<span class="dashicons dashicons-admin-home"></span> '; |
|
606 | - $datetime_html .= '<a href="'. esc_url_raw($venue->get_permalink()) .'" target="_blank">'; |
|
607 | - $datetime_html .= $venue_name . '</a></span>'; |
|
608 | - } |
|
609 | - |
|
610 | - $datetime_description = $datetime->description(); |
|
611 | - $datetime_html .= ! empty($datetime_description) |
|
612 | - ? ' |
|
601 | + $venue = $datetime->venue(); |
|
602 | + if ($venue instanceof EE_Venue) { |
|
603 | + $venue_name = esc_html($venue->name()); |
|
604 | + $datetime_html .= '<br /><span class="ee-event-datetimes-li-venue">'; |
|
605 | + $datetime_html .= '<span class="dashicons dashicons-admin-home"></span> '; |
|
606 | + $datetime_html .= '<a href="'. esc_url_raw($venue->get_permalink()) .'" target="_blank">'; |
|
607 | + $datetime_html .= $venue_name . '</a></span>'; |
|
608 | + } |
|
609 | + |
|
610 | + $datetime_description = $datetime->description(); |
|
611 | + $datetime_html .= ! empty($datetime_description) |
|
612 | + ? ' |
|
613 | 613 | <span class="ee-event-datetimes-li-date-desc"> |
614 | 614 | ' . wp_kses($datetime_description, $allowedtags) . ' |
615 | 615 | </span>' . $newline |
616 | - : ''; |
|
616 | + : ''; |
|
617 | 617 | |
618 | - $datetime_html = apply_filters( |
|
619 | - 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
620 | - $datetime_html, |
|
621 | - $datetime, |
|
622 | - $arguments |
|
623 | - ); |
|
618 | + $datetime_html = apply_filters( |
|
619 | + 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
620 | + $datetime_html, |
|
621 | + $datetime, |
|
622 | + $arguments |
|
623 | + ); |
|
624 | 624 | |
625 | - $DTD_ID = esc_attr($datetime->ID()); |
|
626 | - $active_status = esc_attr('ee-event-datetimes-li-' . $datetime->get_active_status()); |
|
625 | + $DTD_ID = esc_attr($datetime->ID()); |
|
626 | + $active_status = esc_attr('ee-event-datetimes-li-' . $datetime->get_active_status()); |
|
627 | 627 | |
628 | - $html .= ' |
|
628 | + $html .= ' |
|
629 | 629 | <li id="ee-event-datetimes-li-' . $DTD_ID . '" class="ee-event-datetimes-li ' . $active_status . '"> |
630 | 630 | ' . $datetime_html . ' |
631 | 631 | </li>'; |
632 | - } |
|
633 | - } |
|
634 | - $html .= '</ul>'; |
|
635 | - $html = apply_filters('FHEE__espresso_list_of_event_dates__html', $html, $arguments, $datetime); |
|
636 | - } else { |
|
637 | - $html = |
|
638 | - ' |
|
632 | + } |
|
633 | + } |
|
634 | + $html .= '</ul>'; |
|
635 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__html', $html, $arguments, $datetime); |
|
636 | + } else { |
|
637 | + $html = |
|
638 | + ' |
|
639 | 639 | <p> |
640 | 640 | <span class="dashicons dashicons-marker pink-text"></span> |
641 | 641 | ' . esc_html__( |
642 | - 'There are no upcoming dates for this event.', |
|
643 | - 'event_espresso' |
|
644 | - ) . ' |
|
642 | + 'There are no upcoming dates for this event.', |
|
643 | + 'event_espresso' |
|
644 | + ) . ' |
|
645 | 645 | </p> |
646 | 646 | <br/>'; |
647 | - } |
|
648 | - if ($echo) { |
|
649 | - echo wp_kses($html, AllowedTags::getWithFormTags()); |
|
650 | - return ''; |
|
651 | - } |
|
652 | - return $html; |
|
653 | - } |
|
647 | + } |
|
648 | + if ($echo) { |
|
649 | + echo wp_kses($html, AllowedTags::getWithFormTags()); |
|
650 | + return ''; |
|
651 | + } |
|
652 | + return $html; |
|
653 | + } |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | |
657 | 657 | if (! function_exists('espresso_event_end_date')) { |
658 | - /** |
|
659 | - * espresso_event_end_date |
|
660 | - * returns the last date for an event |
|
661 | - * |
|
662 | - * @param string $date_format |
|
663 | - * @param string $time_format |
|
664 | - * @param bool $EVT_ID |
|
665 | - * @param bool $echo |
|
666 | - * @return string |
|
667 | - * @throws EE_Error |
|
668 | - * @throws ReflectionException |
|
669 | - */ |
|
670 | - function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
671 | - { |
|
672 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
673 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
674 | - $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
675 | - $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
676 | - if ($echo) { |
|
677 | - echo wp_kses(EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID), AllowedTags::getWithFormTags()); |
|
678 | - return ''; |
|
679 | - } |
|
680 | - return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
681 | - } |
|
658 | + /** |
|
659 | + * espresso_event_end_date |
|
660 | + * returns the last date for an event |
|
661 | + * |
|
662 | + * @param string $date_format |
|
663 | + * @param string $time_format |
|
664 | + * @param bool $EVT_ID |
|
665 | + * @param bool $echo |
|
666 | + * @return string |
|
667 | + * @throws EE_Error |
|
668 | + * @throws ReflectionException |
|
669 | + */ |
|
670 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
671 | + { |
|
672 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
673 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
674 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
675 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
676 | + if ($echo) { |
|
677 | + echo wp_kses(EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID), AllowedTags::getWithFormTags()); |
|
678 | + return ''; |
|
679 | + } |
|
680 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
681 | + } |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | if (! function_exists('espresso_event_date_range')) { |
685 | - /** |
|
686 | - * espresso_event_date_range |
|
687 | - * returns the first and last chronologically ordered dates for an event (if different) |
|
688 | - * |
|
689 | - * @param string $date_format |
|
690 | - * @param string $time_format |
|
691 | - * @param string $single_date_format |
|
692 | - * @param string $single_time_format |
|
693 | - * @param bool $EVT_ID |
|
694 | - * @param bool $echo |
|
695 | - * @return string |
|
696 | - * @throws EE_Error |
|
697 | - * @throws ReflectionException |
|
698 | - */ |
|
699 | - function espresso_event_date_range( |
|
700 | - $date_format = '', |
|
701 | - $time_format = '', |
|
702 | - $single_date_format = '', |
|
703 | - $single_time_format = '', |
|
704 | - $EVT_ID = false, |
|
705 | - $echo = true |
|
706 | - ) { |
|
707 | - // set and filter date and time formats when a range is returned |
|
708 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
709 | - $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
710 | - // get the start and end date with NO time portion |
|
711 | - $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
712 | - $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
713 | - // now we can determine if date range spans more than one day |
|
714 | - if ($the_event_date != $the_event_end_date) { |
|
715 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
716 | - $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
717 | - $html = sprintf( |
|
718 | - /* translators: 1: first event date, 2: last event date */ |
|
719 | - esc_html__('%1$s - %2$s', 'event_espresso'), |
|
720 | - EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
721 | - EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
722 | - ); |
|
723 | - } else { |
|
724 | - // set and filter date and time formats when only a single datetime is returned |
|
725 | - $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
726 | - $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
727 | - $single_date_format = |
|
728 | - apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
729 | - $single_time_format = |
|
730 | - apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
731 | - $html = |
|
732 | - EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
733 | - } |
|
734 | - if ($echo) { |
|
735 | - echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
736 | - return ''; |
|
737 | - } |
|
738 | - return $html; |
|
739 | - } |
|
685 | + /** |
|
686 | + * espresso_event_date_range |
|
687 | + * returns the first and last chronologically ordered dates for an event (if different) |
|
688 | + * |
|
689 | + * @param string $date_format |
|
690 | + * @param string $time_format |
|
691 | + * @param string $single_date_format |
|
692 | + * @param string $single_time_format |
|
693 | + * @param bool $EVT_ID |
|
694 | + * @param bool $echo |
|
695 | + * @return string |
|
696 | + * @throws EE_Error |
|
697 | + * @throws ReflectionException |
|
698 | + */ |
|
699 | + function espresso_event_date_range( |
|
700 | + $date_format = '', |
|
701 | + $time_format = '', |
|
702 | + $single_date_format = '', |
|
703 | + $single_time_format = '', |
|
704 | + $EVT_ID = false, |
|
705 | + $echo = true |
|
706 | + ) { |
|
707 | + // set and filter date and time formats when a range is returned |
|
708 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
709 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
710 | + // get the start and end date with NO time portion |
|
711 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
712 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
713 | + // now we can determine if date range spans more than one day |
|
714 | + if ($the_event_date != $the_event_end_date) { |
|
715 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
716 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
717 | + $html = sprintf( |
|
718 | + /* translators: 1: first event date, 2: last event date */ |
|
719 | + esc_html__('%1$s - %2$s', 'event_espresso'), |
|
720 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
721 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
722 | + ); |
|
723 | + } else { |
|
724 | + // set and filter date and time formats when only a single datetime is returned |
|
725 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
726 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
727 | + $single_date_format = |
|
728 | + apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
729 | + $single_time_format = |
|
730 | + apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
731 | + $html = |
|
732 | + EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
733 | + } |
|
734 | + if ($echo) { |
|
735 | + echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
736 | + return ''; |
|
737 | + } |
|
738 | + return $html; |
|
739 | + } |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | if (! function_exists('espresso_next_upcoming_datetime_obj')) { |
743 | - /** |
|
744 | - * espresso_next_upcoming_datetime_obj |
|
745 | - * returns the next upcoming datetime object for an event |
|
746 | - * |
|
747 | - * @param int $EVT_ID |
|
748 | - * @return EE_Datetime|null |
|
749 | - * @throws EE_Error |
|
750 | - */ |
|
751 | - function espresso_next_upcoming_datetime_obj($EVT_ID = 0) |
|
752 | - { |
|
753 | - return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID); |
|
754 | - } |
|
743 | + /** |
|
744 | + * espresso_next_upcoming_datetime_obj |
|
745 | + * returns the next upcoming datetime object for an event |
|
746 | + * |
|
747 | + * @param int $EVT_ID |
|
748 | + * @return EE_Datetime|null |
|
749 | + * @throws EE_Error |
|
750 | + */ |
|
751 | + function espresso_next_upcoming_datetime_obj($EVT_ID = 0) |
|
752 | + { |
|
753 | + return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID); |
|
754 | + } |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | if (! function_exists('espresso_next_upcoming_datetime')) { |
758 | - /** |
|
759 | - * espresso_next_upcoming_datetime |
|
760 | - * returns the start date and time for the next upcoming event. |
|
761 | - * |
|
762 | - * @param string $date_format |
|
763 | - * @param string $time_format |
|
764 | - * @param int $EVT_ID |
|
765 | - * @param bool $echo |
|
766 | - * @return string |
|
767 | - * @throws EE_Error |
|
768 | - * @throws ReflectionException |
|
769 | - */ |
|
770 | - function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true) |
|
771 | - { |
|
772 | - |
|
773 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
774 | - $date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format); |
|
775 | - |
|
776 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
777 | - $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format); |
|
778 | - |
|
779 | - $datetime_format = trim($date_format . ' ' . $time_format); |
|
780 | - |
|
781 | - $datetime = espresso_next_upcoming_datetime_obj($EVT_ID); |
|
782 | - |
|
783 | - if (! $datetime instanceof EE_Datetime) { |
|
784 | - return ''; |
|
785 | - } |
|
786 | - if ($echo) { |
|
787 | - echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format)); |
|
788 | - return ''; |
|
789 | - } |
|
790 | - return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format); |
|
791 | - } |
|
758 | + /** |
|
759 | + * espresso_next_upcoming_datetime |
|
760 | + * returns the start date and time for the next upcoming event. |
|
761 | + * |
|
762 | + * @param string $date_format |
|
763 | + * @param string $time_format |
|
764 | + * @param int $EVT_ID |
|
765 | + * @param bool $echo |
|
766 | + * @return string |
|
767 | + * @throws EE_Error |
|
768 | + * @throws ReflectionException |
|
769 | + */ |
|
770 | + function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true) |
|
771 | + { |
|
772 | + |
|
773 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
774 | + $date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format); |
|
775 | + |
|
776 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
777 | + $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format); |
|
778 | + |
|
779 | + $datetime_format = trim($date_format . ' ' . $time_format); |
|
780 | + |
|
781 | + $datetime = espresso_next_upcoming_datetime_obj($EVT_ID); |
|
782 | + |
|
783 | + if (! $datetime instanceof EE_Datetime) { |
|
784 | + return ''; |
|
785 | + } |
|
786 | + if ($echo) { |
|
787 | + echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format)); |
|
788 | + return ''; |
|
789 | + } |
|
790 | + return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format); |
|
791 | + } |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | if (! function_exists('espresso_event_date_as_calendar_page')) { |
795 | - /** |
|
796 | - * espresso_event_date_as_calendar_page |
|
797 | - * returns the primary date for an event, stylized to appear as the page of a calendar |
|
798 | - * |
|
799 | - * @param bool $EVT_ID |
|
800 | - * @return void |
|
801 | - * @throws EE_Error |
|
802 | - * @throws ReflectionException |
|
803 | - */ |
|
804 | - function espresso_event_date_as_calendar_page($EVT_ID = false) |
|
805 | - { |
|
806 | - EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
807 | - } |
|
795 | + /** |
|
796 | + * espresso_event_date_as_calendar_page |
|
797 | + * returns the primary date for an event, stylized to appear as the page of a calendar |
|
798 | + * |
|
799 | + * @param bool $EVT_ID |
|
800 | + * @return void |
|
801 | + * @throws EE_Error |
|
802 | + * @throws ReflectionException |
|
803 | + */ |
|
804 | + function espresso_event_date_as_calendar_page($EVT_ID = false) |
|
805 | + { |
|
806 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
807 | + } |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | |
811 | 811 | if (! function_exists('espresso_event_link_url')) { |
812 | - /** |
|
813 | - * espresso_event_link_url |
|
814 | - * |
|
815 | - * @param int $EVT_ID |
|
816 | - * @param bool $echo |
|
817 | - * @return string |
|
818 | - * @throws EE_Error |
|
819 | - * @throws ReflectionException |
|
820 | - */ |
|
821 | - function espresso_event_link_url($EVT_ID = 0, $echo = true) |
|
822 | - { |
|
823 | - if ($echo) { |
|
824 | - echo wp_kses(EEH_Event_View::event_link_url($EVT_ID), AllowedTags::getWithFormTags()); |
|
825 | - return ''; |
|
826 | - } |
|
827 | - return EEH_Event_View::event_link_url($EVT_ID); |
|
828 | - } |
|
812 | + /** |
|
813 | + * espresso_event_link_url |
|
814 | + * |
|
815 | + * @param int $EVT_ID |
|
816 | + * @param bool $echo |
|
817 | + * @return string |
|
818 | + * @throws EE_Error |
|
819 | + * @throws ReflectionException |
|
820 | + */ |
|
821 | + function espresso_event_link_url($EVT_ID = 0, $echo = true) |
|
822 | + { |
|
823 | + if ($echo) { |
|
824 | + echo wp_kses(EEH_Event_View::event_link_url($EVT_ID), AllowedTags::getWithFormTags()); |
|
825 | + return ''; |
|
826 | + } |
|
827 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
828 | + } |
|
829 | 829 | } |
830 | 830 | |
831 | 831 | |
832 | 832 | if (! function_exists('espresso_event_has_content_or_excerpt')) { |
833 | - /** |
|
834 | - * espresso_event_has_content_or_excerpt |
|
835 | - * |
|
836 | - * @access public |
|
837 | - * @param bool $EVT_ID |
|
838 | - * @return boolean |
|
839 | - * @throws EE_Error |
|
840 | - * @throws ReflectionException |
|
841 | - */ |
|
842 | - function espresso_event_has_content_or_excerpt($EVT_ID = false) |
|
843 | - { |
|
844 | - return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
845 | - } |
|
833 | + /** |
|
834 | + * espresso_event_has_content_or_excerpt |
|
835 | + * |
|
836 | + * @access public |
|
837 | + * @param bool $EVT_ID |
|
838 | + * @return boolean |
|
839 | + * @throws EE_Error |
|
840 | + * @throws ReflectionException |
|
841 | + */ |
|
842 | + function espresso_event_has_content_or_excerpt($EVT_ID = false) |
|
843 | + { |
|
844 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
845 | + } |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | |
849 | 849 | if (! function_exists('espresso_event_content_or_excerpt')) { |
850 | - /** |
|
851 | - * espresso_event_content_or_excerpt |
|
852 | - * |
|
853 | - * @param int $num_words |
|
854 | - * @param null $more |
|
855 | - * @param bool $echo |
|
856 | - * @return string |
|
857 | - */ |
|
858 | - function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true) |
|
859 | - { |
|
860 | - if ($echo) { |
|
861 | - echo wp_kses(EEH_Event_View::event_content_or_excerpt($num_words, $more), AllowedTags::getWithFormTags()); |
|
862 | - return ''; |
|
863 | - } |
|
864 | - return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
865 | - } |
|
850 | + /** |
|
851 | + * espresso_event_content_or_excerpt |
|
852 | + * |
|
853 | + * @param int $num_words |
|
854 | + * @param null $more |
|
855 | + * @param bool $echo |
|
856 | + * @return string |
|
857 | + */ |
|
858 | + function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true) |
|
859 | + { |
|
860 | + if ($echo) { |
|
861 | + echo wp_kses(EEH_Event_View::event_content_or_excerpt($num_words, $more), AllowedTags::getWithFormTags()); |
|
862 | + return ''; |
|
863 | + } |
|
864 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
865 | + } |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
869 | 869 | if (! function_exists('espresso_event_phone')) { |
870 | - /** |
|
871 | - * espresso_event_phone |
|
872 | - * |
|
873 | - * @param int $EVT_ID |
|
874 | - * @param bool $echo |
|
875 | - * @return string |
|
876 | - * @throws EE_Error |
|
877 | - * @throws ReflectionException |
|
878 | - */ |
|
879 | - function espresso_event_phone($EVT_ID = 0, $echo = true) |
|
880 | - { |
|
881 | - if ($echo) { |
|
882 | - echo wp_kses(EEH_Event_View::event_phone($EVT_ID), AllowedTags::getWithFormTags()); |
|
883 | - return ''; |
|
884 | - } |
|
885 | - return EEH_Event_View::event_phone($EVT_ID); |
|
886 | - } |
|
870 | + /** |
|
871 | + * espresso_event_phone |
|
872 | + * |
|
873 | + * @param int $EVT_ID |
|
874 | + * @param bool $echo |
|
875 | + * @return string |
|
876 | + * @throws EE_Error |
|
877 | + * @throws ReflectionException |
|
878 | + */ |
|
879 | + function espresso_event_phone($EVT_ID = 0, $echo = true) |
|
880 | + { |
|
881 | + if ($echo) { |
|
882 | + echo wp_kses(EEH_Event_View::event_phone($EVT_ID), AllowedTags::getWithFormTags()); |
|
883 | + return ''; |
|
884 | + } |
|
885 | + return EEH_Event_View::event_phone($EVT_ID); |
|
886 | + } |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | |
890 | 890 | if (! function_exists('espresso_edit_event_link')) { |
891 | - /** |
|
892 | - * espresso_edit_event_link |
|
893 | - * returns a link to edit an event |
|
894 | - * |
|
895 | - * @param int $EVT_ID |
|
896 | - * @param bool $echo |
|
897 | - * @return string |
|
898 | - * @throws EE_Error |
|
899 | - * @throws ReflectionException |
|
900 | - */ |
|
901 | - function espresso_edit_event_link($EVT_ID = 0, $echo = true) |
|
902 | - { |
|
903 | - if ($echo) { |
|
904 | - echo wp_kses(EEH_Event_View::edit_event_link($EVT_ID), AllowedTags::getWithFormTags()); |
|
905 | - return ''; |
|
906 | - } |
|
907 | - return EEH_Event_View::edit_event_link($EVT_ID); |
|
908 | - } |
|
891 | + /** |
|
892 | + * espresso_edit_event_link |
|
893 | + * returns a link to edit an event |
|
894 | + * |
|
895 | + * @param int $EVT_ID |
|
896 | + * @param bool $echo |
|
897 | + * @return string |
|
898 | + * @throws EE_Error |
|
899 | + * @throws ReflectionException |
|
900 | + */ |
|
901 | + function espresso_edit_event_link($EVT_ID = 0, $echo = true) |
|
902 | + { |
|
903 | + if ($echo) { |
|
904 | + echo wp_kses(EEH_Event_View::edit_event_link($EVT_ID), AllowedTags::getWithFormTags()); |
|
905 | + return ''; |
|
906 | + } |
|
907 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
908 | + } |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | |
912 | 912 | if (! function_exists('espresso_organization_name')) { |
913 | - /** |
|
914 | - * espresso_organization_name |
|
915 | - * |
|
916 | - * @param bool $echo |
|
917 | - * @return string |
|
918 | - * @throws EE_Error |
|
919 | - */ |
|
920 | - function espresso_organization_name($echo = true) |
|
921 | - { |
|
922 | - if ($echo) { |
|
923 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('name')); |
|
924 | - return ''; |
|
925 | - } |
|
926 | - return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
927 | - } |
|
913 | + /** |
|
914 | + * espresso_organization_name |
|
915 | + * |
|
916 | + * @param bool $echo |
|
917 | + * @return string |
|
918 | + * @throws EE_Error |
|
919 | + */ |
|
920 | + function espresso_organization_name($echo = true) |
|
921 | + { |
|
922 | + if ($echo) { |
|
923 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('name')); |
|
924 | + return ''; |
|
925 | + } |
|
926 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
927 | + } |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | if (! function_exists('espresso_organization_address')) { |
931 | - /** |
|
932 | - * espresso_organization_address |
|
933 | - * |
|
934 | - * @param string $type |
|
935 | - * @return string |
|
936 | - */ |
|
937 | - function espresso_organization_address($type = 'inline') |
|
938 | - { |
|
939 | - if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
940 | - $address = new EventEspresso\core\domain\entities\GenericAddress( |
|
941 | - EE_Registry::instance()->CFG->organization->address_1, |
|
942 | - EE_Registry::instance()->CFG->organization->address_2, |
|
943 | - EE_Registry::instance()->CFG->organization->city, |
|
944 | - EE_Registry::instance()->CFG->organization->STA_ID, |
|
945 | - EE_Registry::instance()->CFG->organization->zip, |
|
946 | - EE_Registry::instance()->CFG->organization->CNT_ISO |
|
947 | - ); |
|
948 | - return EEH_Address::format($address, $type); |
|
949 | - } |
|
950 | - return ''; |
|
951 | - } |
|
931 | + /** |
|
932 | + * espresso_organization_address |
|
933 | + * |
|
934 | + * @param string $type |
|
935 | + * @return string |
|
936 | + */ |
|
937 | + function espresso_organization_address($type = 'inline') |
|
938 | + { |
|
939 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
940 | + $address = new EventEspresso\core\domain\entities\GenericAddress( |
|
941 | + EE_Registry::instance()->CFG->organization->address_1, |
|
942 | + EE_Registry::instance()->CFG->organization->address_2, |
|
943 | + EE_Registry::instance()->CFG->organization->city, |
|
944 | + EE_Registry::instance()->CFG->organization->STA_ID, |
|
945 | + EE_Registry::instance()->CFG->organization->zip, |
|
946 | + EE_Registry::instance()->CFG->organization->CNT_ISO |
|
947 | + ); |
|
948 | + return EEH_Address::format($address, $type); |
|
949 | + } |
|
950 | + return ''; |
|
951 | + } |
|
952 | 952 | } |
953 | 953 | |
954 | 954 | if (! function_exists('espresso_organization_email')) { |
955 | - /** |
|
956 | - * espresso_organization_email |
|
957 | - * |
|
958 | - * @param bool $echo |
|
959 | - * @return string |
|
960 | - * @throws EE_Error |
|
961 | - */ |
|
962 | - function espresso_organization_email($echo = true) |
|
963 | - { |
|
964 | - if ($echo) { |
|
965 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('email')); |
|
966 | - return ''; |
|
967 | - } |
|
968 | - return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
969 | - } |
|
955 | + /** |
|
956 | + * espresso_organization_email |
|
957 | + * |
|
958 | + * @param bool $echo |
|
959 | + * @return string |
|
960 | + * @throws EE_Error |
|
961 | + */ |
|
962 | + function espresso_organization_email($echo = true) |
|
963 | + { |
|
964 | + if ($echo) { |
|
965 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('email')); |
|
966 | + return ''; |
|
967 | + } |
|
968 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
969 | + } |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | if (! function_exists('espresso_organization_logo_url')) { |
973 | - /** |
|
974 | - * espresso_organization_logo_url |
|
975 | - * |
|
976 | - * @param bool $echo |
|
977 | - * @return string |
|
978 | - * @throws EE_Error |
|
979 | - */ |
|
980 | - function espresso_organization_logo_url($echo = true) |
|
981 | - { |
|
982 | - if ($echo) { |
|
983 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('logo_url')); |
|
984 | - return ''; |
|
985 | - } |
|
986 | - return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
987 | - } |
|
973 | + /** |
|
974 | + * espresso_organization_logo_url |
|
975 | + * |
|
976 | + * @param bool $echo |
|
977 | + * @return string |
|
978 | + * @throws EE_Error |
|
979 | + */ |
|
980 | + function espresso_organization_logo_url($echo = true) |
|
981 | + { |
|
982 | + if ($echo) { |
|
983 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('logo_url')); |
|
984 | + return ''; |
|
985 | + } |
|
986 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
987 | + } |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | if (! function_exists('espresso_organization_facebook')) { |
991 | - /** |
|
992 | - * espresso_organization_facebook |
|
993 | - * |
|
994 | - * @param bool $echo |
|
995 | - * @return string |
|
996 | - * @throws EE_Error |
|
997 | - */ |
|
998 | - function espresso_organization_facebook($echo = true) |
|
999 | - { |
|
1000 | - if ($echo) { |
|
1001 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('facebook')); |
|
1002 | - return ''; |
|
1003 | - } |
|
1004 | - return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
1005 | - } |
|
991 | + /** |
|
992 | + * espresso_organization_facebook |
|
993 | + * |
|
994 | + * @param bool $echo |
|
995 | + * @return string |
|
996 | + * @throws EE_Error |
|
997 | + */ |
|
998 | + function espresso_organization_facebook($echo = true) |
|
999 | + { |
|
1000 | + if ($echo) { |
|
1001 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('facebook')); |
|
1002 | + return ''; |
|
1003 | + } |
|
1004 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
1005 | + } |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | if (! function_exists('espresso_organization_twitter')) { |
1009 | - /** |
|
1010 | - * espresso_organization_twitter |
|
1011 | - * |
|
1012 | - * @param bool $echo |
|
1013 | - * @return string |
|
1014 | - * @throws EE_Error |
|
1015 | - */ |
|
1016 | - function espresso_organization_twitter($echo = true) |
|
1017 | - { |
|
1018 | - if ($echo) { |
|
1019 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('twitter')); |
|
1020 | - return ''; |
|
1021 | - } |
|
1022 | - return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
1023 | - } |
|
1009 | + /** |
|
1010 | + * espresso_organization_twitter |
|
1011 | + * |
|
1012 | + * @param bool $echo |
|
1013 | + * @return string |
|
1014 | + * @throws EE_Error |
|
1015 | + */ |
|
1016 | + function espresso_organization_twitter($echo = true) |
|
1017 | + { |
|
1018 | + if ($echo) { |
|
1019 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('twitter')); |
|
1020 | + return ''; |
|
1021 | + } |
|
1022 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
1023 | + } |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | if (! function_exists('espresso_organization_linkedin')) { |
1027 | - /** |
|
1028 | - * espresso_organization_linkedin |
|
1029 | - * |
|
1030 | - * @param bool $echo |
|
1031 | - * @return string |
|
1032 | - * @throws EE_Error |
|
1033 | - */ |
|
1034 | - function espresso_organization_linkedin($echo = true) |
|
1035 | - { |
|
1036 | - if ($echo) { |
|
1037 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('linkedin')); |
|
1038 | - return ''; |
|
1039 | - } |
|
1040 | - return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
1041 | - } |
|
1027 | + /** |
|
1028 | + * espresso_organization_linkedin |
|
1029 | + * |
|
1030 | + * @param bool $echo |
|
1031 | + * @return string |
|
1032 | + * @throws EE_Error |
|
1033 | + */ |
|
1034 | + function espresso_organization_linkedin($echo = true) |
|
1035 | + { |
|
1036 | + if ($echo) { |
|
1037 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('linkedin')); |
|
1038 | + return ''; |
|
1039 | + } |
|
1040 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
1041 | + } |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | if (! function_exists('espresso_organization_pinterest')) { |
1045 | - /** |
|
1046 | - * espresso_organization_pinterest |
|
1047 | - * |
|
1048 | - * @param bool $echo |
|
1049 | - * @return string |
|
1050 | - * @throws EE_Error |
|
1051 | - */ |
|
1052 | - function espresso_organization_pinterest($echo = true) |
|
1053 | - { |
|
1054 | - if ($echo) { |
|
1055 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('pinterest')); |
|
1056 | - return ''; |
|
1057 | - } |
|
1058 | - return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
1059 | - } |
|
1045 | + /** |
|
1046 | + * espresso_organization_pinterest |
|
1047 | + * |
|
1048 | + * @param bool $echo |
|
1049 | + * @return string |
|
1050 | + * @throws EE_Error |
|
1051 | + */ |
|
1052 | + function espresso_organization_pinterest($echo = true) |
|
1053 | + { |
|
1054 | + if ($echo) { |
|
1055 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('pinterest')); |
|
1056 | + return ''; |
|
1057 | + } |
|
1058 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
1059 | + } |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | if (! function_exists('espresso_organization_google')) { |
1063 | - /** |
|
1064 | - * espresso_organization_google |
|
1065 | - * |
|
1066 | - * @param bool $echo |
|
1067 | - * @return string |
|
1068 | - * @throws EE_Error |
|
1069 | - */ |
|
1070 | - function espresso_organization_google($echo = true) |
|
1071 | - { |
|
1072 | - if ($echo) { |
|
1073 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('google')); |
|
1074 | - return ''; |
|
1075 | - } |
|
1076 | - return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
1077 | - } |
|
1063 | + /** |
|
1064 | + * espresso_organization_google |
|
1065 | + * |
|
1066 | + * @param bool $echo |
|
1067 | + * @return string |
|
1068 | + * @throws EE_Error |
|
1069 | + */ |
|
1070 | + function espresso_organization_google($echo = true) |
|
1071 | + { |
|
1072 | + if ($echo) { |
|
1073 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('google')); |
|
1074 | + return ''; |
|
1075 | + } |
|
1076 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
1077 | + } |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | if (! function_exists('espresso_organization_instagram')) { |
1081 | - /** |
|
1082 | - * espresso_organization_instagram |
|
1083 | - * |
|
1084 | - * @param bool $echo |
|
1085 | - * @return string |
|
1086 | - * @throws EE_Error |
|
1087 | - */ |
|
1088 | - function espresso_organization_instagram($echo = true) |
|
1089 | - { |
|
1090 | - if ($echo) { |
|
1091 | - echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('instagram')); |
|
1092 | - return ''; |
|
1093 | - } |
|
1094 | - return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
1095 | - } |
|
1081 | + /** |
|
1082 | + * espresso_organization_instagram |
|
1083 | + * |
|
1084 | + * @param bool $echo |
|
1085 | + * @return string |
|
1086 | + * @throws EE_Error |
|
1087 | + */ |
|
1088 | + function espresso_organization_instagram($echo = true) |
|
1089 | + { |
|
1090 | + if ($echo) { |
|
1091 | + echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('instagram')); |
|
1092 | + return ''; |
|
1093 | + } |
|
1094 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
1095 | + } |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | |
@@ -1100,345 +1100,345 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | if (! function_exists('espresso_event_venues')) { |
1103 | - /** |
|
1104 | - * espresso_event_venues |
|
1105 | - * |
|
1106 | - * @return array all venues related to an event |
|
1107 | - * @throws EE_Error |
|
1108 | - * @throws ReflectionException |
|
1109 | - */ |
|
1110 | - function espresso_event_venues() |
|
1111 | - { |
|
1112 | - return EEH_Venue_View::get_event_venues(); |
|
1113 | - } |
|
1103 | + /** |
|
1104 | + * espresso_event_venues |
|
1105 | + * |
|
1106 | + * @return array all venues related to an event |
|
1107 | + * @throws EE_Error |
|
1108 | + * @throws ReflectionException |
|
1109 | + */ |
|
1110 | + function espresso_event_venues() |
|
1111 | + { |
|
1112 | + return EEH_Venue_View::get_event_venues(); |
|
1113 | + } |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | |
1117 | 1117 | if (! function_exists('espresso_venue_id')) { |
1118 | - /** |
|
1119 | - * espresso_venue_name |
|
1120 | - * |
|
1121 | - * @access public |
|
1122 | - * @param int $EVT_ID |
|
1123 | - * @return string |
|
1124 | - * @throws EE_Error |
|
1125 | - * @throws ReflectionException |
|
1126 | - */ |
|
1127 | - function espresso_venue_id($EVT_ID = 0) |
|
1128 | - { |
|
1129 | - $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
1130 | - return $venue instanceof EE_Venue ? $venue->ID() : 0; |
|
1131 | - } |
|
1118 | + /** |
|
1119 | + * espresso_venue_name |
|
1120 | + * |
|
1121 | + * @access public |
|
1122 | + * @param int $EVT_ID |
|
1123 | + * @return string |
|
1124 | + * @throws EE_Error |
|
1125 | + * @throws ReflectionException |
|
1126 | + */ |
|
1127 | + function espresso_venue_id($EVT_ID = 0) |
|
1128 | + { |
|
1129 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
1130 | + return $venue instanceof EE_Venue ? $venue->ID() : 0; |
|
1131 | + } |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
1135 | 1135 | if (! function_exists('espresso_is_venue_private')) { |
1136 | - /** |
|
1137 | - * Return whether a venue is private or not. |
|
1138 | - * |
|
1139 | - * @param int $VNU_ID optional, the venue id to check. |
|
1140 | - * |
|
1141 | - * @return bool | null |
|
1142 | - * @throws EE_Error |
|
1143 | - * @throws ReflectionException |
|
1144 | - * @see EEH_Venue_View::get_venue() for more info on expected return results. |
|
1145 | - */ |
|
1146 | - function espresso_is_venue_private($VNU_ID = 0) |
|
1147 | - { |
|
1148 | - return EEH_Venue_View::is_venue_private($VNU_ID); |
|
1149 | - } |
|
1136 | + /** |
|
1137 | + * Return whether a venue is private or not. |
|
1138 | + * |
|
1139 | + * @param int $VNU_ID optional, the venue id to check. |
|
1140 | + * |
|
1141 | + * @return bool | null |
|
1142 | + * @throws EE_Error |
|
1143 | + * @throws ReflectionException |
|
1144 | + * @see EEH_Venue_View::get_venue() for more info on expected return results. |
|
1145 | + */ |
|
1146 | + function espresso_is_venue_private($VNU_ID = 0) |
|
1147 | + { |
|
1148 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
1149 | + } |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | |
1153 | 1153 | if (! function_exists('espresso_venue_is_password_protected')) { |
1154 | - /** |
|
1155 | - * returns true or false if a venue is password protected or not |
|
1156 | - * |
|
1157 | - * @param int $VNU_ID optional, the venue id to check. |
|
1158 | - * @return bool |
|
1159 | - * @throws EE_Error |
|
1160 | - * @throws ReflectionException |
|
1161 | - */ |
|
1162 | - function espresso_venue_is_password_protected($VNU_ID = 0) |
|
1163 | - { |
|
1164 | - EE_Registry::instance()->load_helper('Venue_View'); |
|
1165 | - return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
1166 | - } |
|
1154 | + /** |
|
1155 | + * returns true or false if a venue is password protected or not |
|
1156 | + * |
|
1157 | + * @param int $VNU_ID optional, the venue id to check. |
|
1158 | + * @return bool |
|
1159 | + * @throws EE_Error |
|
1160 | + * @throws ReflectionException |
|
1161 | + */ |
|
1162 | + function espresso_venue_is_password_protected($VNU_ID = 0) |
|
1163 | + { |
|
1164 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1165 | + return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
1166 | + } |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
1170 | 1170 | if (! function_exists('espresso_password_protected_venue_form')) { |
1171 | - /** |
|
1172 | - * Returns a password form if venue is password protected. |
|
1173 | - * |
|
1174 | - * @param int $VNU_ID optional, the venue id to check. |
|
1175 | - * @return string |
|
1176 | - * @throws EE_Error |
|
1177 | - * @throws ReflectionException |
|
1178 | - */ |
|
1179 | - function espresso_password_protected_venue_form($VNU_ID = 0) |
|
1180 | - { |
|
1181 | - EE_Registry::instance()->load_helper('Venue_View'); |
|
1182 | - return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
1183 | - } |
|
1171 | + /** |
|
1172 | + * Returns a password form if venue is password protected. |
|
1173 | + * |
|
1174 | + * @param int $VNU_ID optional, the venue id to check. |
|
1175 | + * @return string |
|
1176 | + * @throws EE_Error |
|
1177 | + * @throws ReflectionException |
|
1178 | + */ |
|
1179 | + function espresso_password_protected_venue_form($VNU_ID = 0) |
|
1180 | + { |
|
1181 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1182 | + return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
1183 | + } |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | |
1187 | 1187 | if (! function_exists('espresso_venue_name')) { |
1188 | - /** |
|
1189 | - * espresso_venue_name |
|
1190 | - * |
|
1191 | - * @access public |
|
1192 | - * @param int $VNU_ID |
|
1193 | - * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website |
|
1194 | - * @param bool $echo |
|
1195 | - * @return string |
|
1196 | - * @throws EE_Error |
|
1197 | - * @throws ReflectionException |
|
1198 | - */ |
|
1199 | - function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true) |
|
1200 | - { |
|
1201 | - if ($echo) { |
|
1202 | - echo wp_kses(EEH_Venue_View::venue_name($link_to, $VNU_ID), AllowedTags::getWithFormTags()); |
|
1203 | - return ''; |
|
1204 | - } |
|
1205 | - return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
1206 | - } |
|
1188 | + /** |
|
1189 | + * espresso_venue_name |
|
1190 | + * |
|
1191 | + * @access public |
|
1192 | + * @param int $VNU_ID |
|
1193 | + * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website |
|
1194 | + * @param bool $echo |
|
1195 | + * @return string |
|
1196 | + * @throws EE_Error |
|
1197 | + * @throws ReflectionException |
|
1198 | + */ |
|
1199 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true) |
|
1200 | + { |
|
1201 | + if ($echo) { |
|
1202 | + echo wp_kses(EEH_Venue_View::venue_name($link_to, $VNU_ID), AllowedTags::getWithFormTags()); |
|
1203 | + return ''; |
|
1204 | + } |
|
1205 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
1206 | + } |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | 1210 | if (! function_exists('espresso_venue_link')) { |
1211 | - /** |
|
1212 | - * espresso_venue_link |
|
1213 | - * |
|
1214 | - * @access public |
|
1215 | - * @param int $VNU_ID |
|
1216 | - * @param string $text |
|
1217 | - * @return string |
|
1218 | - * @throws EE_Error |
|
1219 | - * @throws ReflectionException |
|
1220 | - */ |
|
1221 | - function espresso_venue_link($VNU_ID = 0, $text = '') |
|
1222 | - { |
|
1223 | - return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
1224 | - } |
|
1211 | + /** |
|
1212 | + * espresso_venue_link |
|
1213 | + * |
|
1214 | + * @access public |
|
1215 | + * @param int $VNU_ID |
|
1216 | + * @param string $text |
|
1217 | + * @return string |
|
1218 | + * @throws EE_Error |
|
1219 | + * @throws ReflectionException |
|
1220 | + */ |
|
1221 | + function espresso_venue_link($VNU_ID = 0, $text = '') |
|
1222 | + { |
|
1223 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
1224 | + } |
|
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | |
1228 | 1228 | if (! function_exists('espresso_venue_description')) { |
1229 | - /** |
|
1230 | - * espresso_venue_description |
|
1231 | - * |
|
1232 | - * @access public |
|
1233 | - * @param bool $VNU_ID |
|
1234 | - * @param bool $echo |
|
1235 | - * @return string |
|
1236 | - * @throws EE_Error |
|
1237 | - * @throws ReflectionException |
|
1238 | - */ |
|
1239 | - function espresso_venue_description($VNU_ID = false, $echo = true) |
|
1240 | - { |
|
1241 | - if ($echo) { |
|
1242 | - echo wp_kses(EEH_Venue_View::venue_description($VNU_ID), AllowedTags::getWithFormTags()); |
|
1243 | - return ''; |
|
1244 | - } |
|
1245 | - return EEH_Venue_View::venue_description($VNU_ID); |
|
1246 | - } |
|
1229 | + /** |
|
1230 | + * espresso_venue_description |
|
1231 | + * |
|
1232 | + * @access public |
|
1233 | + * @param bool $VNU_ID |
|
1234 | + * @param bool $echo |
|
1235 | + * @return string |
|
1236 | + * @throws EE_Error |
|
1237 | + * @throws ReflectionException |
|
1238 | + */ |
|
1239 | + function espresso_venue_description($VNU_ID = false, $echo = true) |
|
1240 | + { |
|
1241 | + if ($echo) { |
|
1242 | + echo wp_kses(EEH_Venue_View::venue_description($VNU_ID), AllowedTags::getWithFormTags()); |
|
1243 | + return ''; |
|
1244 | + } |
|
1245 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
1246 | + } |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | |
1250 | 1250 | if (! function_exists('espresso_venue_excerpt')) { |
1251 | - /** |
|
1252 | - * espresso_venue_excerpt |
|
1253 | - * |
|
1254 | - * @access public |
|
1255 | - * @param int $VNU_ID |
|
1256 | - * @param bool $echo |
|
1257 | - * @return string |
|
1258 | - * @throws EE_Error |
|
1259 | - * @throws ReflectionException |
|
1260 | - */ |
|
1261 | - function espresso_venue_excerpt($VNU_ID = 0, $echo = true) |
|
1262 | - { |
|
1263 | - if ($echo) { |
|
1264 | - echo wp_kses(EEH_Venue_View::venue_excerpt($VNU_ID), AllowedTags::getWithFormTags()); |
|
1265 | - return ''; |
|
1266 | - } |
|
1267 | - return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
1268 | - } |
|
1251 | + /** |
|
1252 | + * espresso_venue_excerpt |
|
1253 | + * |
|
1254 | + * @access public |
|
1255 | + * @param int $VNU_ID |
|
1256 | + * @param bool $echo |
|
1257 | + * @return string |
|
1258 | + * @throws EE_Error |
|
1259 | + * @throws ReflectionException |
|
1260 | + */ |
|
1261 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = true) |
|
1262 | + { |
|
1263 | + if ($echo) { |
|
1264 | + echo wp_kses(EEH_Venue_View::venue_excerpt($VNU_ID), AllowedTags::getWithFormTags()); |
|
1265 | + return ''; |
|
1266 | + } |
|
1267 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
1268 | + } |
|
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | |
1272 | 1272 | if (! function_exists('espresso_venue_categories')) { |
1273 | - /** |
|
1274 | - * espresso_venue_categories |
|
1275 | - * returns the terms associated with a venue |
|
1276 | - * |
|
1277 | - * @param int $VNU_ID |
|
1278 | - * @param bool $hide_uncategorized |
|
1279 | - * @param bool $echo |
|
1280 | - * @return string |
|
1281 | - * @throws EE_Error |
|
1282 | - * @throws ReflectionException |
|
1283 | - */ |
|
1284 | - function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true) |
|
1285 | - { |
|
1286 | - if ($echo) { |
|
1287 | - echo wp_kses(EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized), AllowedTags::getWithFormTags()); |
|
1288 | - return ''; |
|
1289 | - } |
|
1290 | - return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1291 | - } |
|
1273 | + /** |
|
1274 | + * espresso_venue_categories |
|
1275 | + * returns the terms associated with a venue |
|
1276 | + * |
|
1277 | + * @param int $VNU_ID |
|
1278 | + * @param bool $hide_uncategorized |
|
1279 | + * @param bool $echo |
|
1280 | + * @return string |
|
1281 | + * @throws EE_Error |
|
1282 | + * @throws ReflectionException |
|
1283 | + */ |
|
1284 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true) |
|
1285 | + { |
|
1286 | + if ($echo) { |
|
1287 | + echo wp_kses(EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized), AllowedTags::getWithFormTags()); |
|
1288 | + return ''; |
|
1289 | + } |
|
1290 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1291 | + } |
|
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | |
1295 | 1295 | if (! function_exists('espresso_venue_address')) { |
1296 | - /** |
|
1297 | - * espresso_venue_address |
|
1298 | - * returns a formatted block of html for displaying a venue's address |
|
1299 | - * |
|
1300 | - * @param string $type 'inline' or 'multiline' |
|
1301 | - * @param int $VNU_ID |
|
1302 | - * @param bool $echo |
|
1303 | - * @return string |
|
1304 | - * @throws EE_Error |
|
1305 | - * @throws ReflectionException |
|
1306 | - */ |
|
1307 | - function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
1308 | - { |
|
1309 | - if ($echo) { |
|
1310 | - echo wp_kses(EEH_Venue_View::venue_address($type, $VNU_ID), AllowedTags::getWithFormTags()); |
|
1311 | - return ''; |
|
1312 | - } |
|
1313 | - return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1314 | - } |
|
1296 | + /** |
|
1297 | + * espresso_venue_address |
|
1298 | + * returns a formatted block of html for displaying a venue's address |
|
1299 | + * |
|
1300 | + * @param string $type 'inline' or 'multiline' |
|
1301 | + * @param int $VNU_ID |
|
1302 | + * @param bool $echo |
|
1303 | + * @return string |
|
1304 | + * @throws EE_Error |
|
1305 | + * @throws ReflectionException |
|
1306 | + */ |
|
1307 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
1308 | + { |
|
1309 | + if ($echo) { |
|
1310 | + echo wp_kses(EEH_Venue_View::venue_address($type, $VNU_ID), AllowedTags::getWithFormTags()); |
|
1311 | + return ''; |
|
1312 | + } |
|
1313 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1314 | + } |
|
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | |
1318 | 1318 | if (! function_exists('espresso_venue_raw_address')) { |
1319 | - /** |
|
1320 | - * espresso_venue_address |
|
1321 | - * returns an UN-formatted string containing a venue's address |
|
1322 | - * |
|
1323 | - * @param string $type 'inline' or 'multiline' |
|
1324 | - * @param int $VNU_ID |
|
1325 | - * @param bool $echo |
|
1326 | - * @return string |
|
1327 | - * @throws EE_Error |
|
1328 | - * @throws ReflectionException |
|
1329 | - */ |
|
1330 | - function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
1331 | - { |
|
1332 | - if ($echo) { |
|
1333 | - echo wp_kses(EEH_Venue_View::venue_address($type, $VNU_ID, false, false), AllowedTags::getWithFormTags()); |
|
1334 | - return ''; |
|
1335 | - } |
|
1336 | - return EEH_Venue_View::venue_address($type, $VNU_ID, false, false); |
|
1337 | - } |
|
1319 | + /** |
|
1320 | + * espresso_venue_address |
|
1321 | + * returns an UN-formatted string containing a venue's address |
|
1322 | + * |
|
1323 | + * @param string $type 'inline' or 'multiline' |
|
1324 | + * @param int $VNU_ID |
|
1325 | + * @param bool $echo |
|
1326 | + * @return string |
|
1327 | + * @throws EE_Error |
|
1328 | + * @throws ReflectionException |
|
1329 | + */ |
|
1330 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
1331 | + { |
|
1332 | + if ($echo) { |
|
1333 | + echo wp_kses(EEH_Venue_View::venue_address($type, $VNU_ID, false, false), AllowedTags::getWithFormTags()); |
|
1334 | + return ''; |
|
1335 | + } |
|
1336 | + return EEH_Venue_View::venue_address($type, $VNU_ID, false, false); |
|
1337 | + } |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | |
1341 | 1341 | if (! function_exists('espresso_venue_has_address')) { |
1342 | - /** |
|
1343 | - * espresso_venue_has_address |
|
1344 | - * returns TRUE or FALSE if a Venue has address information |
|
1345 | - * |
|
1346 | - * @param int $VNU_ID |
|
1347 | - * @return bool |
|
1348 | - * @throws EE_Error |
|
1349 | - * @throws ReflectionException |
|
1350 | - */ |
|
1351 | - function espresso_venue_has_address($VNU_ID = 0) |
|
1352 | - { |
|
1353 | - return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1354 | - } |
|
1342 | + /** |
|
1343 | + * espresso_venue_has_address |
|
1344 | + * returns TRUE or FALSE if a Venue has address information |
|
1345 | + * |
|
1346 | + * @param int $VNU_ID |
|
1347 | + * @return bool |
|
1348 | + * @throws EE_Error |
|
1349 | + * @throws ReflectionException |
|
1350 | + */ |
|
1351 | + function espresso_venue_has_address($VNU_ID = 0) |
|
1352 | + { |
|
1353 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1354 | + } |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | |
1358 | 1358 | if (! function_exists('espresso_venue_gmap')) { |
1359 | - /** |
|
1360 | - * espresso_venue_gmap |
|
1361 | - * returns a google map for the venue address |
|
1362 | - * |
|
1363 | - * @param int $VNU_ID |
|
1364 | - * @param bool $map_ID |
|
1365 | - * @param array $gmap |
|
1366 | - * @param bool $echo |
|
1367 | - * @return string |
|
1368 | - * @throws EE_Error |
|
1369 | - * @throws ReflectionException |
|
1370 | - */ |
|
1371 | - function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true) |
|
1372 | - { |
|
1373 | - if ($echo) { |
|
1374 | - echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped |
|
1375 | - return ''; |
|
1376 | - } |
|
1377 | - return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1378 | - } |
|
1359 | + /** |
|
1360 | + * espresso_venue_gmap |
|
1361 | + * returns a google map for the venue address |
|
1362 | + * |
|
1363 | + * @param int $VNU_ID |
|
1364 | + * @param bool $map_ID |
|
1365 | + * @param array $gmap |
|
1366 | + * @param bool $echo |
|
1367 | + * @return string |
|
1368 | + * @throws EE_Error |
|
1369 | + * @throws ReflectionException |
|
1370 | + */ |
|
1371 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true) |
|
1372 | + { |
|
1373 | + if ($echo) { |
|
1374 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped |
|
1375 | + return ''; |
|
1376 | + } |
|
1377 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1378 | + } |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | |
1382 | 1382 | if (! function_exists('espresso_venue_phone')) { |
1383 | - /** |
|
1384 | - * espresso_venue_phone |
|
1385 | - * |
|
1386 | - * @param int $VNU_ID |
|
1387 | - * @param bool $echo |
|
1388 | - * @return string |
|
1389 | - * @throws EE_Error |
|
1390 | - * @throws ReflectionException |
|
1391 | - */ |
|
1392 | - function espresso_venue_phone($VNU_ID = 0, $echo = true) |
|
1393 | - { |
|
1394 | - if ($echo) { |
|
1395 | - echo wp_kses(EEH_Venue_View::venue_phone($VNU_ID), AllowedTags::getWithFormTags()); |
|
1396 | - return ''; |
|
1397 | - } |
|
1398 | - return EEH_Venue_View::venue_phone($VNU_ID); |
|
1399 | - } |
|
1383 | + /** |
|
1384 | + * espresso_venue_phone |
|
1385 | + * |
|
1386 | + * @param int $VNU_ID |
|
1387 | + * @param bool $echo |
|
1388 | + * @return string |
|
1389 | + * @throws EE_Error |
|
1390 | + * @throws ReflectionException |
|
1391 | + */ |
|
1392 | + function espresso_venue_phone($VNU_ID = 0, $echo = true) |
|
1393 | + { |
|
1394 | + if ($echo) { |
|
1395 | + echo wp_kses(EEH_Venue_View::venue_phone($VNU_ID), AllowedTags::getWithFormTags()); |
|
1396 | + return ''; |
|
1397 | + } |
|
1398 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1399 | + } |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | |
1403 | 1403 | if (! function_exists('espresso_venue_website')) { |
1404 | - /** |
|
1405 | - * espresso_venue_website |
|
1406 | - * |
|
1407 | - * @param int $VNU_ID |
|
1408 | - * @param bool $echo |
|
1409 | - * @return string |
|
1410 | - * @throws EE_Error |
|
1411 | - * @throws ReflectionException |
|
1412 | - */ |
|
1413 | - function espresso_venue_website($VNU_ID = 0, $echo = true) |
|
1414 | - { |
|
1415 | - if ($echo) { |
|
1416 | - echo wp_kses(EEH_Venue_View::venue_website_link($VNU_ID), AllowedTags::getWithFormTags()); |
|
1417 | - return ''; |
|
1418 | - } |
|
1419 | - return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1420 | - } |
|
1404 | + /** |
|
1405 | + * espresso_venue_website |
|
1406 | + * |
|
1407 | + * @param int $VNU_ID |
|
1408 | + * @param bool $echo |
|
1409 | + * @return string |
|
1410 | + * @throws EE_Error |
|
1411 | + * @throws ReflectionException |
|
1412 | + */ |
|
1413 | + function espresso_venue_website($VNU_ID = 0, $echo = true) |
|
1414 | + { |
|
1415 | + if ($echo) { |
|
1416 | + echo wp_kses(EEH_Venue_View::venue_website_link($VNU_ID), AllowedTags::getWithFormTags()); |
|
1417 | + return ''; |
|
1418 | + } |
|
1419 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1420 | + } |
|
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | |
1424 | 1424 | if (! function_exists('espresso_edit_venue_link')) { |
1425 | - /** |
|
1426 | - * espresso_edit_venue_link |
|
1427 | - * |
|
1428 | - * @param int $VNU_ID |
|
1429 | - * @param bool $echo |
|
1430 | - * @return string |
|
1431 | - * @throws EE_Error |
|
1432 | - * @throws ReflectionException |
|
1433 | - */ |
|
1434 | - function espresso_edit_venue_link($VNU_ID = 0, $echo = true) |
|
1435 | - { |
|
1436 | - if ($echo) { |
|
1437 | - echo wp_kses(EEH_Venue_View::edit_venue_link($VNU_ID), AllowedTags::getWithFormTags()); |
|
1438 | - return ''; |
|
1439 | - } |
|
1440 | - return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1441 | - } |
|
1425 | + /** |
|
1426 | + * espresso_edit_venue_link |
|
1427 | + * |
|
1428 | + * @param int $VNU_ID |
|
1429 | + * @param bool $echo |
|
1430 | + * @return string |
|
1431 | + * @throws EE_Error |
|
1432 | + * @throws ReflectionException |
|
1433 | + */ |
|
1434 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = true) |
|
1435 | + { |
|
1436 | + if ($echo) { |
|
1437 | + echo wp_kses(EEH_Venue_View::edit_venue_link($VNU_ID), AllowedTags::getWithFormTags()); |
|
1438 | + return ''; |
|
1439 | + } |
|
1440 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1441 | + } |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function is_espresso_event($event = null): bool |
24 | 24 | { |
25 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
25 | + if ( ! can_use_espresso_conditionals(__FUNCTION__)) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function is_espresso_event_single(): bool |
41 | 41 | { |
42 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
42 | + if ( ! can_use_espresso_conditionals(__FUNCTION__)) { |
|
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | global $wp_query; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | function is_espresso_event_archive(): bool |
59 | 59 | { |
60 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
60 | + if ( ! can_use_espresso_conditionals(__FUNCTION__)) { |
|
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | global $wp_query; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function is_espresso_event_taxonomy(): bool |
76 | 76 | { |
77 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
77 | + if ( ! can_use_espresso_conditionals(__FUNCTION__)) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | global $wp_query; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function is_espresso_venue($venue = null): bool |
96 | 96 | { |
97 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
97 | + if ( ! can_use_espresso_conditionals(__FUNCTION__)) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | function is_espresso_venue_single(): bool |
113 | 113 | { |
114 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
114 | + if ( ! can_use_espresso_conditionals(__FUNCTION__)) { |
|
115 | 115 | return false; |
116 | 116 | } |
117 | 117 | global $wp_query; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function is_espresso_venue_archive(): bool |
130 | 130 | { |
131 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
131 | + if ( ! can_use_espresso_conditionals(__FUNCTION__)) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | global $wp_query; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function is_espresso_venue_taxonomy(): bool |
147 | 147 | { |
148 | - if (! can_use_espresso_conditionals(__FUNCTION__)) { |
|
148 | + if ( ! can_use_espresso_conditionals(__FUNCTION__)) { |
|
149 | 149 | return false; |
150 | 150 | } |
151 | 151 | global $wp_query; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function can_use_espresso_conditionals($conditional_tag): bool |
165 | 165 | { |
166 | - if (! did_action('AHEE__EE_System__initialize')) { |
|
166 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
167 | 167 | EE_Error::doing_it_wrong( |
168 | 168 | __FUNCTION__, |
169 | 169 | sprintf( |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | /*************************** Event Queries ***************************/ |
185 | 185 | |
186 | -if (! function_exists('espresso_get_events')) { |
|
186 | +if ( ! function_exists('espresso_get_events')) { |
|
187 | 187 | /** |
188 | 188 | * espresso_get_events |
189 | 189 | * |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function espresso_load_ticket_selector() |
235 | 235 | { |
236 | - EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
236 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
237 | 237 | } |
238 | 238 | |
239 | -if (! function_exists('espresso_ticket_selector')) { |
|
239 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
240 | 240 | /** |
241 | 241 | * espresso_ticket_selector |
242 | 242 | * |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | function espresso_ticket_selector($event = null) |
248 | 248 | { |
249 | - if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) { |
|
249 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', false)) { |
|
250 | 250 | espresso_load_ticket_selector(); |
251 | 251 | EED_Ticket_Selector::set_definitions(); |
252 | 252 | echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | -if (! function_exists('espresso_view_details_btn')) { |
|
258 | +if ( ! function_exists('espresso_view_details_btn')) { |
|
259 | 259 | /** |
260 | 260 | * espresso_view_details_btn |
261 | 261 | * |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | function espresso_view_details_btn($event = null) |
267 | 267 | { |
268 | - if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) { |
|
268 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', false)) { |
|
269 | 269 | espresso_load_ticket_selector(); |
270 | 270 | echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped |
271 | 271 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | /*************************** EEH_Event_View ***************************/ |
277 | 277 | |
278 | -if (! function_exists('espresso_load_event_list_assets')) { |
|
278 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
279 | 279 | /** |
280 | 280 | * espresso_load_event_list_assets |
281 | 281 | * ensures that event list styles and scripts are loaded |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | |
294 | -if (! function_exists('espresso_event_reg_button')) { |
|
294 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
295 | 295 | /** |
296 | 296 | * espresso_event_reg_button |
297 | 297 | * returns the "Register Now" button if event is active, |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false) |
309 | 309 | { |
310 | 310 | $event = EEH_Event_View::get_event($EVT_ID); |
311 | - if (! $event instanceof EE_Event) { |
|
311 | + if ( ! $event instanceof EE_Event) { |
|
312 | 312 | return; |
313 | 313 | } |
314 | 314 | $event_status = $event->get_active_status(); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | -if (! function_exists('espresso_display_ticket_selector')) { |
|
356 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
357 | 357 | /** |
358 | 358 | * espresso_display_ticket_selector |
359 | 359 | * whether or not to display the Ticket Selector for an event |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | } |
371 | 371 | |
372 | 372 | |
373 | -if (! function_exists('espresso_event_status_banner')) { |
|
373 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
374 | 374 | /** |
375 | 375 | * espresso_event_status |
376 | 376 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | } |
388 | 388 | |
389 | 389 | |
390 | -if (! function_exists('espresso_event_status')) { |
|
390 | +if ( ! function_exists('espresso_event_status')) { |
|
391 | 391 | /** |
392 | 392 | * espresso_event_status |
393 | 393 | * returns the event status if it is sold out, expired, or inactive |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | |
408 | -if (! function_exists('espresso_event_categories')) { |
|
408 | +if ( ! function_exists('espresso_event_categories')) { |
|
409 | 409 | /** |
410 | 410 | * espresso_event_categories |
411 | 411 | * returns the terms associated with an event |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | |
431 | -if (! function_exists('espresso_event_tickets_available')) { |
|
431 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
432 | 432 | /** |
433 | 433 | * espresso_event_tickets_available |
434 | 434 | * returns the ticket types available for purchase for an event |
@@ -446,14 +446,14 @@ discard block |
||
446 | 446 | if (is_array($tickets) && ! empty($tickets)) { |
447 | 447 | // if formatting then $html will be a string, else it will be an array of ticket objects |
448 | 448 | $html = |
449 | - $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : []; |
|
449 | + $format ? '<ul id="ee-event-tickets-ul-'.esc_attr($EVT_ID).'" class="ee-event-tickets-ul">' : []; |
|
450 | 450 | foreach ($tickets as $ticket) { |
451 | 451 | if ($ticket instanceof EE_Ticket) { |
452 | 452 | if ($format) { |
453 | 453 | $html .= '<li id="ee-event-tickets-li-' |
454 | 454 | . esc_attr($ticket->ID()) |
455 | 455 | . '" class="ee-event-tickets-li">'; |
456 | - $html .= esc_html($ticket->name()) . ' '; |
|
456 | + $html .= esc_html($ticket->name()).' '; |
|
457 | 457 | $html .= EEH_Template::format_currency( |
458 | 458 | $ticket->get_ticket_total_with_taxes() |
459 | 459 | ); // already escaped |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
479 | -if (! function_exists('espresso_event_date_obj')) { |
|
479 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
480 | 480 | /** |
481 | 481 | * espresso_event_date_obj |
482 | 482 | * returns the primary date object for an event |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | } |
494 | 494 | |
495 | 495 | |
496 | -if (! function_exists('espresso_event_date')) { |
|
496 | +if ( ! function_exists('espresso_event_date')) { |
|
497 | 497 | /** |
498 | 498 | * espresso_event_date |
499 | 499 | * returns the primary date for an event |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | |
525 | -if (! function_exists('espresso_list_of_event_dates')) { |
|
525 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
526 | 526 | /** |
527 | 527 | * espresso_list_of_event_dates |
528 | 528 | * returns a unordered list of dates for an event |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $DTT_ID = LoaderFactory::getShared(RequestInterface::class)->getRequestParam('datetime', 0, 'int'); |
555 | 555 | $arguments = apply_filters( |
556 | 556 | 'FHEE__espresso_list_of_event_dates__arguments', |
557 | - [ $EVT_ID, $date_format, $time_format, $echo, $show_expired, $format, $add_breaks, $limit, $DTT_ID ] |
|
557 | + [$EVT_ID, $date_format, $time_format, $echo, $show_expired, $format, $add_breaks, $limit, $DTT_ID] |
|
558 | 558 | ); |
559 | 559 | [$EVT_ID, $date_format, $time_format, $echo, $show_expired, $format, $add_breaks, $limit, $DTT_ID] = $arguments; |
560 | 560 | $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $datetimes = $DTT_ID |
565 | 565 | ? [EEH_Event_View::get_date_obj($DTT_ID)] |
566 | 566 | : EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, (int) $limit); |
567 | - if (! $format) { |
|
567 | + if ( ! $format) { |
|
568 | 568 | return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
569 | 569 | } |
570 | 570 | $newline = $add_breaks ? '<br />' : ''; |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | $cols = count($datetimes); |
574 | 574 | $cols = $cols >= 3 ? 'big' : 'small'; |
575 | 575 | $ul_class = "ee-event-datetimes-ul ee-event-datetimes-ul--{$cols}"; |
576 | - $html = '<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="'. $ul_class.'">'; |
|
576 | + $html = '<ul id="ee-event-datetimes-ul-'.esc_attr($post->ID).'" class="'.$ul_class.'">'; |
|
577 | 577 | $datetime = null; |
578 | 578 | foreach ($datetimes as $datetime) { |
579 | 579 | if ($datetime instanceof EE_Datetime) { |
@@ -582,36 +582,36 @@ discard block |
||
582 | 582 | $datetime_html = ! empty($datetime_name) |
583 | 583 | ? ' |
584 | 584 | <strong class="ee-event-datetimes-li-date-name"> |
585 | - ' . esc_html($datetime_name) . ' |
|
585 | + ' . esc_html($datetime_name).' |
|
586 | 586 | </strong>' . $newline |
587 | 587 | : ''; |
588 | 588 | |
589 | 589 | $datetime_html .= ' |
590 | 590 | <span class="ee-event-datetimes-li-daterange"> |
591 | 591 | <span class="dashicons dashicons-calendar"></span> ' |
592 | - . $datetime->date_range($date_format). ' |
|
592 | + . $datetime->date_range($date_format).' |
|
593 | 593 | </span> |
594 | 594 | <br/> |
595 | 595 | <span class="ee-event-datetimes-li-timerange"> |
596 | 596 | <span class="dashicons dashicons-clock"></span> ' |
597 | - . $datetime->time_range($time_format) . ' |
|
597 | + . $datetime->time_range($time_format).' |
|
598 | 598 | </span> |
599 | 599 | '; |
600 | 600 | |
601 | 601 | $venue = $datetime->venue(); |
602 | 602 | if ($venue instanceof EE_Venue) { |
603 | - $venue_name = esc_html($venue->name()); |
|
603 | + $venue_name = esc_html($venue->name()); |
|
604 | 604 | $datetime_html .= '<br /><span class="ee-event-datetimes-li-venue">'; |
605 | 605 | $datetime_html .= '<span class="dashicons dashicons-admin-home"></span> '; |
606 | - $datetime_html .= '<a href="'. esc_url_raw($venue->get_permalink()) .'" target="_blank">'; |
|
607 | - $datetime_html .= $venue_name . '</a></span>'; |
|
606 | + $datetime_html .= '<a href="'.esc_url_raw($venue->get_permalink()).'" target="_blank">'; |
|
607 | + $datetime_html .= $venue_name.'</a></span>'; |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | $datetime_description = $datetime->description(); |
611 | 611 | $datetime_html .= ! empty($datetime_description) |
612 | 612 | ? ' |
613 | 613 | <span class="ee-event-datetimes-li-date-desc"> |
614 | - ' . wp_kses($datetime_description, $allowedtags) . ' |
|
614 | + ' . wp_kses($datetime_description, $allowedtags).' |
|
615 | 615 | </span>' . $newline |
616 | 616 | : ''; |
617 | 617 | |
@@ -623,11 +623,11 @@ discard block |
||
623 | 623 | ); |
624 | 624 | |
625 | 625 | $DTD_ID = esc_attr($datetime->ID()); |
626 | - $active_status = esc_attr('ee-event-datetimes-li-' . $datetime->get_active_status()); |
|
626 | + $active_status = esc_attr('ee-event-datetimes-li-'.$datetime->get_active_status()); |
|
627 | 627 | |
628 | 628 | $html .= ' |
629 | - <li id="ee-event-datetimes-li-' . $DTD_ID . '" class="ee-event-datetimes-li ' . $active_status . '"> |
|
630 | - ' . $datetime_html . ' |
|
629 | + <li id="ee-event-datetimes-li-' . $DTD_ID.'" class="ee-event-datetimes-li '.$active_status.'"> |
|
630 | + ' . $datetime_html.' |
|
631 | 631 | </li>'; |
632 | 632 | } |
633 | 633 | } |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | ' . esc_html__( |
642 | 642 | 'There are no upcoming dates for this event.', |
643 | 643 | 'event_espresso' |
644 | - ) . ' |
|
644 | + ).' |
|
645 | 645 | </p> |
646 | 646 | <br/>'; |
647 | 647 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | } |
655 | 655 | |
656 | 656 | |
657 | -if (! function_exists('espresso_event_end_date')) { |
|
657 | +if ( ! function_exists('espresso_event_end_date')) { |
|
658 | 658 | /** |
659 | 659 | * espresso_event_end_date |
660 | 660 | * returns the last date for an event |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | } |
682 | 682 | } |
683 | 683 | |
684 | -if (! function_exists('espresso_event_date_range')) { |
|
684 | +if ( ! function_exists('espresso_event_date_range')) { |
|
685 | 685 | /** |
686 | 686 | * espresso_event_date_range |
687 | 687 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | } |
740 | 740 | } |
741 | 741 | |
742 | -if (! function_exists('espresso_next_upcoming_datetime_obj')) { |
|
742 | +if ( ! function_exists('espresso_next_upcoming_datetime_obj')) { |
|
743 | 743 | /** |
744 | 744 | * espresso_next_upcoming_datetime_obj |
745 | 745 | * returns the next upcoming datetime object for an event |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | } |
755 | 755 | } |
756 | 756 | |
757 | -if (! function_exists('espresso_next_upcoming_datetime')) { |
|
757 | +if ( ! function_exists('espresso_next_upcoming_datetime')) { |
|
758 | 758 | /** |
759 | 759 | * espresso_next_upcoming_datetime |
760 | 760 | * returns the start date and time for the next upcoming event. |
@@ -776,11 +776,11 @@ discard block |
||
776 | 776 | $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
777 | 777 | $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format); |
778 | 778 | |
779 | - $datetime_format = trim($date_format . ' ' . $time_format); |
|
779 | + $datetime_format = trim($date_format.' '.$time_format); |
|
780 | 780 | |
781 | 781 | $datetime = espresso_next_upcoming_datetime_obj($EVT_ID); |
782 | 782 | |
783 | - if (! $datetime instanceof EE_Datetime) { |
|
783 | + if ( ! $datetime instanceof EE_Datetime) { |
|
784 | 784 | return ''; |
785 | 785 | } |
786 | 786 | if ($echo) { |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | } |
792 | 792 | } |
793 | 793 | |
794 | -if (! function_exists('espresso_event_date_as_calendar_page')) { |
|
794 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
795 | 795 | /** |
796 | 796 | * espresso_event_date_as_calendar_page |
797 | 797 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | } |
809 | 809 | |
810 | 810 | |
811 | -if (! function_exists('espresso_event_link_url')) { |
|
811 | +if ( ! function_exists('espresso_event_link_url')) { |
|
812 | 812 | /** |
813 | 813 | * espresso_event_link_url |
814 | 814 | * |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | } |
830 | 830 | |
831 | 831 | |
832 | -if (! function_exists('espresso_event_has_content_or_excerpt')) { |
|
832 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
833 | 833 | /** |
834 | 834 | * espresso_event_has_content_or_excerpt |
835 | 835 | * |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | } |
847 | 847 | |
848 | 848 | |
849 | -if (! function_exists('espresso_event_content_or_excerpt')) { |
|
849 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
850 | 850 | /** |
851 | 851 | * espresso_event_content_or_excerpt |
852 | 852 | * |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | } |
867 | 867 | |
868 | 868 | |
869 | -if (! function_exists('espresso_event_phone')) { |
|
869 | +if ( ! function_exists('espresso_event_phone')) { |
|
870 | 870 | /** |
871 | 871 | * espresso_event_phone |
872 | 872 | * |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | } |
888 | 888 | |
889 | 889 | |
890 | -if (! function_exists('espresso_edit_event_link')) { |
|
890 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
891 | 891 | /** |
892 | 892 | * espresso_edit_event_link |
893 | 893 | * returns a link to edit an event |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | } |
910 | 910 | |
911 | 911 | |
912 | -if (! function_exists('espresso_organization_name')) { |
|
912 | +if ( ! function_exists('espresso_organization_name')) { |
|
913 | 913 | /** |
914 | 914 | * espresso_organization_name |
915 | 915 | * |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | } |
928 | 928 | } |
929 | 929 | |
930 | -if (! function_exists('espresso_organization_address')) { |
|
930 | +if ( ! function_exists('espresso_organization_address')) { |
|
931 | 931 | /** |
932 | 932 | * espresso_organization_address |
933 | 933 | * |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
954 | -if (! function_exists('espresso_organization_email')) { |
|
954 | +if ( ! function_exists('espresso_organization_email')) { |
|
955 | 955 | /** |
956 | 956 | * espresso_organization_email |
957 | 957 | * |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | } |
970 | 970 | } |
971 | 971 | |
972 | -if (! function_exists('espresso_organization_logo_url')) { |
|
972 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
973 | 973 | /** |
974 | 974 | * espresso_organization_logo_url |
975 | 975 | * |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | } |
988 | 988 | } |
989 | 989 | |
990 | -if (! function_exists('espresso_organization_facebook')) { |
|
990 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
991 | 991 | /** |
992 | 992 | * espresso_organization_facebook |
993 | 993 | * |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | } |
1006 | 1006 | } |
1007 | 1007 | |
1008 | -if (! function_exists('espresso_organization_twitter')) { |
|
1008 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
1009 | 1009 | /** |
1010 | 1010 | * espresso_organization_twitter |
1011 | 1011 | * |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | } |
1024 | 1024 | } |
1025 | 1025 | |
1026 | -if (! function_exists('espresso_organization_linkedin')) { |
|
1026 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
1027 | 1027 | /** |
1028 | 1028 | * espresso_organization_linkedin |
1029 | 1029 | * |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | } |
1042 | 1042 | } |
1043 | 1043 | |
1044 | -if (! function_exists('espresso_organization_pinterest')) { |
|
1044 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
1045 | 1045 | /** |
1046 | 1046 | * espresso_organization_pinterest |
1047 | 1047 | * |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | |
1062 | -if (! function_exists('espresso_organization_google')) { |
|
1062 | +if ( ! function_exists('espresso_organization_google')) { |
|
1063 | 1063 | /** |
1064 | 1064 | * espresso_organization_google |
1065 | 1065 | * |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | } |
1078 | 1078 | } |
1079 | 1079 | |
1080 | -if (! function_exists('espresso_organization_instagram')) { |
|
1080 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
1081 | 1081 | /** |
1082 | 1082 | * espresso_organization_instagram |
1083 | 1083 | * |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | /*************************** EEH_Venue_View ***************************/ |
1100 | 1100 | |
1101 | 1101 | |
1102 | -if (! function_exists('espresso_event_venues')) { |
|
1102 | +if ( ! function_exists('espresso_event_venues')) { |
|
1103 | 1103 | /** |
1104 | 1104 | * espresso_event_venues |
1105 | 1105 | * |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | |
1117 | -if (! function_exists('espresso_venue_id')) { |
|
1117 | +if ( ! function_exists('espresso_venue_id')) { |
|
1118 | 1118 | /** |
1119 | 1119 | * espresso_venue_name |
1120 | 1120 | * |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
1135 | -if (! function_exists('espresso_is_venue_private')) { |
|
1135 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
1136 | 1136 | /** |
1137 | 1137 | * Return whether a venue is private or not. |
1138 | 1138 | * |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | |
1153 | -if (! function_exists('espresso_venue_is_password_protected')) { |
|
1153 | +if ( ! function_exists('espresso_venue_is_password_protected')) { |
|
1154 | 1154 | /** |
1155 | 1155 | * returns true or false if a venue is password protected or not |
1156 | 1156 | * |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
1170 | -if (! function_exists('espresso_password_protected_venue_form')) { |
|
1170 | +if ( ! function_exists('espresso_password_protected_venue_form')) { |
|
1171 | 1171 | /** |
1172 | 1172 | * Returns a password form if venue is password protected. |
1173 | 1173 | * |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | |
1187 | -if (! function_exists('espresso_venue_name')) { |
|
1187 | +if ( ! function_exists('espresso_venue_name')) { |
|
1188 | 1188 | /** |
1189 | 1189 | * espresso_venue_name |
1190 | 1190 | * |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | -if (! function_exists('espresso_venue_link')) { |
|
1210 | +if ( ! function_exists('espresso_venue_link')) { |
|
1211 | 1211 | /** |
1212 | 1212 | * espresso_venue_link |
1213 | 1213 | * |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | |
1228 | -if (! function_exists('espresso_venue_description')) { |
|
1228 | +if ( ! function_exists('espresso_venue_description')) { |
|
1229 | 1229 | /** |
1230 | 1230 | * espresso_venue_description |
1231 | 1231 | * |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | |
1250 | -if (! function_exists('espresso_venue_excerpt')) { |
|
1250 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
1251 | 1251 | /** |
1252 | 1252 | * espresso_venue_excerpt |
1253 | 1253 | * |
@@ -1269,7 +1269,7 @@ discard block |
||
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | |
1272 | -if (! function_exists('espresso_venue_categories')) { |
|
1272 | +if ( ! function_exists('espresso_venue_categories')) { |
|
1273 | 1273 | /** |
1274 | 1274 | * espresso_venue_categories |
1275 | 1275 | * returns the terms associated with a venue |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | |
1295 | -if (! function_exists('espresso_venue_address')) { |
|
1295 | +if ( ! function_exists('espresso_venue_address')) { |
|
1296 | 1296 | /** |
1297 | 1297 | * espresso_venue_address |
1298 | 1298 | * returns a formatted block of html for displaying a venue's address |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | |
1318 | -if (! function_exists('espresso_venue_raw_address')) { |
|
1318 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
1319 | 1319 | /** |
1320 | 1320 | * espresso_venue_address |
1321 | 1321 | * returns an UN-formatted string containing a venue's address |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | |
1341 | -if (! function_exists('espresso_venue_has_address')) { |
|
1341 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
1342 | 1342 | /** |
1343 | 1343 | * espresso_venue_has_address |
1344 | 1344 | * returns TRUE or FALSE if a Venue has address information |
@@ -1355,7 +1355,7 @@ discard block |
||
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | |
1358 | -if (! function_exists('espresso_venue_gmap')) { |
|
1358 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
1359 | 1359 | /** |
1360 | 1360 | * espresso_venue_gmap |
1361 | 1361 | * returns a google map for the venue address |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | |
1382 | -if (! function_exists('espresso_venue_phone')) { |
|
1382 | +if ( ! function_exists('espresso_venue_phone')) { |
|
1383 | 1383 | /** |
1384 | 1384 | * espresso_venue_phone |
1385 | 1385 | * |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | |
1403 | -if (! function_exists('espresso_venue_website')) { |
|
1403 | +if ( ! function_exists('espresso_venue_website')) { |
|
1404 | 1404 | /** |
1405 | 1405 | * espresso_venue_website |
1406 | 1406 | * |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | |
1424 | -if (! function_exists('espresso_edit_venue_link')) { |
|
1424 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
1425 | 1425 | /** |
1426 | 1426 | * espresso_edit_venue_link |
1427 | 1427 | * |
@@ -28,347 +28,347 @@ |
||
28 | 28 | */ |
29 | 29 | class EE_Brewing_Regular extends EE_BASE implements InterminableInterface |
30 | 30 | { |
31 | - protected EE_Dependency_Map $dependency_map; |
|
32 | - |
|
33 | - protected LoaderInterface $loader; |
|
34 | - |
|
35 | - protected TableAnalysis $_table_analysis; |
|
36 | - |
|
37 | - protected RouteHandler $route_handler; |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * EE_Brewing_Regular constructor. |
|
42 | - * |
|
43 | - * @param EE_Dependency_Map $dependency_map |
|
44 | - * @param LoaderInterface $loader |
|
45 | - * @param RouteHandler $route_handler |
|
46 | - * @param TableAnalysis $table_analysis |
|
47 | - */ |
|
48 | - public function __construct( |
|
49 | - EE_Dependency_Map $dependency_map, |
|
50 | - LoaderInterface $loader, |
|
51 | - RouteHandler $route_handler, |
|
52 | - TableAnalysis $table_analysis |
|
53 | - ) { |
|
54 | - $this->dependency_map = $dependency_map; |
|
55 | - $this->loader = $loader; |
|
56 | - $this->route_handler = $route_handler; |
|
57 | - $this->_table_analysis = $table_analysis; |
|
58 | - if (defined('EE_CAFF_PATH')) { |
|
59 | - // defined some new constants related to caffeinated folder |
|
60 | - define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/'); |
|
61 | - define('EE_CAF_CORE', EE_CAFF_PATH . 'core/'); |
|
62 | - define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries/'); |
|
63 | - define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods/'); |
|
64 | - } |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * @throws EE_Error |
|
70 | - */ |
|
71 | - public function caffeinated() |
|
72 | - { |
|
73 | - $this->setInitializationHooks(); |
|
74 | - $this->setApiRegistrationHooks(); |
|
75 | - $this->setSwitchHooks(); |
|
76 | - $this->setDefaultFilterHooks(); |
|
77 | - // caffeinated constructed |
|
78 | - do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * @throws Exception |
|
84 | - * @deprecated 5.0.20.p |
|
85 | - */ |
|
86 | - public function initializePUE() |
|
87 | - { |
|
88 | - $this->dependency_map->registerDependencies(PueRequests::class, Route::getDefaultDependencies()); |
|
89 | - $this->route_handler->addRoute(PueRequests::class); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * Various hooks used for extending features via registration of modules or extensions. |
|
95 | - * |
|
96 | - * @throws EE_Error |
|
97 | - */ |
|
98 | - private function setApiRegistrationHooks() |
|
99 | - { |
|
100 | - add_filter( |
|
101 | - 'FHEE__EE_Config__register_modules__modules_to_register', |
|
102 | - [$this, 'caffeinated_modules_to_register'] |
|
103 | - ); |
|
104 | - add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths']); |
|
105 | - add_filter( |
|
106 | - 'AHEE__EE_System__load_core_configuration__complete', |
|
107 | - function () { |
|
108 | - EE_Register_Payment_Method::register( |
|
109 | - 'caffeinated_payment_methods', |
|
110 | - [ |
|
111 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
112 | - ] |
|
113 | - ); |
|
114 | - } |
|
115 | - ); |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * Various hooks used for modifying initialization or activation processes. |
|
121 | - */ |
|
122 | - private function setInitializationHooks() |
|
123 | - { |
|
124 | - // activation |
|
125 | - add_action('AHEE__EEH_Activation__initialize_db_content', [$this, 'initialize_caf_db_content']); |
|
126 | - // load caff init |
|
127 | - add_action('AHEE__EE_System__set_hooks_for_core', [$this, 'caffeinated_init']); |
|
128 | - // load caff scripts |
|
129 | - add_action('wp_enqueue_scripts', [$this, 'enqueue_caffeinated_scripts']); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * Various hooks used for switch (on/off) type filters. |
|
135 | - */ |
|
136 | - private function setSwitchHooks() |
|
137 | - { |
|
138 | - // remove the "powered by" credit link from receipts and invoices |
|
139 | - add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
140 | - // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
141 | - add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - /** |
|
146 | - * Various filters for affecting default configuration values in the caffeinated |
|
147 | - * context. |
|
148 | - */ |
|
149 | - private function setDefaultFilterHooks() |
|
150 | - { |
|
151 | - add_filter( |
|
152 | - 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
153 | - '__return_true' |
|
154 | - ); |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
160 | - * |
|
161 | - * @param array $paths original helper paths array |
|
162 | - * @return array new array of paths |
|
163 | - */ |
|
164 | - public function caf_helper_paths(array $paths): array |
|
165 | - { |
|
166 | - $paths[] = EE_CAF_CORE . 'helpers/'; |
|
167 | - return $paths; |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
173 | - * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
174 | - * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
175 | - * This action should only be called when EE 4.x.0.P is initially activated. |
|
176 | - * Right now the only CAF content are these global prices. If there's more in the future, then |
|
177 | - * we should probably create a caf file to contain it all instead just a function like this. |
|
178 | - * Right now, we ASSUME the only price types in the system are default ones |
|
179 | - * |
|
180 | - * @global wpdb $wpdb |
|
181 | - */ |
|
182 | - public function initialize_caf_db_content() |
|
183 | - { |
|
184 | - global $wpdb; |
|
185 | - // use same method of getting creator id as the version introducing the change |
|
186 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
187 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
188 | - $price_table = $wpdb->prefix . "esp_price"; |
|
189 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
190 | - $SQL = |
|
191 | - 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
192 | - $tax_price_type_count = $wpdb->get_var($SQL); |
|
193 | - if ($tax_price_type_count <= 1) { |
|
194 | - $wpdb->insert( |
|
195 | - $price_type_table, |
|
196 | - [ |
|
197 | - 'PRT_name' => esc_html__("Regional Tax", "event_espresso"), |
|
198 | - 'PBT_ID' => 4, |
|
199 | - 'PRT_is_percent' => true, |
|
200 | - 'PRT_order' => 60, |
|
201 | - 'PRT_deleted' => false, |
|
202 | - 'PRT_wp_user' => $default_creator_id, |
|
203 | - ], |
|
204 | - [ |
|
205 | - '%s',// PRT_name |
|
206 | - '%d',// PBT_id |
|
207 | - '%d',// PRT_is_percent |
|
208 | - '%d',// PRT_order |
|
209 | - '%d',// PRT_deleted |
|
210 | - '%d', // PRT_wp_user |
|
211 | - ] |
|
212 | - ); |
|
213 | - // federal tax |
|
214 | - $result = $wpdb->insert( |
|
215 | - $price_type_table, |
|
216 | - [ |
|
217 | - 'PRT_name' => esc_html__("Federal Tax", "event_espresso"), |
|
218 | - 'PBT_ID' => 4, |
|
219 | - 'PRT_is_percent' => true, |
|
220 | - 'PRT_order' => 60, |
|
221 | - 'PRT_deleted' => false, |
|
222 | - 'PRT_wp_user' => $default_creator_id, |
|
223 | - ], |
|
224 | - [ |
|
225 | - '%s',// PRT_name |
|
226 | - '%d',// PBT_id |
|
227 | - '%d',// PRT_is_percent |
|
228 | - '%d',// PRT_order |
|
229 | - '%d',// PRT_deleted |
|
230 | - '%d' // PRT_wp_user |
|
231 | - ] |
|
232 | - ); |
|
233 | - if ($result) { |
|
234 | - $wpdb->insert( |
|
235 | - $price_table, |
|
236 | - [ |
|
237 | - 'PRT_ID' => $wpdb->insert_id, |
|
238 | - 'PRC_amount' => 15.00, |
|
239 | - 'PRC_name' => esc_html__("Sales Tax", "event_espresso"), |
|
240 | - 'PRC_desc' => '', |
|
241 | - 'PRC_is_default' => true, |
|
242 | - 'PRC_overrides' => null, |
|
243 | - 'PRC_deleted' => false, |
|
244 | - 'PRC_order' => 60, |
|
245 | - 'PRC_parent' => null, |
|
246 | - 'PRC_wp_user' => $default_creator_id, |
|
247 | - ], |
|
248 | - [ |
|
249 | - '%d',// PRT_id |
|
250 | - '%f',// PRC_amount |
|
251 | - '%s',// PRC_name |
|
252 | - '%s',// PRC_desc |
|
253 | - '%d',// PRC_is_default |
|
254 | - '%d',// PRC_overrides |
|
255 | - '%d',// PRC_deleted |
|
256 | - '%d',// PRC_order |
|
257 | - '%d',// PRC_parent |
|
258 | - '%d' // PRC_wp_user |
|
259 | - ] |
|
260 | - ); |
|
261 | - } |
|
262 | - } |
|
263 | - } |
|
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * caffeinated_modules_to_register |
|
269 | - * |
|
270 | - * @access public |
|
271 | - * @param array $modules_to_register |
|
272 | - * @return array |
|
273 | - */ |
|
274 | - public function caffeinated_modules_to_register(array $modules_to_register = []): array |
|
275 | - { |
|
276 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
277 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR); |
|
278 | - if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
279 | - $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
280 | - } |
|
281 | - } |
|
282 | - return $modules_to_register; |
|
283 | - } |
|
284 | - |
|
285 | - |
|
286 | - /** |
|
287 | - * @throws EE_Error |
|
288 | - * @throws InvalidArgumentException |
|
289 | - * @throws ReflectionException |
|
290 | - * @throws InvalidDataTypeException |
|
291 | - * @throws InvalidInterfaceException |
|
292 | - */ |
|
293 | - public function caffeinated_init() |
|
294 | - { |
|
295 | - // Custom Post Type hooks |
|
296 | - add_filter( |
|
297 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
298 | - [$this, 'filter_taxonomies'] |
|
299 | - ); |
|
300 | - add_filter( |
|
301 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
302 | - [$this, 'filter_cpts'] |
|
303 | - ); |
|
304 | - add_filter( |
|
305 | - 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
306 | - [$this, 'nav_metabox_items'] |
|
307 | - ); |
|
308 | - EE_Registry::instance()->load_file( |
|
309 | - EE_CAFF_PATH, |
|
310 | - 'EE_Caf_Messages', |
|
311 | - 'class', |
|
312 | - [], |
|
313 | - false |
|
314 | - ); |
|
315 | - // caffeinated_init__complete hook |
|
316 | - do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
317 | - } |
|
318 | - |
|
319 | - |
|
320 | - public function enqueue_caffeinated_scripts() |
|
321 | - { |
|
322 | - // sound of crickets... |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - /** |
|
327 | - * callbacks below here |
|
328 | - * |
|
329 | - * @param array $taxonomy_array |
|
330 | - * @return array |
|
331 | - */ |
|
332 | - public function filter_taxonomies(array $taxonomy_array): array |
|
333 | - { |
|
334 | - $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
335 | - return $taxonomy_array; |
|
336 | - } |
|
337 | - |
|
338 | - |
|
339 | - /** |
|
340 | - * @param array $cpt_array |
|
341 | - * @return array |
|
342 | - */ |
|
343 | - public function filter_cpts(array $cpt_array): array |
|
344 | - { |
|
345 | - $cpt_array[EspressoPostType::VENUES]['args']['show_in_nav_menus'] = true; |
|
346 | - return $cpt_array; |
|
347 | - } |
|
348 | - |
|
349 | - |
|
350 | - /** |
|
351 | - * @param array $menu_items |
|
352 | - * @return array |
|
353 | - */ |
|
354 | - public function nav_metabox_items(array $menu_items): array |
|
355 | - { |
|
356 | - $menu_items[] = [ |
|
357 | - 'title' => esc_html__('Venue List', 'event_espresso'), |
|
358 | - 'url' => get_post_type_archive_link(EspressoPostType::VENUES), |
|
359 | - 'description' => esc_html__('Archive page for all venues.', 'event_espresso'), |
|
360 | - ]; |
|
361 | - return $menu_items; |
|
362 | - } |
|
363 | - |
|
364 | - |
|
365 | - /** |
|
366 | - * Gets the injected table analyzer, or throws an exception |
|
367 | - * |
|
368 | - * @return TableAnalysis |
|
369 | - */ |
|
370 | - protected function _get_table_analysis(): TableAnalysis |
|
371 | - { |
|
372 | - return $this->_table_analysis; |
|
373 | - } |
|
31 | + protected EE_Dependency_Map $dependency_map; |
|
32 | + |
|
33 | + protected LoaderInterface $loader; |
|
34 | + |
|
35 | + protected TableAnalysis $_table_analysis; |
|
36 | + |
|
37 | + protected RouteHandler $route_handler; |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * EE_Brewing_Regular constructor. |
|
42 | + * |
|
43 | + * @param EE_Dependency_Map $dependency_map |
|
44 | + * @param LoaderInterface $loader |
|
45 | + * @param RouteHandler $route_handler |
|
46 | + * @param TableAnalysis $table_analysis |
|
47 | + */ |
|
48 | + public function __construct( |
|
49 | + EE_Dependency_Map $dependency_map, |
|
50 | + LoaderInterface $loader, |
|
51 | + RouteHandler $route_handler, |
|
52 | + TableAnalysis $table_analysis |
|
53 | + ) { |
|
54 | + $this->dependency_map = $dependency_map; |
|
55 | + $this->loader = $loader; |
|
56 | + $this->route_handler = $route_handler; |
|
57 | + $this->_table_analysis = $table_analysis; |
|
58 | + if (defined('EE_CAFF_PATH')) { |
|
59 | + // defined some new constants related to caffeinated folder |
|
60 | + define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/'); |
|
61 | + define('EE_CAF_CORE', EE_CAFF_PATH . 'core/'); |
|
62 | + define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries/'); |
|
63 | + define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods/'); |
|
64 | + } |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * @throws EE_Error |
|
70 | + */ |
|
71 | + public function caffeinated() |
|
72 | + { |
|
73 | + $this->setInitializationHooks(); |
|
74 | + $this->setApiRegistrationHooks(); |
|
75 | + $this->setSwitchHooks(); |
|
76 | + $this->setDefaultFilterHooks(); |
|
77 | + // caffeinated constructed |
|
78 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * @throws Exception |
|
84 | + * @deprecated 5.0.20.p |
|
85 | + */ |
|
86 | + public function initializePUE() |
|
87 | + { |
|
88 | + $this->dependency_map->registerDependencies(PueRequests::class, Route::getDefaultDependencies()); |
|
89 | + $this->route_handler->addRoute(PueRequests::class); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * Various hooks used for extending features via registration of modules or extensions. |
|
95 | + * |
|
96 | + * @throws EE_Error |
|
97 | + */ |
|
98 | + private function setApiRegistrationHooks() |
|
99 | + { |
|
100 | + add_filter( |
|
101 | + 'FHEE__EE_Config__register_modules__modules_to_register', |
|
102 | + [$this, 'caffeinated_modules_to_register'] |
|
103 | + ); |
|
104 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths']); |
|
105 | + add_filter( |
|
106 | + 'AHEE__EE_System__load_core_configuration__complete', |
|
107 | + function () { |
|
108 | + EE_Register_Payment_Method::register( |
|
109 | + 'caffeinated_payment_methods', |
|
110 | + [ |
|
111 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
112 | + ] |
|
113 | + ); |
|
114 | + } |
|
115 | + ); |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * Various hooks used for modifying initialization or activation processes. |
|
121 | + */ |
|
122 | + private function setInitializationHooks() |
|
123 | + { |
|
124 | + // activation |
|
125 | + add_action('AHEE__EEH_Activation__initialize_db_content', [$this, 'initialize_caf_db_content']); |
|
126 | + // load caff init |
|
127 | + add_action('AHEE__EE_System__set_hooks_for_core', [$this, 'caffeinated_init']); |
|
128 | + // load caff scripts |
|
129 | + add_action('wp_enqueue_scripts', [$this, 'enqueue_caffeinated_scripts']); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * Various hooks used for switch (on/off) type filters. |
|
135 | + */ |
|
136 | + private function setSwitchHooks() |
|
137 | + { |
|
138 | + // remove the "powered by" credit link from receipts and invoices |
|
139 | + add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
140 | + // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
141 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + /** |
|
146 | + * Various filters for affecting default configuration values in the caffeinated |
|
147 | + * context. |
|
148 | + */ |
|
149 | + private function setDefaultFilterHooks() |
|
150 | + { |
|
151 | + add_filter( |
|
152 | + 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
153 | + '__return_true' |
|
154 | + ); |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
160 | + * |
|
161 | + * @param array $paths original helper paths array |
|
162 | + * @return array new array of paths |
|
163 | + */ |
|
164 | + public function caf_helper_paths(array $paths): array |
|
165 | + { |
|
166 | + $paths[] = EE_CAF_CORE . 'helpers/'; |
|
167 | + return $paths; |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
173 | + * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
174 | + * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
175 | + * This action should only be called when EE 4.x.0.P is initially activated. |
|
176 | + * Right now the only CAF content are these global prices. If there's more in the future, then |
|
177 | + * we should probably create a caf file to contain it all instead just a function like this. |
|
178 | + * Right now, we ASSUME the only price types in the system are default ones |
|
179 | + * |
|
180 | + * @global wpdb $wpdb |
|
181 | + */ |
|
182 | + public function initialize_caf_db_content() |
|
183 | + { |
|
184 | + global $wpdb; |
|
185 | + // use same method of getting creator id as the version introducing the change |
|
186 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
187 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
188 | + $price_table = $wpdb->prefix . "esp_price"; |
|
189 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
190 | + $SQL = |
|
191 | + 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
192 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
193 | + if ($tax_price_type_count <= 1) { |
|
194 | + $wpdb->insert( |
|
195 | + $price_type_table, |
|
196 | + [ |
|
197 | + 'PRT_name' => esc_html__("Regional Tax", "event_espresso"), |
|
198 | + 'PBT_ID' => 4, |
|
199 | + 'PRT_is_percent' => true, |
|
200 | + 'PRT_order' => 60, |
|
201 | + 'PRT_deleted' => false, |
|
202 | + 'PRT_wp_user' => $default_creator_id, |
|
203 | + ], |
|
204 | + [ |
|
205 | + '%s',// PRT_name |
|
206 | + '%d',// PBT_id |
|
207 | + '%d',// PRT_is_percent |
|
208 | + '%d',// PRT_order |
|
209 | + '%d',// PRT_deleted |
|
210 | + '%d', // PRT_wp_user |
|
211 | + ] |
|
212 | + ); |
|
213 | + // federal tax |
|
214 | + $result = $wpdb->insert( |
|
215 | + $price_type_table, |
|
216 | + [ |
|
217 | + 'PRT_name' => esc_html__("Federal Tax", "event_espresso"), |
|
218 | + 'PBT_ID' => 4, |
|
219 | + 'PRT_is_percent' => true, |
|
220 | + 'PRT_order' => 60, |
|
221 | + 'PRT_deleted' => false, |
|
222 | + 'PRT_wp_user' => $default_creator_id, |
|
223 | + ], |
|
224 | + [ |
|
225 | + '%s',// PRT_name |
|
226 | + '%d',// PBT_id |
|
227 | + '%d',// PRT_is_percent |
|
228 | + '%d',// PRT_order |
|
229 | + '%d',// PRT_deleted |
|
230 | + '%d' // PRT_wp_user |
|
231 | + ] |
|
232 | + ); |
|
233 | + if ($result) { |
|
234 | + $wpdb->insert( |
|
235 | + $price_table, |
|
236 | + [ |
|
237 | + 'PRT_ID' => $wpdb->insert_id, |
|
238 | + 'PRC_amount' => 15.00, |
|
239 | + 'PRC_name' => esc_html__("Sales Tax", "event_espresso"), |
|
240 | + 'PRC_desc' => '', |
|
241 | + 'PRC_is_default' => true, |
|
242 | + 'PRC_overrides' => null, |
|
243 | + 'PRC_deleted' => false, |
|
244 | + 'PRC_order' => 60, |
|
245 | + 'PRC_parent' => null, |
|
246 | + 'PRC_wp_user' => $default_creator_id, |
|
247 | + ], |
|
248 | + [ |
|
249 | + '%d',// PRT_id |
|
250 | + '%f',// PRC_amount |
|
251 | + '%s',// PRC_name |
|
252 | + '%s',// PRC_desc |
|
253 | + '%d',// PRC_is_default |
|
254 | + '%d',// PRC_overrides |
|
255 | + '%d',// PRC_deleted |
|
256 | + '%d',// PRC_order |
|
257 | + '%d',// PRC_parent |
|
258 | + '%d' // PRC_wp_user |
|
259 | + ] |
|
260 | + ); |
|
261 | + } |
|
262 | + } |
|
263 | + } |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * caffeinated_modules_to_register |
|
269 | + * |
|
270 | + * @access public |
|
271 | + * @param array $modules_to_register |
|
272 | + * @return array |
|
273 | + */ |
|
274 | + public function caffeinated_modules_to_register(array $modules_to_register = []): array |
|
275 | + { |
|
276 | + if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
277 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR); |
|
278 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
279 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
280 | + } |
|
281 | + } |
|
282 | + return $modules_to_register; |
|
283 | + } |
|
284 | + |
|
285 | + |
|
286 | + /** |
|
287 | + * @throws EE_Error |
|
288 | + * @throws InvalidArgumentException |
|
289 | + * @throws ReflectionException |
|
290 | + * @throws InvalidDataTypeException |
|
291 | + * @throws InvalidInterfaceException |
|
292 | + */ |
|
293 | + public function caffeinated_init() |
|
294 | + { |
|
295 | + // Custom Post Type hooks |
|
296 | + add_filter( |
|
297 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
298 | + [$this, 'filter_taxonomies'] |
|
299 | + ); |
|
300 | + add_filter( |
|
301 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
302 | + [$this, 'filter_cpts'] |
|
303 | + ); |
|
304 | + add_filter( |
|
305 | + 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
306 | + [$this, 'nav_metabox_items'] |
|
307 | + ); |
|
308 | + EE_Registry::instance()->load_file( |
|
309 | + EE_CAFF_PATH, |
|
310 | + 'EE_Caf_Messages', |
|
311 | + 'class', |
|
312 | + [], |
|
313 | + false |
|
314 | + ); |
|
315 | + // caffeinated_init__complete hook |
|
316 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
317 | + } |
|
318 | + |
|
319 | + |
|
320 | + public function enqueue_caffeinated_scripts() |
|
321 | + { |
|
322 | + // sound of crickets... |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + /** |
|
327 | + * callbacks below here |
|
328 | + * |
|
329 | + * @param array $taxonomy_array |
|
330 | + * @return array |
|
331 | + */ |
|
332 | + public function filter_taxonomies(array $taxonomy_array): array |
|
333 | + { |
|
334 | + $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
335 | + return $taxonomy_array; |
|
336 | + } |
|
337 | + |
|
338 | + |
|
339 | + /** |
|
340 | + * @param array $cpt_array |
|
341 | + * @return array |
|
342 | + */ |
|
343 | + public function filter_cpts(array $cpt_array): array |
|
344 | + { |
|
345 | + $cpt_array[EspressoPostType::VENUES]['args']['show_in_nav_menus'] = true; |
|
346 | + return $cpt_array; |
|
347 | + } |
|
348 | + |
|
349 | + |
|
350 | + /** |
|
351 | + * @param array $menu_items |
|
352 | + * @return array |
|
353 | + */ |
|
354 | + public function nav_metabox_items(array $menu_items): array |
|
355 | + { |
|
356 | + $menu_items[] = [ |
|
357 | + 'title' => esc_html__('Venue List', 'event_espresso'), |
|
358 | + 'url' => get_post_type_archive_link(EspressoPostType::VENUES), |
|
359 | + 'description' => esc_html__('Archive page for all venues.', 'event_espresso'), |
|
360 | + ]; |
|
361 | + return $menu_items; |
|
362 | + } |
|
363 | + |
|
364 | + |
|
365 | + /** |
|
366 | + * Gets the injected table analyzer, or throws an exception |
|
367 | + * |
|
368 | + * @return TableAnalysis |
|
369 | + */ |
|
370 | + protected function _get_table_analysis(): TableAnalysis |
|
371 | + { |
|
372 | + return $this->_table_analysis; |
|
373 | + } |
|
374 | 374 | } |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $this->_table_analysis = $table_analysis; |
58 | 58 | if (defined('EE_CAFF_PATH')) { |
59 | 59 | // defined some new constants related to caffeinated folder |
60 | - define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/'); |
|
61 | - define('EE_CAF_CORE', EE_CAFF_PATH . 'core/'); |
|
62 | - define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries/'); |
|
63 | - define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods/'); |
|
60 | + define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
61 | + define('EE_CAF_CORE', EE_CAFF_PATH.'core/'); |
|
62 | + define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries/'); |
|
63 | + define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods/'); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths']); |
105 | 105 | add_filter( |
106 | 106 | 'AHEE__EE_System__load_core_configuration__complete', |
107 | - function () { |
|
107 | + function() { |
|
108 | 108 | EE_Register_Payment_Method::register( |
109 | 109 | 'caffeinated_payment_methods', |
110 | 110 | [ |
111 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
111 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR), |
|
112 | 112 | ] |
113 | 113 | ); |
114 | 114 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function caf_helper_paths(array $paths): array |
165 | 165 | { |
166 | - $paths[] = EE_CAF_CORE . 'helpers/'; |
|
166 | + $paths[] = EE_CAF_CORE.'helpers/'; |
|
167 | 167 | return $paths; |
168 | 168 | } |
169 | 169 | |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | global $wpdb; |
185 | 185 | // use same method of getting creator id as the version introducing the change |
186 | 186 | $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
187 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
188 | - $price_table = $wpdb->prefix . "esp_price"; |
|
187 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
188 | + $price_table = $wpdb->prefix."esp_price"; |
|
189 | 189 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
190 | 190 | $SQL = |
191 | - 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
191 | + 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; // include trashed price types |
|
192 | 192 | $tax_price_type_count = $wpdb->get_var($SQL); |
193 | 193 | if ($tax_price_type_count <= 1) { |
194 | 194 | $wpdb->insert( |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | 'PRT_wp_user' => $default_creator_id, |
203 | 203 | ], |
204 | 204 | [ |
205 | - '%s',// PRT_name |
|
206 | - '%d',// PBT_id |
|
207 | - '%d',// PRT_is_percent |
|
208 | - '%d',// PRT_order |
|
209 | - '%d',// PRT_deleted |
|
205 | + '%s', // PRT_name |
|
206 | + '%d', // PBT_id |
|
207 | + '%d', // PRT_is_percent |
|
208 | + '%d', // PRT_order |
|
209 | + '%d', // PRT_deleted |
|
210 | 210 | '%d', // PRT_wp_user |
211 | 211 | ] |
212 | 212 | ); |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | 'PRT_wp_user' => $default_creator_id, |
223 | 223 | ], |
224 | 224 | [ |
225 | - '%s',// PRT_name |
|
226 | - '%d',// PBT_id |
|
227 | - '%d',// PRT_is_percent |
|
228 | - '%d',// PRT_order |
|
229 | - '%d',// PRT_deleted |
|
225 | + '%s', // PRT_name |
|
226 | + '%d', // PBT_id |
|
227 | + '%d', // PRT_is_percent |
|
228 | + '%d', // PRT_order |
|
229 | + '%d', // PRT_deleted |
|
230 | 230 | '%d' // PRT_wp_user |
231 | 231 | ] |
232 | 232 | ); |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | 'PRC_wp_user' => $default_creator_id, |
247 | 247 | ], |
248 | 248 | [ |
249 | - '%d',// PRT_id |
|
250 | - '%f',// PRC_amount |
|
251 | - '%s',// PRC_name |
|
252 | - '%s',// PRC_desc |
|
253 | - '%d',// PRC_is_default |
|
254 | - '%d',// PRC_overrides |
|
255 | - '%d',// PRC_deleted |
|
256 | - '%d',// PRC_order |
|
257 | - '%d',// PRC_parent |
|
249 | + '%d', // PRT_id |
|
250 | + '%f', // PRC_amount |
|
251 | + '%s', // PRC_name |
|
252 | + '%s', // PRC_desc |
|
253 | + '%d', // PRC_is_default |
|
254 | + '%d', // PRC_overrides |
|
255 | + '%d', // PRC_deleted |
|
256 | + '%d', // PRC_order |
|
257 | + '%d', // PRC_parent |
|
258 | 258 | '%d' // PRC_wp_user |
259 | 259 | ] |
260 | 260 | ); |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function caffeinated_modules_to_register(array $modules_to_register = []): array |
275 | 275 | { |
276 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
277 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR); |
|
276 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
277 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules/*', GLOB_ONLYDIR); |
|
278 | 278 | if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
279 | 279 | $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
280 | 280 | } |