@@ -13,96 +13,96 @@ |
||
13 | 13 | class CoreAdmin |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - const URL_PREFIX = 'admin.php?page='; |
|
20 | - |
|
21 | - |
|
22 | - /** |
|
23 | - * This is the selector for the next page button on list tables. |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - const ADMIN_LIST_TABLE_NEXT_PAGE_CLASS = '.next-page'; |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * The selector for the search input submit button on list table pages |
|
31 | - * @var string |
|
32 | - */ |
|
33 | - const LIST_TABLE_SEARCH_SUBMIT_SELECTOR = '#search-submit'; |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * Selector for the screen options dropdown. |
|
38 | - * @var string |
|
39 | - */ |
|
40 | - const WP_SCREEN_SETTINGS_LINK_SELECTOR = '#show-settings-link'; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * Selector for the per page field setting selector (found within screen options dropdown) |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - const WP_SCREEN_SETTINGS_PER_PAGE_FIELD_SELECTOR = '.screen-per-page'; |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * Selector for apply screen options settings. |
|
52 | - * @var string |
|
53 | - */ |
|
54 | - const WP_SCREEN_OPTIONS_APPLY_SETTINGS_BUTTON_SELECTOR = '#screen-options-apply'; |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * Selector for bulk action select field on list tables. |
|
59 | - */ |
|
60 | - const SELECTOR_LIST_TABLE_BULK_ACTION_FIELD = '#bulk-action-selector-'; |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * Selector for applying a bulk action. |
|
65 | - */ |
|
66 | - const SELECTOR_LIST_TABLE_BULK_ACTTION_APPLY = '#doaction'; |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * Get the EE admin url for the given properties. |
|
71 | - * Note, this is JUST the endpoint for the admin route. It is expected that the actor/test would be calling this |
|
72 | - * with `amOnAdminPage` action. |
|
73 | - * |
|
74 | - * @param string $page |
|
75 | - * @param string $action |
|
76 | - * @param string $additional_params |
|
77 | - * @return string |
|
78 | - */ |
|
79 | - public static function adminUrl($page = 'espresso_events', $action = 'default', $additional_params = '') |
|
80 | - { |
|
81 | - $url = self::URL_PREFIX . $page; |
|
82 | - $url .= $action ? '&action=' . $action : ''; |
|
83 | - $url .= $additional_params ? '&' . ltrim('&', ltrim('?', $additional_params)) : ''; |
|
84 | - return $url; |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * Returns the selector for the text tab switcher for a wp-editor instance. |
|
90 | - * @param $field_reference |
|
91 | - * @return string |
|
92 | - */ |
|
93 | - public static function wpEditorTextTabSelector($field_reference) |
|
94 | - { |
|
95 | - return '#content-' . $field_reference . '-content-html'; |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * Returns the selector for the textarea exposed when clicing the text tab switcher for a wp-editor instance. |
|
101 | - * @param $field_reference |
|
102 | - * @return string |
|
103 | - */ |
|
104 | - public static function wpEditorTextAreaSelector($field_reference) |
|
105 | - { |
|
106 | - return '#content-' . $field_reference . '-content'; |
|
107 | - } |
|
16 | + /** |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + const URL_PREFIX = 'admin.php?page='; |
|
20 | + |
|
21 | + |
|
22 | + /** |
|
23 | + * This is the selector for the next page button on list tables. |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + const ADMIN_LIST_TABLE_NEXT_PAGE_CLASS = '.next-page'; |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * The selector for the search input submit button on list table pages |
|
31 | + * @var string |
|
32 | + */ |
|
33 | + const LIST_TABLE_SEARCH_SUBMIT_SELECTOR = '#search-submit'; |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * Selector for the screen options dropdown. |
|
38 | + * @var string |
|
39 | + */ |
|
40 | + const WP_SCREEN_SETTINGS_LINK_SELECTOR = '#show-settings-link'; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * Selector for the per page field setting selector (found within screen options dropdown) |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + const WP_SCREEN_SETTINGS_PER_PAGE_FIELD_SELECTOR = '.screen-per-page'; |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * Selector for apply screen options settings. |
|
52 | + * @var string |
|
53 | + */ |
|
54 | + const WP_SCREEN_OPTIONS_APPLY_SETTINGS_BUTTON_SELECTOR = '#screen-options-apply'; |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * Selector for bulk action select field on list tables. |
|
59 | + */ |
|
60 | + const SELECTOR_LIST_TABLE_BULK_ACTION_FIELD = '#bulk-action-selector-'; |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * Selector for applying a bulk action. |
|
65 | + */ |
|
66 | + const SELECTOR_LIST_TABLE_BULK_ACTTION_APPLY = '#doaction'; |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * Get the EE admin url for the given properties. |
|
71 | + * Note, this is JUST the endpoint for the admin route. It is expected that the actor/test would be calling this |
|
72 | + * with `amOnAdminPage` action. |
|
73 | + * |
|
74 | + * @param string $page |
|
75 | + * @param string $action |
|
76 | + * @param string $additional_params |
|
77 | + * @return string |
|
78 | + */ |
|
79 | + public static function adminUrl($page = 'espresso_events', $action = 'default', $additional_params = '') |
|
80 | + { |
|
81 | + $url = self::URL_PREFIX . $page; |
|
82 | + $url .= $action ? '&action=' . $action : ''; |
|
83 | + $url .= $additional_params ? '&' . ltrim('&', ltrim('?', $additional_params)) : ''; |
|
84 | + return $url; |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * Returns the selector for the text tab switcher for a wp-editor instance. |
|
90 | + * @param $field_reference |
|
91 | + * @return string |
|
92 | + */ |
|
93 | + public static function wpEditorTextTabSelector($field_reference) |
|
94 | + { |
|
95 | + return '#content-' . $field_reference . '-content-html'; |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * Returns the selector for the textarea exposed when clicing the text tab switcher for a wp-editor instance. |
|
101 | + * @param $field_reference |
|
102 | + * @return string |
|
103 | + */ |
|
104 | + public static function wpEditorTextAreaSelector($field_reference) |
|
105 | + { |
|
106 | + return '#content-' . $field_reference . '-content'; |
|
107 | + } |
|
108 | 108 | } |
@@ -11,43 +11,43 @@ |
||
11 | 11 | */ |
12 | 12 | class RegistrationsAdmin extends CoreAdmin |
13 | 13 | { |
14 | - /** |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - const REGISTRATION_STATUS_NOT_APPROVED = 'RNA'; |
|
14 | + /** |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + const REGISTRATION_STATUS_NOT_APPROVED = 'RNA'; |
|
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - const REGISTRATION_STATUS_APPROVED = 'RAP'; |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + const REGISTRATION_STATUS_APPROVED = 'RAP'; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - const REGISTRATION_STATUS_PENDING_PAYMENT = 'RPP'; |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + const REGISTRATION_STATUS_PENDING_PAYMENT = 'RPP'; |
|
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @param string $additional_params |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public static function registrationsDefaultAdminListTableUrl($additional_params = '') |
|
38 | - { |
|
39 | - return self::adminUrl('espresso_registrations', 'default', $additional_params); |
|
40 | - } |
|
33 | + /** |
|
34 | + * @param string $additional_params |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public static function registrationsDefaultAdminListTableUrl($additional_params = '') |
|
38 | + { |
|
39 | + return self::adminUrl('espresso_registrations', 'default', $additional_params); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * Given a registration id, this will return the selector for all the checkbox for that id. |
|
45 | - * Assumes the view is a Registration list table. |
|
46 | - * @param int $registration_id |
|
47 | - * @return string |
|
48 | - */ |
|
49 | - public static function listTableCheckBoxSelectorForRegistrationId($registration_id) |
|
50 | - { |
|
51 | - return "//input[@name='_REG_ID[]' and @value='{$registration_id}']"; |
|
52 | - } |
|
43 | + /** |
|
44 | + * Given a registration id, this will return the selector for all the checkbox for that id. |
|
45 | + * Assumes the view is a Registration list table. |
|
46 | + * @param int $registration_id |
|
47 | + * @return string |
|
48 | + */ |
|
49 | + public static function listTableCheckBoxSelectorForRegistrationId($registration_id) |
|
50 | + { |
|
51 | + return "//input[@name='_REG_ID[]' and @value='{$registration_id}']"; |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -14,267 +14,267 @@ |
||
14 | 14 | class EventsAdmin extends CoreAdmin |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Selector for the Add new Event button in the admin. |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - const ADD_NEW_EVENT_BUTTON_SELECTOR = '#add-new-event'; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * Selector for the Event Title field in the event editor |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - const EVENT_EDITOR_TITLE_FIELD_SELECTOR = "//input[@id='title']"; |
|
29 | - |
|
30 | - /** |
|
31 | - * Selector for the publish submit button in the event editor. |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - const EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR = "#publish"; |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * Selector for the save button in the event editor |
|
39 | - */ |
|
40 | - const EVENT_EDITOR_SAVE_BUTTON_SELECTOR = "#save-post"; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @var string |
|
45 | - */ |
|
46 | - const EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR = '#EVT_default_registration_status'; |
|
47 | - |
|
48 | - /** |
|
49 | - * Selector for the view link after publishing an event. |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - const EVENT_EDITOR_VIEW_LINK_AFTER_PUBLISH_SELECTOR = "//span[@id='sample-permalink']/a"; |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * Selector for the ID of the event in the event editor |
|
57 | - * @var string |
|
58 | - */ |
|
59 | - const EVENT_EDITOR_EVT_ID_SELECTOR = "//input[@id='post_ID']"; |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * Selector for the search input on the event list table page. |
|
64 | - * @var string |
|
65 | - */ |
|
66 | - const EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR = '#toplevel_page_espresso_events-search-input'; |
|
67 | - |
|
68 | - |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * @param string $additional_params |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public static function defaultEventsListTableUrl($additional_params = '') |
|
76 | - { |
|
77 | - return self::adminUrl('espresso_events', 'default', $additional_params); |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * The selector for the DTTname field for the given row in the event editor. |
|
83 | - * @param int $row_number |
|
84 | - * @return string |
|
85 | - */ |
|
86 | - public static function eventEditorDatetimeNameFieldSelector($row_number = 1) |
|
87 | - { |
|
88 | - return self::eventEditorDatetimeFieldSelectorForField('DTT_name', $row_number); |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * The selector for the DTT_EVT_start field for the given row in the event editor.d |
|
94 | - * @param int $row_number |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public static function eventEditorDatetimeStartDateFieldSelector($row_number = 1) |
|
98 | - { |
|
99 | - return self::eventEditorDatetimeFieldSelectorForField('DTT_EVT_start', $row_number); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * Wrapper for getting the selector for a given field and given row of a datetime in the event editor. |
|
105 | - * |
|
106 | - * @param string $field_name |
|
107 | - * @param int $row_number |
|
108 | - * @return string |
|
109 | - */ |
|
110 | - public static function eventEditorDatetimeFieldSelectorForField($field_name, $row_number = 1) |
|
111 | - { |
|
112 | - return "//input[@id='event-datetime-$field_name-$row_number']"; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * The selector for the TKT_name field for the given display row in the event editor. |
|
118 | - * @param int $row_number |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - public static function eventEditorTicketNameFieldSelector($row_number = 1) |
|
122 | - { |
|
123 | - return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_name', $row_number); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * Selector for the TKT_base_price field for the given display row in the event editor. |
|
129 | - * @param int $row_number |
|
130 | - * @return string |
|
131 | - */ |
|
132 | - public static function eventEditorTicketPriceFieldSelector($row_number = 1) |
|
133 | - { |
|
134 | - return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_base_price', $row_number); |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * Selector for the TKT_qty field for the given display row in the event editor. |
|
140 | - * @param int $row_number |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - public static function eventEditorTicketQuantityFieldSelector($row_number = 1) |
|
144 | - { |
|
145 | - return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_qty', $row_number); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * Selector for the advanced details toggle for the ticket for the given display row in the event editor. |
|
151 | - * @param int $row_number |
|
152 | - * @return string |
|
153 | - */ |
|
154 | - public static function eventEditorTicketAdvancedDetailsSelector($row_number = 1) |
|
155 | - { |
|
156 | - return "//tr[@id='display-ticketrow-$row_number']//span[contains(@class, 'gear-icon')]"; |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * Selector for the subtotal amount for the given display row of the ticket in the event editor. |
|
162 | - * @param int $row_number |
|
163 | - * @return string |
|
164 | - */ |
|
165 | - public static function eventEditorTicketAdvancedDetailsSubtotalSelector($row_number = 1) |
|
166 | - { |
|
167 | - return "//span[@id='price-total-amount-$row_number']"; |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * Selector for the Total element for the given display row of the ticket in the event editor. |
|
173 | - * @param int $row_number |
|
174 | - * @return string |
|
175 | - */ |
|
176 | - public static function eventEditorTicketAdvancedDetailsTotalSelector($row_number = 1) |
|
177 | - { |
|
178 | - return "//span[@id='price-total-amount-$row_number']"; |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - /** |
|
183 | - * Selector for the taxable selector for the ticket for the given display row in the event editor. |
|
184 | - * @param int $row_number |
|
185 | - * @return string |
|
186 | - */ |
|
187 | - public static function eventEditorTicketTaxableCheckboxSelector($row_number = 1) |
|
188 | - { |
|
189 | - return "//input[@id='edit-ticket-TKT_taxable-$row_number']"; |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * This returns the xpath locater for the Tax amount display container within the advanced settings view for the |
|
195 | - * given ticket (row) and the given tax id (PRC_ID). |
|
196 | - * |
|
197 | - * @param int $tax_id The PRC_ID for the tax you want the locater for. Note, this defaults to the default tax |
|
198 | - * setup on a fresh install. |
|
199 | - * @param int $row_number What row representing the ticket you want the locator for. |
|
200 | - * @return string |
|
201 | - */ |
|
202 | - public static function eventEditorTicketTaxAmountDisplayForTaxIdAndTicketRowSelector($tax_id = 2, $row_number = 1) |
|
203 | - { |
|
204 | - return "//span[@id='TKT-tax-amount-display-$tax_id-$row_number']"; |
|
205 | - } |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * Wrapper for getting the selector for a given field and given display row of a ticket in the event editor. |
|
210 | - * @param $field_name |
|
211 | - * @param int $row_number |
|
212 | - * @return string |
|
213 | - */ |
|
214 | - public static function eventEditorTicketFieldSelectorForFieldInDisplayRow($field_name, $row_number = 1) |
|
215 | - { |
|
216 | - return "//tr[@id='display-ticketrow-$row_number']//input[contains(@class, 'edit-ticket-$field_name')]"; |
|
217 | - } |
|
218 | - |
|
219 | - |
|
220 | - /** |
|
221 | - * Returns the selector for the event title edit link in the events list table for the given Event Title. |
|
222 | - * @param string $event_title |
|
223 | - * @return string |
|
224 | - */ |
|
225 | - public static function eventListTableEventTitleEditLinkSelectorForTitle($event_title) |
|
226 | - { |
|
227 | - return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']"; |
|
228 | - } |
|
229 | - |
|
230 | - |
|
231 | - /** |
|
232 | - * Locator for for the ID column in the event list table for a given event title. |
|
233 | - * @param string $event_title |
|
234 | - * @return string |
|
235 | - */ |
|
236 | - public static function eventListTableEventIdSelectorForTitle($event_title) |
|
237 | - { |
|
238 | - return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
|
239 | - . "//ancestor::tr/th[contains(@class, 'check-column')]/input"; |
|
240 | - } |
|
241 | - |
|
242 | - |
|
243 | - /** |
|
244 | - * Locator for the view link in the row of an event list table for the given event title. |
|
245 | - * @param string $event_title |
|
246 | - * @return string |
|
247 | - */ |
|
248 | - public static function eventListTableEventTitleViewLinkSelectorForTitle($event_title) |
|
249 | - { |
|
250 | - return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
|
251 | - . "//ancestor::td//span[@class='view']/a"; |
|
252 | - } |
|
253 | - |
|
254 | - |
|
255 | - /** |
|
256 | - * Locator for the messenger tab in the Notifications metabox in the event editor. |
|
257 | - * @param string $messenger_slug The slug for the messenger (it's reference slug). |
|
258 | - * @return string |
|
259 | - */ |
|
260 | - public static function eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug) |
|
261 | - { |
|
262 | - return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
|
263 | - . "//a[@rel='ee-tab-$messenger_slug']"; |
|
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * Locator for the select input within the notifications metabox. |
|
269 | - * Note, this assumes the tab content for the related messenger is already visible. |
|
270 | - * @param string $message_type_label The message type label (visible string in the table) you want the selector for. |
|
271 | - * @return string |
|
272 | - */ |
|
273 | - public static function eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label) |
|
274 | - { |
|
275 | - return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
|
276 | - . "//table[@class='messages-custom-template-switcher']" |
|
277 | - . "//tr/td[contains(.,'Registration Approved')]" |
|
278 | - . "//ancestor::tr//select[contains(@class,'message-template-selector')]"; |
|
279 | - } |
|
17 | + /** |
|
18 | + * Selector for the Add new Event button in the admin. |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + const ADD_NEW_EVENT_BUTTON_SELECTOR = '#add-new-event'; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * Selector for the Event Title field in the event editor |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + const EVENT_EDITOR_TITLE_FIELD_SELECTOR = "//input[@id='title']"; |
|
29 | + |
|
30 | + /** |
|
31 | + * Selector for the publish submit button in the event editor. |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + const EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR = "#publish"; |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * Selector for the save button in the event editor |
|
39 | + */ |
|
40 | + const EVENT_EDITOR_SAVE_BUTTON_SELECTOR = "#save-post"; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + */ |
|
46 | + const EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR = '#EVT_default_registration_status'; |
|
47 | + |
|
48 | + /** |
|
49 | + * Selector for the view link after publishing an event. |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + const EVENT_EDITOR_VIEW_LINK_AFTER_PUBLISH_SELECTOR = "//span[@id='sample-permalink']/a"; |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * Selector for the ID of the event in the event editor |
|
57 | + * @var string |
|
58 | + */ |
|
59 | + const EVENT_EDITOR_EVT_ID_SELECTOR = "//input[@id='post_ID']"; |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * Selector for the search input on the event list table page. |
|
64 | + * @var string |
|
65 | + */ |
|
66 | + const EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR = '#toplevel_page_espresso_events-search-input'; |
|
67 | + |
|
68 | + |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * @param string $additional_params |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public static function defaultEventsListTableUrl($additional_params = '') |
|
76 | + { |
|
77 | + return self::adminUrl('espresso_events', 'default', $additional_params); |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * The selector for the DTTname field for the given row in the event editor. |
|
83 | + * @param int $row_number |
|
84 | + * @return string |
|
85 | + */ |
|
86 | + public static function eventEditorDatetimeNameFieldSelector($row_number = 1) |
|
87 | + { |
|
88 | + return self::eventEditorDatetimeFieldSelectorForField('DTT_name', $row_number); |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * The selector for the DTT_EVT_start field for the given row in the event editor.d |
|
94 | + * @param int $row_number |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public static function eventEditorDatetimeStartDateFieldSelector($row_number = 1) |
|
98 | + { |
|
99 | + return self::eventEditorDatetimeFieldSelectorForField('DTT_EVT_start', $row_number); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * Wrapper for getting the selector for a given field and given row of a datetime in the event editor. |
|
105 | + * |
|
106 | + * @param string $field_name |
|
107 | + * @param int $row_number |
|
108 | + * @return string |
|
109 | + */ |
|
110 | + public static function eventEditorDatetimeFieldSelectorForField($field_name, $row_number = 1) |
|
111 | + { |
|
112 | + return "//input[@id='event-datetime-$field_name-$row_number']"; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * The selector for the TKT_name field for the given display row in the event editor. |
|
118 | + * @param int $row_number |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + public static function eventEditorTicketNameFieldSelector($row_number = 1) |
|
122 | + { |
|
123 | + return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_name', $row_number); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * Selector for the TKT_base_price field for the given display row in the event editor. |
|
129 | + * @param int $row_number |
|
130 | + * @return string |
|
131 | + */ |
|
132 | + public static function eventEditorTicketPriceFieldSelector($row_number = 1) |
|
133 | + { |
|
134 | + return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_base_price', $row_number); |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * Selector for the TKT_qty field for the given display row in the event editor. |
|
140 | + * @param int $row_number |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + public static function eventEditorTicketQuantityFieldSelector($row_number = 1) |
|
144 | + { |
|
145 | + return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_qty', $row_number); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * Selector for the advanced details toggle for the ticket for the given display row in the event editor. |
|
151 | + * @param int $row_number |
|
152 | + * @return string |
|
153 | + */ |
|
154 | + public static function eventEditorTicketAdvancedDetailsSelector($row_number = 1) |
|
155 | + { |
|
156 | + return "//tr[@id='display-ticketrow-$row_number']//span[contains(@class, 'gear-icon')]"; |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * Selector for the subtotal amount for the given display row of the ticket in the event editor. |
|
162 | + * @param int $row_number |
|
163 | + * @return string |
|
164 | + */ |
|
165 | + public static function eventEditorTicketAdvancedDetailsSubtotalSelector($row_number = 1) |
|
166 | + { |
|
167 | + return "//span[@id='price-total-amount-$row_number']"; |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * Selector for the Total element for the given display row of the ticket in the event editor. |
|
173 | + * @param int $row_number |
|
174 | + * @return string |
|
175 | + */ |
|
176 | + public static function eventEditorTicketAdvancedDetailsTotalSelector($row_number = 1) |
|
177 | + { |
|
178 | + return "//span[@id='price-total-amount-$row_number']"; |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + /** |
|
183 | + * Selector for the taxable selector for the ticket for the given display row in the event editor. |
|
184 | + * @param int $row_number |
|
185 | + * @return string |
|
186 | + */ |
|
187 | + public static function eventEditorTicketTaxableCheckboxSelector($row_number = 1) |
|
188 | + { |
|
189 | + return "//input[@id='edit-ticket-TKT_taxable-$row_number']"; |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * This returns the xpath locater for the Tax amount display container within the advanced settings view for the |
|
195 | + * given ticket (row) and the given tax id (PRC_ID). |
|
196 | + * |
|
197 | + * @param int $tax_id The PRC_ID for the tax you want the locater for. Note, this defaults to the default tax |
|
198 | + * setup on a fresh install. |
|
199 | + * @param int $row_number What row representing the ticket you want the locator for. |
|
200 | + * @return string |
|
201 | + */ |
|
202 | + public static function eventEditorTicketTaxAmountDisplayForTaxIdAndTicketRowSelector($tax_id = 2, $row_number = 1) |
|
203 | + { |
|
204 | + return "//span[@id='TKT-tax-amount-display-$tax_id-$row_number']"; |
|
205 | + } |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * Wrapper for getting the selector for a given field and given display row of a ticket in the event editor. |
|
210 | + * @param $field_name |
|
211 | + * @param int $row_number |
|
212 | + * @return string |
|
213 | + */ |
|
214 | + public static function eventEditorTicketFieldSelectorForFieldInDisplayRow($field_name, $row_number = 1) |
|
215 | + { |
|
216 | + return "//tr[@id='display-ticketrow-$row_number']//input[contains(@class, 'edit-ticket-$field_name')]"; |
|
217 | + } |
|
218 | + |
|
219 | + |
|
220 | + /** |
|
221 | + * Returns the selector for the event title edit link in the events list table for the given Event Title. |
|
222 | + * @param string $event_title |
|
223 | + * @return string |
|
224 | + */ |
|
225 | + public static function eventListTableEventTitleEditLinkSelectorForTitle($event_title) |
|
226 | + { |
|
227 | + return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']"; |
|
228 | + } |
|
229 | + |
|
230 | + |
|
231 | + /** |
|
232 | + * Locator for for the ID column in the event list table for a given event title. |
|
233 | + * @param string $event_title |
|
234 | + * @return string |
|
235 | + */ |
|
236 | + public static function eventListTableEventIdSelectorForTitle($event_title) |
|
237 | + { |
|
238 | + return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
|
239 | + . "//ancestor::tr/th[contains(@class, 'check-column')]/input"; |
|
240 | + } |
|
241 | + |
|
242 | + |
|
243 | + /** |
|
244 | + * Locator for the view link in the row of an event list table for the given event title. |
|
245 | + * @param string $event_title |
|
246 | + * @return string |
|
247 | + */ |
|
248 | + public static function eventListTableEventTitleViewLinkSelectorForTitle($event_title) |
|
249 | + { |
|
250 | + return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
|
251 | + . "//ancestor::td//span[@class='view']/a"; |
|
252 | + } |
|
253 | + |
|
254 | + |
|
255 | + /** |
|
256 | + * Locator for the messenger tab in the Notifications metabox in the event editor. |
|
257 | + * @param string $messenger_slug The slug for the messenger (it's reference slug). |
|
258 | + * @return string |
|
259 | + */ |
|
260 | + public static function eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug) |
|
261 | + { |
|
262 | + return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
|
263 | + . "//a[@rel='ee-tab-$messenger_slug']"; |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * Locator for the select input within the notifications metabox. |
|
269 | + * Note, this assumes the tab content for the related messenger is already visible. |
|
270 | + * @param string $message_type_label The message type label (visible string in the table) you want the selector for. |
|
271 | + * @return string |
|
272 | + */ |
|
273 | + public static function eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label) |
|
274 | + { |
|
275 | + return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
|
276 | + . "//table[@class='messages-custom-template-switcher']" |
|
277 | + . "//tr/td[contains(.,'Registration Approved')]" |
|
278 | + . "//ancestor::tr//select[contains(@class,'message-template-selector')]"; |
|
279 | + } |
|
280 | 280 | } |
@@ -13,62 +13,62 @@ |
||
13 | 13 | class Checkout |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * The class selector for the next step button in the checkout. |
|
18 | - * @var string |
|
19 | - */ |
|
20 | - const NEXT_STEP_BUTTON_SELECTOR = '.spco-next-step-btn'; |
|
16 | + /** |
|
17 | + * The class selector for the next step button in the checkout. |
|
18 | + * @var string |
|
19 | + */ |
|
20 | + const NEXT_STEP_BUTTON_SELECTOR = '.spco-next-step-btn'; |
|
21 | 21 | |
22 | 22 | |
23 | - const PAYMENT_METHOD_STEP_FORM = '#ee-spco-payment_options-reg-step-form'; |
|
23 | + const PAYMENT_METHOD_STEP_FORM = '#ee-spco-payment_options-reg-step-form'; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @param int $attendee_number |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public static function firstNameFieldSelectorForAttendeeNumber($attendee_number = 1) |
|
31 | - { |
|
32 | - return self::fieldSelectorForAttendeeNumber('fname', $attendee_number); |
|
33 | - } |
|
26 | + /** |
|
27 | + * @param int $attendee_number |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public static function firstNameFieldSelectorForAttendeeNumber($attendee_number = 1) |
|
31 | + { |
|
32 | + return self::fieldSelectorForAttendeeNumber('fname', $attendee_number); |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * @param int $attendee_number |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public static function lastNameFieldSelectorForAttendeeNumber($attendee_number = 1) |
|
41 | - { |
|
42 | - return self::fieldSelectorForAttendeeNumber('lname', $attendee_number); |
|
43 | - } |
|
36 | + /** |
|
37 | + * @param int $attendee_number |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public static function lastNameFieldSelectorForAttendeeNumber($attendee_number = 1) |
|
41 | + { |
|
42 | + return self::fieldSelectorForAttendeeNumber('lname', $attendee_number); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * @param int $attendee_number |
|
48 | - * @return string |
|
49 | - */ |
|
50 | - public static function emailFieldSelectorForAttendeeNumber($attendee_number = 1) |
|
51 | - { |
|
52 | - return self::fieldSelectorForAttendeeNumber('email', $attendee_number); |
|
53 | - } |
|
46 | + /** |
|
47 | + * @param int $attendee_number |
|
48 | + * @return string |
|
49 | + */ |
|
50 | + public static function emailFieldSelectorForAttendeeNumber($attendee_number = 1) |
|
51 | + { |
|
52 | + return self::fieldSelectorForAttendeeNumber('email', $attendee_number); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @param $field_name |
|
57 | - * @param int $attendee_number |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public static function fieldSelectorForAttendeeNumber($field_name, $attendee_number = 1) |
|
61 | - { |
|
62 | - return "//div[starts-with(@id, 'spco-attendee-panel-dv-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]"; |
|
63 | - } |
|
55 | + /** |
|
56 | + * @param $field_name |
|
57 | + * @param int $attendee_number |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public static function fieldSelectorForAttendeeNumber($field_name, $attendee_number = 1) |
|
61 | + { |
|
62 | + return "//div[starts-with(@id, 'spco-attendee-panel-dv-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]"; |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * @param string $payment_method_slug Slug for the payment method. |
|
68 | - * @return string |
|
69 | - */ |
|
70 | - public static function fieldSelectorForPaymentOption($payment_method_slug) |
|
71 | - { |
|
72 | - return "#ee-available-payment-method-inputs-{$payment_method_slug}"; |
|
73 | - } |
|
66 | + /** |
|
67 | + * @param string $payment_method_slug Slug for the payment method. |
|
68 | + * @return string |
|
69 | + */ |
|
70 | + public static function fieldSelectorForPaymentOption($payment_method_slug) |
|
71 | + { |
|
72 | + return "#ee-available-payment-method-inputs-{$payment_method_slug}"; |
|
73 | + } |
|
74 | 74 | } |
@@ -14,289 +14,289 @@ |
||
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 | - |
|
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 | - |
|
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 | - |
|
97 | - /** |
|
98 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
99 | - * a string. |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - public static function messageActivityListTableUrl($additional_params = '') |
|
103 | - { |
|
104 | - return self::adminUrl('espresso_messages', 'default', $additional_params); |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
110 | - * a string. |
|
111 | - * @return string |
|
112 | - */ |
|
113 | - public static function defaultMessageTemplateListTableUrl($additional_params = '') |
|
114 | - { |
|
115 | - return self::adminUrl('espresso_messages', 'global_mtps', $additional_params); |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
121 | - * a string. |
|
122 | - * @return string |
|
123 | - */ |
|
124 | - public static function customMessageTemplateListTableUrl($additional_params = '') |
|
125 | - { |
|
126 | - return self::adminUrl('espresso_messages', 'custom_mtps', $additional_params); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * @return string |
|
132 | - */ |
|
133 | - public static function messageSettingsUrl() |
|
134 | - { |
|
135 | - return self::adminUrl('espresso_messages', 'settings'); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - |
|
140 | - public static function draggableSettingsBoxSelectorForMessageTypeAndMessenger( |
|
141 | - $message_type_slug, |
|
142 | - $messenger_slug = 'email' |
|
143 | - ) { |
|
144 | - return "#$message_type_slug-messagetype-$messenger_slug"; |
|
145 | - } |
|
146 | - |
|
147 | - |
|
148 | - /** |
|
149 | - * @param string $message_type_slug |
|
150 | - * @param string $context |
|
151 | - * @return string |
|
152 | - */ |
|
153 | - public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '') |
|
154 | - { |
|
155 | - return $context |
|
156 | - ? '.' . $message_type_slug . '-' . $context . '-edit-link' |
|
157 | - : '.' . $message_type_slug . '-edit-link'; |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * Selector for (a) specific table cell(s) in the Messages Activity list table for the given parameters. |
|
163 | - * |
|
164 | - * @param $field |
|
165 | - * @param $message_type_label |
|
166 | - * @param string $message_status |
|
167 | - * @param string $messenger |
|
168 | - * @param string $context |
|
169 | - * @param string $table_cell_content_for_field |
|
170 | - * @param int $number_in_set It's possible that the given parameters could match multiple items in the view. |
|
171 | - * This allows you to indicate which item from the set to match. If this is set to 0 |
|
172 | - * then all matches for the locator will be returned. |
|
173 | - * @return string |
|
174 | - * @throws \InvalidArgumentException |
|
175 | - */ |
|
176 | - public static function messagesActivityListTableCellSelectorFor( |
|
177 | - $field, |
|
178 | - $message_type_label, |
|
179 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
180 | - $messenger = 'Email', |
|
181 | - $context = 'Event Admin', |
|
182 | - $table_cell_content_for_field = '', |
|
183 | - $number_in_set = 1 |
|
184 | - ) { |
|
185 | - $selector = "//tbody[@id='the-list']"; |
|
186 | - $selector .= "//tr[contains(@class, 'msg-status-$message_status')]" |
|
187 | - . "//td[contains(@class, 'message_type') and text()='$message_type_label']"; |
|
188 | - if ($messenger) { |
|
189 | - $selector .= "/ancestor::tr/td[contains(@class, 'messenger') and text()='$messenger']"; |
|
190 | - } |
|
191 | - $selector .= "/ancestor::tr/td[contains(@class, 'column-context') and text()='$context']"; |
|
192 | - $selector .= $table_cell_content_for_field |
|
193 | - ? "/ancestor::tr/td[contains(@class, 'column-$field') and text()='$table_cell_content_for_field']" |
|
194 | - : "/ancestor::tr/td[contains(@class, 'column-$field')]"; |
|
195 | - return $number_in_set > 0 ? Locator::elementAt($selector, $number_in_set) : $selector; |
|
196 | - } |
|
197 | - |
|
198 | - |
|
199 | - /** |
|
200 | - * Selector for the Create Custom button found in the message template list table. |
|
201 | - * @param string $message_type_label |
|
202 | - * @param string $messenger_label |
|
203 | - * @return string |
|
204 | - */ |
|
205 | - public static function createCustomButtonForMessageTypeAndMessenger($message_type_label, $messenger_label) |
|
206 | - { |
|
207 | - $selector = "//tr/td[contains(@class, 'message_type') and text()='$message_type_label']" |
|
208 | - . "//ancestor::tr/td[contains(@class, 'messenger') and contains(., '$messenger_label')]" |
|
209 | - . "//ancestor::tr/td/a[@class='button button-small']"; |
|
210 | - return $selector; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * Note, this could potentially match multiple buttons in the view so the selector is intentionally restricted to |
|
216 | - * the FIRST match (which will be the latest message sent if the table is default sorted). |
|
217 | - * |
|
218 | - * @param string $message_type_label The visible message type label for the row you want to match |
|
219 | - * @param string $message_status The status of the message for the row you want to match. |
|
220 | - * @param string $messenger The visible messenger label for the row you want to match. |
|
221 | - * @param string $context The visible context label for the row you want to match. |
|
222 | - * @param int $number_in_set It's possible that the given parameters could match multiple items in the |
|
223 | - * view. This allows you to indicate which item from the set to match. |
|
224 | - * @return string |
|
225 | - * @throws \InvalidArgumentException |
|
226 | - */ |
|
227 | - public static function messagesActivityListTableViewButtonSelectorFor( |
|
228 | - $message_type_label, |
|
229 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
230 | - $messenger = 'Email', |
|
231 | - $context = 'Event Admin', |
|
232 | - $number_in_set = 1 |
|
233 | - ) { |
|
234 | - $selector = self::messagesActivityListTableCellSelectorFor( |
|
235 | - 'action', |
|
236 | - $message_type_label, |
|
237 | - $message_status, |
|
238 | - $messenger, |
|
239 | - $context, |
|
240 | - '', |
|
241 | - $number_in_set |
|
242 | - ); |
|
243 | - $selector .= "/a/span[contains(@class, 'ee-message-action-link-view')" |
|
244 | - . " and not(contains(@class, 'ee-message-action-link-view_transaction'))]"; |
|
245 | - return $selector; |
|
246 | - } |
|
247 | - |
|
248 | - |
|
249 | - /** |
|
250 | - * Locator for the delete action link for a message item in the message activity list table. |
|
251 | - * Note: The link is not visible by default, so the column would need hovered over for the link to appear. |
|
252 | - * |
|
253 | - * @param $message_type_label |
|
254 | - * @param string $message_status |
|
255 | - * @param string $messenger |
|
256 | - * @param string $context |
|
257 | - * @param int $number_in_set |
|
258 | - * @return string |
|
259 | - * @throws \InvalidArgumentException |
|
260 | - */ |
|
261 | - public static function messagesActivityListTableDeleteActionSelectorFor( |
|
262 | - $message_type_label, |
|
263 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
264 | - $messenger = 'Email', |
|
265 | - $context = 'Event Admin', |
|
266 | - $number_in_set = 1 |
|
267 | - ) { |
|
268 | - $selector = self::messagesActivityListTableCellSelectorFor( |
|
269 | - 'to', |
|
270 | - $message_type_label, |
|
271 | - $message_status, |
|
272 | - $messenger, |
|
273 | - $context, |
|
274 | - '', |
|
275 | - $number_in_set |
|
276 | - ); |
|
277 | - $selector .= "/div/span[@class='delete']/a"; |
|
278 | - return $selector; |
|
279 | - } |
|
280 | - |
|
281 | - |
|
282 | - |
|
283 | - /** |
|
284 | - * Returns the input selector for a given field in the message template editor. |
|
285 | - * Assumes one is already viewing the Message Template Editor. |
|
286 | - * @param string $field |
|
287 | - * @return string |
|
288 | - */ |
|
289 | - public static function messageInputFieldSelectorFor($field) |
|
290 | - { |
|
291 | - return "//div[@id='post-body']//input[@id='$field-content']"; |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * Wrapper for self::messageInputFieldSelectorFor('to') that takes care of getting the input for the To field. |
|
297 | - */ |
|
298 | - public static function messageTemplateToFieldSelector() |
|
299 | - { |
|
300 | - return self::messageInputFieldSelectorFor('to'); |
|
301 | - } |
|
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"; |
|
81 | + |
|
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 | + |
|
97 | + /** |
|
98 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
99 | + * a string. |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + public static function messageActivityListTableUrl($additional_params = '') |
|
103 | + { |
|
104 | + return self::adminUrl('espresso_messages', 'default', $additional_params); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
110 | + * a string. |
|
111 | + * @return string |
|
112 | + */ |
|
113 | + public static function defaultMessageTemplateListTableUrl($additional_params = '') |
|
114 | + { |
|
115 | + return self::adminUrl('espresso_messages', 'global_mtps', $additional_params); |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
121 | + * a string. |
|
122 | + * @return string |
|
123 | + */ |
|
124 | + public static function customMessageTemplateListTableUrl($additional_params = '') |
|
125 | + { |
|
126 | + return self::adminUrl('espresso_messages', 'custom_mtps', $additional_params); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * @return string |
|
132 | + */ |
|
133 | + public static function messageSettingsUrl() |
|
134 | + { |
|
135 | + return self::adminUrl('espresso_messages', 'settings'); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + |
|
140 | + public static function draggableSettingsBoxSelectorForMessageTypeAndMessenger( |
|
141 | + $message_type_slug, |
|
142 | + $messenger_slug = 'email' |
|
143 | + ) { |
|
144 | + return "#$message_type_slug-messagetype-$messenger_slug"; |
|
145 | + } |
|
146 | + |
|
147 | + |
|
148 | + /** |
|
149 | + * @param string $message_type_slug |
|
150 | + * @param string $context |
|
151 | + * @return string |
|
152 | + */ |
|
153 | + public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '') |
|
154 | + { |
|
155 | + return $context |
|
156 | + ? '.' . $message_type_slug . '-' . $context . '-edit-link' |
|
157 | + : '.' . $message_type_slug . '-edit-link'; |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * Selector for (a) specific table cell(s) in the Messages Activity list table for the given parameters. |
|
163 | + * |
|
164 | + * @param $field |
|
165 | + * @param $message_type_label |
|
166 | + * @param string $message_status |
|
167 | + * @param string $messenger |
|
168 | + * @param string $context |
|
169 | + * @param string $table_cell_content_for_field |
|
170 | + * @param int $number_in_set It's possible that the given parameters could match multiple items in the view. |
|
171 | + * This allows you to indicate which item from the set to match. If this is set to 0 |
|
172 | + * then all matches for the locator will be returned. |
|
173 | + * @return string |
|
174 | + * @throws \InvalidArgumentException |
|
175 | + */ |
|
176 | + public static function messagesActivityListTableCellSelectorFor( |
|
177 | + $field, |
|
178 | + $message_type_label, |
|
179 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
180 | + $messenger = 'Email', |
|
181 | + $context = 'Event Admin', |
|
182 | + $table_cell_content_for_field = '', |
|
183 | + $number_in_set = 1 |
|
184 | + ) { |
|
185 | + $selector = "//tbody[@id='the-list']"; |
|
186 | + $selector .= "//tr[contains(@class, 'msg-status-$message_status')]" |
|
187 | + . "//td[contains(@class, 'message_type') and text()='$message_type_label']"; |
|
188 | + if ($messenger) { |
|
189 | + $selector .= "/ancestor::tr/td[contains(@class, 'messenger') and text()='$messenger']"; |
|
190 | + } |
|
191 | + $selector .= "/ancestor::tr/td[contains(@class, 'column-context') and text()='$context']"; |
|
192 | + $selector .= $table_cell_content_for_field |
|
193 | + ? "/ancestor::tr/td[contains(@class, 'column-$field') and text()='$table_cell_content_for_field']" |
|
194 | + : "/ancestor::tr/td[contains(@class, 'column-$field')]"; |
|
195 | + return $number_in_set > 0 ? Locator::elementAt($selector, $number_in_set) : $selector; |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + /** |
|
200 | + * Selector for the Create Custom button found in the message template list table. |
|
201 | + * @param string $message_type_label |
|
202 | + * @param string $messenger_label |
|
203 | + * @return string |
|
204 | + */ |
|
205 | + public static function createCustomButtonForMessageTypeAndMessenger($message_type_label, $messenger_label) |
|
206 | + { |
|
207 | + $selector = "//tr/td[contains(@class, 'message_type') and text()='$message_type_label']" |
|
208 | + . "//ancestor::tr/td[contains(@class, 'messenger') and contains(., '$messenger_label')]" |
|
209 | + . "//ancestor::tr/td/a[@class='button button-small']"; |
|
210 | + return $selector; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * Note, this could potentially match multiple buttons in the view so the selector is intentionally restricted to |
|
216 | + * the FIRST match (which will be the latest message sent if the table is default sorted). |
|
217 | + * |
|
218 | + * @param string $message_type_label The visible message type label for the row you want to match |
|
219 | + * @param string $message_status The status of the message for the row you want to match. |
|
220 | + * @param string $messenger The visible messenger label for the row you want to match. |
|
221 | + * @param string $context The visible context label for the row you want to match. |
|
222 | + * @param int $number_in_set It's possible that the given parameters could match multiple items in the |
|
223 | + * view. This allows you to indicate which item from the set to match. |
|
224 | + * @return string |
|
225 | + * @throws \InvalidArgumentException |
|
226 | + */ |
|
227 | + public static function messagesActivityListTableViewButtonSelectorFor( |
|
228 | + $message_type_label, |
|
229 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
230 | + $messenger = 'Email', |
|
231 | + $context = 'Event Admin', |
|
232 | + $number_in_set = 1 |
|
233 | + ) { |
|
234 | + $selector = self::messagesActivityListTableCellSelectorFor( |
|
235 | + 'action', |
|
236 | + $message_type_label, |
|
237 | + $message_status, |
|
238 | + $messenger, |
|
239 | + $context, |
|
240 | + '', |
|
241 | + $number_in_set |
|
242 | + ); |
|
243 | + $selector .= "/a/span[contains(@class, 'ee-message-action-link-view')" |
|
244 | + . " and not(contains(@class, 'ee-message-action-link-view_transaction'))]"; |
|
245 | + return $selector; |
|
246 | + } |
|
247 | + |
|
248 | + |
|
249 | + /** |
|
250 | + * Locator for the delete action link for a message item in the message activity list table. |
|
251 | + * Note: The link is not visible by default, so the column would need hovered over for the link to appear. |
|
252 | + * |
|
253 | + * @param $message_type_label |
|
254 | + * @param string $message_status |
|
255 | + * @param string $messenger |
|
256 | + * @param string $context |
|
257 | + * @param int $number_in_set |
|
258 | + * @return string |
|
259 | + * @throws \InvalidArgumentException |
|
260 | + */ |
|
261 | + public static function messagesActivityListTableDeleteActionSelectorFor( |
|
262 | + $message_type_label, |
|
263 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
264 | + $messenger = 'Email', |
|
265 | + $context = 'Event Admin', |
|
266 | + $number_in_set = 1 |
|
267 | + ) { |
|
268 | + $selector = self::messagesActivityListTableCellSelectorFor( |
|
269 | + 'to', |
|
270 | + $message_type_label, |
|
271 | + $message_status, |
|
272 | + $messenger, |
|
273 | + $context, |
|
274 | + '', |
|
275 | + $number_in_set |
|
276 | + ); |
|
277 | + $selector .= "/div/span[@class='delete']/a"; |
|
278 | + return $selector; |
|
279 | + } |
|
280 | + |
|
281 | + |
|
282 | + |
|
283 | + /** |
|
284 | + * Returns the input selector for a given field in the message template editor. |
|
285 | + * Assumes one is already viewing the Message Template Editor. |
|
286 | + * @param string $field |
|
287 | + * @return string |
|
288 | + */ |
|
289 | + public static function messageInputFieldSelectorFor($field) |
|
290 | + { |
|
291 | + return "//div[@id='post-body']//input[@id='$field-content']"; |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * Wrapper for self::messageInputFieldSelectorFor('to') that takes care of getting the input for the To field. |
|
297 | + */ |
|
298 | + public static function messageTemplateToFieldSelector() |
|
299 | + { |
|
300 | + return self::messageInputFieldSelectorFor('to'); |
|
301 | + } |
|
302 | 302 | } |
303 | 303 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('ABSPATH')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -40,243 +40,243 @@ discard block |
||
40 | 40 | * @since 4.0 |
41 | 41 | */ |
42 | 42 | if (function_exists('espresso_version')) { |
43 | - /** |
|
44 | - * espresso_duplicate_plugin_error |
|
45 | - * displays if more than one version of EE is activated at the same time |
|
46 | - */ |
|
47 | - function espresso_duplicate_plugin_error() |
|
48 | - { |
|
49 | - ?> |
|
43 | + /** |
|
44 | + * espresso_duplicate_plugin_error |
|
45 | + * displays if more than one version of EE is activated at the same time |
|
46 | + */ |
|
47 | + function espresso_duplicate_plugin_error() |
|
48 | + { |
|
49 | + ?> |
|
50 | 50 | <div class="error"> |
51 | 51 | <p> |
52 | 52 | <?php 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 | - ); ?> |
|
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 | - } |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | 61 | |
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | - if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - '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.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + '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.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - /** |
|
97 | - * espresso_version |
|
98 | - * Returns the plugin version |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function espresso_version() |
|
103 | - { |
|
104 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.47.rc.025'); |
|
105 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + /** |
|
97 | + * espresso_version |
|
98 | + * Returns the plugin version |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function espresso_version() |
|
103 | + { |
|
104 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.47.rc.025'); |
|
105 | + } |
|
106 | 106 | |
107 | - // define versions |
|
108 | - define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | - define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | - define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | - define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | - //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | - if ( ! defined('DS')) { |
|
115 | - define('DS', '/'); |
|
116 | - } |
|
117 | - if ( ! defined('PS')) { |
|
118 | - define('PS', PATH_SEPARATOR); |
|
119 | - } |
|
120 | - if ( ! defined('SP')) { |
|
121 | - define('SP', ' '); |
|
122 | - } |
|
123 | - if ( ! defined('EENL')) { |
|
124 | - define('EENL', "\n"); |
|
125 | - } |
|
126 | - define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | - // define the plugin directory and URL |
|
128 | - define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | - define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | - define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | - // main root folder paths |
|
132 | - define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | - define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | - define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | - define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | - define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | - define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | - define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | - define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | - // core system paths |
|
141 | - define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | - define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | - define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | - define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | - define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | - define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | - define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | - define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | - define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | - define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | - define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | - define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | - // gateways |
|
154 | - define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | - define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | - // asset URL paths |
|
157 | - define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | - define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | - define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | - define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | - define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | - define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | - // define upload paths |
|
164 | - $uploads = wp_upload_dir(); |
|
165 | - // define the uploads directory and URL |
|
166 | - define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | - define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | - // define the templates directory and URL |
|
169 | - define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | - define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | - // define the gateway directory and URL |
|
172 | - define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | - define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | - // languages folder/path |
|
175 | - define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | - define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | - //check for dompdf fonts in uploads |
|
178 | - if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | - } |
|
181 | - //ajax constants |
|
182 | - define( |
|
183 | - 'EE_FRONT_AJAX', |
|
184 | - isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | - ); |
|
186 | - define( |
|
187 | - 'EE_ADMIN_AJAX', |
|
188 | - isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | - ); |
|
190 | - //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | - //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | - //want to change its default value! or find when -1 means infinity |
|
193 | - define('EE_INF_IN_DB', -1); |
|
194 | - define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | - define('EE_DEBUG', false); |
|
196 | - // for older WP versions |
|
197 | - if ( ! defined('MONTH_IN_SECONDS')) { |
|
198 | - define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
199 | - } |
|
200 | - /** |
|
201 | - * espresso_plugin_activation |
|
202 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
203 | - */ |
|
204 | - function espresso_plugin_activation() |
|
205 | - { |
|
206 | - update_option('ee_espresso_activation', true); |
|
207 | - } |
|
107 | + // define versions |
|
108 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | + //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | + if ( ! defined('DS')) { |
|
115 | + define('DS', '/'); |
|
116 | + } |
|
117 | + if ( ! defined('PS')) { |
|
118 | + define('PS', PATH_SEPARATOR); |
|
119 | + } |
|
120 | + if ( ! defined('SP')) { |
|
121 | + define('SP', ' '); |
|
122 | + } |
|
123 | + if ( ! defined('EENL')) { |
|
124 | + define('EENL', "\n"); |
|
125 | + } |
|
126 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | + // define the plugin directory and URL |
|
128 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | + // main root folder paths |
|
132 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | + define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | + // core system paths |
|
141 | + define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | + define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | + define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | + define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | + define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | + define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | + define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | + define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | + define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | + define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | + define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | + // gateways |
|
154 | + define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | + // asset URL paths |
|
157 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | + // define upload paths |
|
164 | + $uploads = wp_upload_dir(); |
|
165 | + // define the uploads directory and URL |
|
166 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | + // define the templates directory and URL |
|
169 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | + // define the gateway directory and URL |
|
172 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | + // languages folder/path |
|
175 | + define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | + //check for dompdf fonts in uploads |
|
178 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | + } |
|
181 | + //ajax constants |
|
182 | + define( |
|
183 | + 'EE_FRONT_AJAX', |
|
184 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | + ); |
|
186 | + define( |
|
187 | + 'EE_ADMIN_AJAX', |
|
188 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | + ); |
|
190 | + //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | + //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | + //want to change its default value! or find when -1 means infinity |
|
193 | + define('EE_INF_IN_DB', -1); |
|
194 | + define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | + define('EE_DEBUG', false); |
|
196 | + // for older WP versions |
|
197 | + if ( ! defined('MONTH_IN_SECONDS')) { |
|
198 | + define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
199 | + } |
|
200 | + /** |
|
201 | + * espresso_plugin_activation |
|
202 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
203 | + */ |
|
204 | + function espresso_plugin_activation() |
|
205 | + { |
|
206 | + update_option('ee_espresso_activation', true); |
|
207 | + } |
|
208 | 208 | |
209 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
210 | - /** |
|
211 | - * espresso_load_error_handling |
|
212 | - * this function loads EE's class for handling exceptions and errors |
|
213 | - */ |
|
214 | - function espresso_load_error_handling() |
|
215 | - { |
|
216 | - // load debugging tools |
|
217 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
218 | - require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
219 | - EEH_Debug_Tools::instance(); |
|
220 | - } |
|
221 | - // load error handling |
|
222 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
223 | - require_once(EE_CORE . 'EE_Error.core.php'); |
|
224 | - } else { |
|
225 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
226 | - } |
|
227 | - } |
|
209 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
210 | + /** |
|
211 | + * espresso_load_error_handling |
|
212 | + * this function loads EE's class for handling exceptions and errors |
|
213 | + */ |
|
214 | + function espresso_load_error_handling() |
|
215 | + { |
|
216 | + // load debugging tools |
|
217 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
218 | + require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
219 | + EEH_Debug_Tools::instance(); |
|
220 | + } |
|
221 | + // load error handling |
|
222 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
223 | + require_once(EE_CORE . 'EE_Error.core.php'); |
|
224 | + } else { |
|
225 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
226 | + } |
|
227 | + } |
|
228 | 228 | |
229 | - /** |
|
230 | - * espresso_load_required |
|
231 | - * given a class name and path, this function will load that file or throw an exception |
|
232 | - * |
|
233 | - * @param string $classname |
|
234 | - * @param string $full_path_to_file |
|
235 | - * @throws EE_Error |
|
236 | - */ |
|
237 | - function espresso_load_required($classname, $full_path_to_file) |
|
238 | - { |
|
239 | - static $error_handling_loaded = false; |
|
240 | - if ( ! $error_handling_loaded) { |
|
241 | - espresso_load_error_handling(); |
|
242 | - $error_handling_loaded = true; |
|
243 | - } |
|
244 | - if (is_readable($full_path_to_file)) { |
|
245 | - require_once($full_path_to_file); |
|
246 | - } else { |
|
247 | - throw new EE_Error ( |
|
248 | - sprintf( |
|
249 | - esc_html__( |
|
250 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
251 | - 'event_espresso' |
|
252 | - ), |
|
253 | - $classname |
|
254 | - ) |
|
255 | - ); |
|
256 | - } |
|
257 | - } |
|
229 | + /** |
|
230 | + * espresso_load_required |
|
231 | + * given a class name and path, this function will load that file or throw an exception |
|
232 | + * |
|
233 | + * @param string $classname |
|
234 | + * @param string $full_path_to_file |
|
235 | + * @throws EE_Error |
|
236 | + */ |
|
237 | + function espresso_load_required($classname, $full_path_to_file) |
|
238 | + { |
|
239 | + static $error_handling_loaded = false; |
|
240 | + if ( ! $error_handling_loaded) { |
|
241 | + espresso_load_error_handling(); |
|
242 | + $error_handling_loaded = true; |
|
243 | + } |
|
244 | + if (is_readable($full_path_to_file)) { |
|
245 | + require_once($full_path_to_file); |
|
246 | + } else { |
|
247 | + throw new EE_Error ( |
|
248 | + sprintf( |
|
249 | + esc_html__( |
|
250 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
251 | + 'event_espresso' |
|
252 | + ), |
|
253 | + $classname |
|
254 | + ) |
|
255 | + ); |
|
256 | + } |
|
257 | + } |
|
258 | 258 | |
259 | - espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
260 | - espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
261 | - espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
262 | - new EE_Bootstrap(); |
|
263 | - } |
|
259 | + espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
260 | + espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
261 | + espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
262 | + new EE_Bootstrap(); |
|
263 | + } |
|
264 | 264 | } |
265 | 265 | if ( ! function_exists('espresso_deactivate_plugin')) { |
266 | - /** |
|
267 | - * deactivate_plugin |
|
268 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
269 | - * |
|
270 | - * @access public |
|
271 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
272 | - * @return void |
|
273 | - */ |
|
274 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
275 | - { |
|
276 | - if ( ! function_exists('deactivate_plugins')) { |
|
277 | - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
278 | - } |
|
279 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
280 | - deactivate_plugins($plugin_basename); |
|
281 | - } |
|
266 | + /** |
|
267 | + * deactivate_plugin |
|
268 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
269 | + * |
|
270 | + * @access public |
|
271 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
272 | + * @return void |
|
273 | + */ |
|
274 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
275 | + { |
|
276 | + if ( ! function_exists('deactivate_plugins')) { |
|
277 | + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
278 | + } |
|
279 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
280 | + deactivate_plugins($plugin_basename); |
|
281 | + } |
|
282 | 282 | } |
283 | 283 | \ No newline at end of file |