@@ -14,128 +14,128 @@ |
||
14 | 14 | trait EventsAdmin |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param string $additional_params |
|
19 | - */ |
|
20 | - public function amOnDefaultEventsListTablePage($additional_params = '') |
|
21 | - { |
|
22 | - $this->actor()->amOnAdminPage(EventsPage::defaultEventsListTableUrl($additional_params)); |
|
23 | - } |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * Triggers the publishing of the Event. |
|
28 | - */ |
|
29 | - public function publishEvent() |
|
30 | - { |
|
31 | - $this->actor()->click(EventsPage::EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR); |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * Triggers saving the Event. |
|
37 | - */ |
|
38 | - public function saveEvent() |
|
39 | - { |
|
40 | - $this->actor()->click(EventsPage::EVENT_EDITOR_SAVE_BUTTON_SELECTOR); |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * Navigates the actor to the event list table page and will attempt to edit the event for the given title. |
|
46 | - * First this will search using the given title and then attempt to edit from the results of the search. |
|
47 | - * |
|
48 | - * Assumes actor is already logged in. |
|
49 | - * @param $event_title |
|
50 | - */ |
|
51 | - public function amEditingTheEventWithTitle($event_title) |
|
52 | - { |
|
53 | - $this->amOnDefaultEventsListTablePage(); |
|
54 | - $this->actor()->fillField(EventsPage::EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR, $event_title); |
|
55 | - $this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR); |
|
56 | - $this->actor()->waitForText($event_title, 15); |
|
57 | - $this->actor()->click(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title)); |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * Navigates the user to the single event page (frontend view) for the given event title via clicking the "View" |
|
63 | - * link for the event in the event list table. |
|
64 | - * Assumes the actor is already logged in and on the Event list table page. |
|
65 | - * |
|
66 | - * @param string $event_title |
|
67 | - */ |
|
68 | - public function amOnEventPageAfterClickingViewLinkInListTableForEvent($event_title) |
|
69 | - { |
|
70 | - $this->actor()->moveMouseOver(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title)); |
|
71 | - $this->actor()->click(EventsPage::eventListTableEventTitleViewLinkSelectorForTitle($event_title)); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * Used to retrieve the event id for the event via the list table and for the given event. |
|
77 | - * @param string $event_title |
|
78 | - */ |
|
79 | - public function observeEventIdInListTableForEvent($event_title) |
|
80 | - { |
|
81 | - return $this->actor()->observeValueFromInputAt(EventsPage::eventListTableEventIdSelectorForTitle($event_title)); |
|
82 | - } |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * This performs the click action on the gear icon that triggers the advanced settings view state. |
|
87 | - * Assumes the actor is already logged in and editing an event. |
|
88 | - * |
|
89 | - * @param int $row_number What ticket row to toggle open/close. |
|
90 | - */ |
|
91 | - public function toggleAdvancedSettingsViewForTicketRow($row_number = 1) |
|
92 | - { |
|
93 | - $this->actor()->click(EventsPage::eventEditorTicketAdvancedDetailsSelector($row_number)); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * Toggles the TKT_is_taxable checkbox for the ticket in the given row. |
|
99 | - * Assumes the actor is already logged in and editing an event and that the advanced settings view state for that |
|
100 | - * ticket is "open". |
|
101 | - * |
|
102 | - * @param int $row_number What ticket row to toggle the checkbox for. |
|
103 | - */ |
|
104 | - public function toggleTicketIsTaxableForTicketRow($row_number = 1) |
|
105 | - { |
|
106 | - $this->actor()->click(EventsPage::eventEditorTicketTaxableCheckboxSelector($row_number)); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Use to change the default registration status for the event. |
|
112 | - * Assumes the view is already on the event editor. |
|
113 | - * @param $registration_status |
|
114 | - */ |
|
115 | - public function changeDefaultRegistrationStatusTo($registration_status) |
|
116 | - { |
|
117 | - $this->actor()->selectOption( |
|
118 | - EventsPage::EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR, |
|
119 | - $registration_status |
|
120 | - ); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * Use this from the context of the event editor to select the given custom template for a given message type and |
|
126 | - * messenger. |
|
127 | - * |
|
128 | - * @param string $message_type_label The visible label for the message type (eg Registration Approved) |
|
129 | - * @param string $messenger_slug The slug for the messenger (eg 'email') |
|
130 | - * @param string $custom_template_label The visible label in the select input for the custom template you want |
|
131 | - * selected. |
|
132 | - */ |
|
133 | - public function selectCustomTemplateFor($message_type_label, $messenger_slug, $custom_template_label) |
|
134 | - { |
|
135 | - $this->actor()->click(EventsPage::eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug)); |
|
136 | - $this->actor()->selectOption( |
|
137 | - EventsPage::eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label), |
|
138 | - $custom_template_label |
|
139 | - ); |
|
140 | - } |
|
17 | + /** |
|
18 | + * @param string $additional_params |
|
19 | + */ |
|
20 | + public function amOnDefaultEventsListTablePage($additional_params = '') |
|
21 | + { |
|
22 | + $this->actor()->amOnAdminPage(EventsPage::defaultEventsListTableUrl($additional_params)); |
|
23 | + } |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * Triggers the publishing of the Event. |
|
28 | + */ |
|
29 | + public function publishEvent() |
|
30 | + { |
|
31 | + $this->actor()->click(EventsPage::EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR); |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * Triggers saving the Event. |
|
37 | + */ |
|
38 | + public function saveEvent() |
|
39 | + { |
|
40 | + $this->actor()->click(EventsPage::EVENT_EDITOR_SAVE_BUTTON_SELECTOR); |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * Navigates the actor to the event list table page and will attempt to edit the event for the given title. |
|
46 | + * First this will search using the given title and then attempt to edit from the results of the search. |
|
47 | + * |
|
48 | + * Assumes actor is already logged in. |
|
49 | + * @param $event_title |
|
50 | + */ |
|
51 | + public function amEditingTheEventWithTitle($event_title) |
|
52 | + { |
|
53 | + $this->amOnDefaultEventsListTablePage(); |
|
54 | + $this->actor()->fillField(EventsPage::EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR, $event_title); |
|
55 | + $this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR); |
|
56 | + $this->actor()->waitForText($event_title, 15); |
|
57 | + $this->actor()->click(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title)); |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * Navigates the user to the single event page (frontend view) for the given event title via clicking the "View" |
|
63 | + * link for the event in the event list table. |
|
64 | + * Assumes the actor is already logged in and on the Event list table page. |
|
65 | + * |
|
66 | + * @param string $event_title |
|
67 | + */ |
|
68 | + public function amOnEventPageAfterClickingViewLinkInListTableForEvent($event_title) |
|
69 | + { |
|
70 | + $this->actor()->moveMouseOver(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title)); |
|
71 | + $this->actor()->click(EventsPage::eventListTableEventTitleViewLinkSelectorForTitle($event_title)); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * Used to retrieve the event id for the event via the list table and for the given event. |
|
77 | + * @param string $event_title |
|
78 | + */ |
|
79 | + public function observeEventIdInListTableForEvent($event_title) |
|
80 | + { |
|
81 | + return $this->actor()->observeValueFromInputAt(EventsPage::eventListTableEventIdSelectorForTitle($event_title)); |
|
82 | + } |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * This performs the click action on the gear icon that triggers the advanced settings view state. |
|
87 | + * Assumes the actor is already logged in and editing an event. |
|
88 | + * |
|
89 | + * @param int $row_number What ticket row to toggle open/close. |
|
90 | + */ |
|
91 | + public function toggleAdvancedSettingsViewForTicketRow($row_number = 1) |
|
92 | + { |
|
93 | + $this->actor()->click(EventsPage::eventEditorTicketAdvancedDetailsSelector($row_number)); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * Toggles the TKT_is_taxable checkbox for the ticket in the given row. |
|
99 | + * Assumes the actor is already logged in and editing an event and that the advanced settings view state for that |
|
100 | + * ticket is "open". |
|
101 | + * |
|
102 | + * @param int $row_number What ticket row to toggle the checkbox for. |
|
103 | + */ |
|
104 | + public function toggleTicketIsTaxableForTicketRow($row_number = 1) |
|
105 | + { |
|
106 | + $this->actor()->click(EventsPage::eventEditorTicketTaxableCheckboxSelector($row_number)); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Use to change the default registration status for the event. |
|
112 | + * Assumes the view is already on the event editor. |
|
113 | + * @param $registration_status |
|
114 | + */ |
|
115 | + public function changeDefaultRegistrationStatusTo($registration_status) |
|
116 | + { |
|
117 | + $this->actor()->selectOption( |
|
118 | + EventsPage::EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR, |
|
119 | + $registration_status |
|
120 | + ); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * Use this from the context of the event editor to select the given custom template for a given message type and |
|
126 | + * messenger. |
|
127 | + * |
|
128 | + * @param string $message_type_label The visible label for the message type (eg Registration Approved) |
|
129 | + * @param string $messenger_slug The slug for the messenger (eg 'email') |
|
130 | + * @param string $custom_template_label The visible label in the select input for the custom template you want |
|
131 | + * selected. |
|
132 | + */ |
|
133 | + public function selectCustomTemplateFor($message_type_label, $messenger_slug, $custom_template_label) |
|
134 | + { |
|
135 | + $this->actor()->click(EventsPage::eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug)); |
|
136 | + $this->actor()->selectOption( |
|
137 | + EventsPage::eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label), |
|
138 | + $custom_template_label |
|
139 | + ); |
|
140 | + } |
|
141 | 141 | } |
142 | 142 | \ No newline at end of file |
@@ -10,290 +10,290 @@ |
||
10 | 10 | */ |
11 | 11 | trait MessagesAdmin |
12 | 12 | { |
13 | - /** |
|
14 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
15 | - * a string. |
|
16 | - */ |
|
17 | - public function amOnMessagesActivityListTablePage($additional_params = '') |
|
18 | - { |
|
19 | - $this->actor()->amOnAdminPage(MessagesPage::messageActivityListTableUrl($additional_params)); |
|
20 | - } |
|
21 | - |
|
22 | - /** |
|
23 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
24 | - * a string. |
|
25 | - */ |
|
26 | - public function amOnDefaultMessageTemplateListTablePage($additional_params = '') |
|
27 | - { |
|
28 | - $this->actor()->amOnAdminPage(MessagesPage::defaultMessageTemplateListTableUrl($additional_params)); |
|
29 | - } |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
34 | - * a string. |
|
35 | - */ |
|
36 | - public function amOnCustomMessageTemplateListTablePage($additional_params = '') |
|
37 | - { |
|
38 | - $this->actor()->amOnAdminPage(MessagesPage::customMessageTemplateListTableUrl($additional_params)); |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * Directs to message settings page |
|
44 | - */ |
|
45 | - public function amOnMessageSettingsPage() |
|
46 | - { |
|
47 | - $this->actor()->amOnAdminPage(MessagesPage::messageSettingsUrl()); |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - public function activateMessageTypeForMessenger($message_type_slug, $messenger_slug = 'email') |
|
52 | - { |
|
53 | - $this->actor()->dragAndDrop( |
|
54 | - MessagesPage::draggableSettingsBoxSelectorForMessageTypeAndMessenger($message_type_slug, $messenger_slug), |
|
55 | - MessagesPage::MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR |
|
56 | - ); |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * Assumes you are already on the list table page that has the ui for editing the template. |
|
62 | - * @param string $message_type_slug |
|
63 | - * @param string $context [optional] if you want to click directly to the given context in the editor |
|
64 | - */ |
|
65 | - public function clickToEditMessageTemplateByMessageType($message_type_slug, $context = '') |
|
66 | - { |
|
67 | - $this->actor()->click(MessagesPage::editMessageTemplateClassByMessageType($message_type_slug, $context)); |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * Use this action to verify that the count for the given text in the specified field is as expected. For example |
|
73 | - * filling the condition of, "There should only be 1 instance of `[email protected]` in all the 'to' column. |
|
74 | - * |
|
75 | - * @param int $expected_occurence_count |
|
76 | - * @param string $text_to_check_for |
|
77 | - * @param string $field |
|
78 | - * @param string $message_type_label |
|
79 | - * @param string $message_status |
|
80 | - * @param string $messenger |
|
81 | - * @param string $context |
|
82 | - */ |
|
83 | - public function verifyMatchingCountofTextInMessageActivityListTableFor( |
|
84 | - $expected_occurence_count, |
|
85 | - $text_to_check_for, |
|
86 | - $field, |
|
87 | - $message_type_label, |
|
88 | - $message_status = MessagesPage::MESSAGE_STATUS_SENT, |
|
89 | - $messenger = 'Email', |
|
90 | - $context = 'Event Admin' |
|
91 | - ) { |
|
92 | - $elements = $this->actor()->grabMultiple(MessagesPage::messagesActivityListTableCellSelectorFor( |
|
93 | - $field, |
|
94 | - $message_type_label, |
|
95 | - $message_status, |
|
96 | - $messenger, |
|
97 | - $context, |
|
98 | - $text_to_check_for, |
|
99 | - 0 |
|
100 | - )); |
|
101 | - $actual_count = count($elements); |
|
102 | - $this->actor()->assertEquals( |
|
103 | - $expected_occurence_count, |
|
104 | - $actual_count, |
|
105 | - sprintf( |
|
106 | - 'Expected %s of the %s text for the %s field but there were actually %s counted.', |
|
107 | - $expected_occurence_count, |
|
108 | - $text_to_check_for, |
|
109 | - $field, |
|
110 | - $actual_count |
|
111 | - ) |
|
112 | - ); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * This will create a custom message template for the given messenger and message type from the context of the |
|
118 | - * default (global) message template list table. |
|
119 | - * Also takes care of verifying the template was created. |
|
120 | - * @param string $message_type_label |
|
121 | - * @param string $messenger_label |
|
122 | - */ |
|
123 | - public function createCustomMessageTemplateFromDefaultFor($message_type_label, $messenger_label) |
|
124 | - { |
|
125 | - $this->amOnDefaultMessageTemplateListTablePage(); |
|
126 | - $this->actor()->click( |
|
127 | - MessagesPage::createCustomButtonForMessageTypeAndMessenger( |
|
128 | - $message_type_label, |
|
129 | - $messenger_label |
|
130 | - ) |
|
131 | - ); |
|
132 | - $this->actor()->seeInField('#title', 'New Custom Template'); |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * This switches the context of the current messages template to the given reference. |
|
138 | - * @param string $context_reference This should be the visible label for the option. |
|
139 | - */ |
|
140 | - public function switchContextTo($context_reference) |
|
141 | - { |
|
142 | - $this->actor()->selectOption(MessagesPage::MESSAGES_CONTEXT_SWITCHER_SELECTOR, $context_reference); |
|
143 | - $this->actor()->click(MessagesPage::MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR); |
|
144 | - $this->actor()->waitForText($context_reference, 10, 'h1'); |
|
145 | - } |
|
146 | - |
|
147 | - |
|
148 | - /** |
|
149 | - * Toggles Context so its turned off or on (depending on where it started) and verifies the expected state after |
|
150 | - * toggling. |
|
151 | - * |
|
152 | - * @param string $context_string What context is being switched (used for the expected state text) |
|
153 | - * @param bool $expected_state_is_active Used to indicate whether the expected state is active (true) or inactive |
|
154 | - * (false) |
|
155 | - */ |
|
156 | - public function toggleContextState($context_string, $expected_state_is_active = true) |
|
157 | - { |
|
158 | - $this->actor()->click(MessagesPage::MESSAGES_CONTEXT_ACTIVE_STATE_TOGGLE); |
|
159 | - if ($expected_state_is_active) { |
|
160 | - $this->actor()->waitForText("The template for $context_string is currently active."); |
|
161 | - } else { |
|
162 | - $this->actor()->waitForText("The template for $context_string is currently inactive"); |
|
163 | - } |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - /** |
|
168 | - * Triggers saving the message template. |
|
169 | - * @param bool $and_close Use to indicate to click the Save and Close button. |
|
170 | - */ |
|
171 | - public function saveMessageTemplate($and_close = false) |
|
172 | - { |
|
173 | - if ($and_close) { |
|
174 | - $this->actor()->click('Save and Close'); |
|
175 | - } else { |
|
176 | - $this->actor()->click('Save'); |
|
177 | - } |
|
178 | - $this->actor()->waitForText('successfully updated'); |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - /** |
|
183 | - * This takes care of clicking the View Message icon for the given parameters. |
|
184 | - * Assumes you are already viewing the messages activity list table. |
|
185 | - * @param $message_type_label |
|
186 | - * @param $message_status |
|
187 | - * @param string $messenger |
|
188 | - * @param string $context |
|
189 | - * @param int $number_in_set |
|
190 | - */ |
|
191 | - public function viewMessageInMessagesListTableFor( |
|
192 | - $message_type_label, |
|
193 | - $message_status = MessagesPage::MESSAGE_STATUS_SENT, |
|
194 | - $messenger = 'Email', |
|
195 | - $context = 'Event Admin', |
|
196 | - $number_in_set = 1 |
|
197 | - ) { |
|
198 | - $this->actor()->click(MessagesPage::messagesActivityListTableViewButtonSelectorFor( |
|
199 | - $message_type_label, |
|
200 | - $message_status, |
|
201 | - $messenger, |
|
202 | - $context, |
|
203 | - $number_in_set |
|
204 | - )); |
|
205 | - } |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * Takes care of deleting a message matching the given parameters via the message activity list table. |
|
210 | - * Assumes you are already viewing the messages activity list table. |
|
211 | - * @param $message_type_label |
|
212 | - * @param $message_status |
|
213 | - * @param string $messenger |
|
214 | - * @param string $context |
|
215 | - * @param int $number_in_set |
|
216 | - */ |
|
217 | - public function deleteMessageInMessagesListTableFor( |
|
218 | - $message_type_label, |
|
219 | - $message_status = MessagesPage::MESSAGE_STATUS_SENT, |
|
220 | - $messenger = 'Email', |
|
221 | - $context = 'Event Admin', |
|
222 | - $number_in_set = 1 |
|
223 | - ) { |
|
224 | - $delete_action_selector = MessagesPage::messagesActivityListTableDeleteActionSelectorFor( |
|
225 | - $message_type_label, |
|
226 | - $message_status, |
|
227 | - $messenger, |
|
228 | - $context, |
|
229 | - $number_in_set |
|
230 | - ); |
|
231 | - $this->actor()->moveMouseOver( |
|
232 | - MessagesPage::messagesActivityListTableCellSelectorFor( |
|
233 | - 'to', |
|
234 | - $message_type_label, |
|
235 | - $message_status, |
|
236 | - $messenger, |
|
237 | - $context, |
|
238 | - '', |
|
239 | - $number_in_set |
|
240 | - ), |
|
241 | - 5, |
|
242 | - 5 |
|
243 | - ); |
|
244 | - $this->actor()->waitForElementVisible( |
|
245 | - $delete_action_selector |
|
246 | - ); |
|
247 | - $this->actor()->click( |
|
248 | - $delete_action_selector |
|
249 | - ); |
|
250 | - $this->actor()->waitForText('successfully deleted'); |
|
251 | - } |
|
252 | - |
|
253 | - |
|
254 | - /** |
|
255 | - * Assuming you have already triggered the view modal for a single message from the context of the message activity |
|
256 | - * list table, this will take care of validating the given text is in that window. |
|
257 | - * @param string $text_to_view |
|
258 | - */ |
|
259 | - public function seeTextInViewMessageModal($text_to_view, $should_not_see = false) |
|
260 | - { |
|
261 | - $this->actor()->waitForElementVisible('.ee-admin-dialog-container-inner-content'); |
|
262 | - $this->actor()->switchToIframe('message-view-window'); |
|
263 | - $should_not_see ? $this->actor()->dontSee($text_to_view) : $this->actor()->see($text_to_view); |
|
264 | - $this->actor()->switchToIframe(); |
|
265 | - } |
|
266 | - |
|
267 | - |
|
268 | - /** |
|
269 | - * This returns the value for the link at the given selector in the message modal. |
|
270 | - * @param string $selector (any selector string accepted by WebDriver) |
|
271 | - */ |
|
272 | - public function observeLinkAtSelectorInMessageModal($selector) |
|
273 | - { |
|
274 | - $this->actor()->waitForElementVisible('.ee-admin-dialog-container-inner-content'); |
|
275 | - $this->actor()->switchToIframe('message-view-window'); |
|
276 | - $link = $this->actor()->observeLinkUrlAt($selector); |
|
277 | - $this->actor()->switchToIframe(); |
|
278 | - return $link; |
|
279 | - } |
|
280 | - |
|
281 | - |
|
282 | - /** |
|
283 | - * Assuming you have already triggered the view modal for a single message from the context of the message activity |
|
284 | - * list table, this will take care of validating the given text is NOT that window. |
|
285 | - * @param string $text_to_view |
|
286 | - */ |
|
287 | - public function dontSeeTextInViewMessageModal($text_to_view) |
|
288 | - { |
|
289 | - $this->seeTextInViewMessageModal($text_to_view, true); |
|
290 | - } |
|
291 | - |
|
292 | - |
|
293 | - public function dismissMessageModal() |
|
294 | - { |
|
295 | - $this->actor()->click('#espresso-admin-page-overlay-dv'); |
|
296 | - //this is needed otherwise phantom js gets stuck in the wrong context and any future element events will fail. |
|
297 | - $this->actor()->click('form#EE_Message_List_Table-table-frm'); |
|
298 | - } |
|
13 | + /** |
|
14 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
15 | + * a string. |
|
16 | + */ |
|
17 | + public function amOnMessagesActivityListTablePage($additional_params = '') |
|
18 | + { |
|
19 | + $this->actor()->amOnAdminPage(MessagesPage::messageActivityListTableUrl($additional_params)); |
|
20 | + } |
|
21 | + |
|
22 | + /** |
|
23 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
24 | + * a string. |
|
25 | + */ |
|
26 | + public function amOnDefaultMessageTemplateListTablePage($additional_params = '') |
|
27 | + { |
|
28 | + $this->actor()->amOnAdminPage(MessagesPage::defaultMessageTemplateListTableUrl($additional_params)); |
|
29 | + } |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
34 | + * a string. |
|
35 | + */ |
|
36 | + public function amOnCustomMessageTemplateListTablePage($additional_params = '') |
|
37 | + { |
|
38 | + $this->actor()->amOnAdminPage(MessagesPage::customMessageTemplateListTableUrl($additional_params)); |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * Directs to message settings page |
|
44 | + */ |
|
45 | + public function amOnMessageSettingsPage() |
|
46 | + { |
|
47 | + $this->actor()->amOnAdminPage(MessagesPage::messageSettingsUrl()); |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + public function activateMessageTypeForMessenger($message_type_slug, $messenger_slug = 'email') |
|
52 | + { |
|
53 | + $this->actor()->dragAndDrop( |
|
54 | + MessagesPage::draggableSettingsBoxSelectorForMessageTypeAndMessenger($message_type_slug, $messenger_slug), |
|
55 | + MessagesPage::MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR |
|
56 | + ); |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * Assumes you are already on the list table page that has the ui for editing the template. |
|
62 | + * @param string $message_type_slug |
|
63 | + * @param string $context [optional] if you want to click directly to the given context in the editor |
|
64 | + */ |
|
65 | + public function clickToEditMessageTemplateByMessageType($message_type_slug, $context = '') |
|
66 | + { |
|
67 | + $this->actor()->click(MessagesPage::editMessageTemplateClassByMessageType($message_type_slug, $context)); |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * Use this action to verify that the count for the given text in the specified field is as expected. For example |
|
73 | + * filling the condition of, "There should only be 1 instance of `[email protected]` in all the 'to' column. |
|
74 | + * |
|
75 | + * @param int $expected_occurence_count |
|
76 | + * @param string $text_to_check_for |
|
77 | + * @param string $field |
|
78 | + * @param string $message_type_label |
|
79 | + * @param string $message_status |
|
80 | + * @param string $messenger |
|
81 | + * @param string $context |
|
82 | + */ |
|
83 | + public function verifyMatchingCountofTextInMessageActivityListTableFor( |
|
84 | + $expected_occurence_count, |
|
85 | + $text_to_check_for, |
|
86 | + $field, |
|
87 | + $message_type_label, |
|
88 | + $message_status = MessagesPage::MESSAGE_STATUS_SENT, |
|
89 | + $messenger = 'Email', |
|
90 | + $context = 'Event Admin' |
|
91 | + ) { |
|
92 | + $elements = $this->actor()->grabMultiple(MessagesPage::messagesActivityListTableCellSelectorFor( |
|
93 | + $field, |
|
94 | + $message_type_label, |
|
95 | + $message_status, |
|
96 | + $messenger, |
|
97 | + $context, |
|
98 | + $text_to_check_for, |
|
99 | + 0 |
|
100 | + )); |
|
101 | + $actual_count = count($elements); |
|
102 | + $this->actor()->assertEquals( |
|
103 | + $expected_occurence_count, |
|
104 | + $actual_count, |
|
105 | + sprintf( |
|
106 | + 'Expected %s of the %s text for the %s field but there were actually %s counted.', |
|
107 | + $expected_occurence_count, |
|
108 | + $text_to_check_for, |
|
109 | + $field, |
|
110 | + $actual_count |
|
111 | + ) |
|
112 | + ); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * This will create a custom message template for the given messenger and message type from the context of the |
|
118 | + * default (global) message template list table. |
|
119 | + * Also takes care of verifying the template was created. |
|
120 | + * @param string $message_type_label |
|
121 | + * @param string $messenger_label |
|
122 | + */ |
|
123 | + public function createCustomMessageTemplateFromDefaultFor($message_type_label, $messenger_label) |
|
124 | + { |
|
125 | + $this->amOnDefaultMessageTemplateListTablePage(); |
|
126 | + $this->actor()->click( |
|
127 | + MessagesPage::createCustomButtonForMessageTypeAndMessenger( |
|
128 | + $message_type_label, |
|
129 | + $messenger_label |
|
130 | + ) |
|
131 | + ); |
|
132 | + $this->actor()->seeInField('#title', 'New Custom Template'); |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * This switches the context of the current messages template to the given reference. |
|
138 | + * @param string $context_reference This should be the visible label for the option. |
|
139 | + */ |
|
140 | + public function switchContextTo($context_reference) |
|
141 | + { |
|
142 | + $this->actor()->selectOption(MessagesPage::MESSAGES_CONTEXT_SWITCHER_SELECTOR, $context_reference); |
|
143 | + $this->actor()->click(MessagesPage::MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR); |
|
144 | + $this->actor()->waitForText($context_reference, 10, 'h1'); |
|
145 | + } |
|
146 | + |
|
147 | + |
|
148 | + /** |
|
149 | + * Toggles Context so its turned off or on (depending on where it started) and verifies the expected state after |
|
150 | + * toggling. |
|
151 | + * |
|
152 | + * @param string $context_string What context is being switched (used for the expected state text) |
|
153 | + * @param bool $expected_state_is_active Used to indicate whether the expected state is active (true) or inactive |
|
154 | + * (false) |
|
155 | + */ |
|
156 | + public function toggleContextState($context_string, $expected_state_is_active = true) |
|
157 | + { |
|
158 | + $this->actor()->click(MessagesPage::MESSAGES_CONTEXT_ACTIVE_STATE_TOGGLE); |
|
159 | + if ($expected_state_is_active) { |
|
160 | + $this->actor()->waitForText("The template for $context_string is currently active."); |
|
161 | + } else { |
|
162 | + $this->actor()->waitForText("The template for $context_string is currently inactive"); |
|
163 | + } |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + /** |
|
168 | + * Triggers saving the message template. |
|
169 | + * @param bool $and_close Use to indicate to click the Save and Close button. |
|
170 | + */ |
|
171 | + public function saveMessageTemplate($and_close = false) |
|
172 | + { |
|
173 | + if ($and_close) { |
|
174 | + $this->actor()->click('Save and Close'); |
|
175 | + } else { |
|
176 | + $this->actor()->click('Save'); |
|
177 | + } |
|
178 | + $this->actor()->waitForText('successfully updated'); |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + /** |
|
183 | + * This takes care of clicking the View Message icon for the given parameters. |
|
184 | + * Assumes you are already viewing the messages activity list table. |
|
185 | + * @param $message_type_label |
|
186 | + * @param $message_status |
|
187 | + * @param string $messenger |
|
188 | + * @param string $context |
|
189 | + * @param int $number_in_set |
|
190 | + */ |
|
191 | + public function viewMessageInMessagesListTableFor( |
|
192 | + $message_type_label, |
|
193 | + $message_status = MessagesPage::MESSAGE_STATUS_SENT, |
|
194 | + $messenger = 'Email', |
|
195 | + $context = 'Event Admin', |
|
196 | + $number_in_set = 1 |
|
197 | + ) { |
|
198 | + $this->actor()->click(MessagesPage::messagesActivityListTableViewButtonSelectorFor( |
|
199 | + $message_type_label, |
|
200 | + $message_status, |
|
201 | + $messenger, |
|
202 | + $context, |
|
203 | + $number_in_set |
|
204 | + )); |
|
205 | + } |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * Takes care of deleting a message matching the given parameters via the message activity list table. |
|
210 | + * Assumes you are already viewing the messages activity list table. |
|
211 | + * @param $message_type_label |
|
212 | + * @param $message_status |
|
213 | + * @param string $messenger |
|
214 | + * @param string $context |
|
215 | + * @param int $number_in_set |
|
216 | + */ |
|
217 | + public function deleteMessageInMessagesListTableFor( |
|
218 | + $message_type_label, |
|
219 | + $message_status = MessagesPage::MESSAGE_STATUS_SENT, |
|
220 | + $messenger = 'Email', |
|
221 | + $context = 'Event Admin', |
|
222 | + $number_in_set = 1 |
|
223 | + ) { |
|
224 | + $delete_action_selector = MessagesPage::messagesActivityListTableDeleteActionSelectorFor( |
|
225 | + $message_type_label, |
|
226 | + $message_status, |
|
227 | + $messenger, |
|
228 | + $context, |
|
229 | + $number_in_set |
|
230 | + ); |
|
231 | + $this->actor()->moveMouseOver( |
|
232 | + MessagesPage::messagesActivityListTableCellSelectorFor( |
|
233 | + 'to', |
|
234 | + $message_type_label, |
|
235 | + $message_status, |
|
236 | + $messenger, |
|
237 | + $context, |
|
238 | + '', |
|
239 | + $number_in_set |
|
240 | + ), |
|
241 | + 5, |
|
242 | + 5 |
|
243 | + ); |
|
244 | + $this->actor()->waitForElementVisible( |
|
245 | + $delete_action_selector |
|
246 | + ); |
|
247 | + $this->actor()->click( |
|
248 | + $delete_action_selector |
|
249 | + ); |
|
250 | + $this->actor()->waitForText('successfully deleted'); |
|
251 | + } |
|
252 | + |
|
253 | + |
|
254 | + /** |
|
255 | + * Assuming you have already triggered the view modal for a single message from the context of the message activity |
|
256 | + * list table, this will take care of validating the given text is in that window. |
|
257 | + * @param string $text_to_view |
|
258 | + */ |
|
259 | + public function seeTextInViewMessageModal($text_to_view, $should_not_see = false) |
|
260 | + { |
|
261 | + $this->actor()->waitForElementVisible('.ee-admin-dialog-container-inner-content'); |
|
262 | + $this->actor()->switchToIframe('message-view-window'); |
|
263 | + $should_not_see ? $this->actor()->dontSee($text_to_view) : $this->actor()->see($text_to_view); |
|
264 | + $this->actor()->switchToIframe(); |
|
265 | + } |
|
266 | + |
|
267 | + |
|
268 | + /** |
|
269 | + * This returns the value for the link at the given selector in the message modal. |
|
270 | + * @param string $selector (any selector string accepted by WebDriver) |
|
271 | + */ |
|
272 | + public function observeLinkAtSelectorInMessageModal($selector) |
|
273 | + { |
|
274 | + $this->actor()->waitForElementVisible('.ee-admin-dialog-container-inner-content'); |
|
275 | + $this->actor()->switchToIframe('message-view-window'); |
|
276 | + $link = $this->actor()->observeLinkUrlAt($selector); |
|
277 | + $this->actor()->switchToIframe(); |
|
278 | + return $link; |
|
279 | + } |
|
280 | + |
|
281 | + |
|
282 | + /** |
|
283 | + * Assuming you have already triggered the view modal for a single message from the context of the message activity |
|
284 | + * list table, this will take care of validating the given text is NOT that window. |
|
285 | + * @param string $text_to_view |
|
286 | + */ |
|
287 | + public function dontSeeTextInViewMessageModal($text_to_view) |
|
288 | + { |
|
289 | + $this->seeTextInViewMessageModal($text_to_view, true); |
|
290 | + } |
|
291 | + |
|
292 | + |
|
293 | + public function dismissMessageModal() |
|
294 | + { |
|
295 | + $this->actor()->click('#espresso-admin-page-overlay-dv'); |
|
296 | + //this is needed otherwise phantom js gets stuck in the wrong context and any future element events will fail. |
|
297 | + $this->actor()->click('form#EE_Message_List_Table-table-frm'); |
|
298 | + } |
|
299 | 299 | } |
@@ -14,292 +14,292 @@ |
||
14 | 14 | class MessagesAdmin extends CoreAdmin |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Context slug for the admin messages context. |
|
19 | - */ |
|
20 | - const ADMIN_CONTEXT_SLUG = 'admin'; |
|
17 | + /** |
|
18 | + * Context slug for the admin messages context. |
|
19 | + */ |
|
20 | + const ADMIN_CONTEXT_SLUG = 'admin'; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Context slug for the primary attendee messages context |
|
24 | - */ |
|
25 | - const PRIMARY_ATTENDEE_CONTEXT_SLUG = 'primary_attendee'; |
|
22 | + /** |
|
23 | + * Context slug for the primary attendee messages context |
|
24 | + */ |
|
25 | + const PRIMARY_ATTENDEE_CONTEXT_SLUG = 'primary_attendee'; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * Context slug for the attendee messages context |
|
30 | - */ |
|
31 | - const ATTENDEE_CONTEXT_SLUG = 'attendee'; |
|
28 | + /** |
|
29 | + * Context slug for the attendee messages context |
|
30 | + */ |
|
31 | + const ATTENDEE_CONTEXT_SLUG = 'attendee'; |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * Status reference for the EEM_Message::status_sent status. |
|
36 | - */ |
|
37 | - const MESSAGE_STATUS_SENT = 'MSN'; |
|
34 | + /** |
|
35 | + * Status reference for the EEM_Message::status_sent status. |
|
36 | + */ |
|
37 | + const MESSAGE_STATUS_SENT = 'MSN'; |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * Message type slug for the Payment Failed message type |
|
42 | - */ |
|
43 | - const PAYMENT_FAILED_MESSAGE_TYPE_SLUG = 'payment_failed'; |
|
40 | + /** |
|
41 | + * Message type slug for the Payment Failed message type |
|
42 | + */ |
|
43 | + const PAYMENT_FAILED_MESSAGE_TYPE_SLUG = 'payment_failed'; |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * Message type slug for the Registration Pending Payment message type |
|
48 | - */ |
|
49 | - const MESSAGE_TYPE_PENDING_PAYMENT = 'pending_approval'; |
|
46 | + /** |
|
47 | + * Message type slug for the Registration Pending Payment message type |
|
48 | + */ |
|
49 | + const MESSAGE_TYPE_PENDING_PAYMENT = 'pending_approval'; |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Selector for the Global Messages "Send on same request" field in the Messages Settings tab. |
|
54 | - */ |
|
55 | - const GLOBAL_MESSAGES_SETTINGS_ON_REQUEST_SELECTION_SELECTOR = |
|
56 | - '#global_messages_settings-do-messages-on-same-request'; |
|
52 | + /** |
|
53 | + * Selector for the Global Messages "Send on same request" field in the Messages Settings tab. |
|
54 | + */ |
|
55 | + const GLOBAL_MESSAGES_SETTINGS_ON_REQUEST_SELECTION_SELECTOR = |
|
56 | + '#global_messages_settings-do-messages-on-same-request'; |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Selector for the Global Messages Settings submit button in the Messages Settings tab. |
|
61 | - */ |
|
62 | - const GLOBAL_MESSAGES_SETTINGS_SUBMIT_SELECTOR = '#global_messages_settings-update-settings-submit'; |
|
59 | + /** |
|
60 | + * Selector for the Global Messages Settings submit button in the Messages Settings tab. |
|
61 | + */ |
|
62 | + const GLOBAL_MESSAGES_SETTINGS_SUBMIT_SELECTOR = '#global_messages_settings-update-settings-submit'; |
|
63 | 63 | |
64 | 64 | |
65 | - /** |
|
66 | - * This is the container where active message types for a messenger are found/dragged to. |
|
67 | - */ |
|
68 | - const MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR = '#active-message-types'; |
|
65 | + /** |
|
66 | + * This is the container where active message types for a messenger are found/dragged to. |
|
67 | + */ |
|
68 | + const MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR = '#active-message-types'; |
|
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * Locator for the context switcher selector on the Message Template Editor page. |
|
73 | - */ |
|
74 | - const MESSAGES_CONTEXT_SWITCHER_SELECTOR = "//form[@id='ee-msg-context-switcher-frm']/select"; |
|
71 | + /** |
|
72 | + * Locator for the context switcher selector on the Message Template Editor page. |
|
73 | + */ |
|
74 | + const MESSAGES_CONTEXT_SWITCHER_SELECTOR = "//form[@id='ee-msg-context-switcher-frm']/select"; |
|
75 | 75 | |
76 | 76 | |
77 | - /** |
|
78 | - * Locator for the context switcher submit button in the Message Template Editor page. |
|
79 | - */ |
|
80 | - const MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR = "#submit-msg-context-switcher-sbmt"; |
|
77 | + /** |
|
78 | + * Locator for the context switcher submit button in the Message Template Editor page. |
|
79 | + */ |
|
80 | + const MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR = "#submit-msg-context-switcher-sbmt"; |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * Locator for the dialog container used for housing viewed messages in the message activity list table. |
|
85 | - */ |
|
86 | - const MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR = '.ee-admin-dialog-container-inner-content'; |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * Returns the selector for the on/off toggle for context on the message template editor. |
|
91 | - */ |
|
92 | - const MESSAGES_CONTEXT_ACTIVE_STATE_TOGGLE = |
|
93 | - "//div[@class='activate_context_on_off_toggle_container']/div[@class='switch']/label"; |
|
94 | - |
|
95 | - |
|
96 | - const SELECTOR_LINK_FINALIZE_PAYMENT_PENDING_PAYMENT_MESSAGE = "//td/p[@class='callout']/a"; |
|
97 | - |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
102 | - * a string. |
|
103 | - * @return string |
|
104 | - */ |
|
105 | - public static function messageActivityListTableUrl($additional_params = '') |
|
106 | - { |
|
107 | - return self::adminUrl('espresso_messages', 'default', $additional_params); |
|
108 | - } |
|
109 | - |
|
110 | - |
|
111 | - /** |
|
112 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
113 | - * a string. |
|
114 | - * @return string |
|
115 | - */ |
|
116 | - public static function defaultMessageTemplateListTableUrl($additional_params = '') |
|
117 | - { |
|
118 | - return self::adminUrl('espresso_messages', 'global_mtps', $additional_params); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
124 | - * a string. |
|
125 | - * @return string |
|
126 | - */ |
|
127 | - public static function customMessageTemplateListTableUrl($additional_params = '') |
|
128 | - { |
|
129 | - return self::adminUrl('espresso_messages', 'custom_mtps', $additional_params); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * @return string |
|
135 | - */ |
|
136 | - public static function messageSettingsUrl() |
|
137 | - { |
|
138 | - return self::adminUrl('espresso_messages', 'settings'); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - |
|
143 | - public static function draggableSettingsBoxSelectorForMessageTypeAndMessenger( |
|
144 | - $message_type_slug, |
|
145 | - $messenger_slug = 'email' |
|
146 | - ) { |
|
147 | - return "#$message_type_slug-messagetype-$messenger_slug"; |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * @param string $message_type_slug |
|
153 | - * @param string $context |
|
154 | - * @return string |
|
155 | - */ |
|
156 | - public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '') |
|
157 | - { |
|
158 | - return $context |
|
159 | - ? '.' . $message_type_slug . '-' . $context . '-edit-link' |
|
160 | - : '.' . $message_type_slug . '-edit-link'; |
|
161 | - } |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * Selector for (a) specific table cell(s) in the Messages Activity list table for the given parameters. |
|
166 | - * |
|
167 | - * @param $field |
|
168 | - * @param $message_type_label |
|
169 | - * @param string $message_status |
|
170 | - * @param string $messenger |
|
171 | - * @param string $context |
|
172 | - * @param string $table_cell_content_for_field |
|
173 | - * @param int $number_in_set It's possible that the given parameters could match multiple items in the view. |
|
174 | - * This allows you to indicate which item from the set to match. If this is set to 0 |
|
175 | - * then all matches for the locator will be returned. |
|
176 | - * @return string |
|
177 | - * @throws \InvalidArgumentException |
|
178 | - */ |
|
179 | - public static function messagesActivityListTableCellSelectorFor( |
|
180 | - $field, |
|
181 | - $message_type_label, |
|
182 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
183 | - $messenger = 'Email', |
|
184 | - $context = 'Event Admin', |
|
185 | - $table_cell_content_for_field = '', |
|
186 | - $number_in_set = 1 |
|
187 | - ) { |
|
188 | - $selector = "//tbody[@id='the-list']"; |
|
189 | - $selector .= "//tr[contains(@class, 'msg-status-$message_status')]" |
|
190 | - . "//td[contains(@class, 'message_type') and text()='$message_type_label']"; |
|
191 | - if ($messenger) { |
|
192 | - $selector .= "/ancestor::tr/td[contains(@class, 'messenger') and text()='$messenger']"; |
|
193 | - } |
|
194 | - $selector .= "/ancestor::tr/td[contains(@class, 'column-context') and text()='$context']"; |
|
195 | - $selector .= $table_cell_content_for_field |
|
196 | - ? "/ancestor::tr/td[contains(@class, 'column-$field') and text()='$table_cell_content_for_field']" |
|
197 | - : "/ancestor::tr/td[contains(@class, 'column-$field')]"; |
|
198 | - return $number_in_set > 0 ? Locator::elementAt($selector, $number_in_set) : $selector; |
|
199 | - } |
|
200 | - |
|
201 | - |
|
202 | - /** |
|
203 | - * Selector for the Create Custom button found in the message template list table. |
|
204 | - * @param string $message_type_label |
|
205 | - * @param string $messenger_label |
|
206 | - * @return string |
|
207 | - */ |
|
208 | - public static function createCustomButtonForMessageTypeAndMessenger($message_type_label, $messenger_label) |
|
209 | - { |
|
210 | - $selector = "//tr/td[contains(@class, 'message_type') and text()='$message_type_label']" |
|
211 | - . "//ancestor::tr/td[contains(@class, 'messenger') and contains(., '$messenger_label')]" |
|
212 | - . "//ancestor::tr/td/a[@class='button button-small']"; |
|
213 | - return $selector; |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - /** |
|
218 | - * Note, this could potentially match multiple buttons in the view so the selector is intentionally restricted to |
|
219 | - * the FIRST match (which will be the latest message sent if the table is default sorted). |
|
220 | - * |
|
221 | - * @param string $message_type_label The visible message type label for the row you want to match |
|
222 | - * @param string $message_status The status of the message for the row you want to match. |
|
223 | - * @param string $messenger The visible messenger label for the row you want to match. |
|
224 | - * @param string $context The visible context label for the row you want to match. |
|
225 | - * @param int $number_in_set It's possible that the given parameters could match multiple items in the |
|
226 | - * view. This allows you to indicate which item from the set to match. |
|
227 | - * @return string |
|
228 | - * @throws \InvalidArgumentException |
|
229 | - */ |
|
230 | - public static function messagesActivityListTableViewButtonSelectorFor( |
|
231 | - $message_type_label, |
|
232 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
233 | - $messenger = 'Email', |
|
234 | - $context = 'Event Admin', |
|
235 | - $number_in_set = 1 |
|
236 | - ) { |
|
237 | - $selector = self::messagesActivityListTableCellSelectorFor( |
|
238 | - 'action', |
|
239 | - $message_type_label, |
|
240 | - $message_status, |
|
241 | - $messenger, |
|
242 | - $context, |
|
243 | - '', |
|
244 | - $number_in_set |
|
245 | - ); |
|
246 | - $selector .= "/a/span[contains(@class, 'ee-message-action-link-view')" |
|
247 | - . " and not(contains(@class, 'ee-message-action-link-view_transaction'))]"; |
|
248 | - return $selector; |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - /** |
|
253 | - * Locator for the delete action link for a message item in the message activity list table. |
|
254 | - * Note: The link is not visible by default, so the column would need hovered over for the link to appear. |
|
255 | - * |
|
256 | - * @param $message_type_label |
|
257 | - * @param string $message_status |
|
258 | - * @param string $messenger |
|
259 | - * @param string $context |
|
260 | - * @param int $number_in_set |
|
261 | - * @return string |
|
262 | - * @throws \InvalidArgumentException |
|
263 | - */ |
|
264 | - public static function messagesActivityListTableDeleteActionSelectorFor( |
|
265 | - $message_type_label, |
|
266 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
267 | - $messenger = 'Email', |
|
268 | - $context = 'Event Admin', |
|
269 | - $number_in_set = 1 |
|
270 | - ) { |
|
271 | - $selector = self::messagesActivityListTableCellSelectorFor( |
|
272 | - 'to', |
|
273 | - $message_type_label, |
|
274 | - $message_status, |
|
275 | - $messenger, |
|
276 | - $context, |
|
277 | - '', |
|
278 | - $number_in_set |
|
279 | - ); |
|
280 | - $selector .= "/div/span[@class='delete']/a"; |
|
281 | - return $selector; |
|
282 | - } |
|
283 | - |
|
284 | - |
|
285 | - |
|
286 | - /** |
|
287 | - * Returns the input selector for a given field in the message template editor. |
|
288 | - * Assumes one is already viewing the Message Template Editor. |
|
289 | - * @param string $field |
|
290 | - * @return string |
|
291 | - */ |
|
292 | - public static function messageInputFieldSelectorFor($field) |
|
293 | - { |
|
294 | - return "//div[@id='post-body']//input[@id='$field-content']"; |
|
295 | - } |
|
296 | - |
|
297 | - |
|
298 | - /** |
|
299 | - * Wrapper for self::messageInputFieldSelectorFor('to') that takes care of getting the input for the To field. |
|
300 | - */ |
|
301 | - public static function messageTemplateToFieldSelector() |
|
302 | - { |
|
303 | - return self::messageInputFieldSelectorFor('to'); |
|
304 | - } |
|
83 | + /** |
|
84 | + * Locator for the dialog container used for housing viewed messages in the message activity list table. |
|
85 | + */ |
|
86 | + const MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR = '.ee-admin-dialog-container-inner-content'; |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * Returns the selector for the on/off toggle for context on the message template editor. |
|
91 | + */ |
|
92 | + const MESSAGES_CONTEXT_ACTIVE_STATE_TOGGLE = |
|
93 | + "//div[@class='activate_context_on_off_toggle_container']/div[@class='switch']/label"; |
|
94 | + |
|
95 | + |
|
96 | + const SELECTOR_LINK_FINALIZE_PAYMENT_PENDING_PAYMENT_MESSAGE = "//td/p[@class='callout']/a"; |
|
97 | + |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
102 | + * a string. |
|
103 | + * @return string |
|
104 | + */ |
|
105 | + public static function messageActivityListTableUrl($additional_params = '') |
|
106 | + { |
|
107 | + return self::adminUrl('espresso_messages', 'default', $additional_params); |
|
108 | + } |
|
109 | + |
|
110 | + |
|
111 | + /** |
|
112 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
113 | + * a string. |
|
114 | + * @return string |
|
115 | + */ |
|
116 | + public static function defaultMessageTemplateListTableUrl($additional_params = '') |
|
117 | + { |
|
118 | + return self::adminUrl('espresso_messages', 'global_mtps', $additional_params); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
124 | + * a string. |
|
125 | + * @return string |
|
126 | + */ |
|
127 | + public static function customMessageTemplateListTableUrl($additional_params = '') |
|
128 | + { |
|
129 | + return self::adminUrl('espresso_messages', 'custom_mtps', $additional_params); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * @return string |
|
135 | + */ |
|
136 | + public static function messageSettingsUrl() |
|
137 | + { |
|
138 | + return self::adminUrl('espresso_messages', 'settings'); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + |
|
143 | + public static function draggableSettingsBoxSelectorForMessageTypeAndMessenger( |
|
144 | + $message_type_slug, |
|
145 | + $messenger_slug = 'email' |
|
146 | + ) { |
|
147 | + return "#$message_type_slug-messagetype-$messenger_slug"; |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * @param string $message_type_slug |
|
153 | + * @param string $context |
|
154 | + * @return string |
|
155 | + */ |
|
156 | + public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '') |
|
157 | + { |
|
158 | + return $context |
|
159 | + ? '.' . $message_type_slug . '-' . $context . '-edit-link' |
|
160 | + : '.' . $message_type_slug . '-edit-link'; |
|
161 | + } |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * Selector for (a) specific table cell(s) in the Messages Activity list table for the given parameters. |
|
166 | + * |
|
167 | + * @param $field |
|
168 | + * @param $message_type_label |
|
169 | + * @param string $message_status |
|
170 | + * @param string $messenger |
|
171 | + * @param string $context |
|
172 | + * @param string $table_cell_content_for_field |
|
173 | + * @param int $number_in_set It's possible that the given parameters could match multiple items in the view. |
|
174 | + * This allows you to indicate which item from the set to match. If this is set to 0 |
|
175 | + * then all matches for the locator will be returned. |
|
176 | + * @return string |
|
177 | + * @throws \InvalidArgumentException |
|
178 | + */ |
|
179 | + public static function messagesActivityListTableCellSelectorFor( |
|
180 | + $field, |
|
181 | + $message_type_label, |
|
182 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
183 | + $messenger = 'Email', |
|
184 | + $context = 'Event Admin', |
|
185 | + $table_cell_content_for_field = '', |
|
186 | + $number_in_set = 1 |
|
187 | + ) { |
|
188 | + $selector = "//tbody[@id='the-list']"; |
|
189 | + $selector .= "//tr[contains(@class, 'msg-status-$message_status')]" |
|
190 | + . "//td[contains(@class, 'message_type') and text()='$message_type_label']"; |
|
191 | + if ($messenger) { |
|
192 | + $selector .= "/ancestor::tr/td[contains(@class, 'messenger') and text()='$messenger']"; |
|
193 | + } |
|
194 | + $selector .= "/ancestor::tr/td[contains(@class, 'column-context') and text()='$context']"; |
|
195 | + $selector .= $table_cell_content_for_field |
|
196 | + ? "/ancestor::tr/td[contains(@class, 'column-$field') and text()='$table_cell_content_for_field']" |
|
197 | + : "/ancestor::tr/td[contains(@class, 'column-$field')]"; |
|
198 | + return $number_in_set > 0 ? Locator::elementAt($selector, $number_in_set) : $selector; |
|
199 | + } |
|
200 | + |
|
201 | + |
|
202 | + /** |
|
203 | + * Selector for the Create Custom button found in the message template list table. |
|
204 | + * @param string $message_type_label |
|
205 | + * @param string $messenger_label |
|
206 | + * @return string |
|
207 | + */ |
|
208 | + public static function createCustomButtonForMessageTypeAndMessenger($message_type_label, $messenger_label) |
|
209 | + { |
|
210 | + $selector = "//tr/td[contains(@class, 'message_type') and text()='$message_type_label']" |
|
211 | + . "//ancestor::tr/td[contains(@class, 'messenger') and contains(., '$messenger_label')]" |
|
212 | + . "//ancestor::tr/td/a[@class='button button-small']"; |
|
213 | + return $selector; |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + /** |
|
218 | + * Note, this could potentially match multiple buttons in the view so the selector is intentionally restricted to |
|
219 | + * the FIRST match (which will be the latest message sent if the table is default sorted). |
|
220 | + * |
|
221 | + * @param string $message_type_label The visible message type label for the row you want to match |
|
222 | + * @param string $message_status The status of the message for the row you want to match. |
|
223 | + * @param string $messenger The visible messenger label for the row you want to match. |
|
224 | + * @param string $context The visible context label for the row you want to match. |
|
225 | + * @param int $number_in_set It's possible that the given parameters could match multiple items in the |
|
226 | + * view. This allows you to indicate which item from the set to match. |
|
227 | + * @return string |
|
228 | + * @throws \InvalidArgumentException |
|
229 | + */ |
|
230 | + public static function messagesActivityListTableViewButtonSelectorFor( |
|
231 | + $message_type_label, |
|
232 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
233 | + $messenger = 'Email', |
|
234 | + $context = 'Event Admin', |
|
235 | + $number_in_set = 1 |
|
236 | + ) { |
|
237 | + $selector = self::messagesActivityListTableCellSelectorFor( |
|
238 | + 'action', |
|
239 | + $message_type_label, |
|
240 | + $message_status, |
|
241 | + $messenger, |
|
242 | + $context, |
|
243 | + '', |
|
244 | + $number_in_set |
|
245 | + ); |
|
246 | + $selector .= "/a/span[contains(@class, 'ee-message-action-link-view')" |
|
247 | + . " and not(contains(@class, 'ee-message-action-link-view_transaction'))]"; |
|
248 | + return $selector; |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * Locator for the delete action link for a message item in the message activity list table. |
|
254 | + * Note: The link is not visible by default, so the column would need hovered over for the link to appear. |
|
255 | + * |
|
256 | + * @param $message_type_label |
|
257 | + * @param string $message_status |
|
258 | + * @param string $messenger |
|
259 | + * @param string $context |
|
260 | + * @param int $number_in_set |
|
261 | + * @return string |
|
262 | + * @throws \InvalidArgumentException |
|
263 | + */ |
|
264 | + public static function messagesActivityListTableDeleteActionSelectorFor( |
|
265 | + $message_type_label, |
|
266 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
267 | + $messenger = 'Email', |
|
268 | + $context = 'Event Admin', |
|
269 | + $number_in_set = 1 |
|
270 | + ) { |
|
271 | + $selector = self::messagesActivityListTableCellSelectorFor( |
|
272 | + 'to', |
|
273 | + $message_type_label, |
|
274 | + $message_status, |
|
275 | + $messenger, |
|
276 | + $context, |
|
277 | + '', |
|
278 | + $number_in_set |
|
279 | + ); |
|
280 | + $selector .= "/div/span[@class='delete']/a"; |
|
281 | + return $selector; |
|
282 | + } |
|
283 | + |
|
284 | + |
|
285 | + |
|
286 | + /** |
|
287 | + * Returns the input selector for a given field in the message template editor. |
|
288 | + * Assumes one is already viewing the Message Template Editor. |
|
289 | + * @param string $field |
|
290 | + * @return string |
|
291 | + */ |
|
292 | + public static function messageInputFieldSelectorFor($field) |
|
293 | + { |
|
294 | + return "//div[@id='post-body']//input[@id='$field-content']"; |
|
295 | + } |
|
296 | + |
|
297 | + |
|
298 | + /** |
|
299 | + * Wrapper for self::messageInputFieldSelectorFor('to') that takes care of getting the input for the To field. |
|
300 | + */ |
|
301 | + public static function messageTemplateToFieldSelector() |
|
302 | + { |
|
303 | + return self::messageInputFieldSelectorFor('to'); |
|
304 | + } |
|
305 | 305 | } |
306 | 306 | \ No newline at end of file |
@@ -38,217 +38,217 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | |
64 | 64 | } else { |
65 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
66 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | - /** |
|
68 | - * espresso_minimum_php_version_error |
|
69 | - * |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - function espresso_minimum_php_version_error() |
|
73 | - { |
|
74 | - ?> |
|
65 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
66 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | + /** |
|
68 | + * espresso_minimum_php_version_error |
|
69 | + * |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + function espresso_minimum_php_version_error() |
|
73 | + { |
|
74 | + ?> |
|
75 | 75 | <div class="error"> |
76 | 76 | <p> |
77 | 77 | <?php |
78 | - printf( |
|
79 | - esc_html__( |
|
80 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
81 | - 'event_espresso' |
|
82 | - ), |
|
83 | - EE_MIN_PHP_VER_REQUIRED, |
|
84 | - PHP_VERSION, |
|
85 | - '<br/>', |
|
86 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
87 | - ); |
|
88 | - ?> |
|
78 | + printf( |
|
79 | + esc_html__( |
|
80 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
81 | + 'event_espresso' |
|
82 | + ), |
|
83 | + EE_MIN_PHP_VER_REQUIRED, |
|
84 | + PHP_VERSION, |
|
85 | + '<br/>', |
|
86 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
87 | + ); |
|
88 | + ?> |
|
89 | 89 | </p> |
90 | 90 | </div> |
91 | 91 | <?php |
92 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
93 | - } |
|
92 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
93 | + } |
|
94 | 94 | |
95 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
96 | - } else { |
|
97 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
98 | - /** |
|
99 | - * espresso_version |
|
100 | - * Returns the plugin version |
|
101 | - * |
|
102 | - * @return string |
|
103 | - */ |
|
104 | - function espresso_version() |
|
105 | - { |
|
106 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.48.rc.007'); |
|
107 | - } |
|
95 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
96 | + } else { |
|
97 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
98 | + /** |
|
99 | + * espresso_version |
|
100 | + * Returns the plugin version |
|
101 | + * |
|
102 | + * @return string |
|
103 | + */ |
|
104 | + function espresso_version() |
|
105 | + { |
|
106 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.48.rc.007'); |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * espresso_plugin_activation |
|
111 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
112 | - */ |
|
113 | - function espresso_plugin_activation() |
|
114 | - { |
|
115 | - update_option('ee_espresso_activation', true); |
|
116 | - } |
|
109 | + /** |
|
110 | + * espresso_plugin_activation |
|
111 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
112 | + */ |
|
113 | + function espresso_plugin_activation() |
|
114 | + { |
|
115 | + update_option('ee_espresso_activation', true); |
|
116 | + } |
|
117 | 117 | |
118 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
119 | - /** |
|
120 | - * espresso_load_error_handling |
|
121 | - * this function loads EE's class for handling exceptions and errors |
|
122 | - */ |
|
123 | - function espresso_load_error_handling() |
|
124 | - { |
|
125 | - static $error_handling_loaded = false; |
|
126 | - if ($error_handling_loaded) { |
|
127 | - return; |
|
128 | - } |
|
129 | - // load debugging tools |
|
130 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
131 | - require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
132 | - \EEH_Debug_Tools::instance(); |
|
133 | - } |
|
134 | - // load error handling |
|
135 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
136 | - require_once EE_CORE . 'EE_Error.core.php'; |
|
137 | - } else { |
|
138 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
139 | - } |
|
140 | - $error_handling_loaded = true; |
|
141 | - } |
|
118 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
119 | + /** |
|
120 | + * espresso_load_error_handling |
|
121 | + * this function loads EE's class for handling exceptions and errors |
|
122 | + */ |
|
123 | + function espresso_load_error_handling() |
|
124 | + { |
|
125 | + static $error_handling_loaded = false; |
|
126 | + if ($error_handling_loaded) { |
|
127 | + return; |
|
128 | + } |
|
129 | + // load debugging tools |
|
130 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
131 | + require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
132 | + \EEH_Debug_Tools::instance(); |
|
133 | + } |
|
134 | + // load error handling |
|
135 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
136 | + require_once EE_CORE . 'EE_Error.core.php'; |
|
137 | + } else { |
|
138 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
139 | + } |
|
140 | + $error_handling_loaded = true; |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
144 | - * espresso_load_required |
|
145 | - * given a class name and path, this function will load that file or throw an exception |
|
146 | - * |
|
147 | - * @param string $classname |
|
148 | - * @param string $full_path_to_file |
|
149 | - * @throws EE_Error |
|
150 | - */ |
|
151 | - function espresso_load_required($classname, $full_path_to_file) |
|
152 | - { |
|
153 | - if (is_readable($full_path_to_file)) { |
|
154 | - require_once $full_path_to_file; |
|
155 | - } else { |
|
156 | - throw new \EE_Error ( |
|
157 | - sprintf( |
|
158 | - esc_html__( |
|
159 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
160 | - 'event_espresso' |
|
161 | - ), |
|
162 | - $classname |
|
163 | - ) |
|
164 | - ); |
|
165 | - } |
|
166 | - } |
|
143 | + /** |
|
144 | + * espresso_load_required |
|
145 | + * given a class name and path, this function will load that file or throw an exception |
|
146 | + * |
|
147 | + * @param string $classname |
|
148 | + * @param string $full_path_to_file |
|
149 | + * @throws EE_Error |
|
150 | + */ |
|
151 | + function espresso_load_required($classname, $full_path_to_file) |
|
152 | + { |
|
153 | + if (is_readable($full_path_to_file)) { |
|
154 | + require_once $full_path_to_file; |
|
155 | + } else { |
|
156 | + throw new \EE_Error ( |
|
157 | + sprintf( |
|
158 | + esc_html__( |
|
159 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
160 | + 'event_espresso' |
|
161 | + ), |
|
162 | + $classname |
|
163 | + ) |
|
164 | + ); |
|
165 | + } |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * @since 4.9.27 |
|
170 | - * @throws \EE_Error |
|
171 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
172 | - * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
173 | - * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
174 | - * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
175 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
176 | - * @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException |
|
177 | - * @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException |
|
178 | - * @throws \OutOfBoundsException |
|
179 | - */ |
|
180 | - function bootstrap_espresso() |
|
181 | - { |
|
182 | - require_once __DIR__ . '/core/espresso_definitions.php'; |
|
183 | - try { |
|
184 | - espresso_load_error_handling(); |
|
185 | - espresso_load_required( |
|
186 | - 'EEH_Base', |
|
187 | - EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
188 | - ); |
|
189 | - espresso_load_required( |
|
190 | - 'EEH_File', |
|
191 | - EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
192 | - ); |
|
193 | - espresso_load_required( |
|
194 | - 'EEH_File', |
|
195 | - EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
196 | - ); |
|
197 | - espresso_load_required( |
|
198 | - 'EEH_Array', |
|
199 | - EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
200 | - ); |
|
201 | - // instantiate and configure PSR4 autoloader |
|
202 | - espresso_load_required( |
|
203 | - 'Psr4Autoloader', |
|
204 | - EE_CORE . 'Psr4Autoloader.php' |
|
205 | - ); |
|
206 | - espresso_load_required( |
|
207 | - 'EE_Psr4AutoloaderInit', |
|
208 | - EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
209 | - ); |
|
210 | - $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
211 | - $AutoloaderInit->initializeAutoloader(); |
|
212 | - espresso_load_required( |
|
213 | - 'EE_Request', |
|
214 | - EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
215 | - ); |
|
216 | - espresso_load_required( |
|
217 | - 'EE_Response', |
|
218 | - EE_CORE . 'request_stack' . DS . 'EE_Response.core.php' |
|
219 | - ); |
|
220 | - espresso_load_required( |
|
221 | - 'EE_Bootstrap', |
|
222 | - EE_CORE . 'EE_Bootstrap.core.php' |
|
223 | - ); |
|
224 | - // bootstrap EE and the request stack |
|
225 | - new EE_Bootstrap( |
|
226 | - new EE_Request($_GET, $_POST, $_COOKIE), |
|
227 | - new EE_Response() |
|
228 | - ); |
|
229 | - } catch (Exception $e) { |
|
230 | - require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
231 | - new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
232 | - } |
|
233 | - } |
|
234 | - bootstrap_espresso(); |
|
235 | - } |
|
168 | + /** |
|
169 | + * @since 4.9.27 |
|
170 | + * @throws \EE_Error |
|
171 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
172 | + * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
173 | + * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
174 | + * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
175 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
176 | + * @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException |
|
177 | + * @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException |
|
178 | + * @throws \OutOfBoundsException |
|
179 | + */ |
|
180 | + function bootstrap_espresso() |
|
181 | + { |
|
182 | + require_once __DIR__ . '/core/espresso_definitions.php'; |
|
183 | + try { |
|
184 | + espresso_load_error_handling(); |
|
185 | + espresso_load_required( |
|
186 | + 'EEH_Base', |
|
187 | + EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
188 | + ); |
|
189 | + espresso_load_required( |
|
190 | + 'EEH_File', |
|
191 | + EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
192 | + ); |
|
193 | + espresso_load_required( |
|
194 | + 'EEH_File', |
|
195 | + EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
196 | + ); |
|
197 | + espresso_load_required( |
|
198 | + 'EEH_Array', |
|
199 | + EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
200 | + ); |
|
201 | + // instantiate and configure PSR4 autoloader |
|
202 | + espresso_load_required( |
|
203 | + 'Psr4Autoloader', |
|
204 | + EE_CORE . 'Psr4Autoloader.php' |
|
205 | + ); |
|
206 | + espresso_load_required( |
|
207 | + 'EE_Psr4AutoloaderInit', |
|
208 | + EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
209 | + ); |
|
210 | + $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
211 | + $AutoloaderInit->initializeAutoloader(); |
|
212 | + espresso_load_required( |
|
213 | + 'EE_Request', |
|
214 | + EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
215 | + ); |
|
216 | + espresso_load_required( |
|
217 | + 'EE_Response', |
|
218 | + EE_CORE . 'request_stack' . DS . 'EE_Response.core.php' |
|
219 | + ); |
|
220 | + espresso_load_required( |
|
221 | + 'EE_Bootstrap', |
|
222 | + EE_CORE . 'EE_Bootstrap.core.php' |
|
223 | + ); |
|
224 | + // bootstrap EE and the request stack |
|
225 | + new EE_Bootstrap( |
|
226 | + new EE_Request($_GET, $_POST, $_COOKIE), |
|
227 | + new EE_Response() |
|
228 | + ); |
|
229 | + } catch (Exception $e) { |
|
230 | + require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
231 | + new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
232 | + } |
|
233 | + } |
|
234 | + bootstrap_espresso(); |
|
235 | + } |
|
236 | 236 | } |
237 | 237 | if (! function_exists('espresso_deactivate_plugin')) { |
238 | - /** |
|
239 | - * deactivate_plugin |
|
240 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
241 | - * |
|
242 | - * @access public |
|
243 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
244 | - * @return void |
|
245 | - */ |
|
246 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
247 | - { |
|
248 | - if (! function_exists('deactivate_plugins')) { |
|
249 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
250 | - } |
|
251 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
252 | - deactivate_plugins($plugin_basename); |
|
253 | - } |
|
238 | + /** |
|
239 | + * deactivate_plugin |
|
240 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
241 | + * |
|
242 | + * @access public |
|
243 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
244 | + * @return void |
|
245 | + */ |
|
246 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
247 | + { |
|
248 | + if (! function_exists('deactivate_plugins')) { |
|
249 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
250 | + } |
|
251 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
252 | + deactivate_plugins($plugin_basename); |
|
253 | + } |
|
254 | 254 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\InterminableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | 4 | /** |
5 | 5 | * EE_PUE |
6 | 6 | * |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | public function __construct() { |
20 | 20 | // throw new EE_Error('error'); |
21 | 21 | |
22 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
22 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
23 | 23 | |
24 | 24 | //wp have no MONTH_IN_SECONDS constant. So we approximate our own assuming all months are 4 weeks long. |
25 | - if ( !defined('MONTH_IN_SECONDS' ) ) |
|
26 | - define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
25 | + if ( ! defined('MONTH_IN_SECONDS')) |
|
26 | + define('MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4); |
|
27 | 27 | |
28 | - if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){ |
|
28 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
29 | 29 | $this->_uxip_hooks(); |
30 | 30 | } |
31 | 31 | |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
35 | 35 | |
36 | 36 | //has optin been selected for data collection? |
37 | - $espresso_data_optin = !empty($ueip_optin) ? $ueip_optin : NULL; |
|
37 | + $espresso_data_optin = ! empty($ueip_optin) ? $ueip_optin : NULL; |
|
38 | 38 | |
39 | - if ( empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
40 | - add_action('admin_notices', array( $this, 'espresso_data_collection_optin_notice' ), 10 ); |
|
41 | - add_action('admin_enqueue_scripts', array( $this, 'espresso_data_collection_enqueue_scripts' ), 10 ); |
|
42 | - add_action('wp_ajax_espresso_data_optin', array( $this, 'espresso_data_optin_ajax_handler' ), 10 ); |
|
39 | + if (empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
40 | + add_action('admin_notices', array($this, 'espresso_data_collection_optin_notice'), 10); |
|
41 | + add_action('admin_enqueue_scripts', array($this, 'espresso_data_collection_enqueue_scripts'), 10); |
|
42 | + add_action('wp_ajax_espresso_data_optin', array($this, 'espresso_data_optin_ajax_handler'), 10); |
|
43 | 43 | update_option('ee_ueip_optin', 'yes'); |
44 | 44 | $espresso_data_optin = 'yes'; |
45 | 45 | } |
@@ -48,80 +48,80 @@ discard block |
||
48 | 48 | $extra_stats = array(); |
49 | 49 | |
50 | 50 | //only collect extra stats if the plugin user has opted in. |
51 | - if ( !empty($espresso_data_optin) && $espresso_data_optin == 'yes' ) { |
|
51 | + if ( ! empty($espresso_data_optin) && $espresso_data_optin == 'yes') { |
|
52 | 52 | //let's only setup extra data if transient has expired |
53 | - if ( false === ( $transient = get_transient('ee_extra_data') ) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
53 | + if (false === ($transient = get_transient('ee_extra_data')) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
54 | 54 | |
55 | 55 | $current_site = is_multisite() ? get_current_site() : NULL; |
56 | - $site_pre = ! is_main_site() && ! empty($current_site) ? trim( preg_replace('/\b\w\S\w\b/', '', $current_site->domain ), '.' ) . '_' : ''; |
|
56 | + $site_pre = ! is_main_site() && ! empty($current_site) ? trim(preg_replace('/\b\w\S\w\b/', '', $current_site->domain), '.').'_' : ''; |
|
57 | 57 | |
58 | 58 | |
59 | 59 | //active gateways |
60 | 60 | $active_gateways = get_option('event_espresso_active_gateways'); |
61 | - if ( !empty($active_gateways ) ) { |
|
62 | - foreach ( (array) $active_gateways as $gateway => $ignore ) { |
|
63 | - $extra_stats[$site_pre . $gateway . '_gateway_active'] = 1; |
|
61 | + if ( ! empty($active_gateways)) { |
|
62 | + foreach ((array) $active_gateways as $gateway => $ignore) { |
|
63 | + $extra_stats[$site_pre.$gateway.'_gateway_active'] = 1; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - if ( is_multisite() && is_main_site() ) { |
|
67 | + if (is_multisite() && is_main_site()) { |
|
68 | 68 | $extra_stats['is_multisite'] = true; |
69 | 69 | } |
70 | 70 | |
71 | 71 | //what is the current active theme? |
72 | 72 | $active_theme = get_option('uxip_ee_active_theme'); |
73 | - if ( !empty( $active_theme ) ) |
|
74 | - $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
73 | + if ( ! empty($active_theme)) |
|
74 | + $extra_stats[$site_pre.'active_theme'] = $active_theme; |
|
75 | 75 | |
76 | 76 | //event info regarding an all event count and all "active" event count |
77 | 77 | $all_events_count = get_option('uxip_ee4_all_events_count'); |
78 | - if ( !empty( $all_events_count ) ) |
|
79 | - $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
78 | + if ( ! empty($all_events_count)) |
|
79 | + $extra_stats[$site_pre.'ee4_all_events_count'] = $all_events_count; |
|
80 | 80 | $active_events_count = get_option('uxip_ee4_active_events_count'); |
81 | - if ( !empty( $active_events_count ) ) |
|
82 | - $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
81 | + if ( ! empty($active_events_count)) |
|
82 | + $extra_stats[$site_pre.'ee4_active_events_count'] = $active_events_count; |
|
83 | 83 | |
84 | 84 | //datetime stuff |
85 | 85 | $dtt_count = get_option('uxip_ee_all_dtts_count'); |
86 | - if ( !empty( $dtt_count ) ) |
|
87 | - $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
86 | + if ( ! empty($dtt_count)) |
|
87 | + $extra_stats[$site_pre.'all_dtts_count'] = $dtt_count; |
|
88 | 88 | |
89 | 89 | $dtt_sold = get_option('uxip_ee_dtt_sold'); |
90 | - if ( !empty( $dtt_sold ) ) |
|
91 | - $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
90 | + if ( ! empty($dtt_sold)) |
|
91 | + $extra_stats[$site_pre.'dtt_sold'] = $dtt_sold; |
|
92 | 92 | |
93 | 93 | //ticket stuff |
94 | 94 | $all_tkt_count = get_option('uxip_ee_all_tkt_count'); |
95 | - if ( !empty( $all_tkt_count ) ) |
|
96 | - $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
95 | + if ( ! empty($all_tkt_count)) |
|
96 | + $extra_stats[$site_pre.'all_tkt_count'] = $all_tkt_count; |
|
97 | 97 | |
98 | 98 | $free_tkt_count = get_option('uxip_ee_free_tkt_count'); |
99 | - if ( !empty( $free_tkt_count ) ) |
|
100 | - $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
99 | + if ( ! empty($free_tkt_count)) |
|
100 | + $extra_stats[$site_pre.'free_tkt_count'] = $free_tkt_count; |
|
101 | 101 | |
102 | 102 | $paid_tkt_count = get_option('uxip_ee_paid_tkt_count'); |
103 | - if ( !empty( $paid_tkt_count ) ) |
|
104 | - $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
103 | + if ( ! empty($paid_tkt_count)) |
|
104 | + $extra_stats[$site_pre.'paid_tkt_count'] = $paid_tkt_count; |
|
105 | 105 | |
106 | - $tkt_sold = get_option('uxip_ee_tkt_sold' ); |
|
107 | - if ( !empty($tkt_sold) ) |
|
108 | - $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
106 | + $tkt_sold = get_option('uxip_ee_tkt_sold'); |
|
107 | + if ( ! empty($tkt_sold)) |
|
108 | + $extra_stats[$site_pre.'tkt_sold'] = $tkt_sold; |
|
109 | 109 | |
110 | 110 | //phpversion checking |
111 | 111 | $extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown'; |
112 | 112 | |
113 | 113 | //set transient |
114 | - set_transient( 'ee_extra_data', $extra_stats, WEEK_IN_SECONDS ); |
|
114 | + set_transient('ee_extra_data', $extra_stats, WEEK_IN_SECONDS); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | |
119 | 119 | |
120 | 120 | // PUE Auto Upgrades stuff |
121 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { //include the file |
|
122 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php' ); |
|
121 | + if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { //include the file |
|
122 | + require_once(EE_THIRD_PARTY.'pue/pue-client.php'); |
|
123 | 123 | |
124 | - $api_key = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->site_license_key : ''; |
|
124 | + $api_key = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->site_license_key : ''; |
|
125 | 125 | $host_server_url = 'https://eventespresso.com'; //this needs to be the host server where plugin update engine is installed. Note, if you leave this blank then it is assumed the WordPress repo will be used and we'll just check there. |
126 | 126 | |
127 | 127 | //Note: PUE uses a simple preg_match to determine what type is currently installed based on version number. So it's important that you use a key for the version type that is unique and not found in another key. |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | //$plugin_slug['prerelease']['b'] = 'some-pre-release-slug'; |
134 | 134 | //..WOULD work! |
135 | 135 | $plugin_slug = array( |
136 | - 'free' => array( 'decaf' => 'event-espresso-core-decaf' ), |
|
137 | - 'premium' => array( 'p' => 'event-espresso-core-reg' ), |
|
138 | - 'prerelease' => array( 'beta' => 'event-espresso-core-pr' ) |
|
136 | + 'free' => array('decaf' => 'event-espresso-core-decaf'), |
|
137 | + 'premium' => array('p' => 'event-espresso-core-reg'), |
|
138 | + 'prerelease' => array('beta' => 'event-espresso-core-pr') |
|
139 | 139 | ); |
140 | 140 | |
141 | 141 | |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | * @param bool $extra |
166 | 166 | * @return string html. |
167 | 167 | */ |
168 | - public static function espresso_data_collection_optin_text( $extra = true ) { |
|
169 | - if ( ! $extra ) { |
|
170 | - echo '<h2 class="ee-admin-settings-hdr" '. (!$extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>'; |
|
171 | - echo sprintf( __('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>','<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">','</a>','<br><br>','<a href="https://eventespresso.com/about/privacy-policy/" target="_blank">','</a>' ); |
|
168 | + public static function espresso_data_collection_optin_text($extra = true) { |
|
169 | + if ( ! $extra) { |
|
170 | + echo '<h2 class="ee-admin-settings-hdr" '.( ! $extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>'; |
|
171 | + echo sprintf(__('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>', '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<br><br>', '<a href="https://eventespresso.com/about/privacy-policy/" target="_blank">', '</a>'); |
|
172 | 172 | } else { |
173 | - $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
|
173 | + $settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings')); |
|
174 | 174 | $settings_url .= '#UXIP_settings'; |
175 | - echo sprintf( __( 'The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso' ), '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<a href="' . $settings_url . '" target="_blank">', '</a>' ); |
|
175 | + echo sprintf(__('The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso'), '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<a href="'.$settings_url.'" target="_blank">', '</a>'); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | function espresso_data_collection_optin_notice() { |
183 | 183 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
184 | - if ( $ueip_has_notified ) return; |
|
184 | + if ($ueip_has_notified) return; |
|
185 | 185 | // $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
186 | 186 | // $settings_url = $settings_url . '#UXIP_settings'; |
187 | 187 | ?> |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | function espresso_data_collection_enqueue_scripts() { |
208 | - wp_register_script( 'ee-data-optin-js', EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
209 | - wp_register_style( 'ee-data-optin-css', EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
208 | + wp_register_script('ee-data-optin-js', EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
209 | + wp_register_style('ee-data-optin-css', EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION); |
|
210 | 210 | |
211 | 211 | wp_enqueue_script('ee-data-optin-js'); |
212 | 212 | wp_enqueue_style('ee-data-optin-css'); |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | function espresso_data_optin_ajax_handler() { |
222 | 222 | |
223 | 223 | //verify nonce |
224 | - if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit(); |
|
224 | + if (isset($_POST['nonce']) && ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) exit(); |
|
225 | 225 | |
226 | 226 | //made it here so let's save the selection |
227 | 227 | // $ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no'; |
228 | 228 | |
229 | 229 | //update_option('ee_ueip_optin', $ueip_optin); |
230 | 230 | EE_Registry::instance()->CFG->core->ee_ueip_has_notified = 1; |
231 | - EE_Registry::instance()->CFG->update_espresso_config( FALSE, FALSE ); |
|
231 | + EE_Registry::instance()->CFG->update_espresso_config(FALSE, FALSE); |
|
232 | 232 | exit(); |
233 | 233 | } |
234 | 234 | |
@@ -241,22 +241,22 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public static function is_update_available($basename = '') { |
243 | 243 | |
244 | - $basename = ! empty( $basename ) ? $basename : EE_PLUGIN_BASENAME; |
|
244 | + $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
245 | 245 | |
246 | 246 | $update = false; |
247 | 247 | |
248 | - $folder = DS . dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
248 | + $folder = DS.dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
249 | 249 | |
250 | 250 | $plugins = get_plugins($folder); |
251 | - $current = get_site_transient( 'update_plugins' ); |
|
251 | + $current = get_site_transient('update_plugins'); |
|
252 | 252 | |
253 | - foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
|
254 | - if ( isset( $current->response['plugin_file'] ) ) |
|
253 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
254 | + if (isset($current->response['plugin_file'])) |
|
255 | 255 | $update = true; |
256 | 256 | } |
257 | 257 | |
258 | 258 | //it's possible that there is an update but an invalid site-license-key is in use |
259 | - if ( get_site_option('pue_json_error_' . $basename ) ) |
|
259 | + if (get_site_option('pue_json_error_'.$basename)) |
|
260 | 260 | $update = true; |
261 | 261 | |
262 | 262 | return $update; |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @return void |
275 | 275 | */ |
276 | 276 | public function _uxip_hooks() { |
277 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
278 | - add_action('admin_init', array( $this, 'track_active_theme' ) ); |
|
279 | - add_action('admin_init', array( $this, 'track_event_info' ) ); |
|
277 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
278 | + add_action('admin_init', array($this, 'track_active_theme')); |
|
279 | + add_action('admin_init', array($this, 'track_event_info')); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -285,66 +285,66 @@ discard block |
||
285 | 285 | |
286 | 286 | public function track_active_theme() { |
287 | 287 | //we only check this once a month. |
288 | - if ( false === ( $transient = get_transient( 'ee_active_theme_check' ) ) ) { |
|
288 | + if (false === ($transient = get_transient('ee_active_theme_check'))) { |
|
289 | 289 | $theme = wp_get_theme(); |
290 | - update_option('uxip_ee_active_theme', $theme->get('Name') ); |
|
291 | - set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS ); |
|
290 | + update_option('uxip_ee_active_theme', $theme->get('Name')); |
|
291 | + set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | 295 | |
296 | 296 | public function track_event_info() { |
297 | 297 | //we only check this once every couple weeks. |
298 | - if ( false === ( $transient = get_transient( 'ee4_event_info_check') ) ) { |
|
298 | + if (false === ($transient = get_transient('ee4_event_info_check'))) { |
|
299 | 299 | //first let's get the number for ALL events |
300 | 300 | /** @var EEM_Event $EVT */ |
301 | - $EVT = EE_Registry::instance()->load_model( 'Event'); |
|
301 | + $EVT = EE_Registry::instance()->load_model('Event'); |
|
302 | 302 | $DTT = EE_Registry::instance()->load_model('Datetime'); |
303 | 303 | $TKT = EE_Registry::instance()->load_model('Ticket'); |
304 | 304 | $count = $EVT->count(); |
305 | - if ( $count > 0 ) |
|
305 | + if ($count > 0) |
|
306 | 306 | update_option('uxip_ee4_all_events_count', $count); |
307 | 307 | |
308 | 308 | //next let's just get the number of ACTIVE events |
309 | 309 | $count_active = $EVT->get_active_events(array(), TRUE); |
310 | - if ( $count_active > 0 ) |
|
310 | + if ($count_active > 0) |
|
311 | 311 | update_option('uxip_ee4_active_events_count', $count_active); |
312 | 312 | |
313 | 313 | //datetimes! |
314 | 314 | $dtt_count = $DTT->count(); |
315 | - if ( $dtt_count > 0 ) |
|
316 | - update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
315 | + if ($dtt_count > 0) |
|
316 | + update_option('uxip_ee_all_dtts_count', $dtt_count); |
|
317 | 317 | |
318 | 318 | |
319 | 319 | //dttsold |
320 | 320 | $dtt_sold = $DTT->sum(array(), 'DTT_sold'); |
321 | - if ( $dtt_sold > 0 ) |
|
322 | - update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
321 | + if ($dtt_sold > 0) |
|
322 | + update_option('uxip_ee_dtt_sold', $dtt_sold); |
|
323 | 323 | |
324 | 324 | //allticketcount |
325 | 325 | $all_tkt_count = $TKT->count(); |
326 | - if ( $all_tkt_count > 0 ) |
|
327 | - update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
326 | + if ($all_tkt_count > 0) |
|
327 | + update_option('uxip_ee_all_tkt_count', $all_tkt_count); |
|
328 | 328 | |
329 | 329 | //freetktcount |
330 | - $_where = array( 'TKT_price' => 0 ); |
|
330 | + $_where = array('TKT_price' => 0); |
|
331 | 331 | $free_tkt_count = $TKT->count(array($_where)); |
332 | - if ( $free_tkt_count > 0 ) |
|
333 | - update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
332 | + if ($free_tkt_count > 0) |
|
333 | + update_option('uxip_ee_free_tkt_count', $free_tkt_count); |
|
334 | 334 | |
335 | 335 | //paidtktcount |
336 | - $_where = array( 'TKT_price' => array('>', 0) ); |
|
337 | - $paid_tkt_count = $TKT->count( array( $_where ) ); |
|
338 | - if ( $paid_tkt_count > 0 ) |
|
339 | - update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
336 | + $_where = array('TKT_price' => array('>', 0)); |
|
337 | + $paid_tkt_count = $TKT->count(array($_where)); |
|
338 | + if ($paid_tkt_count > 0) |
|
339 | + update_option('uxip_ee_paid_tkt_count', $paid_tkt_count); |
|
340 | 340 | |
341 | 341 | //tktsold |
342 | - $tkt_sold = $TKT->sum( array(), 'TKT_sold' ); |
|
343 | - if( $tkt_sold > 0 ) |
|
344 | - update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
342 | + $tkt_sold = $TKT->sum(array(), 'TKT_sold'); |
|
343 | + if ($tkt_sold > 0) |
|
344 | + update_option('uxip_ee_tkt_sold', $tkt_sold); |
|
345 | 345 | |
346 | 346 | |
347 | - set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 ); |
|
347 | + set_transient('ee4_event_info_check', 1, WEEK_IN_SECONDS * 2); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 |