Completed
Branch master (4bd299)
by
unknown
04:49
created
languages/event_espresso-translations-js.php 1 patch
Spacing   +710 added lines, -710 removed lines patch added patch discarded remove patch
@@ -2,137 +2,137 @@  discard block
 block discarded – undo
2 2
 /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
3 3
 $generated_i18n_strings = array(
4 4
 	// Reference: packages/ui-components/src/Pagination/constants.ts:6
5
-	__( '2', 'event_espresso' ),
5
+	__('2', 'event_espresso'),
6 6
 
7 7
 	// Reference: packages/ui-components/src/Pagination/constants.ts:7
8
-	__( '6', 'event_espresso' ),
8
+	__('6', 'event_espresso'),
9 9
 
10 10
 	// Reference: packages/ui-components/src/Pagination/constants.ts:8
11
-	__( '12', 'event_espresso' ),
11
+	__('12', 'event_espresso'),
12 12
 
13 13
 	// Reference: packages/ui-components/src/Pagination/constants.ts:9
14
-	__( '24', 'event_espresso' ),
14
+	__('24', 'event_espresso'),
15 15
 
16 16
 	// Reference: packages/ui-components/src/Pagination/constants.ts:10
17
-	__( '48', 'event_espresso' ),
17
+	__('48', 'event_espresso'),
18 18
 
19 19
 	// Reference: domains/core/admin/blocks/src/components/AvatarImage.tsx:27
20
-	__( 'contact avatar', 'event_espresso' ),
20
+	__('contact avatar', 'event_espresso'),
21 21
 
22 22
 	// Reference: domains/core/admin/blocks/src/components/OrderByControl.tsx:12
23
-	__( 'Order by', 'event_espresso' ),
23
+	__('Order by', 'event_espresso'),
24 24
 
25 25
 	// Reference: domains/core/admin/blocks/src/components/RegStatusControl.tsx:17
26 26
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectStatus.tsx:13
27
-	__( 'Select Registration Status', 'event_espresso' ),
27
+	__('Select Registration Status', 'event_espresso'),
28 28
 
29 29
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:14
30
-	__( 'Ascending', 'event_espresso' ),
30
+	__('Ascending', 'event_espresso'),
31 31
 
32 32
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:18
33
-	__( 'Descending', 'event_espresso' ),
33
+	__('Descending', 'event_espresso'),
34 34
 
35 35
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:24
36
-	__( 'Sort order:', 'event_espresso' ),
36
+	__('Sort order:', 'event_espresso'),
37 37
 
38 38
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:41
39
-	__( 'There was some error fetching attendees list', 'event_espresso' ),
39
+	__('There was some error fetching attendees list', 'event_espresso'),
40 40
 
41 41
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:47
42
-	__( 'To get started, select what event you want to show attendees from in the block settings.', 'event_espresso' ),
42
+	__('To get started, select what event you want to show attendees from in the block settings.', 'event_espresso'),
43 43
 
44 44
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:53
45
-	__( 'There are no attendees for selected options.', 'event_espresso' ),
45
+	__('There are no attendees for selected options.', 'event_espresso'),
46 46
 
47 47
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:12
48
-	__( 'Display on Archives', 'event_espresso' ),
48
+	__('Display on Archives', 'event_espresso'),
49 49
 
50 50
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:17
51
-	__( 'Attendees are shown whenever this post is listed in an archive view.', 'event_espresso' ),
51
+	__('Attendees are shown whenever this post is listed in an archive view.', 'event_espresso'),
52 52
 
53 53
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:18
54
-	__( 'Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso' ),
54
+	__('Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso'),
55 55
 
56 56
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/AttendeeLimit.tsx:29
57
-	__( 'Number of Attendees to Display:', 'event_espresso' ),
57
+	__('Number of Attendees to Display:', 'event_espresso'),
58 58
 
59 59
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/AttendeeLimit.tsx:34
60 60
 	/* translators: %d attendees count */
61
-	_n_noop( 'Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso' ),
61
+	_n_noop('Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso'),
62 62
 
63 63
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:27
64
-	__( 'Display Gravatar', 'event_espresso' ),
64
+	__('Display Gravatar', 'event_espresso'),
65 65
 
66 66
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:32
67
-	__( 'Gravatar images are shown for each attendee.', 'event_espresso' ),
67
+	__('Gravatar images are shown for each attendee.', 'event_espresso'),
68 68
 
69 69
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:33
70
-	__( 'No gravatar images are shown for each attendee.', 'event_espresso' ),
70
+	__('No gravatar images are shown for each attendee.', 'event_espresso'),
71 71
 
72 72
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:38
73
-	__( 'Size of Gravatar', 'event_espresso' ),
73
+	__('Size of Gravatar', 'event_espresso'),
74 74
 
75 75
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectDatetime.tsx:22
76
-	__( 'Select Datetime', 'event_espresso' ),
76
+	__('Select Datetime', 'event_espresso'),
77 77
 
78 78
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectEvent.tsx:22
79 79
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectEvent.tsx:22
80
-	__( 'Select Event', 'event_espresso' ),
80
+	__('Select Event', 'event_espresso'),
81 81
 
82 82
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:11
83
-	__( 'Attendee id', 'event_espresso' ),
83
+	__('Attendee id', 'event_espresso'),
84 84
 
85 85
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:15
86
-	__( 'Last name only', 'event_espresso' ),
86
+	__('Last name only', 'event_espresso'),
87 87
 
88 88
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:19
89
-	__( 'First name only', 'event_espresso' ),
89
+	__('First name only', 'event_espresso'),
90 90
 
91 91
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:23
92
-	__( 'First, then Last name', 'event_espresso' ),
92
+	__('First, then Last name', 'event_espresso'),
93 93
 
94 94
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:27
95
-	__( 'Last, then First name', 'event_espresso' ),
95
+	__('Last, then First name', 'event_espresso'),
96 96
 
97 97
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:41
98
-	__( 'Order Attendees by:', 'event_espresso' ),
98
+	__('Order Attendees by:', 'event_espresso'),
99 99
 
100 100
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectTicket.tsx:22
101
-	__( 'Select Ticket', 'event_espresso' ),
101
+	__('Select Ticket', 'event_espresso'),
102 102
 
103 103
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:21
104
-	__( 'Filter By Settings', 'event_espresso' ),
104
+	__('Filter By Settings', 'event_espresso'),
105 105
 
106 106
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:36
107
-	__( 'Gravatar Setttings', 'event_espresso' ),
107
+	__('Gravatar Setttings', 'event_espresso'),
108 108
 
109 109
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:39
110
-	__( 'Archive Settings', 'event_espresso' ),
110
+	__('Archive Settings', 'event_espresso'),
111 111
 
112 112
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:10
113
-	__( 'Event Attendees', 'event_espresso' ),
113
+	__('Event Attendees', 'event_espresso'),
114 114
 
115 115
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:11
116
-	__( 'Displays a list of people that have registered for the specified event', 'event_espresso' ),
116
+	__('Displays a list of people that have registered for the specified event', 'event_espresso'),
117 117
 
118 118
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
119 119
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:12
120 120
 	// Reference: packages/edtr-services/src/constants.ts:25
121
-	__( 'event', 'event_espresso' ),
121
+	__('event', 'event_espresso'),
122 122
 
123 123
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
124
-	__( 'attendees', 'event_espresso' ),
124
+	__('attendees', 'event_espresso'),
125 125
 
126 126
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
127
-	__( 'list', 'event_espresso' ),
127
+	__('list', 'event_espresso'),
128 128
 
129 129
 	// Reference: domains/core/admin/blocks/src/event/DisplayField.tsx:41
130
-	__( 'An unknown error occurred while fetching event details.', 'event_espresso' ),
130
+	__('An unknown error occurred while fetching event details.', 'event_espresso'),
131 131
 
132 132
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:10
133 133
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:24
134 134
 	// Reference: packages/utils/src/list/index.ts:14
135
-	__( 'Select…', 'event_espresso' ),
135
+	__('Select…', 'event_espresso'),
136 136
 
137 137
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:15
138 138
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:75
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:198
142 142
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:48
143 143
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:42
144
-	__( 'Name', 'event_espresso' ),
144
+	__('Name', 'event_espresso'),
145 145
 
146 146
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:19
147 147
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:80
@@ -149,407 +149,407 @@  discard block
 block discarded – undo
149 149
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:203
150 150
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:54
151 151
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:47
152
-	__( 'Description', 'event_espresso' ),
152
+	__('Description', 'event_espresso'),
153 153
 
154 154
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:23
155
-	__( 'Short description', 'event_espresso' ),
155
+	__('Short description', 'event_espresso'),
156 156
 
157 157
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:35
158
-	__( 'Select Field', 'event_espresso' ),
158
+	__('Select Field', 'event_espresso'),
159 159
 
160 160
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:27
161
-	__( 'Text Color', 'event_espresso' ),
161
+	__('Text Color', 'event_espresso'),
162 162
 
163 163
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:32
164
-	__( 'Background Color', 'event_espresso' ),
164
+	__('Background Color', 'event_espresso'),
165 165
 
166 166
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:41
167 167
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:22
168 168
 	// Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:21
169
-	__( 'Settings', 'event_espresso' ),
169
+	__('Settings', 'event_espresso'),
170 170
 
171 171
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:45
172
-	__( 'Typography', 'event_espresso' ),
172
+	__('Typography', 'event_espresso'),
173 173
 
174 174
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:48
175
-	__( 'Color', 'event_espresso' ),
175
+	__('Color', 'event_espresso'),
176 176
 
177 177
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:12
178
-	__( 'field', 'event_espresso' ),
178
+	__('field', 'event_espresso'),
179 179
 
180 180
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:8
181
-	__( 'Event Field', 'event_espresso' ),
181
+	__('Event Field', 'event_espresso'),
182 182
 
183 183
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:9
184
-	__( 'Displays the selected field of an event', 'event_espresso' ),
184
+	__('Displays the selected field of an event', 'event_espresso'),
185 185
 
186 186
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:17
187
-	__( 'Error', 'event_espresso' ),
187
+	__('Error', 'event_espresso'),
188 188
 
189 189
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:9
190
-	__( 'Loading…', 'event_espresso' ),
190
+	__('Loading…', 'event_espresso'),
191 191
 
192 192
 	// Reference: domains/core/admin/eventEditor/src/ui/EventDescription.tsx:33
193
-	__( 'Event Description', 'event_espresso' ),
193
+	__('Event Description', 'event_espresso'),
194 194
 
195 195
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/ActiveStatus.tsx:28
196
-	__( 'Active status', 'event_espresso' ),
196
+	__('Active status', 'event_espresso'),
197 197
 
198 198
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/AltRegPage.tsx:12
199
-	__( 'Alternative Registration Page', 'event_espresso' ),
199
+	__('Alternative Registration Page', 'event_espresso'),
200 200
 
201 201
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/DefaultRegistrationStatus.tsx:25
202
-	__( 'Default Registration Status', 'event_espresso' ),
202
+	__('Default Registration Status', 'event_espresso'),
203 203
 
204 204
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:8
205
-	__( 'Donations Enabled', 'event_espresso' ),
205
+	__('Donations Enabled', 'event_espresso'),
206 206
 
207 207
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:8
208
-	__( 'Donations Disabled', 'event_espresso' ),
208
+	__('Donations Disabled', 'event_espresso'),
209 209
 
210 210
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/EventManager.tsx:16
211
-	__( 'Event Manager', 'event_espresso' ),
211
+	__('Event Manager', 'event_espresso'),
212 212
 
213 213
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/EventPhoneNumber.tsx:15
214
-	__( 'Event Phone Number', 'event_espresso' ),
214
+	__('Event Phone Number', 'event_espresso'),
215 215
 
216 216
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/MaxRegistrations.tsx:13
217
-	__( 'Max Registrations per Transaction', 'event_espresso' ),
217
+	__('Max Registrations per Transaction', 'event_espresso'),
218 218
 
219 219
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:8
220
-	__( 'Ticket Selector Enabled', 'event_espresso' ),
220
+	__('Ticket Selector Enabled', 'event_espresso'),
221 221
 
222 222
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:8
223
-	__( 'Ticket Selector Disabled', 'event_espresso' ),
223
+	__('Ticket Selector Disabled', 'event_espresso'),
224 224
 
225 225
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/index.tsx:41
226
-	__( 'Event Details', 'event_espresso' ),
226
+	__('Event Details', 'event_espresso'),
227 227
 
228 228
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/index.tsx:47
229
-	__( 'Registration Options', 'event_espresso' ),
229
+	__('Registration Options', 'event_espresso'),
230 230
 
231 231
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:10
232
-	__( 'primary information about the date', 'event_espresso' ),
232
+	__('primary information about the date', 'event_espresso'),
233 233
 
234 234
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:10
235
-	__( 'Date Details', 'event_espresso' ),
235
+	__('Date Details', 'event_espresso'),
236 236
 
237 237
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11
238 238
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:16
239 239
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:16
240
-	__( 'relations between tickets and dates', 'event_espresso' ),
240
+	__('relations between tickets and dates', 'event_espresso'),
241 241
 
242 242
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11
243
-	__( 'Assign Tickets', 'event_espresso' ),
243
+	__('Assign Tickets', 'event_espresso'),
244 244
 
245 245
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/FooterButtons.tsx:22
246
-	__( 'Save and assign tickets', 'event_espresso' ),
246
+	__('Save and assign tickets', 'event_espresso'),
247 247
 
248 248
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:30
249 249
 	/* translators: %d database id */
250
-	__( 'Edit datetime %s', 'event_espresso' ),
250
+	__('Edit datetime %s', 'event_espresso'),
251 251
 
252 252
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:33
253
-	__( 'New Datetime', 'event_espresso' ),
253
+	__('New Datetime', 'event_espresso'),
254 254
 
255 255
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:43
256
-	__( 'modal for datetime', 'event_espresso' ),
256
+	__('modal for datetime', 'event_espresso'),
257 257
 
258 258
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:110
259 259
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:107
260 260
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:233
261 261
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:106
262
-	__( 'Details', 'event_espresso' ),
262
+	__('Details', 'event_espresso'),
263 263
 
264 264
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:114
265 265
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:111
266 266
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:83
267
-	__( 'Capacity', 'event_espresso' ),
267
+	__('Capacity', 'event_espresso'),
268 268
 
269 269
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:119
270
-	__( 'The maximum number of registrants that can attend the event at this particular date.', 'event_espresso' ),
270
+	__('The maximum number of registrants that can attend the event at this particular date.', 'event_espresso'),
271 271
 
272 272
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:123
273
-	__( 'Set to 0 to close registration or leave blank for no limit.', 'event_espresso' ),
273
+	__('Set to 0 to close registration or leave blank for no limit.', 'event_espresso'),
274 274
 
275 275
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:129
276 276
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:171
277
-	__( 'Trash', 'event_espresso' ),
277
+	__('Trash', 'event_espresso'),
278 278
 
279 279
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:71
280 280
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:44
281 281
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:194
282 282
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:44
283
-	__( 'Basics', 'event_espresso' ),
283
+	__('Basics', 'event_espresso'),
284 284
 
285 285
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:88
286 286
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:62
287 287
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:62
288
-	__( 'Dates', 'event_espresso' ),
288
+	__('Dates', 'event_espresso'),
289 289
 
290 290
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:92
291 291
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:53
292 292
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:215
293
-	__( 'Start Date', 'event_espresso' ),
293
+	__('Start Date', 'event_espresso'),
294 294
 
295 295
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:99
296 296
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:67
297 297
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:222
298
-	__( 'End Date', 'event_espresso' ),
298
+	__('End Date', 'event_espresso'),
299 299
 
300 300
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DateRegistrationsLink.tsx:13
301
-	__( 'view ALL registrations for this date.', 'event_espresso' ),
301
+	__('view ALL registrations for this date.', 'event_espresso'),
302 302
 
303 303
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DateSoldLink.tsx:13
304
-	__( 'view approved registrations for this date.', 'event_espresso' ),
304
+	__('view approved registrations for this date.', 'event_espresso'),
305 305
 
306 306
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:35
307 307
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/TableView.tsx:33
308
-	__( 'Event Dates', 'event_espresso' ),
308
+	__('Event Dates', 'event_espresso'),
309 309
 
310 310
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:38
311
-	__( 'loading event dates…', 'event_espresso' ),
311
+	__('loading event dates…', 'event_espresso'),
312 312
 
313 313
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:22
314
-	__( 'Add a date or a ticket in order to use Ticket Assignment Manager', 'event_espresso' ),
314
+	__('Add a date or a ticket in order to use Ticket Assignment Manager', 'event_espresso'),
315 315
 
316 316
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:32
317
-	__( 'Ticket Assignments', 'event_espresso' ),
317
+	__('Ticket Assignments', 'event_espresso'),
318 318
 
319 319
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:25
320
-	__( 'Number of related tickets', 'event_espresso' ),
320
+	__('Number of related tickets', 'event_espresso'),
321 321
 
322 322
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:26
323
-	__( 'There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso' ),
323
+	__('There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso'),
324 324
 
325 325
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:34
326
-	__( 'assign tickets', 'event_espresso' ),
326
+	__('assign tickets', 'event_espresso'),
327 327
 
328 328
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:21
329
-	__( 'event datetime main menu', 'event_espresso' ),
329
+	__('event datetime main menu', 'event_espresso'),
330 330
 
331 331
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:33
332
-	__( 'edit datetime', 'event_espresso' ),
332
+	__('edit datetime', 'event_espresso'),
333 333
 
334 334
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:34
335
-	__( 'copy datetime', 'event_espresso' ),
335
+	__('copy datetime', 'event_espresso'),
336 336
 
337 337
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:15
338 338
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:48
339
-	__( 'delete permanently', 'event_espresso' ),
339
+	__('delete permanently', 'event_espresso'),
340 340
 
341 341
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:15
342
-	__( 'trash datetime', 'event_espresso' ),
342
+	__('trash datetime', 'event_espresso'),
343 343
 
344 344
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:18
345
-	__( 'Permanently Delete Datetime?', 'event_espresso' ),
345
+	__('Permanently Delete Datetime?', 'event_espresso'),
346 346
 
347 347
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:18
348
-	__( 'Move Datetime to Trash?', 'event_espresso' ),
348
+	__('Move Datetime to Trash?', 'event_espresso'),
349 349
 
350 350
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:20
351
-	__( 'Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso' ),
351
+	__('Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso'),
352 352
 
353 353
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:23
354
-	__( 'Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso' ),
354
+	__('Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso'),
355 355
 
356 356
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:33
357
-	__( 'delete', 'event_espresso' ),
357
+	__('delete', 'event_espresso'),
358 358
 
359 359
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:36
360 360
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:42
361 361
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:43
362
-	__( 'bulk actions', 'event_espresso' ),
362
+	__('bulk actions', 'event_espresso'),
363 363
 
364 364
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:40
365
-	__( 'edit datetime details', 'event_espresso' ),
365
+	__('edit datetime details', 'event_espresso'),
366 366
 
367 367
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:44
368
-	__( 'delete datetimes', 'event_espresso' ),
368
+	__('delete datetimes', 'event_espresso'),
369 369
 
370 370
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:44
371
-	__( 'trash datetimes', 'event_espresso' ),
371
+	__('trash datetimes', 'event_espresso'),
372 372
 
373 373
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:14
374
-	__( 'Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso' ),
374
+	__('Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso'),
375 375
 
376 376
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:15
377
-	__( 'Are you sure you want to trash these datetimes?', 'event_espresso' ),
377
+	__('Are you sure you want to trash these datetimes?', 'event_espresso'),
378 378
 
379 379
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:16
380
-	__( 'Delete datetimes permanently', 'event_espresso' ),
380
+	__('Delete datetimes permanently', 'event_espresso'),
381 381
 
382 382
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:16
383
-	__( 'Trash datetimes', 'event_espresso' ),
383
+	__('Trash datetimes', 'event_espresso'),
384 384
 
385 385
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:21
386
-	__( 'Bulk edit date details', 'event_espresso' ),
386
+	__('Bulk edit date details', 'event_espresso'),
387 387
 
388 388
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:22
389
-	__( 'any changes will be applied to ALL of the selected dates.', 'event_espresso' ),
389
+	__('any changes will be applied to ALL of the selected dates.', 'event_espresso'),
390 390
 
391 391
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/formValidation.ts:12
392 392
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/formValidation.ts:12
393
-	__( 'Name must be at least three characters', 'event_espresso' ),
393
+	__('Name must be at least three characters', 'event_espresso'),
394 394
 
395 395
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:66
396 396
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:66
397
-	__( 'Shift dates', 'event_espresso' ),
397
+	__('Shift dates', 'event_espresso'),
398 398
 
399 399
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:91
400 400
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:90
401
-	__( 'earlier', 'event_espresso' ),
401
+	__('earlier', 'event_espresso'),
402 402
 
403 403
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:95
404 404
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:94
405
-	__( 'later', 'event_espresso' ),
405
+	__('later', 'event_espresso'),
406 406
 
407 407
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCapacity.tsx:31
408 408
 	/* translators: click to edit capacity<linebreak>(registration limit)… */
409
-	__( 'click to edit capacity%s(registration limit)…', 'event_espresso' ),
409
+	__('click to edit capacity%s(registration limit)…', 'event_espresso'),
410 410
 
411 411
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:31
412 412
 	// Reference: packages/ee-components/src/SimpleTicketCard/SimpleTicketCard.tsx:27
413 413
 	// Reference: packages/ui-components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:34
414
-	__( 'starts', 'event_espresso' ),
414
+	__('starts', 'event_espresso'),
415 415
 
416 416
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
417 417
 	// Reference: packages/ee-components/src/SimpleTicketCard/SimpleTicketCard.tsx:34
418 418
 	// Reference: packages/ui-components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:47
419
-	__( 'ends', 'event_espresso' ),
419
+	__('ends', 'event_espresso'),
420 420
 
421 421
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
422
-	__( 'started', 'event_espresso' ),
422
+	__('started', 'event_espresso'),
423 423
 
424 424
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
425
-	__( 'ended', 'event_espresso' ),
425
+	__('ended', 'event_espresso'),
426 426
 
427 427
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:46
428
-	__( 'Edit Event Date', 'event_espresso' ),
428
+	__('Edit Event Date', 'event_espresso'),
429 429
 
430 430
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:50
431
-	__( 'edit start and end dates', 'event_espresso' ),
431
+	__('edit start and end dates', 'event_espresso'),
432 432
 
433 433
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:16
434 434
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:16
435
-	__( 'sold', 'event_espresso' ),
435
+	__('sold', 'event_espresso'),
436 436
 
437 437
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:21
438
-	__( 'capacity', 'event_espresso' ),
438
+	__('capacity', 'event_espresso'),
439 439
 
440 440
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:27
441 441
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:26
442
-	__( 'reg list', 'event_espresso' ),
442
+	__('reg list', 'event_espresso'),
443 443
 
444 444
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:43
445 445
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:35
446
-	__( 'add description…', 'event_espresso' ),
446
+	__('add description…', 'event_espresso'),
447 447
 
448 448
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:44
449 449
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:36
450
-	__( 'Edit description', 'event_espresso' ),
450
+	__('Edit description', 'event_espresso'),
451 451
 
452 452
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:45
453 453
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:37
454
-	__( 'click to edit description…', 'event_espresso' ),
454
+	__('click to edit description…', 'event_espresso'),
455 455
 
456 456
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:10
457
-	__( 'Move Date to Trash', 'event_espresso' ),
457
+	__('Move Date to Trash', 'event_espresso'),
458 458
 
459 459
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:13
460 460
 	// Reference: packages/constants/src/datetime.ts:6
461
-	__( 'Active', 'event_espresso' ),
461
+	__('Active', 'event_espresso'),
462 462
 
463 463
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:14
464 464
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:13
465
-	__( 'Trashed', 'event_espresso' ),
465
+	__('Trashed', 'event_espresso'),
466 466
 
467 467
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:15
468 468
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:14
469 469
 	// Reference: packages/constants/src/datetime.ts:8
470
-	__( 'Expired', 'event_espresso' ),
470
+	__('Expired', 'event_espresso'),
471 471
 
472 472
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:16
473 473
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:16
474
-	__( 'Sold Out', 'event_espresso' ),
474
+	__('Sold Out', 'event_espresso'),
475 475
 
476 476
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:17
477 477
 	// Reference: packages/constants/src/datetime.ts:12
478
-	__( 'Upcoming', 'event_espresso' ),
478
+	__('Upcoming', 'event_espresso'),
479 479
 
480 480
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:7
481
-	__( 'Edit Event Date Details', 'event_espresso' ),
481
+	__('Edit Event Date Details', 'event_espresso'),
482 482
 
483 483
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:8
484
-	__( 'View Registrations for this Date', 'event_espresso' ),
484
+	__('View Registrations for this Date', 'event_espresso'),
485 485
 
486 486
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:9
487
-	__( 'Manage Ticket Assignments', 'event_espresso' ),
487
+	__('Manage Ticket Assignments', 'event_espresso'),
488 488
 
489 489
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:41
490 490
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:41
491
-	__( 'click to edit title…', 'event_espresso' ),
491
+	__('click to edit title…', 'event_espresso'),
492 492
 
493 493
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:42
494 494
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:42
495
-	__( 'add title…', 'event_espresso' ),
495
+	__('add title…', 'event_espresso'),
496 496
 
497 497
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/ActiveDatesFilters.tsx:17
498 498
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/ActiveTicketsFilters.tsx:17
499
-	__( 'ON', 'event_espresso' ),
499
+	__('ON', 'event_espresso'),
500 500
 
501 501
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:10
502
-	__( 'end dates only', 'event_espresso' ),
502
+	__('end dates only', 'event_espresso'),
503 503
 
504 504
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:11
505
-	__( 'start and end dates', 'event_espresso' ),
505
+	__('start and end dates', 'event_espresso'),
506 506
 
507 507
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:16
508
-	__( 'dates above 90% capacity', 'event_espresso' ),
508
+	__('dates above 90% capacity', 'event_espresso'),
509 509
 
510 510
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:17
511
-	__( 'dates above 75% capacity', 'event_espresso' ),
511
+	__('dates above 75% capacity', 'event_espresso'),
512 512
 
513 513
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:18
514
-	__( 'dates above 50% capacity', 'event_espresso' ),
514
+	__('dates above 50% capacity', 'event_espresso'),
515 515
 
516 516
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:19
517
-	__( 'dates below 50% capacity', 'event_espresso' ),
517
+	__('dates below 50% capacity', 'event_espresso'),
518 518
 
519 519
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:23
520
-	__( 'all dates', 'event_espresso' ),
520
+	__('all dates', 'event_espresso'),
521 521
 
522 522
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:24
523
-	__( 'all active and upcoming', 'event_espresso' ),
523
+	__('all active and upcoming', 'event_espresso'),
524 524
 
525 525
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:25
526
-	__( 'active dates only', 'event_espresso' ),
526
+	__('active dates only', 'event_espresso'),
527 527
 
528 528
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:26
529
-	__( 'upcoming dates only', 'event_espresso' ),
529
+	__('upcoming dates only', 'event_espresso'),
530 530
 
531 531
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:27
532
-	__( 'next active or upcoming only', 'event_espresso' ),
532
+	__('next active or upcoming only', 'event_espresso'),
533 533
 
534 534
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:28
535
-	__( 'sold out dates only', 'event_espresso' ),
535
+	__('sold out dates only', 'event_espresso'),
536 536
 
537 537
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:29
538
-	__( 'recently expired dates', 'event_espresso' ),
538
+	__('recently expired dates', 'event_espresso'),
539 539
 
540 540
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:30
541
-	__( 'all expired dates', 'event_espresso' ),
541
+	__('all expired dates', 'event_espresso'),
542 542
 
543 543
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:31
544
-	__( 'trashed dates only', 'event_espresso' ),
544
+	__('trashed dates only', 'event_espresso'),
545 545
 
546 546
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:35
547 547
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:9
548 548
 	// Reference: packages/dates/src/components/DateRangePicker/index.tsx:61
549
-	__( 'start date', 'event_espresso' ),
549
+	__('start date', 'event_espresso'),
550 550
 
551 551
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:36
552
-	__( 'name', 'event_espresso' ),
552
+	__('name', 'event_espresso'),
553 553
 
554 554
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:37
555 555
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:33
@@ -557,176 +557,176 @@  discard block
 block discarded – undo
557 557
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/HeaderCell.tsx:27
558 558
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:33
559 559
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:23
560
-	__( 'ID', 'event_espresso' ),
560
+	__('ID', 'event_espresso'),
561 561
 
562 562
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:38
563 563
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:47
564
-	__( 'custom order', 'event_espresso' ),
564
+	__('custom order', 'event_espresso'),
565 565
 
566 566
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:42
567 567
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:51
568
-	__( 'display', 'event_espresso' ),
568
+	__('display', 'event_espresso'),
569 569
 
570 570
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:43
571
-	__( 'recurrence', 'event_espresso' ),
571
+	__('recurrence', 'event_espresso'),
572 572
 
573 573
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:44
574 574
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:53
575
-	__( 'sales', 'event_espresso' ),
575
+	__('sales', 'event_espresso'),
576 576
 
577 577
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:45
578 578
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:55
579
-	__( 'sort by', 'event_espresso' ),
579
+	__('sort by', 'event_espresso'),
580 580
 
581 581
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:46
582 582
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:54
583 583
 	// Reference: packages/ee-components/src/EntityList/EntityListFilterBar.tsx:38
584
-	__( 'search', 'event_espresso' ),
584
+	__('search', 'event_espresso'),
585 585
 
586 586
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:47
587 587
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:56
588
-	__( 'status', 'event_espresso' ),
588
+	__('status', 'event_espresso'),
589 589
 
590 590
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:9
591
-	__( 'start dates only', 'event_espresso' ),
591
+	__('start dates only', 'event_espresso'),
592 592
 
593 593
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:26
594 594
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/NewDateModal.tsx:12
595 595
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/OptionsModalButton.tsx:18
596
-	__( 'Add New Date', 'event_espresso' ),
596
+	__('Add New Date', 'event_espresso'),
597 597
 
598 598
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:26
599
-	__( 'Add Single Date', 'event_espresso' ),
599
+	__('Add Single Date', 'event_espresso'),
600 600
 
601 601
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:44
602
-	__( 'Add a single date that only occurs once', 'event_espresso' ),
602
+	__('Add a single date that only occurs once', 'event_espresso'),
603 603
 
604 604
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:46
605
-	__( 'Single Date', 'event_espresso' ),
605
+	__('Single Date', 'event_espresso'),
606 606
 
607 607
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:108
608
-	__( 'Reg list', 'event_espresso' ),
608
+	__('Reg list', 'event_espresso'),
609 609
 
610 610
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:109
611
-	__( 'Regs', 'event_espresso' ),
611
+	__('Regs', 'event_espresso'),
612 612
 
613 613
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:124
614 614
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:123
615 615
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:59
616
-	__( 'Actions', 'event_espresso' ),
616
+	__('Actions', 'event_espresso'),
617 617
 
618 618
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:54
619
-	__( 'Start', 'event_espresso' ),
619
+	__('Start', 'event_espresso'),
620 620
 
621 621
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:68
622
-	__( 'End', 'event_espresso' ),
622
+	__('End', 'event_espresso'),
623 623
 
624 624
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:84
625
-	__( 'Cap', 'event_espresso' ),
625
+	__('Cap', 'event_espresso'),
626 626
 
627 627
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:96
628 628
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:100
629
-	__( 'Sold', 'event_espresso' ),
629
+	__('Sold', 'event_espresso'),
630 630
 
631 631
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:33
632 632
 	// Reference: packages/form-builder/src/constants.ts:67
633
-	__( 'Text Input', 'event_espresso' ),
633
+	__('Text Input', 'event_espresso'),
634 634
 
635 635
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:34
636 636
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:32
637
-	__( 'Attendee First Name', 'event_espresso' ),
637
+	__('Attendee First Name', 'event_espresso'),
638 638
 
639 639
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:39
640 640
 	/* translators: field name */
641
-	__( 'Registration form must have a field of type "%1$s" which maps to "%2$s"', 'event_espresso' ),
641
+	__('Registration form must have a field of type "%1$s" which maps to "%2$s"', 'event_espresso'),
642 642
 
643 643
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:40
644 644
 	// Reference: packages/form-builder/src/constants.ts:82
645
-	__( 'Email Address', 'event_espresso' ),
645
+	__('Email Address', 'event_espresso'),
646 646
 
647 647
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:41
648 648
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:40
649
-	__( 'Attendee Email Address', 'event_espresso' ),
649
+	__('Attendee Email Address', 'event_espresso'),
650 650
 
651 651
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:49
652
-	__( 'Please add the required fields', 'event_espresso' ),
652
+	__('Please add the required fields', 'event_espresso'),
653 653
 
654 654
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/RegistrationForm.tsx:12
655
-	__( 'Registration Form', 'event_espresso' ),
655
+	__('Registration Form', 'event_espresso'),
656 656
 
657 657
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:13
658
-	__( 'primary registrant', 'event_espresso' ),
658
+	__('primary registrant', 'event_espresso'),
659 659
 
660 660
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:17
661
-	__( 'purchaser', 'event_espresso' ),
661
+	__('purchaser', 'event_espresso'),
662 662
 
663 663
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:21
664
-	__( 'registrants', 'event_espresso' ),
664
+	__('registrants', 'event_espresso'),
665 665
 
666 666
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:36
667
-	__( 'Attendee Last Name', 'event_espresso' ),
667
+	__('Attendee Last Name', 'event_espresso'),
668 668
 
669 669
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:44
670
-	__( 'Attendee Address', 'event_espresso' ),
670
+	__('Attendee Address', 'event_espresso'),
671 671
 
672 672
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:9
673
-	__( 'all', 'event_espresso' ),
673
+	__('all', 'event_espresso'),
674 674
 
675 675
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:18
676
-	__( 'Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. 
677
-Please correct the assignments for the highlighted cells.', 'event_espresso' ),
676
+	__('Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. 
677
+Please correct the assignments for the highlighted cells.', 'event_espresso'),
678 678
 
679 679
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:22
680
-	__( 'Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. 
681
-Please correct the assignments for the highlighted cells.', 'event_espresso' ),
680
+	__('Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. 
681
+Please correct the assignments for the highlighted cells.', 'event_espresso'),
682 682
 
683 683
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:32
684
-	__( 'Please Update Assignments', 'event_espresso' ),
684
+	__('Please Update Assignments', 'event_espresso'),
685 685
 
686 686
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:26
687
-	__( 'There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso' ),
687
+	__('There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso'),
688 688
 
689 689
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:29
690
-	__( 'Alert!', 'event_espresso' ),
690
+	__('Alert!', 'event_espresso'),
691 691
 
692 692
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:42
693 693
 	/* translators: 1 entity id, 2 entity name */
694
-	__( 'Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso' ),
694
+	__('Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso'),
695 695
 
696 696
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:49
697 697
 	/* translators: 1 entity id, 2 entity name */
698
-	__( 'Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso' ),
698
+	__('Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso'),
699 699
 
700 700
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal.tsx:45
701 701
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/Table.tsx:13
702
-	__( 'Ticket Assignment Manager', 'event_espresso' ),
702
+	__('Ticket Assignment Manager', 'event_espresso'),
703 703
 
704 704
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:10
705
-	__( 'existing relation', 'event_espresso' ),
705
+	__('existing relation', 'event_espresso'),
706 706
 
707 707
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:15
708
-	__( 'remove existing relation', 'event_espresso' ),
708
+	__('remove existing relation', 'event_espresso'),
709 709
 
710 710
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:20
711
-	__( 'add new relation', 'event_espresso' ),
711
+	__('add new relation', 'event_espresso'),
712 712
 
713 713
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:25
714
-	__( 'invalid relation', 'event_espresso' ),
714
+	__('invalid relation', 'event_espresso'),
715 715
 
716 716
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:29
717
-	__( 'no relation', 'event_espresso' ),
717
+	__('no relation', 'event_espresso'),
718 718
 
719 719
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:15
720
-	__( 'Assignments', 'event_espresso' ),
720
+	__('Assignments', 'event_espresso'),
721 721
 
722 722
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:16
723
-	__( 'Event Dates are listed below', 'event_espresso' ),
723
+	__('Event Dates are listed below', 'event_espresso'),
724 724
 
725 725
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:17
726
-	__( 'Tickets are listed along the top', 'event_espresso' ),
726
+	__('Tickets are listed along the top', 'event_espresso'),
727 727
 
728 728
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:18
729
-	__( 'Click the cell buttons to toggle assigments', 'event_espresso' ),
729
+	__('Click the cell buttons to toggle assigments', 'event_espresso'),
730 730
 
731 731
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/useSubmitButtonProps.ts:29
732 732
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:16
@@ -735,1566 +735,1566 @@  discard block
 block discarded – undo
735 735
 	// Reference: packages/tpc/src/buttons/useSubmitButtonProps.tsx:29
736 736
 	// Reference: packages/ui-components/src/Modal/useSubmitButtonProps.tsx:13
737 737
 	// Reference: packages/ui-components/src/Stepper/buttons/Submit.tsx:7
738
-	__( 'Submit', 'event_espresso' ),
738
+	__('Submit', 'event_espresso'),
739 739
 
740 740
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:20
741
-	__( 'All Dates', 'event_espresso' ),
741
+	__('All Dates', 'event_espresso'),
742 742
 
743 743
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:27
744
-	__( 'dates by month', 'event_espresso' ),
744
+	__('dates by month', 'event_espresso'),
745 745
 
746 746
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowExpiredTicketsControl.tsx:16
747
-	__( 'show expired tickets', 'event_espresso' ),
747
+	__('show expired tickets', 'event_espresso'),
748 748
 
749 749
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedDatesControl.tsx:13
750
-	__( 'show trashed dates', 'event_espresso' ),
750
+	__('show trashed dates', 'event_espresso'),
751 751
 
752 752
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedTicketsControl.tsx:16
753
-	__( 'show trashed tickets', 'event_espresso' ),
753
+	__('show trashed tickets', 'event_espresso'),
754 754
 
755 755
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/Container.tsx:38
756 756
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actions/Actions.tsx:25
757
-	__( 'Default tickets', 'event_espresso' ),
757
+	__('Default tickets', 'event_espresso'),
758 758
 
759 759
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/ModalBody.tsx:63
760 760
 	// Reference: packages/edtr-services/src/constants.ts:26
761
-	__( 'ticket', 'event_espresso' ),
761
+	__('ticket', 'event_espresso'),
762 762
 
763 763
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:26
764 764
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:33
765
-	__( 'Set ticket prices', 'event_espresso' ),
765
+	__('Set ticket prices', 'event_espresso'),
766 766
 
767 767
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:31
768
-	__( 'Skip prices - Save', 'event_espresso' ),
768
+	__('Skip prices - Save', 'event_espresso'),
769 769
 
770 770
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:37
771 771
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:57
772
-	__( 'Ticket details', 'event_espresso' ),
772
+	__('Ticket details', 'event_espresso'),
773 773
 
774 774
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:38
775
-	__( 'Save', 'event_espresso' ),
775
+	__('Save', 'event_espresso'),
776 776
 
777 777
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/Modal.tsx:22
778 778
 	/* translators: %s ticket id */
779
-	__( 'Edit ticket %s', 'event_espresso' ),
779
+	__('Edit ticket %s', 'event_espresso'),
780 780
 
781 781
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/Modal.tsx:25
782 782
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:33
783
-	__( 'New Ticket Details', 'event_espresso' ),
783
+	__('New Ticket Details', 'event_espresso'),
784 784
 
785 785
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:10
786 786
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:10
787
-	__( 'primary information about the ticket', 'event_espresso' ),
787
+	__('primary information about the ticket', 'event_espresso'),
788 788
 
789 789
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:10
790 790
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:10
791
-	__( 'Ticket Details', 'event_espresso' ),
791
+	__('Ticket Details', 'event_espresso'),
792 792
 
793 793
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:12
794 794
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:12
795
-	__( 'apply ticket price modifiers and taxes', 'event_espresso' ),
795
+	__('apply ticket price modifiers and taxes', 'event_espresso'),
796 796
 
797 797
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:14
798 798
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:14
799
-	__( 'Price Calculator', 'event_espresso' ),
799
+	__('Price Calculator', 'event_espresso'),
800 800
 
801 801
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:16
802 802
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:16
803
-	__( 'Assign Dates', 'event_espresso' ),
803
+	__('Assign Dates', 'event_espresso'),
804 804
 
805 805
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:39
806
-	__( 'Skip prices - assign dates', 'event_espresso' ),
806
+	__('Skip prices - assign dates', 'event_espresso'),
807 807
 
808 808
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:50
809
-	__( 'Save and assign dates', 'event_espresso' ),
809
+	__('Save and assign dates', 'event_espresso'),
810 810
 
811 811
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:29
812 812
 	/* translators: %1$s ticket name, %2$s ticket id */
813
-	__( 'Edit ticket "%1$s" - %2$s', 'event_espresso' ),
813
+	__('Edit ticket "%1$s" - %2$s', 'event_espresso'),
814 814
 
815 815
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:43
816
-	__( 'modal for ticket', 'event_espresso' ),
816
+	__('modal for ticket', 'event_espresso'),
817 817
 
818 818
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:101
819
-	__( 'The maximum number of this ticket available for sale.', 'event_espresso' ),
819
+	__('The maximum number of this ticket available for sale.', 'event_espresso'),
820 820
 
821 821
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:103
822
-	__( 'Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso' ),
822
+	__('Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso'),
823 823
 
824 824
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:114
825 825
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:119
826
-	__( 'Number of Uses', 'event_espresso' ),
826
+	__('Number of Uses', 'event_espresso'),
827 827
 
828 828
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:120
829
-	__( 'Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso' ),
829
+	__('Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso'),
830 830
 
831 831
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:124
832
-	__( 'Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso' ),
832
+	__('Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso'),
833 833
 
834 834
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:132
835 835
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:127
836
-	__( 'Minimum Quantity', 'event_espresso' ),
836
+	__('Minimum Quantity', 'event_espresso'),
837 837
 
838 838
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:137
839
-	__( 'The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ),
839
+	__('The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'),
840 840
 
841 841
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:141
842
-	__( 'Leave blank for no minimum.', 'event_espresso' ),
842
+	__('Leave blank for no minimum.', 'event_espresso'),
843 843
 
844 844
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:147
845 845
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:135
846
-	__( 'Maximum Quantity', 'event_espresso' ),
846
+	__('Maximum Quantity', 'event_espresso'),
847 847
 
848 848
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:153
849
-	__( 'The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ),
849
+	__('The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'),
850 850
 
851 851
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:157
852
-	__( 'Leave blank for no maximum.', 'event_espresso' ),
852
+	__('Leave blank for no maximum.', 'event_espresso'),
853 853
 
854 854
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:163
855 855
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:144
856
-	__( 'Required Ticket', 'event_espresso' ),
856
+	__('Required Ticket', 'event_espresso'),
857 857
 
858 858
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:165
859
-	__( 'If enabled, the ticket must be selected and will appear first in ticket lists.', 'event_espresso' ),
859
+	__('If enabled, the ticket must be selected and will appear first in ticket lists.', 'event_espresso'),
860 860
 
861 861
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:177
862
-	__( 'Visibility', 'event_espresso' ),
862
+	__('Visibility', 'event_espresso'),
863 863
 
864 864
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:211
865
-	__( 'Ticket Sales', 'event_espresso' ),
865
+	__('Ticket Sales', 'event_espresso'),
866 866
 
867 867
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:95
868 868
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:110
869
-	__( 'Quantity For Sale', 'event_espresso' ),
869
+	__('Quantity For Sale', 'event_espresso'),
870 870
 
871 871
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketRegistrationsLink.tsx:13
872
-	__( 'total registrations.', 'event_espresso' ),
872
+	__('total registrations.', 'event_espresso'),
873 873
 
874 874
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketRegistrationsLink.tsx:14
875
-	__( 'view ALL registrations for this ticket.', 'event_espresso' ),
875
+	__('view ALL registrations for this ticket.', 'event_espresso'),
876 876
 
877 877
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketSoldLink.tsx:13
878
-	__( 'view approved registrations for this ticket.', 'event_espresso' ),
878
+	__('view approved registrations for this ticket.', 'event_espresso'),
879 879
 
880 880
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:36
881
-	__( 'Available Tickets', 'event_espresso' ),
881
+	__('Available Tickets', 'event_espresso'),
882 882
 
883 883
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:39
884
-	__( 'loading tickets…', 'event_espresso' ),
884
+	__('loading tickets…', 'event_espresso'),
885 885
 
886 886
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:26
887
-	__( 'Number of related dates', 'event_espresso' ),
887
+	__('Number of related dates', 'event_espresso'),
888 888
 
889 889
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:27
890
-	__( 'There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso' ),
890
+	__('There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso'),
891 891
 
892 892
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:37
893
-	__( 'assign dates', 'event_espresso' ),
893
+	__('assign dates', 'event_espresso'),
894 894
 
895 895
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:19
896
-	__( 'Permanently Delete Ticket?', 'event_espresso' ),
896
+	__('Permanently Delete Ticket?', 'event_espresso'),
897 897
 
898 898
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:19
899
-	__( 'Move Ticket to Trash?', 'event_espresso' ),
899
+	__('Move Ticket to Trash?', 'event_espresso'),
900 900
 
901 901
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:22
902
-	__( 'Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso' ),
902
+	__('Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso'),
903 903
 
904 904
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:48
905 905
 	// Reference: packages/ee-components/src/SimpleTicketCard/actions/Trash.tsx:6
906
-	__( 'trash ticket', 'event_espresso' ),
906
+	__('trash ticket', 'event_espresso'),
907 907
 
908 908
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:25
909
-	__( 'ticket main menu', 'event_espresso' ),
909
+	__('ticket main menu', 'event_espresso'),
910 910
 
911 911
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:38
912 912
 	// Reference: packages/ee-components/src/SimpleTicketCard/actions/Edit.tsx:15
913
-	__( 'edit ticket', 'event_espresso' ),
913
+	__('edit ticket', 'event_espresso'),
914 914
 
915 915
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:39
916
-	__( 'copy ticket', 'event_espresso' ),
916
+	__('copy ticket', 'event_espresso'),
917 917
 
918 918
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:46
919
-	__( 'edit ticket details', 'event_espresso' ),
919
+	__('edit ticket details', 'event_espresso'),
920 920
 
921 921
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:50
922
-	__( 'delete tickets', 'event_espresso' ),
922
+	__('delete tickets', 'event_espresso'),
923 923
 
924 924
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:50
925
-	__( 'trash tickets', 'event_espresso' ),
925
+	__('trash tickets', 'event_espresso'),
926 926
 
927 927
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:54
928
-	__( 'edit ticket prices', 'event_espresso' ),
928
+	__('edit ticket prices', 'event_espresso'),
929 929
 
930 930
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:14
931
-	__( 'Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso' ),
931
+	__('Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso'),
932 932
 
933 933
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:15
934
-	__( 'Are you sure you want to trash these tickets?', 'event_espresso' ),
934
+	__('Are you sure you want to trash these tickets?', 'event_espresso'),
935 935
 
936 936
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:16
937
-	__( 'Delete tickets permanently', 'event_espresso' ),
937
+	__('Delete tickets permanently', 'event_espresso'),
938 938
 
939 939
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:16
940
-	__( 'Trash tickets', 'event_espresso' ),
940
+	__('Trash tickets', 'event_espresso'),
941 941
 
942 942
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:21
943
-	__( 'Bulk edit ticket details', 'event_espresso' ),
943
+	__('Bulk edit ticket details', 'event_espresso'),
944 944
 
945 945
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:22
946
-	__( 'any changes will be applied to ALL of the selected tickets.', 'event_espresso' ),
946
+	__('any changes will be applied to ALL of the selected tickets.', 'event_espresso'),
947 947
 
948 948
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/EditPrices.tsx:19
949
-	__( 'Bulk edit ticket prices', 'event_espresso' ),
949
+	__('Bulk edit ticket prices', 'event_espresso'),
950 950
 
951 951
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:20
952
-	__( 'Edit all prices together', 'event_espresso' ),
952
+	__('Edit all prices together', 'event_espresso'),
953 953
 
954 954
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:21
955
-	__( 'Edit all the selected ticket prices dynamically', 'event_espresso' ),
955
+	__('Edit all the selected ticket prices dynamically', 'event_espresso'),
956 956
 
957 957
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:25
958
-	__( 'Edit prices individually', 'event_espresso' ),
958
+	__('Edit prices individually', 'event_espresso'),
959 959
 
960 960
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:26
961
-	__( 'Edit prices for each ticket individually', 'event_espresso' ),
961
+	__('Edit prices for each ticket individually', 'event_espresso'),
962 962
 
963 963
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:14
964 964
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:34
965 965
 	// Reference: packages/form/src/ResetButton.tsx:18
966 966
 	// Reference: packages/tpc/src/buttons/useResetButtonProps.tsx:12
967
-	__( 'Reset', 'event_espresso' ),
967
+	__('Reset', 'event_espresso'),
968 968
 
969 969
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:15
970 970
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:76
971 971
 	// Reference: packages/ui-components/src/Modal/useCancelButtonProps.tsx:10
972
-	__( 'Cancel', 'event_espresso' ),
972
+	__('Cancel', 'event_espresso'),
973 973
 
974 974
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/editSeparately/TPCInstance.tsx:26
975 975
 	/* translators: %s ticket name */
976
-	__( 'Edit prices for Ticket: %s', 'event_espresso' ),
976
+	__('Edit prices for Ticket: %s', 'event_espresso'),
977 977
 
978 978
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:30
979
-	__( 'sales start', 'event_espresso' ),
979
+	__('sales start', 'event_espresso'),
980 980
 
981 981
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:33
982
-	__( 'sales began', 'event_espresso' ),
982
+	__('sales began', 'event_espresso'),
983 983
 
984 984
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:35
985
-	__( 'sales ended', 'event_espresso' ),
985
+	__('sales ended', 'event_espresso'),
986 986
 
987 987
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:36
988
-	__( 'sales end', 'event_espresso' ),
988
+	__('sales end', 'event_espresso'),
989 989
 
990 990
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:50
991
-	__( 'Edit Ticket Sale Dates', 'event_espresso' ),
991
+	__('Edit Ticket Sale Dates', 'event_espresso'),
992 992
 
993 993
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:54
994
-	__( 'edit ticket sales start and end dates', 'event_espresso' ),
994
+	__('edit ticket sales start and end dates', 'event_espresso'),
995 995
 
996 996
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:21
997
-	__( 'quantity', 'event_espresso' ),
997
+	__('quantity', 'event_espresso'),
998 998
 
999 999
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:28
1000 1000
 	// Reference: packages/edtr-services/src/apollo/mutations/tickets/useUpdateTicketQtyByCapacity.ts:78
1001
-	__( 'Ticket quantity has been adjusted because it cannot be more than the related event date capacity.', 'event_espresso' ),
1001
+	__('Ticket quantity has been adjusted because it cannot be more than the related event date capacity.', 'event_espresso'),
1002 1002
 
1003 1003
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:51
1004
-	__( 'edit quantity of tickets available…', 'event_espresso' ),
1004
+	__('edit quantity of tickets available…', 'event_espresso'),
1005 1005
 
1006 1006
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:10
1007
-	__( 'Move Ticket to Trash', 'event_espresso' ),
1007
+	__('Move Ticket to Trash', 'event_espresso'),
1008 1008
 
1009 1009
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:15
1010 1010
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:54
1011
-	__( 'On Sale', 'event_espresso' ),
1011
+	__('On Sale', 'event_espresso'),
1012 1012
 
1013 1013
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:17
1014
-	__( 'Pending', 'event_espresso' ),
1014
+	__('Pending', 'event_espresso'),
1015 1015
 
1016 1016
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:7
1017
-	__( 'Edit Ticket Details', 'event_espresso' ),
1017
+	__('Edit Ticket Details', 'event_espresso'),
1018 1018
 
1019 1019
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:8
1020
-	__( 'Manage Date Assignments', 'event_espresso' ),
1020
+	__('Manage Date Assignments', 'event_espresso'),
1021 1021
 
1022 1022
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:9
1023 1023
 	// Reference: packages/tpc/src/components/table/Table.tsx:43
1024
-	__( 'Ticket Price Calculator', 'event_espresso' ),
1024
+	__('Ticket Price Calculator', 'event_espresso'),
1025 1025
 
1026 1026
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:39
1027
-	__( 'edit ticket total…', 'event_espresso' ),
1027
+	__('edit ticket total…', 'event_espresso'),
1028 1028
 
1029 1029
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:53
1030
-	__( 'set price…', 'event_espresso' ),
1030
+	__('set price…', 'event_espresso'),
1031 1031
 
1032 1032
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:23
1033
-	__( 'tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso' ),
1033
+	__('tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso'),
1034 1034
 
1035 1035
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:24
1036
-	__( 'tickets list is unlinked and is showing tickets for all event dates', 'event_espresso' ),
1036
+	__('tickets list is unlinked and is showing tickets for all event dates', 'event_espresso'),
1037 1037
 
1038 1038
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:10
1039
-	__( 'ticket sales start and end dates', 'event_espresso' ),
1039
+	__('ticket sales start and end dates', 'event_espresso'),
1040 1040
 
1041 1041
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:15
1042
-	__( 'tickets with 90% or more sold', 'event_espresso' ),
1042
+	__('tickets with 90% or more sold', 'event_espresso'),
1043 1043
 
1044 1044
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:16
1045
-	__( 'tickets with 75% or more sold', 'event_espresso' ),
1045
+	__('tickets with 75% or more sold', 'event_espresso'),
1046 1046
 
1047 1047
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:17
1048
-	__( 'tickets with 50% or more sold', 'event_espresso' ),
1048
+	__('tickets with 50% or more sold', 'event_espresso'),
1049 1049
 
1050 1050
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:19
1051
-	__( 'tickets with less than 50% sold', 'event_espresso' ),
1051
+	__('tickets with less than 50% sold', 'event_espresso'),
1052 1052
 
1053 1053
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:28
1054
-	__( 'all tickets for all dates', 'event_espresso' ),
1054
+	__('all tickets for all dates', 'event_espresso'),
1055 1055
 
1056 1056
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:29
1057
-	__( 'all on sale and sale pending', 'event_espresso' ),
1057
+	__('all on sale and sale pending', 'event_espresso'),
1058 1058
 
1059 1059
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:30
1060
-	__( 'on sale tickets only', 'event_espresso' ),
1060
+	__('on sale tickets only', 'event_espresso'),
1061 1061
 
1062 1062
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:31
1063
-	__( 'sale pending tickets only', 'event_espresso' ),
1063
+	__('sale pending tickets only', 'event_espresso'),
1064 1064
 
1065 1065
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:32
1066
-	__( 'next on sale or sale pending only', 'event_espresso' ),
1066
+	__('next on sale or sale pending only', 'event_espresso'),
1067 1067
 
1068 1068
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:33
1069
-	__( 'sold out tickets only', 'event_espresso' ),
1069
+	__('sold out tickets only', 'event_espresso'),
1070 1070
 
1071 1071
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:34
1072
-	__( 'expired tickets only', 'event_espresso' ),
1072
+	__('expired tickets only', 'event_espresso'),
1073 1073
 
1074 1074
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:35
1075
-	__( 'trashed tickets only', 'event_espresso' ),
1075
+	__('trashed tickets only', 'event_espresso'),
1076 1076
 
1077 1077
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:40
1078
-	__( 'all tickets for above dates', 'event_espresso' ),
1078
+	__('all tickets for above dates', 'event_espresso'),
1079 1079
 
1080 1080
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:44
1081
-	__( 'ticket sale date', 'event_espresso' ),
1081
+	__('ticket sale date', 'event_espresso'),
1082 1082
 
1083 1083
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:45
1084
-	__( 'ticket name', 'event_espresso' ),
1084
+	__('ticket name', 'event_espresso'),
1085 1085
 
1086 1086
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:46
1087
-	__( 'ticket ID', 'event_espresso' ),
1087
+	__('ticket ID', 'event_espresso'),
1088 1088
 
1089 1089
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:52
1090
-	__( 'linked', 'event_espresso' ),
1090
+	__('linked', 'event_espresso'),
1091 1091
 
1092 1092
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:8
1093
-	__( 'ticket sales start date only', 'event_espresso' ),
1093
+	__('ticket sales start date only', 'event_espresso'),
1094 1094
 
1095 1095
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:9
1096
-	__( 'ticket sales end date only', 'event_espresso' ),
1096
+	__('ticket sales end date only', 'event_espresso'),
1097 1097
 
1098 1098
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:18
1099
-	__( 'Add New Ticket', 'event_espresso' ),
1099
+	__('Add New Ticket', 'event_espresso'),
1100 1100
 
1101 1101
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:32
1102
-	__( 'Add a single ticket and assign the dates to it', 'event_espresso' ),
1102
+	__('Add a single ticket and assign the dates to it', 'event_espresso'),
1103 1103
 
1104 1104
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:34
1105
-	__( 'Single Ticket', 'event_espresso' ),
1105
+	__('Single Ticket', 'event_espresso'),
1106 1106
 
1107 1107
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/TableView.tsx:39
1108
-	__( 'Tickets', 'event_espresso' ),
1108
+	__('Tickets', 'event_espresso'),
1109 1109
 
1110 1110
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:110
1111
-	__( 'Reg List', 'event_espresso' ),
1111
+	__('Reg List', 'event_espresso'),
1112 1112
 
1113 1113
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:53
1114
-	__( 'Goes on Sale', 'event_espresso' ),
1114
+	__('Goes on Sale', 'event_espresso'),
1115 1115
 
1116 1116
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:67
1117
-	__( 'Sale Ends', 'event_espresso' ),
1117
+	__('Sale Ends', 'event_espresso'),
1118 1118
 
1119 1119
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:68
1120
-	__( 'Ends', 'event_espresso' ),
1120
+	__('Ends', 'event_espresso'),
1121 1121
 
1122 1122
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:80
1123
-	__( 'Price', 'event_espresso' ),
1123
+	__('Price', 'event_espresso'),
1124 1124
 
1125 1125
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:90
1126
-	__( 'Qty', 'event_espresso' ),
1126
+	__('Qty', 'event_espresso'),
1127 1127
 
1128 1128
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:104
1129
-	__( 'Venue telephone', 'event_espresso' ),
1129
+	__('Venue telephone', 'event_espresso'),
1130 1130
 
1131 1131
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:111
1132
-	__( 'Edit this Venue', 'event_espresso' ),
1132
+	__('Edit this Venue', 'event_espresso'),
1133 1133
 
1134 1134
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:120
1135
-	__( 'Select a Venue for the Event', 'event_espresso' ),
1135
+	__('Select a Venue for the Event', 'event_espresso'),
1136 1136
 
1137 1137
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:21
1138
-	__( 'Venue Details', 'event_espresso' ),
1138
+	__('Venue Details', 'event_espresso'),
1139 1139
 
1140 1140
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:39
1141
-	__( 'unlimited space', 'event_espresso' ),
1141
+	__('unlimited space', 'event_espresso'),
1142 1142
 
1143 1143
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:42
1144 1144
 	/* translators: %d venue capacity */
1145
-	__( 'Space for up to %d people', 'event_espresso' ),
1145
+	__('Space for up to %d people', 'event_espresso'),
1146 1146
 
1147 1147
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:53
1148
-	__( 'Venue address', 'event_espresso' ),
1148
+	__('Venue address', 'event_espresso'),
1149 1149
 
1150 1150
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:59
1151
-	__( 'Venue Details card', 'event_espresso' ),
1151
+	__('Venue Details card', 'event_espresso'),
1152 1152
 
1153 1153
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:68
1154
-	__( 'no image', 'event_espresso' ),
1154
+	__('no image', 'event_espresso'),
1155 1155
 
1156 1156
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:72
1157
-	__( 'Venue name', 'event_espresso' ),
1157
+	__('Venue name', 'event_espresso'),
1158 1158
 
1159 1159
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:96
1160
-	__( 'Venue capacity', 'event_espresso' ),
1160
+	__('Venue capacity', 'event_espresso'),
1161 1161
 
1162 1162
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:29
1163
-	__( 'Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso' ),
1163
+	__('Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso'),
1164 1164
 
1165 1165
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:40
1166
-	__( 'Skip', 'event_espresso' ),
1166
+	__('Skip', 'event_espresso'),
1167 1167
 
1168 1168
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:42
1169
-	__( 'Sure I\'ll help', 'event_espresso' ),
1169
+	__('Sure I\'ll help', 'event_espresso'),
1170 1170
 
1171 1171
 	// Reference: packages/adapters/src/Pagination/Pagination.tsx:23
1172
-	__( 'pagination', 'event_espresso' ),
1172
+	__('pagination', 'event_espresso'),
1173 1173
 
1174 1174
 	// Reference: packages/adapters/src/TagSelector/TagSelector.tsx:113
1175
-	__( 'toggle menu', 'event_espresso' ),
1175
+	__('toggle menu', 'event_espresso'),
1176 1176
 
1177 1177
 	// Reference: packages/constants/src/datetime.ts:10
1178
-	__( 'Postponed', 'event_espresso' ),
1178
+	__('Postponed', 'event_espresso'),
1179 1179
 
1180 1180
 	// Reference: packages/constants/src/datetime.ts:11
1181
-	__( 'SoldOut', 'event_espresso' ),
1181
+	__('SoldOut', 'event_espresso'),
1182 1182
 
1183 1183
 	// Reference: packages/constants/src/datetime.ts:7
1184 1184
 	// Reference: packages/predicates/src/registration/statusOptions.ts:11
1185
-	__( 'Cancelled', 'event_espresso' ),
1185
+	__('Cancelled', 'event_espresso'),
1186 1186
 
1187 1187
 	// Reference: packages/constants/src/datetime.ts:9
1188
-	__( 'Inactive', 'event_espresso' ),
1188
+	__('Inactive', 'event_espresso'),
1189 1189
 
1190 1190
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:25
1191
-	__( 'error creating %s', 'event_espresso' ),
1191
+	__('error creating %s', 'event_espresso'),
1192 1192
 
1193 1193
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:26
1194
-	__( 'error deleting %s', 'event_espresso' ),
1194
+	__('error deleting %s', 'event_espresso'),
1195 1195
 
1196 1196
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:27
1197
-	__( 'error updating %s', 'event_espresso' ),
1197
+	__('error updating %s', 'event_espresso'),
1198 1198
 
1199 1199
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:28
1200
-	__( 'creating %s', 'event_espresso' ),
1200
+	__('creating %s', 'event_espresso'),
1201 1201
 
1202 1202
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:29
1203
-	__( 'deleting %s', 'event_espresso' ),
1203
+	__('deleting %s', 'event_espresso'),
1204 1204
 
1205 1205
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:30
1206
-	__( 'updating %s', 'event_espresso' ),
1206
+	__('updating %s', 'event_espresso'),
1207 1207
 
1208 1208
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:31
1209
-	__( 'successfully created %s', 'event_espresso' ),
1209
+	__('successfully created %s', 'event_espresso'),
1210 1210
 
1211 1211
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:32
1212
-	__( 'successfully deleted %s', 'event_espresso' ),
1212
+	__('successfully deleted %s', 'event_espresso'),
1213 1213
 
1214 1214
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:33
1215
-	__( 'successfully updated %s', 'event_espresso' ),
1215
+	__('successfully updated %s', 'event_espresso'),
1216 1216
 
1217 1217
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:13
1218
-	__( 'day in range', 'event_espresso' ),
1218
+	__('day in range', 'event_espresso'),
1219 1219
 
1220 1220
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:17
1221 1221
 	// Reference: packages/dates/src/components/DateRangePicker/index.tsx:79
1222
-	__( 'end date', 'event_espresso' ),
1222
+	__('end date', 'event_espresso'),
1223 1223
 
1224 1224
 	// Reference: packages/dates/src/components/DateTimePicker.tsx:17
1225 1225
 	// Reference: packages/dates/src/components/TimePicker.tsx:17
1226 1226
 	// Reference: packages/form-builder/src/state/utils.ts:433
1227
-	__( 'time', 'event_espresso' ),
1227
+	__('time', 'event_espresso'),
1228 1228
 
1229 1229
 	// Reference: packages/dates/src/constants.ts:7
1230
-	__( 'End Date & Time must be set later than the Start Date & Time', 'event_espresso' ),
1230
+	__('End Date & Time must be set later than the Start Date & Time', 'event_espresso'),
1231 1231
 
1232 1232
 	// Reference: packages/dates/src/constants.ts:9
1233
-	__( 'Start Date & Time must be set before the End Date & Time', 'event_espresso' ),
1233
+	__('Start Date & Time must be set before the End Date & Time', 'event_espresso'),
1234 1234
 
1235 1235
 	// Reference: packages/dates/src/utils/misc.ts:16
1236
-	__( 'month(s)', 'event_espresso' ),
1236
+	__('month(s)', 'event_espresso'),
1237 1237
 
1238 1238
 	// Reference: packages/dates/src/utils/misc.ts:17
1239
-	__( 'week(s)', 'event_espresso' ),
1239
+	__('week(s)', 'event_espresso'),
1240 1240
 
1241 1241
 	// Reference: packages/dates/src/utils/misc.ts:18
1242
-	__( 'day(s)', 'event_espresso' ),
1242
+	__('day(s)', 'event_espresso'),
1243 1243
 
1244 1244
 	// Reference: packages/dates/src/utils/misc.ts:19
1245
-	__( 'hour(s)', 'event_espresso' ),
1245
+	__('hour(s)', 'event_espresso'),
1246 1246
 
1247 1247
 	// Reference: packages/dates/src/utils/misc.ts:20
1248
-	__( 'minute(s)', 'event_espresso' ),
1248
+	__('minute(s)', 'event_espresso'),
1249 1249
 
1250 1250
 	// Reference: packages/edtr-services/src/apollo/mutations/useReorderEntities.ts:63
1251
-	__( 'order updated', 'event_espresso' ),
1251
+	__('order updated', 'event_espresso'),
1252 1252
 
1253 1253
 	// Reference: packages/edtr-services/src/constants.ts:24
1254
-	__( 'datetime', 'event_espresso' ),
1254
+	__('datetime', 'event_espresso'),
1255 1255
 
1256 1256
 	// Reference: packages/edtr-services/src/constants.ts:27
1257
-	__( 'price', 'event_espresso' ),
1257
+	__('price', 'event_espresso'),
1258 1258
 
1259 1259
 	// Reference: packages/edtr-services/src/constants.ts:28
1260 1260
 	// Reference: packages/tpc/src/inputs/PriceTypeInput.tsx:20
1261
-	__( 'price type', 'event_espresso' ),
1261
+	__('price type', 'event_espresso'),
1262 1262
 
1263 1263
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:38
1264 1264
 	// Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:39
1265
-	__( 'End date has been adjusted', 'event_espresso' ),
1265
+	__('End date has been adjusted', 'event_espresso'),
1266 1266
 
1267 1267
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:59
1268
-	__( 'Required', 'event_espresso' ),
1268
+	__('Required', 'event_espresso'),
1269 1269
 
1270 1270
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:64
1271
-	__( 'Start Date is required', 'event_espresso' ),
1271
+	__('Start Date is required', 'event_espresso'),
1272 1272
 
1273 1273
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:68
1274
-	__( 'End Date is required', 'event_espresso' ),
1274
+	__('End Date is required', 'event_espresso'),
1275 1275
 
1276 1276
 	// Reference: packages/ee-components/src/EntityList/EntityList.tsx:30
1277
-	__( 'no results found', 'event_espresso' ),
1277
+	__('no results found', 'event_espresso'),
1278 1278
 
1279 1279
 	// Reference: packages/ee-components/src/EntityList/EntityList.tsx:31
1280
-	__( 'try changing filter settings', 'event_espresso' ),
1280
+	__('try changing filter settings', 'event_espresso'),
1281 1281
 
1282 1282
 	// Reference: packages/ee-components/src/bulkEdit/ActionCheckbox.tsx:38
1283 1283
 	/* translators: %d entity id */
1284
-	__( 'select entity with id %d', 'event_espresso' ),
1284
+	__('select entity with id %d', 'event_espresso'),
1285 1285
 
1286 1286
 	// Reference: packages/ee-components/src/bulkEdit/ActionCheckbox.tsx:41
1287
-	__( 'select all entities', 'event_espresso' ),
1287
+	__('select all entities', 'event_espresso'),
1288 1288
 
1289 1289
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:20
1290
-	__( 'Note: ', 'event_espresso' ),
1290
+	__('Note: ', 'event_espresso'),
1291 1291
 
1292 1292
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:20
1293
-	__( 'any changes will be applied to ALL of the selected entities.', 'event_espresso' ),
1293
+	__('any changes will be applied to ALL of the selected entities.', 'event_espresso'),
1294 1294
 
1295 1295
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:27
1296
-	__( 'Bulk edit details', 'event_espresso' ),
1296
+	__('Bulk edit details', 'event_espresso'),
1297 1297
 
1298 1298
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:17
1299
-	__( 'Are you sure you want to bulk update the details?', 'event_espresso' ),
1299
+	__('Are you sure you want to bulk update the details?', 'event_espresso'),
1300 1300
 
1301 1301
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:18
1302
-	__( 'Bulk update details', 'event_espresso' ),
1302
+	__('Bulk update details', 'event_espresso'),
1303 1303
 
1304 1304
 	// Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:26
1305
-	__( 'set order', 'event_espresso' ),
1305
+	__('set order', 'event_espresso'),
1306 1306
 
1307 1307
 	// Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:28
1308
-	__( 'Set Custom Dates Order - this is how dates are ordered on the frontend', 'event_espresso' ),
1308
+	__('Set Custom Dates Order - this is how dates are ordered on the frontend', 'event_espresso'),
1309 1309
 
1310 1310
 	// Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:29
1311
-	__( 'Set Custom Tickets Order - this is how tickets are ordered on the frontend', 'event_espresso' ),
1311
+	__('Set Custom Tickets Order - this is how tickets are ordered on the frontend', 'event_espresso'),
1312 1312
 
1313 1313
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:32
1314
-	__( 'delete form element', 'event_espresso' ),
1314
+	__('delete form element', 'event_espresso'),
1315 1315
 
1316 1316
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:49
1317
-	__( 'form element settings', 'event_espresso' ),
1317
+	__('form element settings', 'event_espresso'),
1318 1318
 
1319 1319
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:59
1320
-	__( 'copy form element', 'event_espresso' ),
1320
+	__('copy form element', 'event_espresso'),
1321 1321
 
1322 1322
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:69
1323
-	__( 'click, hold, and drag to reorder form element', 'event_espresso' ),
1323
+	__('click, hold, and drag to reorder form element', 'event_espresso'),
1324 1324
 
1325 1325
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:20
1326
-	__( 'remove option', 'event_espresso' ),
1326
+	__('remove option', 'event_espresso'),
1327 1327
 
1328 1328
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:42
1329
-	__( 'value', 'event_espresso' ),
1329
+	__('value', 'event_espresso'),
1330 1330
 
1331 1331
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:52
1332
-	__( 'label', 'event_espresso' ),
1332
+	__('label', 'event_espresso'),
1333 1333
 
1334 1334
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:63
1335
-	__( 'click, hold, and drag to reorder field option', 'event_espresso' ),
1335
+	__('click, hold, and drag to reorder field option', 'event_espresso'),
1336 1336
 
1337 1337
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:61
1338
-	__( 'Options are the choices you give people to select from.', 'event_espresso' ),
1338
+	__('Options are the choices you give people to select from.', 'event_espresso'),
1339 1339
 
1340 1340
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:63
1341
-	__( 'The value is a simple key that will be saved to the database and the label is what is shown to the user.', 'event_espresso' ),
1341
+	__('The value is a simple key that will be saved to the database and the label is what is shown to the user.', 'event_espresso'),
1342 1342
 
1343 1343
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:96
1344
-	__( 'add new option', 'event_espresso' ),
1344
+	__('add new option', 'event_espresso'),
1345 1345
 
1346 1346
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:26
1347 1347
 	// Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:25
1348
-	__( 'Styles', 'event_espresso' ),
1348
+	__('Styles', 'event_espresso'),
1349 1349
 
1350 1350
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:30
1351
-	__( 'Validation', 'event_espresso' ),
1351
+	__('Validation', 'event_espresso'),
1352 1352
 
1353 1353
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:18
1354
-	__( 'Change input type', 'event_espresso' ),
1354
+	__('Change input type', 'event_espresso'),
1355 1355
 
1356 1356
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:19
1357
-	__( 'Some configurations might be lost. Are you sure you want to change the input type?', 'event_espresso' ),
1357
+	__('Some configurations might be lost. Are you sure you want to change the input type?', 'event_espresso'),
1358 1358
 
1359 1359
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:40
1360
-	__( 'type', 'event_espresso' ),
1360
+	__('type', 'event_espresso'),
1361 1361
 
1362 1362
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:26
1363 1363
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:17
1364
-	__( 'public label', 'event_espresso' ),
1364
+	__('public label', 'event_espresso'),
1365 1365
 
1366 1366
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:33
1367 1367
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:22
1368
-	__( 'admin label', 'event_espresso' ),
1368
+	__('admin label', 'event_espresso'),
1369 1369
 
1370 1370
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:40
1371
-	__( 'content', 'event_espresso' ),
1371
+	__('content', 'event_espresso'),
1372 1372
 
1373 1373
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:48
1374
-	__( 'options', 'event_espresso' ),
1374
+	__('options', 'event_espresso'),
1375 1375
 
1376 1376
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:51
1377
-	__( 'placeholder', 'event_espresso' ),
1377
+	__('placeholder', 'event_espresso'),
1378 1378
 
1379 1379
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:57
1380
-	__( 'admin only', 'event_espresso' ),
1380
+	__('admin only', 'event_espresso'),
1381 1381
 
1382 1382
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:62
1383
-	__( 'help text', 'event_espresso' ),
1383
+	__('help text', 'event_espresso'),
1384 1384
 
1385 1385
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:71
1386
-	__( 'maps to', 'event_espresso' ),
1386
+	__('maps to', 'event_espresso'),
1387 1387
 
1388 1388
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:15
1389 1389
 	// Reference: packages/form-builder/src/FormSection/Tabs/Styles.tsx:13
1390
-	__( 'css class', 'event_espresso' ),
1390
+	__('css class', 'event_espresso'),
1391 1391
 
1392 1392
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:20
1393
-	__( 'help text css class', 'event_espresso' ),
1393
+	__('help text css class', 'event_espresso'),
1394 1394
 
1395 1395
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:27
1396
-	__( 'size', 'event_espresso' ),
1396
+	__('size', 'event_espresso'),
1397 1397
 
1398 1398
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:35
1399
-	__( 'step', 'event_espresso' ),
1399
+	__('step', 'event_espresso'),
1400 1400
 
1401 1401
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:41
1402
-	__( 'maxlength', 'event_espresso' ),
1402
+	__('maxlength', 'event_espresso'),
1403 1403
 
1404 1404
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:123
1405
-	__( 'min', 'event_espresso' ),
1405
+	__('min', 'event_espresso'),
1406 1406
 
1407 1407
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:128
1408
-	__( 'max', 'event_espresso' ),
1408
+	__('max', 'event_espresso'),
1409 1409
 
1410 1410
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:28
1411
-	__( 'Germany', 'event_espresso' ),
1411
+	__('Germany', 'event_espresso'),
1412 1412
 
1413 1413
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:32
1414
-	__( 'France', 'event_espresso' ),
1414
+	__('France', 'event_espresso'),
1415 1415
 
1416 1416
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:36
1417
-	__( 'United Kingdom', 'event_espresso' ),
1417
+	__('United Kingdom', 'event_espresso'),
1418 1418
 
1419 1419
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:40
1420
-	__( 'United States', 'event_espresso' ),
1420
+	__('United States', 'event_espresso'),
1421 1421
 
1422 1422
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:44
1423
-	__( 'Custom', 'event_espresso' ),
1423
+	__('Custom', 'event_espresso'),
1424 1424
 
1425 1425
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:54
1426
-	__( 'required', 'event_espresso' ),
1426
+	__('required', 'event_espresso'),
1427 1427
 
1428 1428
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:59
1429
-	__( 'required text', 'event_espresso' ),
1429
+	__('required text', 'event_espresso'),
1430 1430
 
1431 1431
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:66
1432
-	__( 'autocomplete', 'event_espresso' ),
1432
+	__('autocomplete', 'event_espresso'),
1433 1433
 
1434 1434
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:74
1435
-	__( 'custom format', 'event_espresso' ),
1435
+	__('custom format', 'event_espresso'),
1436 1436
 
1437 1437
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:75
1438
-	__( 'format', 'event_espresso' ),
1438
+	__('format', 'event_espresso'),
1439 1439
 
1440 1440
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:83
1441
-	__( 'pattern', 'event_espresso' ),
1441
+	__('pattern', 'event_espresso'),
1442 1442
 
1443 1443
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:110
1444
-	__( 'add new form element', 'event_espresso' ),
1444
+	__('add new form element', 'event_espresso'),
1445 1445
 
1446 1446
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:117
1447 1447
 	// Reference: packages/form/src/renderers/RepeatableRenderer.tsx:52
1448
-	__( 'Add', 'event_espresso' ),
1448
+	__('Add', 'event_espresso'),
1449 1449
 
1450 1450
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:76
1451
-	__( 'Add Form Element', 'event_espresso' ),
1451
+	__('Add Form Element', 'event_espresso'),
1452 1452
 
1453 1453
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:85
1454
-	__( 'form element order can be changed after adding by using the drag handles in the form element toolbar', 'event_espresso' ),
1454
+	__('form element order can be changed after adding by using the drag handles in the form element toolbar', 'event_espresso'),
1455 1455
 
1456 1456
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:92
1457
-	__( 'load existing form section', 'event_espresso' ),
1457
+	__('load existing form section', 'event_espresso'),
1458 1458
 
1459 1459
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:32
1460
-	__( 'delete form section', 'event_espresso' ),
1460
+	__('delete form section', 'event_espresso'),
1461 1461
 
1462 1462
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:47
1463
-	__( 'form section settings', 'event_espresso' ),
1463
+	__('form section settings', 'event_espresso'),
1464 1464
 
1465 1465
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:57
1466
-	__( 'copy form section', 'event_espresso' ),
1466
+	__('copy form section', 'event_espresso'),
1467 1467
 
1468 1468
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:74
1469
-	__( 'click, hold, and drag to reorder form section', 'event_espresso' ),
1469
+	__('click, hold, and drag to reorder form section', 'event_espresso'),
1470 1470
 
1471 1471
 	// Reference: packages/form-builder/src/FormSection/FormSections.tsx:26
1472
-	__( 'Add Form Section', 'event_espresso' ),
1472
+	__('Add Form Section', 'event_espresso'),
1473 1473
 
1474 1474
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:47
1475
-	__( 'save form section for use in other forms', 'event_espresso' ),
1475
+	__('save form section for use in other forms', 'event_espresso'),
1476 1476
 
1477 1477
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:51
1478
-	__( 'save as', 'event_espresso' ),
1478
+	__('save as', 'event_espresso'),
1479 1479
 
1480 1480
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:55
1481
-	__( 'default', 'event_espresso' ),
1481
+	__('default', 'event_espresso'),
1482 1482
 
1483 1483
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:58
1484
-	__( ' a copy of this form section will be automatically added to ALL new events', 'event_espresso' ),
1484
+	__(' a copy of this form section will be automatically added to ALL new events', 'event_espresso'),
1485 1485
 
1486 1486
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:61
1487
-	__( 'shared', 'event_espresso' ),
1487
+	__('shared', 'event_espresso'),
1488 1488
 
1489 1489
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:64
1490
-	__( 'a copy of this form section will be saved for use in other events but not loaded by default', 'event_espresso' ),
1490
+	__('a copy of this form section will be saved for use in other events but not loaded by default', 'event_espresso'),
1491 1491
 
1492 1492
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:27
1493
-	__( 'show label', 'event_espresso' ),
1493
+	__('show label', 'event_espresso'),
1494 1494
 
1495 1495
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:33
1496
-	__( 'applies to', 'event_espresso' ),
1496
+	__('applies to', 'event_espresso'),
1497 1497
 
1498 1498
 	// Reference: packages/form-builder/src/constants.ts:102
1499 1499
 	// Reference: packages/form-builder/src/state/utils.ts:436
1500
-	__( 'URL', 'event_espresso' ),
1500
+	__('URL', 'event_espresso'),
1501 1501
 
1502 1502
 	// Reference: packages/form-builder/src/constants.ts:104
1503
-	__( 'adds a text input for entering a URL address', 'event_espresso' ),
1503
+	__('adds a text input for entering a URL address', 'event_espresso'),
1504 1504
 
1505 1505
 	// Reference: packages/form-builder/src/constants.ts:107
1506
-	__( 'Date', 'event_espresso' ),
1506
+	__('Date', 'event_espresso'),
1507 1507
 
1508 1508
 	// Reference: packages/form-builder/src/constants.ts:109
1509
-	__( 'adds a text input that allows users to enter a date directly via keyboard or a datepicker', 'event_espresso' ),
1509
+	__('adds a text input that allows users to enter a date directly via keyboard or a datepicker', 'event_espresso'),
1510 1510
 
1511 1511
 	// Reference: packages/form-builder/src/constants.ts:112
1512 1512
 	// Reference: packages/form-builder/src/state/utils.ts:369
1513
-	__( 'Local Date', 'event_espresso' ),
1513
+	__('Local Date', 'event_espresso'),
1514 1514
 
1515 1515
 	// Reference: packages/form-builder/src/constants.ts:117
1516
-	__( 'Month', 'event_espresso' ),
1516
+	__('Month', 'event_espresso'),
1517 1517
 
1518 1518
 	// Reference: packages/form-builder/src/constants.ts:119
1519
-	__( 'adds a text input that allows users to enter a month and year directly via keyboard or a datepicker', 'event_espresso' ),
1519
+	__('adds a text input that allows users to enter a month and year directly via keyboard or a datepicker', 'event_espresso'),
1520 1520
 
1521 1521
 	// Reference: packages/form-builder/src/constants.ts:122
1522
-	__( 'Time', 'event_espresso' ),
1522
+	__('Time', 'event_espresso'),
1523 1523
 
1524 1524
 	// Reference: packages/form-builder/src/constants.ts:124
1525
-	__( 'adds a text input that allows users to enter a time directly via keyboard or a timepicker', 'event_espresso' ),
1525
+	__('adds a text input that allows users to enter a time directly via keyboard or a timepicker', 'event_espresso'),
1526 1526
 
1527 1527
 	// Reference: packages/form-builder/src/constants.ts:127
1528
-	__( 'Week', 'event_espresso' ),
1528
+	__('Week', 'event_espresso'),
1529 1529
 
1530 1530
 	// Reference: packages/form-builder/src/constants.ts:129
1531
-	__( 'adds a text input that allows users to enter a week and year directly via keyboard or a datepicker', 'event_espresso' ),
1531
+	__('adds a text input that allows users to enter a week and year directly via keyboard or a datepicker', 'event_espresso'),
1532 1532
 
1533 1533
 	// Reference: packages/form-builder/src/constants.ts:132
1534
-	__( 'Day Selector', 'event_espresso' ),
1534
+	__('Day Selector', 'event_espresso'),
1535 1535
 
1536 1536
 	// Reference: packages/form-builder/src/constants.ts:134
1537
-	__( 'adds a dropdown selector that allows users to select the day of the month (01 to 31)', 'event_espresso' ),
1537
+	__('adds a dropdown selector that allows users to select the day of the month (01 to 31)', 'event_espresso'),
1538 1538
 
1539 1539
 	// Reference: packages/form-builder/src/constants.ts:137
1540
-	__( 'Month Selector', 'event_espresso' ),
1540
+	__('Month Selector', 'event_espresso'),
1541 1541
 
1542 1542
 	// Reference: packages/form-builder/src/constants.ts:139
1543
-	__( 'adds a dropdown selector that allows users to select the month of the year (01 to 12)', 'event_espresso' ),
1543
+	__('adds a dropdown selector that allows users to select the month of the year (01 to 12)', 'event_espresso'),
1544 1544
 
1545 1545
 	// Reference: packages/form-builder/src/constants.ts:142
1546
-	__( 'Year Selector', 'event_espresso' ),
1546
+	__('Year Selector', 'event_espresso'),
1547 1547
 
1548 1548
 	// Reference: packages/form-builder/src/constants.ts:144
1549
-	__( 'adds a dropdown selector that allows users to select the year from a configurable range', 'event_espresso' ),
1549
+	__('adds a dropdown selector that allows users to select the year from a configurable range', 'event_espresso'),
1550 1550
 
1551 1551
 	// Reference: packages/form-builder/src/constants.ts:147
1552
-	__( 'Radio Buttons', 'event_espresso' ),
1552
+	__('Radio Buttons', 'event_espresso'),
1553 1553
 
1554 1554
 	// Reference: packages/form-builder/src/constants.ts:149
1555
-	__( 'adds one or more radio buttons that allow users to only select one option from those provided', 'event_espresso' ),
1555
+	__('adds one or more radio buttons that allow users to only select one option from those provided', 'event_espresso'),
1556 1556
 
1557 1557
 	// Reference: packages/form-builder/src/constants.ts:152
1558 1558
 	// Reference: packages/form-builder/src/state/utils.ts:375
1559
-	__( 'Decimal Number', 'event_espresso' ),
1559
+	__('Decimal Number', 'event_espresso'),
1560 1560
 
1561 1561
 	// Reference: packages/form-builder/src/constants.ts:154
1562
-	__( 'adds a text input that only accepts numbers whose value is a decimal (float)', 'event_espresso' ),
1562
+	__('adds a text input that only accepts numbers whose value is a decimal (float)', 'event_espresso'),
1563 1563
 
1564 1564
 	// Reference: packages/form-builder/src/constants.ts:157
1565 1565
 	// Reference: packages/form-builder/src/state/utils.ts:378
1566
-	__( 'Whole Number', 'event_espresso' ),
1566
+	__('Whole Number', 'event_espresso'),
1567 1567
 
1568 1568
 	// Reference: packages/form-builder/src/constants.ts:159
1569
-	__( 'adds a text input that only accepts numbers whose value is an integer (whole number)', 'event_espresso' ),
1569
+	__('adds a text input that only accepts numbers whose value is an integer (whole number)', 'event_espresso'),
1570 1570
 
1571 1571
 	// Reference: packages/form-builder/src/constants.ts:162
1572
-	__( 'Number Range', 'event_espresso' ),
1572
+	__('Number Range', 'event_espresso'),
1573 1573
 
1574 1574
 	// Reference: packages/form-builder/src/constants.ts:167
1575
-	__( 'Phone Number', 'event_espresso' ),
1575
+	__('Phone Number', 'event_espresso'),
1576 1576
 
1577 1577
 	// Reference: packages/form-builder/src/constants.ts:172
1578
-	__( 'Dropdown', 'event_espresso' ),
1578
+	__('Dropdown', 'event_espresso'),
1579 1579
 
1580 1580
 	// Reference: packages/form-builder/src/constants.ts:174
1581
-	__( 'adds a dropdown selector that accepts a single value', 'event_espresso' ),
1581
+	__('adds a dropdown selector that accepts a single value', 'event_espresso'),
1582 1582
 
1583 1583
 	// Reference: packages/form-builder/src/constants.ts:177
1584
-	__( 'Multi Select', 'event_espresso' ),
1584
+	__('Multi Select', 'event_espresso'),
1585 1585
 
1586 1586
 	// Reference: packages/form-builder/src/constants.ts:179
1587
-	__( 'adds a dropdown selector that accepts multiple values', 'event_espresso' ),
1587
+	__('adds a dropdown selector that accepts multiple values', 'event_espresso'),
1588 1588
 
1589 1589
 	// Reference: packages/form-builder/src/constants.ts:182
1590
-	__( 'Toggle/Switch', 'event_espresso' ),
1590
+	__('Toggle/Switch', 'event_espresso'),
1591 1591
 
1592 1592
 	// Reference: packages/form-builder/src/constants.ts:184
1593
-	__( 'adds a toggle or a switch to accept true or false value', 'event_espresso' ),
1593
+	__('adds a toggle or a switch to accept true or false value', 'event_espresso'),
1594 1594
 
1595 1595
 	// Reference: packages/form-builder/src/constants.ts:187
1596
-	__( 'Multi Checkbox', 'event_espresso' ),
1596
+	__('Multi Checkbox', 'event_espresso'),
1597 1597
 
1598 1598
 	// Reference: packages/form-builder/src/constants.ts:189
1599
-	__( 'adds checkboxes that allow users to select zero or more options from those provided', 'event_espresso' ),
1599
+	__('adds checkboxes that allow users to select zero or more options from those provided', 'event_espresso'),
1600 1600
 
1601 1601
 	// Reference: packages/form-builder/src/constants.ts:192
1602
-	__( 'Country Selector', 'event_espresso' ),
1602
+	__('Country Selector', 'event_espresso'),
1603 1603
 
1604 1604
 	// Reference: packages/form-builder/src/constants.ts:194
1605
-	__( 'adds a dropdown selector populated with names of countries that are enabled for the site', 'event_espresso' ),
1605
+	__('adds a dropdown selector populated with names of countries that are enabled for the site', 'event_espresso'),
1606 1606
 
1607 1607
 	// Reference: packages/form-builder/src/constants.ts:197
1608
-	__( 'State Selector', 'event_espresso' ),
1608
+	__('State Selector', 'event_espresso'),
1609 1609
 
1610 1610
 	// Reference: packages/form-builder/src/constants.ts:202
1611
-	__( 'Button', 'event_espresso' ),
1611
+	__('Button', 'event_espresso'),
1612 1612
 
1613 1613
 	// Reference: packages/form-builder/src/constants.ts:204
1614
-	__( 'adds a button to the form that can be used for triggering fucntionality (requires custom coding)', 'event_espresso' ),
1614
+	__('adds a button to the form that can be used for triggering fucntionality (requires custom coding)', 'event_espresso'),
1615 1615
 
1616 1616
 	// Reference: packages/form-builder/src/constants.ts:207
1617
-	__( 'Reset Button', 'event_espresso' ),
1617
+	__('Reset Button', 'event_espresso'),
1618 1618
 
1619 1619
 	// Reference: packages/form-builder/src/constants.ts:209
1620
-	__( 'adds a button that will reset the form back to its original state.', 'event_espresso' ),
1620
+	__('adds a button that will reset the form back to its original state.', 'event_espresso'),
1621 1621
 
1622 1622
 	// Reference: packages/form-builder/src/constants.ts:55
1623
-	__( 'Form Section', 'event_espresso' ),
1623
+	__('Form Section', 'event_espresso'),
1624 1624
 
1625 1625
 	// Reference: packages/form-builder/src/constants.ts:57
1626
-	__( 'Used for creating logical groupings for questions and form elements. Need to add a heading or description? Use the HTML form element.', 'event_espresso' ),
1626
+	__('Used for creating logical groupings for questions and form elements. Need to add a heading or description? Use the HTML form element.', 'event_espresso'),
1627 1627
 
1628 1628
 	// Reference: packages/form-builder/src/constants.ts:62
1629
-	__( 'HTML Block', 'event_espresso' ),
1629
+	__('HTML Block', 'event_espresso'),
1630 1630
 
1631 1631
 	// Reference: packages/form-builder/src/constants.ts:64
1632
-	__( 'allows you to add HTML like headings or text paragraphs to your form', 'event_espresso' ),
1632
+	__('allows you to add HTML like headings or text paragraphs to your form', 'event_espresso'),
1633 1633
 
1634 1634
 	// Reference: packages/form-builder/src/constants.ts:69
1635
-	__( 'adds a text input that only accepts plain text', 'event_espresso' ),
1635
+	__('adds a text input that only accepts plain text', 'event_espresso'),
1636 1636
 
1637 1637
 	// Reference: packages/form-builder/src/constants.ts:72
1638
-	__( 'Plain Text Area', 'event_espresso' ),
1638
+	__('Plain Text Area', 'event_espresso'),
1639 1639
 
1640 1640
 	// Reference: packages/form-builder/src/constants.ts:74
1641
-	__( 'adds a textarea block that only accepts plain text', 'event_espresso' ),
1641
+	__('adds a textarea block that only accepts plain text', 'event_espresso'),
1642 1642
 
1643 1643
 	// Reference: packages/form-builder/src/constants.ts:77
1644
-	__( 'HTML Text Area', 'event_espresso' ),
1644
+	__('HTML Text Area', 'event_espresso'),
1645 1645
 
1646 1646
 	// Reference: packages/form-builder/src/constants.ts:79
1647
-	__( 'adds a textarea block that accepts text including simple HTML markup', 'event_espresso' ),
1647
+	__('adds a textarea block that accepts text including simple HTML markup', 'event_espresso'),
1648 1648
 
1649 1649
 	// Reference: packages/form-builder/src/constants.ts:84
1650
-	__( 'adds a text input that only accepts a valid email address', 'event_espresso' ),
1650
+	__('adds a text input that only accepts a valid email address', 'event_espresso'),
1651 1651
 
1652 1652
 	// Reference: packages/form-builder/src/constants.ts:87
1653
-	__( 'Email Confirmation', 'event_espresso' ),
1653
+	__('Email Confirmation', 'event_espresso'),
1654 1654
 
1655 1655
 	// Reference: packages/form-builder/src/constants.ts:92
1656
-	__( 'Password', 'event_espresso' ),
1656
+	__('Password', 'event_espresso'),
1657 1657
 
1658 1658
 	// Reference: packages/form-builder/src/constants.ts:94
1659
-	__( 'adds a text input that accepts text but masks what the user enters', 'event_espresso' ),
1659
+	__('adds a text input that accepts text but masks what the user enters', 'event_espresso'),
1660 1660
 
1661 1661
 	// Reference: packages/form-builder/src/constants.ts:97
1662
-	__( 'Password Confirmation', 'event_espresso' ),
1662
+	__('Password Confirmation', 'event_espresso'),
1663 1663
 
1664 1664
 	// Reference: packages/form-builder/src/data/useElementMutator.ts:54
1665
-	__( 'element', 'event_espresso' ),
1665
+	__('element', 'event_espresso'),
1666 1666
 
1667 1667
 	// Reference: packages/form-builder/src/data/useSectionMutator.ts:54
1668
-	__( 'section', 'event_espresso' ),
1668
+	__('section', 'event_espresso'),
1669 1669
 
1670 1670
 	// Reference: packages/form-builder/src/state/utils.ts:360
1671
-	__( 'click', 'event_espresso' ),
1671
+	__('click', 'event_espresso'),
1672 1672
 
1673 1673
 	// Reference: packages/form-builder/src/state/utils.ts:363
1674
-	__( 'checkboxes', 'event_espresso' ),
1674
+	__('checkboxes', 'event_espresso'),
1675 1675
 
1676 1676
 	// Reference: packages/form-builder/src/state/utils.ts:366
1677
-	__( 'date', 'event_espresso' ),
1677
+	__('date', 'event_espresso'),
1678 1678
 
1679 1679
 	// Reference: packages/form-builder/src/state/utils.ts:372
1680
-	__( 'day', 'event_espresso' ),
1680
+	__('day', 'event_espresso'),
1681 1681
 
1682 1682
 	// Reference: packages/form-builder/src/state/utils.ts:381
1683
-	__( 'email address', 'event_espresso' ),
1683
+	__('email address', 'event_espresso'),
1684 1684
 
1685 1685
 	// Reference: packages/form-builder/src/state/utils.ts:384
1686
-	__( 'confirm email address', 'event_espresso' ),
1686
+	__('confirm email address', 'event_espresso'),
1687 1687
 
1688 1688
 	// Reference: packages/form-builder/src/state/utils.ts:388
1689
-	__( 'month', 'event_espresso' ),
1689
+	__('month', 'event_espresso'),
1690 1690
 
1691 1691
 	// Reference: packages/form-builder/src/state/utils.ts:391
1692
-	__( 'password', 'event_espresso' ),
1692
+	__('password', 'event_espresso'),
1693 1693
 
1694 1694
 	// Reference: packages/form-builder/src/state/utils.ts:394
1695
-	__( 'confirm password', 'event_espresso' ),
1695
+	__('confirm password', 'event_espresso'),
1696 1696
 
1697 1697
 	// Reference: packages/form-builder/src/state/utils.ts:397
1698
-	__( 'radio buttons', 'event_espresso' ),
1698
+	__('radio buttons', 'event_espresso'),
1699 1699
 
1700 1700
 	// Reference: packages/form-builder/src/state/utils.ts:400
1701
-	__( 'number range', 'event_espresso' ),
1701
+	__('number range', 'event_espresso'),
1702 1702
 
1703 1703
 	// Reference: packages/form-builder/src/state/utils.ts:403
1704
-	__( 'selection dropdown', 'event_espresso' ),
1704
+	__('selection dropdown', 'event_espresso'),
1705 1705
 
1706 1706
 	// Reference: packages/form-builder/src/state/utils.ts:406
1707
-	__( 'country', 'event_espresso' ),
1707
+	__('country', 'event_espresso'),
1708 1708
 
1709 1709
 	// Reference: packages/form-builder/src/state/utils.ts:409
1710
-	__( 'multi-select dropdown', 'event_espresso' ),
1710
+	__('multi-select dropdown', 'event_espresso'),
1711 1711
 
1712 1712
 	// Reference: packages/form-builder/src/state/utils.ts:412
1713
-	__( 'state/province', 'event_espresso' ),
1713
+	__('state/province', 'event_espresso'),
1714 1714
 
1715 1715
 	// Reference: packages/form-builder/src/state/utils.ts:415
1716
-	__( 'on/off switch', 'event_espresso' ),
1716
+	__('on/off switch', 'event_espresso'),
1717 1717
 
1718 1718
 	// Reference: packages/form-builder/src/state/utils.ts:418
1719
-	__( 'reset', 'event_espresso' ),
1719
+	__('reset', 'event_espresso'),
1720 1720
 
1721 1721
 	// Reference: packages/form-builder/src/state/utils.ts:421
1722
-	__( 'phone number', 'event_espresso' ),
1722
+	__('phone number', 'event_espresso'),
1723 1723
 
1724 1724
 	// Reference: packages/form-builder/src/state/utils.ts:424
1725
-	__( 'text', 'event_espresso' ),
1725
+	__('text', 'event_espresso'),
1726 1726
 
1727 1727
 	// Reference: packages/form-builder/src/state/utils.ts:427
1728
-	__( 'simple textarea', 'event_espresso' ),
1728
+	__('simple textarea', 'event_espresso'),
1729 1729
 
1730 1730
 	// Reference: packages/form-builder/src/state/utils.ts:430
1731
-	__( 'html textarea', 'event_espresso' ),
1731
+	__('html textarea', 'event_espresso'),
1732 1732
 
1733 1733
 	// Reference: packages/form-builder/src/state/utils.ts:439
1734
-	__( 'week', 'event_espresso' ),
1734
+	__('week', 'event_espresso'),
1735 1735
 
1736 1736
 	// Reference: packages/form-builder/src/state/utils.ts:442
1737
-	__( 'year', 'event_espresso' ),
1737
+	__('year', 'event_espresso'),
1738 1738
 
1739 1739
 	// Reference: packages/form/src/adapters/WPMediaImage.tsx:12
1740
-	__( 'Select Image', 'event_espresso' ),
1740
+	__('Select Image', 'event_espresso'),
1741 1741
 
1742 1742
 	// Reference: packages/form/src/adapters/WPMediaImage.tsx:44
1743 1743
 	// Reference: packages/rich-text-editor/src/components/AdvancedTextEditor/toolbarButtons/WPMedia.tsx:11
1744 1744
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:12
1745 1745
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityTemplate.tsx:32
1746
-	__( 'Select', 'event_espresso' ),
1746
+	__('Select', 'event_espresso'),
1747 1747
 
1748 1748
 	// Reference: packages/form/src/renderers/FormRenderer.tsx:51
1749
-	__( 'Form Errors', 'event_espresso' ),
1749
+	__('Form Errors', 'event_espresso'),
1750 1750
 
1751 1751
 	// Reference: packages/form/src/renderers/RepeatableRenderer.tsx:36
1752 1752
 	/* translators: %d the entry number */
1753
-	__( 'Entry %d', 'event_espresso' ),
1753
+	__('Entry %d', 'event_espresso'),
1754 1754
 
1755 1755
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:11
1756 1756
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:17
1757
-	__( 'sold out', 'event_espresso' ),
1757
+	__('sold out', 'event_espresso'),
1758 1758
 
1759 1759
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:14
1760 1760
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:14
1761
-	__( 'expired', 'event_espresso' ),
1761
+	__('expired', 'event_espresso'),
1762 1762
 
1763 1763
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:17
1764
-	__( 'upcoming', 'event_espresso' ),
1764
+	__('upcoming', 'event_espresso'),
1765 1765
 
1766 1766
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:20
1767
-	__( 'active', 'event_espresso' ),
1767
+	__('active', 'event_espresso'),
1768 1768
 
1769 1769
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:23
1770 1770
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:11
1771
-	__( 'trashed', 'event_espresso' ),
1771
+	__('trashed', 'event_espresso'),
1772 1772
 
1773 1773
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:26
1774
-	__( 'cancelled', 'event_espresso' ),
1774
+	__('cancelled', 'event_espresso'),
1775 1775
 
1776 1776
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:29
1777
-	__( 'postponed', 'event_espresso' ),
1777
+	__('postponed', 'event_espresso'),
1778 1778
 
1779 1779
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:33
1780
-	__( 'inactive', 'event_espresso' ),
1780
+	__('inactive', 'event_espresso'),
1781 1781
 
1782 1782
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:20
1783
-	__( 'pending', 'event_espresso' ),
1783
+	__('pending', 'event_espresso'),
1784 1784
 
1785 1785
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:23
1786
-	__( 'on sale', 'event_espresso' ),
1786
+	__('on sale', 'event_espresso'),
1787 1787
 
1788 1788
 	// Reference: packages/helpers/src/tickets/ticketVisibilityOptions.ts:6
1789
-	__( 'Where the ticket can be viewed throughout the UI. ', 'event_espresso' ),
1789
+	__('Where the ticket can be viewed throughout the UI. ', 'event_espresso'),
1790 1790
 
1791 1791
 	// Reference: packages/predicates/src/registration/statusOptions.ts:16
1792
-	__( 'Declined', 'event_espresso' ),
1792
+	__('Declined', 'event_espresso'),
1793 1793
 
1794 1794
 	// Reference: packages/predicates/src/registration/statusOptions.ts:21
1795
-	__( 'Incomplete', 'event_espresso' ),
1795
+	__('Incomplete', 'event_espresso'),
1796 1796
 
1797 1797
 	// Reference: packages/predicates/src/registration/statusOptions.ts:26
1798
-	__( 'Not Approved', 'event_espresso' ),
1798
+	__('Not Approved', 'event_espresso'),
1799 1799
 
1800 1800
 	// Reference: packages/predicates/src/registration/statusOptions.ts:31
1801
-	__( 'Pending Payment', 'event_espresso' ),
1801
+	__('Pending Payment', 'event_espresso'),
1802 1802
 
1803 1803
 	// Reference: packages/predicates/src/registration/statusOptions.ts:36
1804
-	__( 'Wait List', 'event_espresso' ),
1804
+	__('Wait List', 'event_espresso'),
1805 1805
 
1806 1806
 	// Reference: packages/predicates/src/registration/statusOptions.ts:6
1807
-	__( 'Approved', 'event_espresso' ),
1807
+	__('Approved', 'event_espresso'),
1808 1808
 
1809 1809
 	// Reference: packages/rich-text-editor/src/components/AdvancedTextEditor/toolbarButtons/WPMedia.tsx:9
1810 1810
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:10
1811
-	__( 'Select media', 'event_espresso' ),
1811
+	__('Select media', 'event_espresso'),
1812 1812
 
1813 1813
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/RichTextEditor.tsx:84
1814
-	__( 'Write something…', 'event_espresso' ),
1814
+	__('Write something…', 'event_espresso'),
1815 1815
 
1816 1816
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/Toolbar.tsx:20
1817
-	__( 'RTE Toolbar', 'event_espresso' ),
1817
+	__('RTE Toolbar', 'event_espresso'),
1818 1818
 
1819 1819
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:11
1820
-	__( 'Normal', 'event_espresso' ),
1820
+	__('Normal', 'event_espresso'),
1821 1821
 
1822 1822
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:12
1823
-	__( 'H1', 'event_espresso' ),
1823
+	__('H1', 'event_espresso'),
1824 1824
 
1825 1825
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:13
1826
-	__( 'H2', 'event_espresso' ),
1826
+	__('H2', 'event_espresso'),
1827 1827
 
1828 1828
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:14
1829
-	__( 'H3', 'event_espresso' ),
1829
+	__('H3', 'event_espresso'),
1830 1830
 
1831 1831
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:15
1832
-	__( 'H4', 'event_espresso' ),
1832
+	__('H4', 'event_espresso'),
1833 1833
 
1834 1834
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:16
1835
-	__( 'H5', 'event_espresso' ),
1835
+	__('H5', 'event_espresso'),
1836 1836
 
1837 1837
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:17
1838
-	__( 'H6', 'event_espresso' ),
1838
+	__('H6', 'event_espresso'),
1839 1839
 
1840 1840
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:18
1841
-	__( 'Block quote', 'event_espresso' ),
1841
+	__('Block quote', 'event_espresso'),
1842 1842
 
1843 1843
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:19
1844
-	__( 'Code', 'event_espresso' ),
1844
+	__('Code', 'event_espresso'),
1845 1845
 
1846 1846
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:36
1847
-	__( 'Set color', 'event_espresso' ),
1847
+	__('Set color', 'event_espresso'),
1848 1848
 
1849 1849
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:45
1850
-	__( 'Text color', 'event_espresso' ),
1850
+	__('Text color', 'event_espresso'),
1851 1851
 
1852 1852
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:47
1853
-	__( 'Background color', 'event_espresso' ),
1853
+	__('Background color', 'event_espresso'),
1854 1854
 
1855 1855
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:39
1856
-	__( 'Add image', 'event_espresso' ),
1856
+	__('Add image', 'event_espresso'),
1857 1857
 
1858 1858
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:51
1859
-	__( 'Image URL', 'event_espresso' ),
1859
+	__('Image URL', 'event_espresso'),
1860 1860
 
1861 1861
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:55
1862
-	__( 'Alt text', 'event_espresso' ),
1862
+	__('Alt text', 'event_espresso'),
1863 1863
 
1864 1864
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:56
1865
-	__( 'Width', 'event_espresso' ),
1865
+	__('Width', 'event_espresso'),
1866 1866
 
1867 1867
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:60
1868
-	__( 'Height', 'event_espresso' ),
1868
+	__('Height', 'event_espresso'),
1869 1869
 
1870 1870
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/link/Component.tsx:54
1871
-	__( 'Edit link', 'event_espresso' ),
1871
+	__('Edit link', 'event_espresso'),
1872 1872
 
1873 1873
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/link/Component.tsx:64
1874
-	__( 'URL title', 'event_espresso' ),
1874
+	__('URL title', 'event_espresso'),
1875 1875
 
1876 1876
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:11
1877
-	__( 'Unordered list', 'event_espresso' ),
1877
+	__('Unordered list', 'event_espresso'),
1878 1878
 
1879 1879
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:12
1880
-	__( 'Ordered list', 'event_espresso' ),
1880
+	__('Ordered list', 'event_espresso'),
1881 1881
 
1882 1882
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:13
1883 1883
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:13
1884
-	__( 'Indent', 'event_espresso' ),
1884
+	__('Indent', 'event_espresso'),
1885 1885
 
1886 1886
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:14
1887 1887
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:14
1888
-	__( 'Outdent', 'event_espresso' ),
1888
+	__('Outdent', 'event_espresso'),
1889 1889
 
1890 1890
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:11
1891
-	__( 'Unordered textalign', 'event_espresso' ),
1891
+	__('Unordered textalign', 'event_espresso'),
1892 1892
 
1893 1893
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:12
1894
-	__( 'Ordered textalign', 'event_espresso' ),
1894
+	__('Ordered textalign', 'event_espresso'),
1895 1895
 
1896 1896
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/render/Image/Toolbar.tsx:32
1897
-	__( 'Image toolbar', 'event_espresso' ),
1897
+	__('Image toolbar', 'event_espresso'),
1898 1898
 
1899 1899
 	// Reference: packages/rich-text-editor/src/components/WithEditMode/WithEditMode.tsx:62
1900 1900
 	// Reference: packages/rich-text-editor/src/rte-old/components/RTEWithEditMode/RTEWithEditMode.tsx:35
1901
-	__( 'Visual editor', 'event_espresso' ),
1901
+	__('Visual editor', 'event_espresso'),
1902 1902
 
1903 1903
 	// Reference: packages/rich-text-editor/src/components/WithEditMode/WithEditMode.tsx:66
1904 1904
 	// Reference: packages/rich-text-editor/src/rte-old/components/RTEWithEditMode/RTEWithEditMode.tsx:39
1905
-	__( 'HTML editor', 'event_espresso' ),
1905
+	__('HTML editor', 'event_espresso'),
1906 1906
 
1907 1907
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:68
1908
-	__( 'Add Media', 'event_espresso' ),
1908
+	__('Add Media', 'event_espresso'),
1909 1909
 
1910 1910
 	// Reference: packages/tpc/src/buttons/AddPriceModifierButton.tsx:16
1911
-	__( 'add new price modifier after this row', 'event_espresso' ),
1911
+	__('add new price modifier after this row', 'event_espresso'),
1912 1912
 
1913 1913
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:14
1914
-	__( 'Delete all prices', 'event_espresso' ),
1914
+	__('Delete all prices', 'event_espresso'),
1915 1915
 
1916 1916
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:27
1917
-	__( 'Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso' ),
1917
+	__('Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso'),
1918 1918
 
1919 1919
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:31
1920
-	__( 'Delete all prices?', 'event_espresso' ),
1920
+	__('Delete all prices?', 'event_espresso'),
1921 1921
 
1922 1922
 	// Reference: packages/tpc/src/buttons/DeletePriceModifierButton.tsx:12
1923
-	__( 'delete price modifier', 'event_espresso' ),
1923
+	__('delete price modifier', 'event_espresso'),
1924 1924
 
1925 1925
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:14
1926
-	__( 'Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso' ),
1926
+	__('Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso'),
1927 1927
 
1928 1928
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:17
1929
-	__( 'Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso' ),
1929
+	__('Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso'),
1930 1930
 
1931 1931
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21
1932
-	__( 'Disable reverse calculate', 'event_espresso' ),
1932
+	__('Disable reverse calculate', 'event_espresso'),
1933 1933
 
1934 1934
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21
1935
-	__( 'Enable reverse calculate', 'event_espresso' ),
1935
+	__('Enable reverse calculate', 'event_espresso'),
1936 1936
 
1937 1937
 	// Reference: packages/tpc/src/buttons/TicketPriceCalculatorButton.tsx:28
1938
-	__( 'ticket price calculator', 'event_espresso' ),
1938
+	__('ticket price calculator', 'event_espresso'),
1939 1939
 
1940 1940
 	// Reference: packages/tpc/src/buttons/taxes/AddDefaultTaxesButton.tsx:9
1941
-	__( 'Add default taxes', 'event_espresso' ),
1941
+	__('Add default taxes', 'event_espresso'),
1942 1942
 
1943 1943
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:10
1944
-	__( 'Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso' ),
1944
+	__('Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso'),
1945 1945
 
1946 1946
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:14
1947
-	__( 'Remove all taxes?', 'event_espresso' ),
1947
+	__('Remove all taxes?', 'event_espresso'),
1948 1948
 
1949 1949
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:7
1950
-	__( 'Remove taxes', 'event_espresso' ),
1950
+	__('Remove taxes', 'event_espresso'),
1951 1951
 
1952 1952
 	// Reference: packages/tpc/src/components/AddDefaultPricesButton.tsx:9
1953
-	__( 'Add default prices', 'event_espresso' ),
1953
+	__('Add default prices', 'event_espresso'),
1954 1954
 
1955 1955
 	// Reference: packages/tpc/src/components/DefaultPricesInfo.tsx:29
1956
-	__( 'Modify default prices.', 'event_espresso' ),
1956
+	__('Modify default prices.', 'event_espresso'),
1957 1957
 
1958 1958
 	// Reference: packages/tpc/src/components/DefaultTaxesInfo.tsx:29
1959
-	__( 'New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso' ),
1959
+	__('New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso'),
1960 1960
 
1961 1961
 	// Reference: packages/tpc/src/components/LockedTicketsBanner.tsx:12
1962 1962
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:74
1963
-	__( 'Price editing is disabled!', 'event_espresso' ),
1963
+	__('Price editing is disabled!', 'event_espresso'),
1964 1964
 
1965 1965
 	// Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:12
1966
-	__( 'One or more price types are missing. Maybe they were placed in the trash?', 'event_espresso' ),
1966
+	__('One or more price types are missing. Maybe they were placed in the trash?', 'event_espresso'),
1967 1967
 
1968 1968
 	// Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:17
1969 1969
 	/* translators: %s link to price types admin */
1970
-	__( 'Go to the%sto restore (untrash) your price types and/or create some new ones.', 'event_espresso' ),
1970
+	__('Go to the%sto restore (untrash) your price types and/or create some new ones.', 'event_espresso'),
1971 1971
 
1972 1972
 	// Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:18
1973
-	__( 'price types admin page', 'event_espresso' ),
1973
+	__('price types admin page', 'event_espresso'),
1974 1974
 
1975 1975
 	// Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:26
1976
-	__( 'Missing Price Types!', 'event_espresso' ),
1976
+	__('Missing Price Types!', 'event_espresso'),
1977 1977
 
1978 1978
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:14
1979
-	__( 'This Ticket is Currently Free', 'event_espresso' ),
1979
+	__('This Ticket is Currently Free', 'event_espresso'),
1980 1980
 
1981 1981
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:21
1982 1982
 	/* translators: %s default prices */
1983
-	__( 'Click the button below to load your %s into the calculator.', 'event_espresso' ),
1983
+	__('Click the button below to load your %s into the calculator.', 'event_espresso'),
1984 1984
 
1985 1985
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:22
1986
-	__( 'default prices', 'event_espresso' ),
1986
+	__('default prices', 'event_espresso'),
1987 1987
 
1988 1988
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:29
1989
-	__( 'Additional ticket price modifiers can be added or removed.', 'event_espresso' ),
1989
+	__('Additional ticket price modifiers can be added or removed.', 'event_espresso'),
1990 1990
 
1991 1991
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:31
1992
-	__( 'Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso' ),
1992
+	__('Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso'),
1993 1993
 
1994 1994
 	// Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:22
1995 1995
 	// Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:7
1996 1996
 	// Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:10
1997 1997
 	// Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:52
1998
-	__( 'Changes will be lost if you proceed.', 'event_espresso' ),
1998
+	__('Changes will be lost if you proceed.', 'event_espresso'),
1999 1999
 
2000 2000
 	// Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:33
2001 2001
 	/* translators: %s ticket name */
2002
-	__( 'Price Calculator for Ticket: %s', 'event_espresso' ),
2002
+	__('Price Calculator for Ticket: %s', 'event_espresso'),
2003 2003
 
2004 2004
 	// Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:48
2005
-	__( 'Total', 'event_espresso' ),
2005
+	__('Total', 'event_espresso'),
2006 2006
 
2007 2007
 	// Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:57
2008
-	__( 'ticket total', 'event_espresso' ),
2008
+	__('ticket total', 'event_espresso'),
2009 2009
 
2010 2010
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:29
2011
-	__( 'Order', 'event_espresso' ),
2011
+	__('Order', 'event_espresso'),
2012 2012
 
2013 2013
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:35
2014
-	__( 'Price Type', 'event_espresso' ),
2014
+	__('Price Type', 'event_espresso'),
2015 2015
 
2016 2016
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:41
2017
-	__( 'Label', 'event_espresso' ),
2017
+	__('Label', 'event_espresso'),
2018 2018
 
2019 2019
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:53
2020
-	__( 'Amount', 'event_espresso' ),
2020
+	__('Amount', 'event_espresso'),
2021 2021
 
2022 2022
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:22
2023
-	__( 'Copy ticket', 'event_espresso' ),
2023
+	__('Copy ticket', 'event_espresso'),
2024 2024
 
2025 2025
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:26
2026
-	__( 'Copy and archive this ticket', 'event_espresso' ),
2026
+	__('Copy and archive this ticket', 'event_espresso'),
2027 2027
 
2028 2028
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:29
2029
-	__( 'OK', 'event_espresso' ),
2029
+	__('OK', 'event_espresso'),
2030 2030
 
2031 2031
 	// Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:34
2032
-	__( 'amount', 'event_espresso' ),
2032
+	__('amount', 'event_espresso'),
2033 2033
 
2034 2034
 	// Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:46
2035
-	__( 'amount…', 'event_espresso' ),
2035
+	__('amount…', 'event_espresso'),
2036 2036
 
2037 2037
 	// Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:14
2038
-	__( 'description…', 'event_espresso' ),
2038
+	__('description…', 'event_espresso'),
2039 2039
 
2040 2040
 	// Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:9
2041
-	__( 'price description', 'event_espresso' ),
2041
+	__('price description', 'event_espresso'),
2042 2042
 
2043 2043
 	// Reference: packages/tpc/src/inputs/PriceIdInput.tsx:6
2044
-	__( 'price id', 'event_espresso' ),
2044
+	__('price id', 'event_espresso'),
2045 2045
 
2046 2046
 	// Reference: packages/tpc/src/inputs/PriceNameInput.tsx:13
2047
-	__( 'label…', 'event_espresso' ),
2047
+	__('label…', 'event_espresso'),
2048 2048
 
2049 2049
 	// Reference: packages/tpc/src/inputs/PriceNameInput.tsx:8
2050
-	__( 'price name', 'event_espresso' ),
2050
+	__('price name', 'event_espresso'),
2051 2051
 
2052 2052
 	// Reference: packages/tpc/src/inputs/PriceOrderInput.tsx:14
2053
-	__( 'price order', 'event_espresso' ),
2053
+	__('price order', 'event_espresso'),
2054 2054
 
2055 2055
 	// Reference: packages/tpc/src/utils/constants.ts:8
2056
-	__( 'Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then trash the old tickets.', 'event_espresso' ),
2056
+	__('Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then trash the old tickets.', 'event_espresso'),
2057 2057
 
2058 2058
 	// Reference: packages/ui-components/src/ActiveFilters/ActiveFilters.tsx:8
2059
-	__( 'active filters:', 'event_espresso' ),
2059
+	__('active filters:', 'event_espresso'),
2060 2060
 
2061 2061
 	// Reference: packages/ui-components/src/ActiveFilters/FilterTag/index.tsx:15
2062 2062
 	/* translators: %s filter name */
2063
-	__( 'remove filter - %s', 'event_espresso' ),
2063
+	__('remove filter - %s', 'event_espresso'),
2064 2064
 
2065 2065
 	// Reference: packages/ui-components/src/Address/Address.tsx:105
2066
-	__( 'Country:', 'event_espresso' ),
2066
+	__('Country:', 'event_espresso'),
2067 2067
 
2068 2068
 	// Reference: packages/ui-components/src/Address/Address.tsx:113
2069
-	__( 'Zip:', 'event_espresso' ),
2069
+	__('Zip:', 'event_espresso'),
2070 2070
 
2071 2071
 	// Reference: packages/ui-components/src/Address/Address.tsx:81
2072
-	__( 'Address:', 'event_espresso' ),
2072
+	__('Address:', 'event_espresso'),
2073 2073
 
2074 2074
 	// Reference: packages/ui-components/src/Address/Address.tsx:89
2075
-	__( 'City:', 'event_espresso' ),
2075
+	__('City:', 'event_espresso'),
2076 2076
 
2077 2077
 	// Reference: packages/ui-components/src/Address/Address.tsx:97
2078
-	__( 'State:', 'event_espresso' ),
2078
+	__('State:', 'event_espresso'),
2079 2079
 
2080 2080
 	// Reference: packages/ui-components/src/CalendarDateRange/CalendarDateRange.tsx:37
2081
-	__( 'to', 'event_espresso' ),
2081
+	__('to', 'event_espresso'),
2082 2082
 
2083 2083
 	// Reference: packages/ui-components/src/CalendarPageDate/CalendarPageDate.tsx:54
2084
-	__( 'TO', 'event_espresso' ),
2084
+	__('TO', 'event_espresso'),
2085 2085
 
2086 2086
 	// Reference: packages/ui-components/src/ColorPicker/ColorPicker.tsx:60
2087
-	__( 'Custom color', 'event_espresso' ),
2087
+	__('Custom color', 'event_espresso'),
2088 2088
 
2089 2089
 	// Reference: packages/ui-components/src/ColorPicker/Swatch.tsx:23
2090 2090
 	/* translators: color name */
2091
-	__( 'Color: %s', 'event_espresso' ),
2091
+	__('Color: %s', 'event_espresso'),
2092 2092
 
2093 2093
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:13
2094
-	__( 'Cyan bluish gray', 'event_espresso' ),
2094
+	__('Cyan bluish gray', 'event_espresso'),
2095 2095
 
2096 2096
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:17
2097
-	__( 'White', 'event_espresso' ),
2097
+	__('White', 'event_espresso'),
2098 2098
 
2099 2099
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:21
2100
-	__( 'Pale pink', 'event_espresso' ),
2100
+	__('Pale pink', 'event_espresso'),
2101 2101
 
2102 2102
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:25
2103
-	__( 'Vivid red', 'event_espresso' ),
2103
+	__('Vivid red', 'event_espresso'),
2104 2104
 
2105 2105
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:29
2106
-	__( 'Luminous vivid orange', 'event_espresso' ),
2106
+	__('Luminous vivid orange', 'event_espresso'),
2107 2107
 
2108 2108
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:33
2109
-	__( 'Luminous vivid amber', 'event_espresso' ),
2109
+	__('Luminous vivid amber', 'event_espresso'),
2110 2110
 
2111 2111
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:37
2112
-	__( 'Light green cyan', 'event_espresso' ),
2112
+	__('Light green cyan', 'event_espresso'),
2113 2113
 
2114 2114
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:41
2115
-	__( 'Vivid green cyan', 'event_espresso' ),
2115
+	__('Vivid green cyan', 'event_espresso'),
2116 2116
 
2117 2117
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:45
2118
-	__( 'Pale cyan blue', 'event_espresso' ),
2118
+	__('Pale cyan blue', 'event_espresso'),
2119 2119
 
2120 2120
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:49
2121
-	__( 'Vivid cyan blue', 'event_espresso' ),
2121
+	__('Vivid cyan blue', 'event_espresso'),
2122 2122
 
2123 2123
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:53
2124
-	__( 'Vivid purple', 'event_espresso' ),
2124
+	__('Vivid purple', 'event_espresso'),
2125 2125
 
2126 2126
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:9
2127
-	__( 'Black', 'event_espresso' ),
2127
+	__('Black', 'event_espresso'),
2128 2128
 
2129 2129
 	// Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:8
2130 2130
 	// Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:24
2131
-	__( 'Are you sure you want to close this?', 'event_espresso' ),
2131
+	__('Are you sure you want to close this?', 'event_espresso'),
2132 2132
 
2133 2133
 	// Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:9
2134 2134
 	// Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:25
2135
-	__( 'Yes, discard changes', 'event_espresso' ),
2135
+	__('Yes, discard changes', 'event_espresso'),
2136 2136
 
2137 2137
 	// Reference: packages/ui-components/src/Confirm/ConfirmDelete.tsx:7
2138
-	__( 'Are you sure you want to delete this?', 'event_espresso' ),
2138
+	__('Are you sure you want to delete this?', 'event_espresso'),
2139 2139
 
2140 2140
 	// Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:11
2141
-	__( 'Please confirm this action.', 'event_espresso' ),
2141
+	__('Please confirm this action.', 'event_espresso'),
2142 2142
 
2143 2143
 	// Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:39
2144
-	__( 'cancel', 'event_espresso' ),
2144
+	__('cancel', 'event_espresso'),
2145 2145
 
2146 2146
 	// Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:40
2147
-	__( 'confirm', 'event_espresso' ),
2147
+	__('confirm', 'event_espresso'),
2148 2148
 
2149 2149
 	// Reference: packages/ui-components/src/CurrencyDisplay/CurrencyDisplay.tsx:34
2150
-	__( 'free', 'event_espresso' ),
2150
+	__('free', 'event_espresso'),
2151 2151
 
2152 2152
 	// Reference: packages/ui-components/src/DateTimeRangePicker/DateTimeRangePicker.tsx:117
2153 2153
 	// Reference: packages/ui-components/src/Popover/PopoverForm/PopoverForm.tsx:44
2154
-	__( 'save', 'event_espresso' ),
2154
+	__('save', 'event_espresso'),
2155 2155
 
2156 2156
 	// Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36
2157
-	__( 'Hide Debug Info', 'event_espresso' ),
2157
+	__('Hide Debug Info', 'event_espresso'),
2158 2158
 
2159 2159
 	// Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36
2160
-	__( 'Show Debug Info', 'event_espresso' ),
2160
+	__('Show Debug Info', 'event_espresso'),
2161 2161
 
2162 2162
 	// Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:49
2163
-	__( 'Edit Start and End Dates and Times', 'event_espresso' ),
2163
+	__('Edit Start and End Dates and Times', 'event_espresso'),
2164 2164
 
2165 2165
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/CopyEntity.tsx:8
2166
-	__( 'copy', 'event_espresso' ),
2166
+	__('copy', 'event_espresso'),
2167 2167
 
2168 2168
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/EditEntity.tsx:8
2169
-	__( 'edit', 'event_espresso' ),
2169
+	__('edit', 'event_espresso'),
2170 2170
 
2171 2171
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/TrashEntity.tsx:8
2172
-	__( 'trash', 'event_espresso' ),
2172
+	__('trash', 'event_espresso'),
2173 2173
 
2174 2174
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/Untrash.tsx:8
2175
-	__( 'untrash', 'event_espresso' ),
2175
+	__('untrash', 'event_espresso'),
2176 2176
 
2177 2177
 	// Reference: packages/ui-components/src/EntityList/EntityList.tsx:23
2178
-	__( 'OOPS!', 'event_espresso' ),
2178
+	__('OOPS!', 'event_espresso'),
2179 2179
 
2180 2180
 	// Reference: packages/ui-components/src/EntityList/EntityList.tsx:23
2181
-	__( 'Error Loading Entites List', 'event_espresso' ),
2181
+	__('Error Loading Entites List', 'event_espresso'),
2182 2182
 
2183 2183
 	// Reference: packages/ui-components/src/EntityList/RegistrationsLink/index.tsx:12
2184
-	__( 'click to open the registrations admin page in a new tab or window', 'event_espresso' ),
2184
+	__('click to open the registrations admin page in a new tab or window', 'event_espresso'),
2185 2185
 
2186 2186
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/CardViewFilterButton.tsx:22
2187
-	__( 'card view', 'event_espresso' ),
2187
+	__('card view', 'event_espresso'),
2188 2188
 
2189 2189
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/TableViewFilterButton.tsx:21
2190
-	__( 'table view', 'event_espresso' ),
2190
+	__('table view', 'event_espresso'),
2191 2191
 
2192 2192
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8
2193
-	__( 'hide bulk actions', 'event_espresso' ),
2193
+	__('hide bulk actions', 'event_espresso'),
2194 2194
 
2195 2195
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8
2196
-	__( 'show bulk actions', 'event_espresso' ),
2196
+	__('show bulk actions', 'event_espresso'),
2197 2197
 
2198 2198
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:23
2199
-	__( 'filters', 'event_espresso' ),
2199
+	__('filters', 'event_espresso'),
2200 2200
 
2201 2201
 	// Reference: packages/ui-components/src/Legend/ToggleLegendButton.tsx:38
2202
-	__( 'legend', 'event_espresso' ),
2202
+	__('legend', 'event_espresso'),
2203 2203
 
2204 2204
 	// Reference: packages/ui-components/src/LoadingNotice/LoadingNotice.tsx:11
2205
-	__( 'loading…', 'event_espresso' ),
2205
+	__('loading…', 'event_espresso'),
2206 2206
 
2207 2207
 	// Reference: packages/ui-components/src/Modal/Modal.tsx:59
2208
-	__( 'close modal', 'event_espresso' ),
2208
+	__('close modal', 'event_espresso'),
2209 2209
 
2210 2210
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:10
2211
-	__( 'jump to previous', 'event_espresso' ),
2211
+	__('jump to previous', 'event_espresso'),
2212 2212
 
2213 2213
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:11
2214
-	__( 'jump to next', 'event_espresso' ),
2214
+	__('jump to next', 'event_espresso'),
2215 2215
 
2216 2216
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:12
2217
-	__( 'page', 'event_espresso' ),
2217
+	__('page', 'event_espresso'),
2218 2218
 
2219 2219
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:8
2220
-	__( 'previous', 'event_espresso' ),
2220
+	__('previous', 'event_espresso'),
2221 2221
 
2222 2222
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:9
2223
-	__( 'next', 'event_espresso' ),
2223
+	__('next', 'event_espresso'),
2224 2224
 
2225 2225
 	// Reference: packages/ui-components/src/Pagination/PerPage.tsx:37
2226
-	__( 'items per page', 'event_espresso' ),
2226
+	__('items per page', 'event_espresso'),
2227 2227
 
2228 2228
 	// Reference: packages/ui-components/src/Pagination/constants.ts:10
2229 2229
 	/* translators: %s is per page value */
2230
-	__( '%s / page', 'event_espresso' ),
2230
+	__('%s / page', 'event_espresso'),
2231 2231
 
2232 2232
 	// Reference: packages/ui-components/src/Pagination/constants.ts:13
2233
-	__( 'Next Page', 'event_espresso' ),
2233
+	__('Next Page', 'event_espresso'),
2234 2234
 
2235 2235
 	// Reference: packages/ui-components/src/Pagination/constants.ts:14
2236
-	__( 'Previous Page', 'event_espresso' ),
2236
+	__('Previous Page', 'event_espresso'),
2237 2237
 
2238 2238
 	// Reference: packages/ui-components/src/PercentSign/index.tsx:10
2239
-	__( '%', 'event_espresso' ),
2239
+	__('%', 'event_espresso'),
2240 2240
 
2241 2241
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:31
2242 2242
 	/* translators: entity type to select */
2243
-	__( 'Select an existing %s to use as a template.', 'event_espresso' ),
2243
+	__('Select an existing %s to use as a template.', 'event_espresso'),
2244 2244
 
2245 2245
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:38
2246
-	__( 'or', 'event_espresso' ),
2246
+	__('or', 'event_espresso'),
2247 2247
 
2248 2248
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:43
2249 2249
 	/* translators: entity type to add */
2250
-	__( 'Add a new %s and insert details manually', 'event_espresso' ),
2250
+	__('Add a new %s and insert details manually', 'event_espresso'),
2251 2251
 
2252 2252
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:48
2253
-	__( 'Add New', 'event_espresso' ),
2253
+	__('Add New', 'event_espresso'),
2254 2254
 
2255 2255
 	// Reference: packages/ui-components/src/Stepper/buttons/Next.tsx:8
2256
-	__( 'Next', 'event_espresso' ),
2256
+	__('Next', 'event_espresso'),
2257 2257
 
2258 2258
 	// Reference: packages/ui-components/src/Stepper/buttons/Previous.tsx:8
2259
-	__( 'Previous', 'event_espresso' ),
2259
+	__('Previous', 'event_espresso'),
2260 2260
 
2261 2261
 	// Reference: packages/ui-components/src/Steps/Steps.tsx:31
2262
-	__( 'Steps', 'event_espresso' ),
2262
+	__('Steps', 'event_espresso'),
2263 2263
 
2264 2264
 	// Reference: packages/ui-components/src/TabbableText/index.tsx:21
2265
-	__( 'click to edit…', 'event_espresso' ),
2265
+	__('click to edit…', 'event_espresso'),
2266 2266
 
2267 2267
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:14
2268
-	__( 'The Website\'s Time Zone', 'event_espresso' ),
2268
+	__('The Website\'s Time Zone', 'event_espresso'),
2269 2269
 
2270 2270
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:19
2271
-	__( 'UTC (Greenwich Mean Time)', 'event_espresso' ),
2271
+	__('UTC (Greenwich Mean Time)', 'event_espresso'),
2272 2272
 
2273 2273
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:9
2274
-	__( 'Your Local Time Zone', 'event_espresso' ),
2274
+	__('Your Local Time Zone', 'event_espresso'),
2275 2275
 
2276 2276
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:25
2277
-	__( 'click for timezone information', 'event_espresso' ),
2277
+	__('click for timezone information', 'event_espresso'),
2278 2278
 
2279 2279
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:30
2280
-	__( 'This Date Converted To:', 'event_espresso' ),
2280
+	__('This Date Converted To:', 'event_espresso'),
2281 2281
 
2282 2282
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:120
2283
-	__( 'Add New Venue', 'event_espresso' ),
2283
+	__('Add New Venue', 'event_espresso'),
2284 2284
 
2285 2285
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:36
2286
-	__( '~ no venue ~', 'event_espresso' ),
2286
+	__('~ no venue ~', 'event_espresso'),
2287 2287
 
2288 2288
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:43
2289
-	__( 'assign venue…', 'event_espresso' ),
2289
+	__('assign venue…', 'event_espresso'),
2290 2290
 
2291 2291
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:44
2292
-	__( 'click to select a venue…', 'event_espresso' ),
2292
+	__('click to select a venue…', 'event_espresso'),
2293 2293
 
2294 2294
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:51
2295
-	__( 'select all', 'event_espresso' ),
2295
+	__('select all', 'event_espresso'),
2296 2296
 
2297 2297
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:54
2298
-	__( 'apply', 'event_espresso' )
2298
+	__('apply', 'event_espresso')
2299 2299
 );
2300 2300
 /* THIS IS THE END OF THE GENERATED FILE */
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -37,138 +37,138 @@
 block discarded – undo
37 37
  * @since           4.0
38 38
  */
39 39
 if (function_exists('espresso_version')) {
40
-    if (! function_exists('espresso_duplicate_plugin_error')) {
41
-        /**
42
-         *    espresso_duplicate_plugin_error
43
-         *    displays if more than one version of EE is activated at the same time.
44
-         */
45
-        function espresso_duplicate_plugin_error()
46
-        {
47
-            ?>
40
+	if (! function_exists('espresso_duplicate_plugin_error')) {
41
+		/**
42
+		 *    espresso_duplicate_plugin_error
43
+		 *    displays if more than one version of EE is activated at the same time.
44
+		 */
45
+		function espresso_duplicate_plugin_error()
46
+		{
47
+			?>
48 48
 <div class="error">
49 49
 	<p>
50 50
 		<?php
51
-                    echo esc_html__(
52
-                        '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.',
53
-                        'event_espresso'
54
-                    ); ?>
51
+					echo esc_html__(
52
+						'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.',
53
+						'event_espresso'
54
+					); ?>
55 55
 	</p>
56 56
 </div>
57 57
 <?php
58
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
59
-        }
60
-    }
61
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
58
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
59
+		}
60
+	}
61
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62 62
 } else {
63
-    define('EE_MIN_PHP_VER_REQUIRED', '7.4.0');
64
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
65
-        /**
66
-         * espresso_minimum_php_version_error
67
-         *
68
-         * @return void
69
-         */
70
-        function espresso_minimum_php_version_error()
71
-        {
72
-            ?>
63
+	define('EE_MIN_PHP_VER_REQUIRED', '7.4.0');
64
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
65
+		/**
66
+		 * espresso_minimum_php_version_error
67
+		 *
68
+		 * @return void
69
+		 */
70
+		function espresso_minimum_php_version_error()
71
+		{
72
+			?>
73 73
 <div class="error">
74 74
 	<p>
75 75
 		<?php
76
-                    printf(
77
-                        esc_html__(
78
-                            '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.',
79
-                            'event_espresso'
80
-                        ),
81
-                        EE_MIN_PHP_VER_REQUIRED,
82
-                        PHP_VERSION,
83
-                        '<br/>',
84
-                        '<a href="https://www.php.net/downloads.php">https://php.net/downloads.php</a>'
85
-                    );
86
-                    ?>
76
+					printf(
77
+						esc_html__(
78
+							'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.',
79
+							'event_espresso'
80
+						),
81
+						EE_MIN_PHP_VER_REQUIRED,
82
+						PHP_VERSION,
83
+						'<br/>',
84
+						'<a href="https://www.php.net/downloads.php">https://php.net/downloads.php</a>'
85
+					);
86
+					?>
87 87
 	</p>
88 88
 </div>
89 89
 <?php
90
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
91
-        }
90
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
91
+		}
92 92
 
93
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
94
-    } else {
95
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
93
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
94
+	} else {
95
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
96 96
 
97
-        require_once __DIR__ . '/vendor/autoload.php';
97
+		require_once __DIR__ . '/vendor/autoload.php';
98 98
 
99
-        /**
100
-         * espresso_version
101
-         * Returns the plugin version
102
-         *
103
-         * @return string
104
-         */
105
-        function espresso_version(): string
106
-        {
107
-            return apply_filters('FHEE__espresso__espresso_version', '5.0.15.rc.000');
108
-        }
99
+		/**
100
+		 * espresso_version
101
+		 * Returns the plugin version
102
+		 *
103
+		 * @return string
104
+		 */
105
+		function espresso_version(): string
106
+		{
107
+			return apply_filters('FHEE__espresso__espresso_version', '5.0.15.rc.000');
108
+		}
109 109
 
110
-        /**
111
-         * espresso_plugin_activation
112
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
113
-         */
114
-        function espresso_plugin_activation()
115
-        {
116
-            update_option('ee_espresso_activation', true);
117
-            update_option('event-espresso-core_allow_tracking', 'no');
118
-            update_option('event-espresso-core_tracking_notice', 'hide');
119
-            // Run WP GraphQL activation callback
120
-            espressoLoadWpGraphQL();
121
-            graphql_activation_callback();
122
-        }
110
+		/**
111
+		 * espresso_plugin_activation
112
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
113
+		 */
114
+		function espresso_plugin_activation()
115
+		{
116
+			update_option('ee_espresso_activation', true);
117
+			update_option('event-espresso-core_allow_tracking', 'no');
118
+			update_option('event-espresso-core_tracking_notice', 'hide');
119
+			// Run WP GraphQL activation callback
120
+			espressoLoadWpGraphQL();
121
+			graphql_activation_callback();
122
+		}
123 123
 
124
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
124
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
125 125
 
126
-        /**
127
-         * espresso_plugin_deactivation
128
-         */
129
-        function espresso_plugin_deactivation()
130
-        {
131
-            // Run WP GraphQL deactivation callback
132
-            espressoLoadWpGraphQL();
133
-            graphql_deactivation_callback();
134
-            delete_option('event-espresso-core_allow_tracking');
135
-            delete_option('event-espresso-core_tracking_notice');
136
-        }
137
-        register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
126
+		/**
127
+		 * espresso_plugin_deactivation
128
+		 */
129
+		function espresso_plugin_deactivation()
130
+		{
131
+			// Run WP GraphQL deactivation callback
132
+			espressoLoadWpGraphQL();
133
+			graphql_deactivation_callback();
134
+			delete_option('event-espresso-core_allow_tracking');
135
+			delete_option('event-espresso-core_tracking_notice');
136
+		}
137
+		register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
138 138
 
139
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
140
-        bootstrap_espresso();
141
-    }
139
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
140
+		bootstrap_espresso();
141
+	}
142 142
 }
143 143
 
144 144
 if (! function_exists('espresso_deactivate_plugin')) {
145
-    /**
146
-     *    deactivate_plugin
147
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
148
-     *
149
-     * @access public
150
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
151
-     * @return    void
152
-     */
153
-    function espresso_deactivate_plugin(string $plugin_basename = '')
154
-    {
155
-        if (! function_exists('deactivate_plugins')) {
156
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
157
-        }
158
-        unset($_GET['activate'], $_REQUEST['activate']);
159
-        deactivate_plugins($plugin_basename);
160
-    }
145
+	/**
146
+	 *    deactivate_plugin
147
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
148
+	 *
149
+	 * @access public
150
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
151
+	 * @return    void
152
+	 */
153
+	function espresso_deactivate_plugin(string $plugin_basename = '')
154
+	{
155
+		if (! function_exists('deactivate_plugins')) {
156
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
157
+		}
158
+		unset($_GET['activate'], $_REQUEST['activate']);
159
+		deactivate_plugins($plugin_basename);
160
+	}
161 161
 }
162 162
 
163 163
 
164 164
 if (! function_exists('espressoLoadWpGraphQL')) {
165
-    function espressoLoadWpGraphQL()
166
-    {
167
-        if (
168
-            ! class_exists('WPGraphQL')
169
-            && is_readable(__DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php')
170
-        ) {
171
-            require_once __DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php';
172
-        }
173
-    }
165
+	function espressoLoadWpGraphQL()
166
+	{
167
+		if (
168
+			! class_exists('WPGraphQL')
169
+			&& is_readable(__DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php')
170
+		) {
171
+			require_once __DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php';
172
+		}
173
+	}
174 174
 }
Please login to merge, or discard this patch.
core/EE_Session.core.php 2 patches
Indentation   +1299 added lines, -1299 removed lines patch added patch discarded remove patch
@@ -24,1292 +24,1292 @@  discard block
 block discarded – undo
24 24
  */
25 25
 class EE_Session implements SessionIdentifierInterface
26 26
 {
27
-    const session_id_prefix    = 'ee_ssn_';
28
-
29
-    const hash_check_prefix    = 'ee_shc_';
30
-
31
-    const OPTION_NAME_SETTINGS = 'ee_session_settings';
32
-
33
-    const STATUS_CLOSED        = 0;
34
-
35
-    const STATUS_OPEN          = 1;
36
-
37
-    const SAVE_STATE_CLEAN     = 'clean';
38
-
39
-    const SAVE_STATE_DIRTY     = 'dirty';
40
-
41
-
42
-    private static ?EE_Session $_instance = null;
43
-
44
-    protected ?Base64Encoder $encryption = null;
45
-
46
-    protected ?CacheStorageInterface $cache_storage = null;
47
-
48
-    protected ?RequestInterface $request = null;
49
-
50
-    protected ?SessionStartHandler $session_start_handler = null;
51
-
52
-    /**
53
-     * how long an EE session lasts
54
-     * default session lifespan of 1 hour (for not so instant IPNs)
55
-     *
56
-     * @var SessionLifespan|null $session_lifespan
57
-     */
58
-    private ?SessionLifespan $session_lifespan = null;
59
-
60
-    /**
61
-     * the session id
62
-     *
63
-     * @var string
64
-     */
65
-    private string $_sid = '';
66
-
67
-    /**
68
-     * session id salt
69
-     *
70
-     * @var string
71
-     */
72
-    private string $_sid_salt = '';
73
-
74
-    private array $_session_data = [];
75
-
76
-    /**
77
-     * session expiration time as Unix timestamp in GMT
78
-     *
79
-     * @var int
80
-     */
81
-    private int $_expiration = 0;
82
-
83
-    /**
84
-     * whether session has expired at some point
85
-     *
86
-     * @var boolean
87
-     */
88
-    private bool $_expired = false;
89
-
90
-    /**
91
-     * current time as Unix timestamp in GMT
92
-     *
93
-     * @var int|null
94
-     */
95
-    private ?int $_time = null;
96
-
97
-    /**
98
-     * whether to encrypt session data
99
-     *
100
-     * @var bool
101
-     */
102
-    private bool $_use_encryption = false;
103
-
104
-    /**
105
-     * well... according to the server...
106
-     *
107
-     * @var string
108
-     */
109
-    private string $_user_agent = '';
110
-
111
-
112
-    /**
113
-     * array for defining default session vars
114
-     *
115
-     * @var array
116
-     */
117
-    private array $_default_session_vars = [
118
-        'id'            => null,
119
-        'user_id'       => null,
120
-        'ip_address'    => null,
121
-        'user_agent'    => null,
122
-        'init_access'   => null,
123
-        'last_access'   => null,
124
-        'expiration'    => null,
125
-        'pages_visited' => [],
126
-    ];
127
-
128
-    /**
129
-     * timestamp for when last garbage collection cycle was performed
130
-     *
131
-     * @var int $_last_gc
132
-     */
133
-    private int $_last_gc = 0;
134
-
135
-    /**
136
-     * whether session is active or not
137
-     *
138
-     * @var int $status
139
-     */
140
-    private int $status = EE_Session::STATUS_CLOSED;
141
-
142
-    /**
143
-     * whether session data has changed therefore requiring a session save
144
-     *
145
-     * @var string $save_state
146
-     */
147
-    private string $save_state = EE_Session::SAVE_STATE_CLEAN;
148
-
149
-
150
-    /**
151
-     * @singleton method used to instantiate class object
152
-     * @param CacheStorageInterface|null $cache_storage
153
-     * @param SessionLifespan|null       $lifespan
154
-     * @param RequestInterface|null      $request
155
-     * @param SessionStartHandler|null   $session_start_handler
156
-     * @param Base64Encoder|null         $encryption
157
-     * @return EE_Session|null
158
-     * @throws InvalidArgumentException
159
-     * @throws InvalidDataTypeException
160
-     * @throws InvalidInterfaceException
161
-     */
162
-    public static function instance(
163
-        CacheStorageInterface $cache_storage = null,
164
-        SessionLifespan $lifespan = null,
165
-        RequestInterface $request = null,
166
-        SessionStartHandler $session_start_handler = null,
167
-        Base64Encoder $encryption = null
168
-    ): ?EE_Session {
169
-        // check if class object is instantiated
170
-        // session loading is turned ON by default, but prior to the init hook, can be turned back OFF via:
171
-        // add_filter( 'FHEE_load_EE_Session', '__return_false' );
172
-        if (
173
-            ! self::$_instance instanceof EE_Session
174
-            && $cache_storage instanceof CacheStorageInterface
175
-            && $lifespan instanceof SessionLifespan
176
-            && $request instanceof RequestInterface
177
-            && $session_start_handler instanceof SessionStartHandler
178
-            && apply_filters('FHEE_load_EE_Session', true)
179
-        ) {
180
-            self::$_instance = new self(
181
-                $cache_storage,
182
-                $lifespan,
183
-                $request,
184
-                $session_start_handler,
185
-                $encryption
186
-            );
187
-        }
188
-        return self::$_instance;
189
-    }
190
-
191
-
192
-    /**
193
-     * protected constructor to prevent direct creation
194
-     *
195
-     * @param CacheStorageInterface $cache_storage
196
-     * @param SessionLifespan       $lifespan
197
-     * @param RequestInterface      $request
198
-     * @param SessionStartHandler   $session_start_handler
199
-     * @param Base64Encoder|null    $encryption
200
-     * @throws InvalidArgumentException
201
-     * @throws InvalidDataTypeException
202
-     * @throws InvalidInterfaceException
203
-     */
204
-    protected function __construct(
205
-        CacheStorageInterface $cache_storage,
206
-        SessionLifespan $lifespan,
207
-        RequestInterface $request,
208
-        SessionStartHandler $session_start_handler,
209
-        Base64Encoder $encryption = null
210
-    ) {
211
-        // session loading is turned ON by default,
212
-        // but prior to the 'AHEE__EE_System__core_loaded_and_ready' hook
213
-        // (which currently fires on the init hook at priority 9),
214
-        // can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
215
-        if (! apply_filters('FHEE_load_EE_Session', true)) {
216
-            return;
217
-        }
218
-        $this->session_start_handler = $session_start_handler;
219
-        $this->session_lifespan      = $lifespan;
220
-        $this->request               = $request;
221
-        if (! defined('ESPRESSO_SESSION')) {
222
-            define('ESPRESSO_SESSION', true);
223
-        }
224
-        // retrieve session options from db
225
-        $session_settings = (array) get_option(EE_Session::OPTION_NAME_SETTINGS, []);
226
-        if (! empty($session_settings)) {
227
-            // cycle though existing session options
228
-            foreach ($session_settings as $var_name => $session_setting) {
229
-                // set values for class properties
230
-                $var_name          = '_' . $var_name;
231
-                $this->{$var_name} = $session_setting;
232
-            }
233
-        }
234
-        $this->cache_storage = $cache_storage;
235
-        // are we using encryption?
236
-        $this->_use_encryption = $encryption instanceof Base64Encoder
237
-                                 && EE_Registry::instance()->CFG->admin->encode_session_data();
238
-        // encrypt data via: $this->encryption->encodeString();
239
-        $this->encryption = $encryption;
240
-        // filter hook allows outside functions/classes/plugins to change default empty cart
241
-        $extra_default_session_vars  = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', []);
242
-        $this->_default_session_vars = array_merge($this->_default_session_vars, $extra_default_session_vars);
243
-        // apply default session vars
244
-        $this->_set_defaults();
245
-        add_action('AHEE__EE_System__initialize', [$this, 'open_session']);
246
-        // check request for 'clear_session' param
247
-        add_action('AHEE__EE_Request_Handler__construct__complete', [$this, 'wp_loaded']);
248
-        // once everything is all said and done,
249
-        add_action('shutdown', [$this, 'update'], 100);
250
-        add_action('shutdown', [$this, 'garbageCollection'], 1000);
251
-        $this->configure_garbage_collection_filters();
252
-    }
253
-
254
-
255
-    /**
256
-     * @return bool
257
-     * @throws InvalidArgumentException
258
-     * @throws InvalidDataTypeException
259
-     * @throws InvalidInterfaceException
260
-     */
261
-    public static function isLoadedAndActive(): bool
262
-    {
263
-        return did_action('AHEE__EE_System__core_loaded_and_ready')
264
-               && EE_Session::instance() instanceof EE_Session
265
-               && EE_Session::instance()->isActive();
266
-    }
267
-
268
-
269
-    /**
270
-     * @return bool
271
-     */
272
-    public function isActive(): bool
273
-    {
274
-        return $this->status === EE_Session::STATUS_OPEN;
275
-    }
276
-
277
-
278
-    /**
279
-     * @return void
280
-     * @throws EE_Error
281
-     * @throws InvalidArgumentException
282
-     * @throws InvalidDataTypeException
283
-     * @throws InvalidInterfaceException
284
-     * @throws InvalidSessionDataException
285
-     * @throws RuntimeException
286
-     * @throws ReflectionException
287
-     */
288
-    public function open_session()
289
-    {
290
-        // Check for an existing session and retrieve it from the database, unless the system is in maintenance level 2.
291
-        if (DbStatus::isOnline() && ! $this->_espresso_session()) {
292
-            // or just start a new one
293
-            $this->_create_espresso_session();
294
-        }
295
-    }
296
-
297
-
298
-    /**
299
-     * @return bool
300
-     */
301
-    public function expired(): bool
302
-    {
303
-        return $this->_expired;
304
-    }
305
-
306
-
307
-    /**
308
-     * @return void
309
-     */
310
-    public function reset_expired()
311
-    {
312
-        $this->_expired = false;
313
-    }
314
-
315
-
316
-    /**
317
-     * @return int
318
-     */
319
-    public function expiration(): int
320
-    {
321
-        return $this->_expiration;
322
-    }
323
-
324
-
325
-    /**
326
-     * @return int
327
-     */
328
-    public function extension(): int
329
-    {
330
-        return apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS);
331
-    }
332
-
333
-
334
-    /**
335
-     * @param int $time number of seconds to add to session expiration
336
-     */
337
-    public function extend_expiration(int $time = 0)
338
-    {
339
-        $time              = $time
340
-            ?: $this->extension();
341
-        $this->_expiration += absint($time);
342
-    }
343
-
344
-
345
-    /**
346
-     * @return int
347
-     */
348
-    public function lifespan(): int
349
-    {
350
-        return $this->session_lifespan->inSeconds();
351
-    }
352
-
353
-
354
-    /**
355
-     * Marks whether the session data has been updated or not.
356
-     * Valid options are:
357
-     *      EE_Session::SAVE_STATE_CLEAN - session data remains unchanged and updating is not necessary
358
-     *      EE_Session::SAVE_STATE_DIRTY - session data has changed since last save and needs to be updated
359
-     * default value is EE_Session::SAVE_STATE_DIRTY
360
-     *
361
-     * @param string $save_state
362
-     */
363
-    public function setSaveState(string $save_state = EE_Session::SAVE_STATE_DIRTY)
364
-    {
365
-        $valid_save_states = [
366
-            EE_Session::SAVE_STATE_CLEAN,
367
-            EE_Session::SAVE_STATE_DIRTY,
368
-        ];
369
-        if (! in_array($save_state, $valid_save_states, true)) {
370
-            $save_state = EE_Session::SAVE_STATE_DIRTY;
371
-        }
372
-        $this->save_state = $save_state;
373
-    }
374
-
375
-
376
-    /**
377
-     * This just sets some defaults for the _session data property
378
-     *
379
-     * @return void
380
-     */
381
-    private function _set_defaults()
382
-    {
383
-        // set some defaults
384
-        foreach ($this->_default_session_vars as $key => $default_var) {
385
-            if (is_array($default_var)) {
386
-                $this->_session_data[ $key ] = [];
387
-            } else {
388
-                $this->_session_data[ $key ] = '';
389
-            }
390
-        }
391
-    }
392
-
393
-
394
-    /**
395
-     * @retrieve  session data
396
-     * @return    string
397
-     */
398
-    public function id(): string
399
-    {
400
-        return $this->_sid;
401
-    }
402
-
403
-
404
-    /**
405
-     * @param EE_Cart $cart
406
-     * @return bool
407
-     */
408
-    public function set_cart(EE_Cart $cart): bool
409
-    {
410
-        $this->_session_data['cart'] = $cart;
411
-        $this->setSaveState();
412
-        return true;
413
-    }
414
-
415
-
416
-    /**
417
-     * reset_cart
418
-     */
419
-    public function reset_cart()
420
-    {
421
-        do_action('AHEE__EE_Session__reset_cart__before_reset', $this);
422
-        $this->_session_data['cart'] = null;
423
-        $this->setSaveState();
424
-    }
425
-
426
-
427
-    /**
428
-     * @return EE_Cart
429
-     */
430
-    public function cart(): ?EE_Cart
431
-    {
432
-        return isset($this->_session_data['cart']) && $this->_session_data['cart'] instanceof EE_Cart
433
-            ? $this->_session_data['cart']
434
-            : null;
435
-    }
436
-
437
-
438
-    /**
439
-     * @param EE_Checkout $checkout
440
-     * @return bool
441
-     */
442
-    public function set_checkout(EE_Checkout $checkout): bool
443
-    {
444
-        $this->_session_data['checkout'] = $checkout;
445
-        $this->setSaveState();
446
-        return true;
447
-    }
448
-
449
-
450
-    /**
451
-     * reset_checkout
452
-     */
453
-    public function reset_checkout()
454
-    {
455
-        do_action('AHEE__EE_Session__reset_checkout__before_reset', $this);
456
-        $this->_session_data['checkout'] = null;
457
-        $this->setSaveState();
458
-    }
459
-
460
-
461
-    /**
462
-     * @return EE_Checkout
463
-     */
464
-    public function checkout(): ?EE_Checkout
465
-    {
466
-        return isset($this->_session_data['checkout']) && $this->_session_data['checkout'] instanceof EE_Checkout
467
-            ? $this->_session_data['checkout']
468
-            : null;
469
-    }
470
-
471
-
472
-    /**
473
-     * @param EE_Transaction $transaction
474
-     * @return bool
475
-     * @throws EE_Error
476
-     * @throws ReflectionException
477
-     */
478
-    public function set_transaction(EE_Transaction $transaction): bool
479
-    {
480
-        // first remove the session from the transaction before we save the transaction in the session
481
-        $transaction->set_txn_session_data(null);
482
-        $this->_session_data['transaction'] = $transaction;
483
-        $this->setSaveState();
484
-        return true;
485
-    }
486
-
487
-
488
-    /**
489
-     * reset_transaction
490
-     */
491
-    public function reset_transaction()
492
-    {
493
-        do_action('AHEE__EE_Session__reset_transaction__before_reset', $this);
494
-        $this->_session_data['transaction'] = null;
495
-        $this->setSaveState();
496
-    }
497
-
498
-
499
-    /**
500
-     * @return EE_Transaction
501
-     */
502
-    public function transaction(): ?EE_Transaction
503
-    {
504
-        return isset($this->_session_data['transaction'])
505
-               && $this->_session_data['transaction'] instanceof EE_Transaction
506
-            ? $this->_session_data['transaction']
507
-            : null;
508
-    }
509
-
510
-
511
-    /**
512
-     * retrieve session data
513
-     *
514
-     * @param string|null $key
515
-     * @param bool        $reset_cache
516
-     * @return array|EE_Cart|EE_Checkout|EE_Transaction
517
-     */
518
-    public function get_session_data(?string $key = null, bool $reset_cache = false)
519
-    {
520
-        if ($reset_cache) {
521
-            $this->reset_cart();
522
-            $this->reset_checkout();
523
-            $this->reset_transaction();
524
-        }
525
-        if (! empty($key)) {
526
-            return $this->_session_data[ $key ] ?? null;
527
-        }
528
-        return $this->_session_data;
529
-    }
530
-
531
-
532
-    /**
533
-     * Returns TRUE on success, FALSE on fail
534
-     *
535
-     * @param array $data
536
-     * @return bool
537
-     */
538
-    public function set_session_data(array $data): bool
539
-    {
540
-        // nothing ??? bad data ??? go home!
541
-        if (empty($data)) {
542
-            EE_Error::add_error(
543
-                esc_html__(
544
-                    'No session data or invalid session data was provided.',
545
-                    'event_espresso'
546
-                ),
547
-                __FILE__,
548
-                __FUNCTION__,
549
-                __LINE__
550
-            );
551
-            return false;
552
-        }
553
-        foreach ($data as $key => $value) {
554
-            if (isset($this->_default_session_vars[ $key ])) {
555
-                EE_Error::add_error(
556
-                    sprintf(
557
-                        esc_html__(
558
-                            'Sorry! %s is a default session datum and can not be reset.',
559
-                            'event_espresso'
560
-                        ),
561
-                        $key
562
-                    ),
563
-                    __FILE__,
564
-                    __FUNCTION__,
565
-                    __LINE__
566
-                );
567
-                return false;
568
-            }
569
-            $this->_session_data[ $key ] = $value;
570
-            $this->setSaveState();
571
-        }
572
-        return true;
573
-    }
574
-
575
-
576
-    /**
577
-     * @initiate session
578
-     * @return bool TRUE on success, FALSE on fail
579
-     * @throws EE_Error
580
-     * @throws InvalidArgumentException
581
-     * @throws InvalidDataTypeException
582
-     * @throws InvalidInterfaceException
583
-     * @throws InvalidSessionDataException
584
-     * @throws RuntimeException
585
-     * @throws ReflectionException
586
-     */
587
-    private function _espresso_session(): bool
588
-    {
589
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
590
-        $this->session_start_handler->startSession();
591
-        $this->status = EE_Session::STATUS_OPEN;
592
-        // get our modified session ID
593
-        $this->_sid = $this->_generate_session_id();
594
-        // set the "user agent"
595
-        $this->_user_agent = $this->request->userAgent();
596
-        // now let's retrieve what's in the db
597
-        $session_data = $this->_retrieve_session_data();
598
-        if (empty($session_data)) {
599
-            // set initial site access time and the session expiration
600
-            $this->_set_init_access_and_expiration();
601
-            // set referer
602
-            $this->_session_data['pages_visited'][ $this->_session_data['init_access'] ] = esc_attr(
603
-                $this->request->getServerParam('HTTP_REFERER')
604
-            );
605
-            // no previous session = go back and create one (on top of the data above)
606
-            return false;
607
-        }
608
-        // get the current time in UTC
609
-        $this->_time = $this->_time !== null
610
-            ? $this->_time
611
-            : time();
612
-        // and reset the session expiration
613
-        $this->_expiration = $session_data['expiration'] ?? $this->_time + $this->session_lifespan->inSeconds();
614
-        // now the user agent
615
-        if ($session_data['user_agent'] !== $this->_user_agent) {
616
-            return false;
617
-        }
618
-        // wait a minute... how old are you?
619
-        if ($this->_time > $this->_expiration) {
620
-            // yer too old fer me!
621
-            $this->_expired = true;
622
-            // wipe out everything that isn't a default session datum
623
-            $this->clear_session(__CLASS__, __FUNCTION__);
624
-        }
625
-        // make event espresso session data available to plugin
626
-        $this->_session_data = array_merge($this->_session_data, $session_data);
627
-        return true;
628
-    }
629
-
630
-    private function sessionKey(string $prefix = ''): string
631
-    {
632
-        return $prefix . EE_Session::session_id_prefix . $this->_sid;
633
-    }
634
-
635
-    private function hashCheckKey(): string
636
-    {
637
-        return EE_Session::hash_check_prefix . $this->_sid;
638
-    }
639
-
640
-
641
-    /**
642
-     * _get_session_data
643
-     * Retrieves the session data, and attempts to correct any encoding issues that can occur due to improperly setup
644
-     * databases
645
-     *
646
-     * @return array
647
-     * @throws EE_Error
648
-     * @throws InvalidArgumentException
649
-     * @throws InvalidSessionDataException
650
-     * @throws InvalidDataTypeException
651
-     * @throws InvalidInterfaceException
652
-     * @throws RuntimeException
653
-     * @throws ReflectionException
654
-     */
655
-    protected function _retrieve_session_data(): array
656
-    {
657
-        try {
658
-            // we're using WP's Transient API to store session data using the PHP session ID as the option name
659
-            $session_data = $this->cache_storage->get($this->sessionKey(), false);
660
-            if (empty($session_data)) {
661
-                return [];
662
-            }
663
-            if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
664
-                $hash_check = $this->cache_storage->get($this->hashCheckKey(), false);
665
-                if ($hash_check && $hash_check !== md5($session_data)) {
666
-                    EE_Error::add_error(
667
-                        sprintf(
668
-                            esc_html__(
669
-                                'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.',
670
-                                'event_espresso'
671
-                            ),
672
-                            $this->sessionKey()
673
-                        ),
674
-                        __FILE__,
675
-                        __FUNCTION__,
676
-                        __LINE__
677
-                    );
678
-                }
679
-            }
680
-        } catch (Exception $e) {
681
-            // let's just eat that error for now and attempt to correct any corrupted data
682
-            global $wpdb;
683
-            $row          = $wpdb->get_row(
684
-                $wpdb->prepare(
685
-                    "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
686
-                    $this->sessionKey('_transient_')
687
-                )
688
-            );
689
-            $session_data = is_object($row) ? $row->option_value : null;
690
-            if ($session_data) {
691
-                $session_data = preg_replace_callback(
692
-                    '!s:(d+):"(.*?)";!',
693
-                    function ($match) {
694
-                        return $match[1] === strlen($match[2])
695
-                            ? $match[0]
696
-                            : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
697
-                    },
698
-                    $session_data
699
-                );
700
-            }
701
-            $session_data = maybe_unserialize($session_data);
702
-        }
703
-        // in case the data is encoded... try to decode it
704
-        $session_data = $this->_use_encryption
705
-            ? $this->encryption->decodeString($session_data)
706
-            : $session_data;
707
-        if (! is_array($session_data)) {
708
-            try {
709
-                $session_data = maybe_unserialize($session_data);
710
-            } catch (Exception $e) {
711
-                $msg = esc_html__(
712
-                    'An error occurred while attempting to unserialize the session data.',
713
-                    'event_espresso'
714
-                );
715
-                $msg .= WP_DEBUG
716
-                    ? '<br><pre>'
717
-                      . print_r($session_data, true)
718
-                      . '</pre><br>'
719
-                      . $this->find_serialize_error($session_data)
720
-                    : '';
721
-                $this->cache_storage->delete($this->sessionKey());
722
-                throw new InvalidSessionDataException($msg, 0, $e);
723
-            }
724
-        }
725
-        // just a check to make sure the session array is indeed an array
726
-        if (! is_array($session_data)) {
727
-            // no?!?! then something is wrong
728
-            $msg = esc_html__(
729
-                'The session data is missing, invalid, or corrupted.',
730
-                'event_espresso'
731
-            );
732
-            $msg .= WP_DEBUG
733
-                ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
734
-                : '';
735
-            $this->cache_storage->delete($this->sessionKey());
736
-            throw new InvalidSessionDataException($msg);
737
-        }
738
-        if (isset($session_data['transaction']) && absint($session_data['transaction']) !== 0) {
739
-            $session_data['transaction'] = EEM_Transaction::instance()->get_one_by_ID(
740
-                $session_data['transaction']
741
-            );
742
-        }
743
-        return $session_data;
744
-    }
745
-
746
-
747
-    /**
748
-     * _generate_session_id
749
-     * Retrieves the PHP session id either directly from the PHP session,
750
-     * or from the request array if it was passed in from an AJAX request.
751
-     * The session id is then salted and hashed (mmm sounds tasty)
752
-     * so that it can be safely used as a request param
753
-     *
754
-     * @return string
755
-     */
756
-    protected function _generate_session_id(): string
757
-    {
758
-        // check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
759
-        $session_id = $this->request->requestParamIsSet('EESID')
760
-            ? $this->request->getRequestParam('EESID')
761
-            : md5(session_id() . get_current_blog_id() . $this->_get_sid_salt());
762
-        return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
763
-    }
764
-
765
-
766
-    /**
767
-     * _get_sid_salt
768
-     *
769
-     * @return string
770
-     */
771
-    protected function _get_sid_salt(): string
772
-    {
773
-        // was session id salt already saved to db ?
774
-        if (empty($this->_sid_salt)) {
775
-            // no?  then maybe use WP defined constant
776
-            if (defined('AUTH_SALT')) {
777
-                $this->_sid_salt = AUTH_SALT;
778
-            }
779
-            // if salt doesn't exist or is too short
780
-            if (strlen($this->_sid_salt) < 32) {
781
-                // create a new one
782
-                $this->_sid_salt = wp_generate_password(64);
783
-            }
784
-            // and save it as a permanent session setting
785
-            $this->updateSessionSettings(['sid_salt' => $this->_sid_salt]);
786
-        }
787
-        return $this->_sid_salt;
788
-    }
789
-
790
-
791
-    /**
792
-     * _set_init_access_and_expiration
793
-     *
794
-     * @return void
795
-     */
796
-    protected function _set_init_access_and_expiration()
797
-    {
798
-        $this->_time       = time();
799
-        $this->_expiration = $this->_time + $this->session_lifespan->inSeconds();
800
-        // set initial site access time
801
-        $this->_session_data['init_access'] = $this->_time;
802
-        // and the session expiration
803
-        $this->_session_data['expiration'] = $this->_expiration;
804
-    }
805
-
806
-
807
-    /**
808
-     * @update session data  prior to saving to the db
809
-     * @param bool $new_session
810
-     * @return bool TRUE on success, FALSE on fail
811
-     * @throws EE_Error
812
-     * @throws InvalidArgumentException
813
-     * @throws InvalidDataTypeException
814
-     * @throws InvalidInterfaceException
815
-     * @throws ReflectionException
816
-     */
817
-    public function update(bool $new_session = false): bool
818
-    {
819
-        $this->_session_data = isset($this->_session_data['id']) ? $this->_session_data : [];
820
-        if (empty($this->_session_data)) {
821
-            $this->_set_defaults();
822
-        }
823
-        $session_data = [];
824
-        foreach ($this->_session_data as $key => $value) {
825
-            switch ($key) {
826
-                case 'id':
827
-                    // session ID
828
-                    $session_data['id'] = $this->_sid;
829
-                    break;
830
-                case 'ip_address':
831
-                    // visitor ip address
832
-                    $session_data['ip_address'] = $this->request->ipAddress();
833
-                    break;
834
-                case 'user_agent':
835
-                    // visitor user_agent
836
-                    $session_data['user_agent'] = $this->_user_agent;
837
-                    break;
838
-                case 'init_access':
839
-                    $session_data['init_access'] = absint($value);
840
-                    break;
841
-                case 'last_access':
842
-                    // current access time
843
-                    $session_data['last_access'] = $this->_time;
844
-                    break;
845
-                case 'expiration':
846
-                    // when the session expires
847
-                    $session_data['expiration'] = ! empty($this->_expiration)
848
-                        ? $this->_expiration
849
-                        : $session_data['init_access'] + $this->session_lifespan->inSeconds();
850
-                    break;
851
-                case 'user_id':
852
-                    // current user if logged in
853
-                    $session_data['user_id'] = $this->_wp_user_id();
854
-                    break;
855
-                case 'pages_visited':
856
-                    $page_visit = $this->_get_page_visit();
857
-                    if ($page_visit) {
858
-                        // set pages visited where the first will be the http referrer
859
-                        $this->_session_data['pages_visited'][ $this->_time ] = $page_visit;
860
-                        // we'll only save the last 10 page visits.
861
-                        $session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
862
-                    }
863
-                    break;
864
-                default:
865
-                    // carry any other data over
866
-                    $session_data[ $key ] = $this->_session_data[ $key ];
867
-            }
868
-        }
869
-        $this->_session_data = $session_data;
870
-        // creating a new session does not require saving to the db just yet
871
-        if (! $new_session) {
872
-            // ready? let's save
873
-            if ($this->_save_session_to_db()) {
874
-                return true;
875
-            }
876
-            return false;
877
-        }
878
-        // meh, why not?
879
-        return true;
880
-    }
881
-
882
-
883
-    /**
884
-     * @create session data array
885
-     * @throws EE_Error
886
-     * @throws InvalidArgumentException
887
-     * @throws InvalidDataTypeException
888
-     * @throws InvalidInterfaceException
889
-     * @throws ReflectionException
890
-     */
891
-    private function _create_espresso_session()
892
-    {
893
-        do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
894
-        // use the update function for now with $new_session arg set to TRUE
895
-        $this->update(true);
896
-    }
897
-
898
-
899
-    /**
900
-     * Detects if there is anything worth saving in the session (eg the cart is a good one, notices are pretty good
901
-     * too). This is used when determining if we want to save the session or not.
902
-     *
903
-     * @return bool
904
-     * @since 4.9.67.p
905
-     */
906
-    private function sessionHasStuffWorthSaving(): bool
907
-    {
908
-        if ($this->save_state === EE_Session::SAVE_STATE_DIRTY) {
909
-            return true;
910
-        }
911
-        $default_session_vars = array_keys($this->_default_session_vars);
912
-        foreach ($this->_session_data as $key => $sessionDatum) {
913
-            if (in_array($key, $default_session_vars, true)) {
914
-                continue;
915
-            }
916
-            if (! empty($sessionDatum)) {
917
-                return true;
918
-            }
919
-            if (
920
-                $key === 'ee_notices'
921
-                && (
922
-                    ! empty($this->_session_data['ee_notices']['attention'])
923
-                    || ! empty($this->_session_data['ee_notices']['errors'])
924
-                    || ! empty($this->_session_data['ee_notices']['success'])
925
-                )
926
-            ) {
927
-                return true;
928
-            }
929
-        }
930
-        return false;
931
-    }
932
-
933
-
934
-    /**
935
-     * _save_session_to_db
936
-     *
937
-     * @param bool $clear_session
938
-     * @return bool
939
-     * @throws EE_Error
940
-     * @throws InvalidArgumentException
941
-     * @throws InvalidDataTypeException
942
-     * @throws InvalidInterfaceException
943
-     * @throws ReflectionException
944
-     */
945
-    private function _save_session_to_db(bool $clear_session = false): bool
946
-    {
947
-        // don't save sessions for crawlers
948
-        // and unless we're deleting the session data, don't save anything if there isn't a cart
949
-        if (
950
-            $this->request->isBot()
951
-            || (
952
-                ! $clear_session
953
-                && ! $this->sessionHasStuffWorthSaving()
954
-                && apply_filters('FHEE__EE_Session___save_session_to_db__abort_session_save', true)
955
-            )
956
-        ) {
957
-            return false;
958
-        }
959
-        $transaction = $this->transaction();
960
-        if ($transaction instanceof EE_Transaction) {
961
-            if (! $transaction->ID()) {
962
-                $transaction->save();
963
-            }
964
-            $this->_session_data['transaction'] = $transaction->ID();
965
-        }
966
-        // then serialize all of our session data
967
-        $session_data = serialize($this->_session_data);
968
-        // do we need to also encode it to avoid corrupted data when saved to the db?
969
-        $session_data = $this->_use_encryption
970
-            ? $this->encryption->encodeString($session_data)
971
-            : $session_data;
972
-        // maybe save hash check
973
-        if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
974
-            $this->cache_storage->add(
975
-                $this->hashCheckKey(),
976
-                md5($session_data),
977
-                $this->session_lifespan->inSeconds()
978
-            );
979
-        }
980
-        // we're using the Transient API for storing session data,
981
-        $saved = $this->cache_storage->add(
982
-            $this->sessionKey(),
983
-            $session_data,
984
-            $this->session_lifespan->inSeconds()
985
-        );
986
-        $this->setSaveState(EE_Session::SAVE_STATE_CLEAN);
987
-        return $saved;
988
-    }
989
-
990
-
991
-    /**
992
-     * @get    the full page request the visitor is accessing
993
-     * @return string
994
-     */
995
-    public function _get_page_visit(): string
996
-    {
997
-        $page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
998
-        // check for request url
999
-        if ($this->request->serverParamIsSet('REQUEST_URI')) {
1000
-            $page_id     = '?';
1001
-            $e_reg       = '';
1002
-            $request_uri = $this->request->getServerParam('REQUEST_URI');
1003
-            $ru_bits     = explode('?', $request_uri);
1004
-            $request_uri = $ru_bits[0];
1005
-            $http_host   = $this->request->getServerParam('HTTP_HOST');
1006
-            // check for page_id in SERVER REQUEST
1007
-            if ($this->request->requestParamIsSet('page_id')) {
1008
-                // rebuild $e_reg without any of the extra parameters
1009
-                $page_id .= 'page_id=' . $this->request->getRequestParam('page_id', 0, 'int') . '&amp;';
1010
-            }
1011
-            // check for $e_reg in SERVER REQUEST
1012
-            if ($this->request->requestParamIsSet('ee')) {
1013
-                // rebuild $e_reg without any of the extra parameters
1014
-                $e_reg = 'ee=' . $this->request->getRequestParam('ee');
1015
-            }
1016
-            $page_visit = esc_url(rtrim($http_host . $request_uri . $page_id . $e_reg, '?'));
1017
-        }
1018
-        return $page_visit !== home_url('/wp-admin/admin-ajax.php')
1019
-            ? $page_visit
1020
-            : '';
1021
-    }
1022
-
1023
-
1024
-    /**
1025
-     * @the    current wp user id
1026
-     * @return int
1027
-     */
1028
-    public function _wp_user_id(): int
1029
-    {
1030
-        // if I need to explain the following lines of code, then you shouldn't be looking at this!
1031
-        return get_current_user_id();
1032
-    }
1033
-
1034
-
1035
-    /**
1036
-     * Clear EE_Session data
1037
-     *
1038
-     * @param string $class
1039
-     * @param string $function
1040
-     * @return void
1041
-     * @throws EE_Error
1042
-     * @throws InvalidArgumentException
1043
-     * @throws InvalidDataTypeException
1044
-     * @throws InvalidInterfaceException
1045
-     * @throws ReflectionException
1046
-     */
1047
-    public function clear_session(string $class = '', string $function = '')
1048
-    {
1049
-        do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' . $function . '()');
1050
-        $this->reset_cart();
1051
-        $this->reset_checkout();
1052
-        $this->reset_transaction();
1053
-        // wipe out everything that isn't a default session datum
1054
-        $this->reset_data(array_keys($this->_session_data));
1055
-        // reset initial site access time and the session expiration
1056
-        $this->_set_init_access_and_expiration();
1057
-        $this->setSaveState();
1058
-        $this->_save_session_to_db(true);
1059
-    }
1060
-
1061
-
1062
-    /**
1063
-     * resets all non-default session vars. Returns TRUE on success, FALSE on fail
1064
-     *
1065
-     * @param array|mixed $keys_to_reset
1066
-     * @param bool        $show_all_notices
1067
-     * @return bool
1068
-     */
1069
-    public function reset_data($keys_to_reset = [], bool $show_all_notices = false): bool
1070
-    {
1071
-        $keys_to_reset = (array) apply_filters(
1072
-            'FHEE__EE_Session__reset_data__session_data_keys_to_reset',
1073
-            (array) $keys_to_reset
1074
-        );
1075
-        // nothing ??? go home!
1076
-        if (empty($keys_to_reset)) {
1077
-            EE_Error::add_error(
1078
-                esc_html__(
1079
-                    'No session data could be reset, because no session var name was provided.',
1080
-                    'event_espresso'
1081
-                ),
1082
-                __FILE__,
1083
-                __FUNCTION__,
1084
-                __LINE__
1085
-            );
1086
-            return false;
1087
-        }
1088
-        $return_value = true;
1089
-        // since $keys_to_reset is an array, cycle through the values
1090
-        foreach ($keys_to_reset as $key_to_reset) {
1091
-            // first check to make sure it is a valid session var
1092
-            if (! isset($this->_session_data[ $key_to_reset ]) && $show_all_notices) {
1093
-                // oops! that session var does not exist!
1094
-                EE_Error::add_error(
1095
-                    sprintf(
1096
-                        esc_html__(
1097
-                            'The session item provided, %s, is invalid or does not exist.',
1098
-                            'event_espresso'
1099
-                        ),
1100
-                        $key_to_reset
1101
-                    ),
1102
-                    __FILE__,
1103
-                    __FUNCTION__,
1104
-                    __LINE__
1105
-                );
1106
-                $return_value = false;
1107
-                continue;
1108
-            }
1109
-            // then check to make sure it is not a default var
1110
-            if (array_key_exists($key_to_reset, $this->_default_session_vars)) {
1111
-                // yeeeeeeeeerrrrrrrrrrr OUT !!!!
1112
-                if ($show_all_notices) {
1113
-                    EE_Error::add_error(
1114
-                        sprintf(
1115
-                            esc_html__(
1116
-                                'Sorry! %s is a default session datum and can not be reset.',
1117
-                                'event_espresso'
1118
-                            ),
1119
-                            $key_to_reset
1120
-                        ),
1121
-                        __FILE__,
1122
-                        __FUNCTION__,
1123
-                        __LINE__
1124
-                    );
1125
-                }
1126
-                $return_value = false;
1127
-                continue;
1128
-            }
1129
-            // remove session var
1130
-            unset($this->_session_data[ $key_to_reset ]);
1131
-            $this->setSaveState();
1132
-            if ($show_all_notices) {
1133
-                EE_Error::add_success(
1134
-                    sprintf(
1135
-                        esc_html__('The session variable %s was removed.', 'event_espresso'),
1136
-                        $key_to_reset
1137
-                    ),
1138
-                    __FILE__,
1139
-                    __FUNCTION__,
1140
-                    __LINE__
1141
-                );
1142
-            }
1143
-        } // end of foreach
1144
-        return $return_value;
1145
-    }
1146
-
1147
-
1148
-    /**
1149
-     *   wp_loaded
1150
-     *
1151
-     * @throws EE_Error
1152
-     * @throws InvalidDataTypeException
1153
-     * @throws InvalidInterfaceException
1154
-     * @throws InvalidArgumentException
1155
-     * @throws ReflectionException
1156
-     */
1157
-    public function wp_loaded()
1158
-    {
1159
-        if ($this->request->requestParamIsSet('clear_session')) {
1160
-            $this->clear_session(__CLASS__, __FUNCTION__);
1161
-        }
1162
-    }
1163
-
1164
-
1165
-    /**
1166
-     * Used to reset the entire object (for tests).
1167
-     *
1168
-     * @throws EE_Error
1169
-     * @throws InvalidDataTypeException
1170
-     * @throws InvalidInterfaceException
1171
-     * @throws InvalidArgumentException
1172
-     * @throws ReflectionException
1173
-     * @since 4.3.0
1174
-     */
1175
-    public function reset_instance()
1176
-    {
1177
-        $this->clear_session();
1178
-        self::$_instance = null;
1179
-    }
1180
-
1181
-
1182
-    public function configure_garbage_collection_filters()
1183
-    {
1184
-        // run old filter we had for controlling session cleanup
1185
-        $expired_session_transient_delete_query_limit = absint(
1186
-            apply_filters(
1187
-                'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit',
1188
-                50
1189
-            )
1190
-        );
1191
-        // is there a value? or one that is different from the default 50 records?
1192
-        if ($expired_session_transient_delete_query_limit === 0) {
1193
-            // hook into TransientCacheStorage in case Session cleanup was turned off
1194
-            add_filter('FHEE__TransientCacheStorage__transient_cleanup_schedule', '__return_zero');
1195
-        } elseif ($expired_session_transient_delete_query_limit !== 50) {
1196
-            // or use that for the new transient cleanup query limit
1197
-            add_filter(
1198
-                'FHEE__TransientCacheStorage__clearExpiredTransients__limit',
1199
-                function () use ($expired_session_transient_delete_query_limit) {
1200
-                    return $expired_session_transient_delete_query_limit;
1201
-                }
1202
-            );
1203
-        }
1204
-    }
1205
-
1206
-
1207
-    /**
1208
-     * @see http://stackoverflow.com/questions/10152904/unserialize-function-unserialize-error-at-offset/21389439#10152996
1209
-     * @param string $data1
1210
-     * @return string
1211
-     */
1212
-    private function find_serialize_error(string $data1): string
1213
-    {
1214
-        $error = '<pre>';
1215
-        $data2 = preg_replace_callback(
1216
-            '!s:(\d+):"(.*?)";!',
1217
-            function ($match) {
1218
-                return ($match[1] === strlen($match[2]))
1219
-                    ? $match[0]
1220
-                    : 's:'
1221
-                      . strlen($match[2])
1222
-                      . ':"'
1223
-                      . $match[2]
1224
-                      . '";';
1225
-            },
1226
-            $data1
1227
-        );
1228
-        $max   = (strlen($data1) > strlen($data2))
1229
-            ? strlen($data1)
1230
-            : strlen($data2);
1231
-        $error .= $data1 . PHP_EOL;
1232
-        $error .= $data2 . PHP_EOL;
1233
-        for ($i = 0; $i < $max; $i++) {
1234
-            if (@$data1[ $i ] !== @$data2[ $i ]) {
1235
-                $error  .= 'Difference ' . @$data1[ $i ] . ' != ' . @$data2[ $i ] . PHP_EOL;
1236
-                $error  .= "\t-> ORD number " . ord(@$data1[ $i ]) . ' != ' . ord(@$data2[ $i ]) . PHP_EOL;
1237
-                $error  .= "\t-> Line Number = $i" . PHP_EOL;
1238
-                $start  = ($i - 20);
1239
-                $start  = ($start < 0)
1240
-                    ? 0
1241
-                    : $start;
1242
-                $length = 40;
1243
-                $point  = $max - $i;
1244
-                if ($point < 20) {
1245
-                    $rlength = 1;
1246
-                    $rpoint  = -$point;
1247
-                } else {
1248
-                    $rpoint  = $length - 20;
1249
-                    $rlength = 1;
1250
-                }
1251
-                $error .= "\t-> Section Data1  = ";
1252
-                $error .= substr_replace(
1253
-                    substr($data1, $start, $length),
1254
-                    "<b style=\"color:green\">$i</b>",
1255
-                    $rpoint,
1256
-                    $rlength
1257
-                );
1258
-                $error .= PHP_EOL;
1259
-                $error .= "\t-> Section Data2  = ";
1260
-                $error .= substr_replace(
1261
-                    substr($data2, $start, $length),
1262
-                    "<b style=\"color:red\">$i</b>",
1263
-                    $rpoint,
1264
-                    $rlength
1265
-                );
1266
-                $error .= PHP_EOL;
1267
-            }
1268
-        }
1269
-        $error .= '</pre>';
1270
-        return $error;
1271
-    }
1272
-
1273
-
1274
-    /**
1275
-     * Saves an  array of settings used for configuring aspects of session behaviour
1276
-     *
1277
-     * @param array $updated_settings
1278
-     */
1279
-    private function updateSessionSettings(array $updated_settings = [])
1280
-    {
1281
-        // add existing settings, but only if not included in incoming $updated_settings array
1282
-        $updated_settings += get_option(EE_Session::OPTION_NAME_SETTINGS, []);
1283
-        update_option(EE_Session::OPTION_NAME_SETTINGS, $updated_settings);
1284
-    }
1285
-
1286
-
1287
-    /**
1288
-     * garbage_collection
1289
-     */
1290
-    public function garbageCollection()
1291
-    {
1292
-        // only perform during regular requests if last garbage collection was over an hour ago
1293
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && (time() - HOUR_IN_SECONDS) >= $this->_last_gc) {
1294
-            $this->_last_gc = time();
1295
-            $this->updateSessionSettings(['last_gc' => $this->_last_gc]);
1296
-            /** @type WPDB $wpdb */
1297
-            global $wpdb;
1298
-            // filter the query limit. Set to 0 to turn off garbage collection
1299
-            $expired_session_transient_delete_query_limit = absint(
1300
-                apply_filters(
1301
-                    'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit',
1302
-                    50
1303
-                )
1304
-            );
1305
-            // non-zero LIMIT means take out the trash
1306
-            if ($expired_session_transient_delete_query_limit) {
1307
-                $session_key    = str_replace('_', '\_', EE_Session::session_id_prefix);
1308
-                $hash_check_key = str_replace('_', '\_', EE_Session::hash_check_prefix);
1309
-                // since transient expiration timestamps are set in the future, we can compare against NOW,
1310
-                // but we only want to pick up any trash that's been around for more than a day
1311
-                $expiration = time() - DAY_IN_SECONDS;
1312
-                $SQL        = "
27
+	const session_id_prefix    = 'ee_ssn_';
28
+
29
+	const hash_check_prefix    = 'ee_shc_';
30
+
31
+	const OPTION_NAME_SETTINGS = 'ee_session_settings';
32
+
33
+	const STATUS_CLOSED        = 0;
34
+
35
+	const STATUS_OPEN          = 1;
36
+
37
+	const SAVE_STATE_CLEAN     = 'clean';
38
+
39
+	const SAVE_STATE_DIRTY     = 'dirty';
40
+
41
+
42
+	private static ?EE_Session $_instance = null;
43
+
44
+	protected ?Base64Encoder $encryption = null;
45
+
46
+	protected ?CacheStorageInterface $cache_storage = null;
47
+
48
+	protected ?RequestInterface $request = null;
49
+
50
+	protected ?SessionStartHandler $session_start_handler = null;
51
+
52
+	/**
53
+	 * how long an EE session lasts
54
+	 * default session lifespan of 1 hour (for not so instant IPNs)
55
+	 *
56
+	 * @var SessionLifespan|null $session_lifespan
57
+	 */
58
+	private ?SessionLifespan $session_lifespan = null;
59
+
60
+	/**
61
+	 * the session id
62
+	 *
63
+	 * @var string
64
+	 */
65
+	private string $_sid = '';
66
+
67
+	/**
68
+	 * session id salt
69
+	 *
70
+	 * @var string
71
+	 */
72
+	private string $_sid_salt = '';
73
+
74
+	private array $_session_data = [];
75
+
76
+	/**
77
+	 * session expiration time as Unix timestamp in GMT
78
+	 *
79
+	 * @var int
80
+	 */
81
+	private int $_expiration = 0;
82
+
83
+	/**
84
+	 * whether session has expired at some point
85
+	 *
86
+	 * @var boolean
87
+	 */
88
+	private bool $_expired = false;
89
+
90
+	/**
91
+	 * current time as Unix timestamp in GMT
92
+	 *
93
+	 * @var int|null
94
+	 */
95
+	private ?int $_time = null;
96
+
97
+	/**
98
+	 * whether to encrypt session data
99
+	 *
100
+	 * @var bool
101
+	 */
102
+	private bool $_use_encryption = false;
103
+
104
+	/**
105
+	 * well... according to the server...
106
+	 *
107
+	 * @var string
108
+	 */
109
+	private string $_user_agent = '';
110
+
111
+
112
+	/**
113
+	 * array for defining default session vars
114
+	 *
115
+	 * @var array
116
+	 */
117
+	private array $_default_session_vars = [
118
+		'id'            => null,
119
+		'user_id'       => null,
120
+		'ip_address'    => null,
121
+		'user_agent'    => null,
122
+		'init_access'   => null,
123
+		'last_access'   => null,
124
+		'expiration'    => null,
125
+		'pages_visited' => [],
126
+	];
127
+
128
+	/**
129
+	 * timestamp for when last garbage collection cycle was performed
130
+	 *
131
+	 * @var int $_last_gc
132
+	 */
133
+	private int $_last_gc = 0;
134
+
135
+	/**
136
+	 * whether session is active or not
137
+	 *
138
+	 * @var int $status
139
+	 */
140
+	private int $status = EE_Session::STATUS_CLOSED;
141
+
142
+	/**
143
+	 * whether session data has changed therefore requiring a session save
144
+	 *
145
+	 * @var string $save_state
146
+	 */
147
+	private string $save_state = EE_Session::SAVE_STATE_CLEAN;
148
+
149
+
150
+	/**
151
+	 * @singleton method used to instantiate class object
152
+	 * @param CacheStorageInterface|null $cache_storage
153
+	 * @param SessionLifespan|null       $lifespan
154
+	 * @param RequestInterface|null      $request
155
+	 * @param SessionStartHandler|null   $session_start_handler
156
+	 * @param Base64Encoder|null         $encryption
157
+	 * @return EE_Session|null
158
+	 * @throws InvalidArgumentException
159
+	 * @throws InvalidDataTypeException
160
+	 * @throws InvalidInterfaceException
161
+	 */
162
+	public static function instance(
163
+		CacheStorageInterface $cache_storage = null,
164
+		SessionLifespan $lifespan = null,
165
+		RequestInterface $request = null,
166
+		SessionStartHandler $session_start_handler = null,
167
+		Base64Encoder $encryption = null
168
+	): ?EE_Session {
169
+		// check if class object is instantiated
170
+		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via:
171
+		// add_filter( 'FHEE_load_EE_Session', '__return_false' );
172
+		if (
173
+			! self::$_instance instanceof EE_Session
174
+			&& $cache_storage instanceof CacheStorageInterface
175
+			&& $lifespan instanceof SessionLifespan
176
+			&& $request instanceof RequestInterface
177
+			&& $session_start_handler instanceof SessionStartHandler
178
+			&& apply_filters('FHEE_load_EE_Session', true)
179
+		) {
180
+			self::$_instance = new self(
181
+				$cache_storage,
182
+				$lifespan,
183
+				$request,
184
+				$session_start_handler,
185
+				$encryption
186
+			);
187
+		}
188
+		return self::$_instance;
189
+	}
190
+
191
+
192
+	/**
193
+	 * protected constructor to prevent direct creation
194
+	 *
195
+	 * @param CacheStorageInterface $cache_storage
196
+	 * @param SessionLifespan       $lifespan
197
+	 * @param RequestInterface      $request
198
+	 * @param SessionStartHandler   $session_start_handler
199
+	 * @param Base64Encoder|null    $encryption
200
+	 * @throws InvalidArgumentException
201
+	 * @throws InvalidDataTypeException
202
+	 * @throws InvalidInterfaceException
203
+	 */
204
+	protected function __construct(
205
+		CacheStorageInterface $cache_storage,
206
+		SessionLifespan $lifespan,
207
+		RequestInterface $request,
208
+		SessionStartHandler $session_start_handler,
209
+		Base64Encoder $encryption = null
210
+	) {
211
+		// session loading is turned ON by default,
212
+		// but prior to the 'AHEE__EE_System__core_loaded_and_ready' hook
213
+		// (which currently fires on the init hook at priority 9),
214
+		// can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
215
+		if (! apply_filters('FHEE_load_EE_Session', true)) {
216
+			return;
217
+		}
218
+		$this->session_start_handler = $session_start_handler;
219
+		$this->session_lifespan      = $lifespan;
220
+		$this->request               = $request;
221
+		if (! defined('ESPRESSO_SESSION')) {
222
+			define('ESPRESSO_SESSION', true);
223
+		}
224
+		// retrieve session options from db
225
+		$session_settings = (array) get_option(EE_Session::OPTION_NAME_SETTINGS, []);
226
+		if (! empty($session_settings)) {
227
+			// cycle though existing session options
228
+			foreach ($session_settings as $var_name => $session_setting) {
229
+				// set values for class properties
230
+				$var_name          = '_' . $var_name;
231
+				$this->{$var_name} = $session_setting;
232
+			}
233
+		}
234
+		$this->cache_storage = $cache_storage;
235
+		// are we using encryption?
236
+		$this->_use_encryption = $encryption instanceof Base64Encoder
237
+								 && EE_Registry::instance()->CFG->admin->encode_session_data();
238
+		// encrypt data via: $this->encryption->encodeString();
239
+		$this->encryption = $encryption;
240
+		// filter hook allows outside functions/classes/plugins to change default empty cart
241
+		$extra_default_session_vars  = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', []);
242
+		$this->_default_session_vars = array_merge($this->_default_session_vars, $extra_default_session_vars);
243
+		// apply default session vars
244
+		$this->_set_defaults();
245
+		add_action('AHEE__EE_System__initialize', [$this, 'open_session']);
246
+		// check request for 'clear_session' param
247
+		add_action('AHEE__EE_Request_Handler__construct__complete', [$this, 'wp_loaded']);
248
+		// once everything is all said and done,
249
+		add_action('shutdown', [$this, 'update'], 100);
250
+		add_action('shutdown', [$this, 'garbageCollection'], 1000);
251
+		$this->configure_garbage_collection_filters();
252
+	}
253
+
254
+
255
+	/**
256
+	 * @return bool
257
+	 * @throws InvalidArgumentException
258
+	 * @throws InvalidDataTypeException
259
+	 * @throws InvalidInterfaceException
260
+	 */
261
+	public static function isLoadedAndActive(): bool
262
+	{
263
+		return did_action('AHEE__EE_System__core_loaded_and_ready')
264
+			   && EE_Session::instance() instanceof EE_Session
265
+			   && EE_Session::instance()->isActive();
266
+	}
267
+
268
+
269
+	/**
270
+	 * @return bool
271
+	 */
272
+	public function isActive(): bool
273
+	{
274
+		return $this->status === EE_Session::STATUS_OPEN;
275
+	}
276
+
277
+
278
+	/**
279
+	 * @return void
280
+	 * @throws EE_Error
281
+	 * @throws InvalidArgumentException
282
+	 * @throws InvalidDataTypeException
283
+	 * @throws InvalidInterfaceException
284
+	 * @throws InvalidSessionDataException
285
+	 * @throws RuntimeException
286
+	 * @throws ReflectionException
287
+	 */
288
+	public function open_session()
289
+	{
290
+		// Check for an existing session and retrieve it from the database, unless the system is in maintenance level 2.
291
+		if (DbStatus::isOnline() && ! $this->_espresso_session()) {
292
+			// or just start a new one
293
+			$this->_create_espresso_session();
294
+		}
295
+	}
296
+
297
+
298
+	/**
299
+	 * @return bool
300
+	 */
301
+	public function expired(): bool
302
+	{
303
+		return $this->_expired;
304
+	}
305
+
306
+
307
+	/**
308
+	 * @return void
309
+	 */
310
+	public function reset_expired()
311
+	{
312
+		$this->_expired = false;
313
+	}
314
+
315
+
316
+	/**
317
+	 * @return int
318
+	 */
319
+	public function expiration(): int
320
+	{
321
+		return $this->_expiration;
322
+	}
323
+
324
+
325
+	/**
326
+	 * @return int
327
+	 */
328
+	public function extension(): int
329
+	{
330
+		return apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS);
331
+	}
332
+
333
+
334
+	/**
335
+	 * @param int $time number of seconds to add to session expiration
336
+	 */
337
+	public function extend_expiration(int $time = 0)
338
+	{
339
+		$time              = $time
340
+			?: $this->extension();
341
+		$this->_expiration += absint($time);
342
+	}
343
+
344
+
345
+	/**
346
+	 * @return int
347
+	 */
348
+	public function lifespan(): int
349
+	{
350
+		return $this->session_lifespan->inSeconds();
351
+	}
352
+
353
+
354
+	/**
355
+	 * Marks whether the session data has been updated or not.
356
+	 * Valid options are:
357
+	 *      EE_Session::SAVE_STATE_CLEAN - session data remains unchanged and updating is not necessary
358
+	 *      EE_Session::SAVE_STATE_DIRTY - session data has changed since last save and needs to be updated
359
+	 * default value is EE_Session::SAVE_STATE_DIRTY
360
+	 *
361
+	 * @param string $save_state
362
+	 */
363
+	public function setSaveState(string $save_state = EE_Session::SAVE_STATE_DIRTY)
364
+	{
365
+		$valid_save_states = [
366
+			EE_Session::SAVE_STATE_CLEAN,
367
+			EE_Session::SAVE_STATE_DIRTY,
368
+		];
369
+		if (! in_array($save_state, $valid_save_states, true)) {
370
+			$save_state = EE_Session::SAVE_STATE_DIRTY;
371
+		}
372
+		$this->save_state = $save_state;
373
+	}
374
+
375
+
376
+	/**
377
+	 * This just sets some defaults for the _session data property
378
+	 *
379
+	 * @return void
380
+	 */
381
+	private function _set_defaults()
382
+	{
383
+		// set some defaults
384
+		foreach ($this->_default_session_vars as $key => $default_var) {
385
+			if (is_array($default_var)) {
386
+				$this->_session_data[ $key ] = [];
387
+			} else {
388
+				$this->_session_data[ $key ] = '';
389
+			}
390
+		}
391
+	}
392
+
393
+
394
+	/**
395
+	 * @retrieve  session data
396
+	 * @return    string
397
+	 */
398
+	public function id(): string
399
+	{
400
+		return $this->_sid;
401
+	}
402
+
403
+
404
+	/**
405
+	 * @param EE_Cart $cart
406
+	 * @return bool
407
+	 */
408
+	public function set_cart(EE_Cart $cart): bool
409
+	{
410
+		$this->_session_data['cart'] = $cart;
411
+		$this->setSaveState();
412
+		return true;
413
+	}
414
+
415
+
416
+	/**
417
+	 * reset_cart
418
+	 */
419
+	public function reset_cart()
420
+	{
421
+		do_action('AHEE__EE_Session__reset_cart__before_reset', $this);
422
+		$this->_session_data['cart'] = null;
423
+		$this->setSaveState();
424
+	}
425
+
426
+
427
+	/**
428
+	 * @return EE_Cart
429
+	 */
430
+	public function cart(): ?EE_Cart
431
+	{
432
+		return isset($this->_session_data['cart']) && $this->_session_data['cart'] instanceof EE_Cart
433
+			? $this->_session_data['cart']
434
+			: null;
435
+	}
436
+
437
+
438
+	/**
439
+	 * @param EE_Checkout $checkout
440
+	 * @return bool
441
+	 */
442
+	public function set_checkout(EE_Checkout $checkout): bool
443
+	{
444
+		$this->_session_data['checkout'] = $checkout;
445
+		$this->setSaveState();
446
+		return true;
447
+	}
448
+
449
+
450
+	/**
451
+	 * reset_checkout
452
+	 */
453
+	public function reset_checkout()
454
+	{
455
+		do_action('AHEE__EE_Session__reset_checkout__before_reset', $this);
456
+		$this->_session_data['checkout'] = null;
457
+		$this->setSaveState();
458
+	}
459
+
460
+
461
+	/**
462
+	 * @return EE_Checkout
463
+	 */
464
+	public function checkout(): ?EE_Checkout
465
+	{
466
+		return isset($this->_session_data['checkout']) && $this->_session_data['checkout'] instanceof EE_Checkout
467
+			? $this->_session_data['checkout']
468
+			: null;
469
+	}
470
+
471
+
472
+	/**
473
+	 * @param EE_Transaction $transaction
474
+	 * @return bool
475
+	 * @throws EE_Error
476
+	 * @throws ReflectionException
477
+	 */
478
+	public function set_transaction(EE_Transaction $transaction): bool
479
+	{
480
+		// first remove the session from the transaction before we save the transaction in the session
481
+		$transaction->set_txn_session_data(null);
482
+		$this->_session_data['transaction'] = $transaction;
483
+		$this->setSaveState();
484
+		return true;
485
+	}
486
+
487
+
488
+	/**
489
+	 * reset_transaction
490
+	 */
491
+	public function reset_transaction()
492
+	{
493
+		do_action('AHEE__EE_Session__reset_transaction__before_reset', $this);
494
+		$this->_session_data['transaction'] = null;
495
+		$this->setSaveState();
496
+	}
497
+
498
+
499
+	/**
500
+	 * @return EE_Transaction
501
+	 */
502
+	public function transaction(): ?EE_Transaction
503
+	{
504
+		return isset($this->_session_data['transaction'])
505
+			   && $this->_session_data['transaction'] instanceof EE_Transaction
506
+			? $this->_session_data['transaction']
507
+			: null;
508
+	}
509
+
510
+
511
+	/**
512
+	 * retrieve session data
513
+	 *
514
+	 * @param string|null $key
515
+	 * @param bool        $reset_cache
516
+	 * @return array|EE_Cart|EE_Checkout|EE_Transaction
517
+	 */
518
+	public function get_session_data(?string $key = null, bool $reset_cache = false)
519
+	{
520
+		if ($reset_cache) {
521
+			$this->reset_cart();
522
+			$this->reset_checkout();
523
+			$this->reset_transaction();
524
+		}
525
+		if (! empty($key)) {
526
+			return $this->_session_data[ $key ] ?? null;
527
+		}
528
+		return $this->_session_data;
529
+	}
530
+
531
+
532
+	/**
533
+	 * Returns TRUE on success, FALSE on fail
534
+	 *
535
+	 * @param array $data
536
+	 * @return bool
537
+	 */
538
+	public function set_session_data(array $data): bool
539
+	{
540
+		// nothing ??? bad data ??? go home!
541
+		if (empty($data)) {
542
+			EE_Error::add_error(
543
+				esc_html__(
544
+					'No session data or invalid session data was provided.',
545
+					'event_espresso'
546
+				),
547
+				__FILE__,
548
+				__FUNCTION__,
549
+				__LINE__
550
+			);
551
+			return false;
552
+		}
553
+		foreach ($data as $key => $value) {
554
+			if (isset($this->_default_session_vars[ $key ])) {
555
+				EE_Error::add_error(
556
+					sprintf(
557
+						esc_html__(
558
+							'Sorry! %s is a default session datum and can not be reset.',
559
+							'event_espresso'
560
+						),
561
+						$key
562
+					),
563
+					__FILE__,
564
+					__FUNCTION__,
565
+					__LINE__
566
+				);
567
+				return false;
568
+			}
569
+			$this->_session_data[ $key ] = $value;
570
+			$this->setSaveState();
571
+		}
572
+		return true;
573
+	}
574
+
575
+
576
+	/**
577
+	 * @initiate session
578
+	 * @return bool TRUE on success, FALSE on fail
579
+	 * @throws EE_Error
580
+	 * @throws InvalidArgumentException
581
+	 * @throws InvalidDataTypeException
582
+	 * @throws InvalidInterfaceException
583
+	 * @throws InvalidSessionDataException
584
+	 * @throws RuntimeException
585
+	 * @throws ReflectionException
586
+	 */
587
+	private function _espresso_session(): bool
588
+	{
589
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
590
+		$this->session_start_handler->startSession();
591
+		$this->status = EE_Session::STATUS_OPEN;
592
+		// get our modified session ID
593
+		$this->_sid = $this->_generate_session_id();
594
+		// set the "user agent"
595
+		$this->_user_agent = $this->request->userAgent();
596
+		// now let's retrieve what's in the db
597
+		$session_data = $this->_retrieve_session_data();
598
+		if (empty($session_data)) {
599
+			// set initial site access time and the session expiration
600
+			$this->_set_init_access_and_expiration();
601
+			// set referer
602
+			$this->_session_data['pages_visited'][ $this->_session_data['init_access'] ] = esc_attr(
603
+				$this->request->getServerParam('HTTP_REFERER')
604
+			);
605
+			// no previous session = go back and create one (on top of the data above)
606
+			return false;
607
+		}
608
+		// get the current time in UTC
609
+		$this->_time = $this->_time !== null
610
+			? $this->_time
611
+			: time();
612
+		// and reset the session expiration
613
+		$this->_expiration = $session_data['expiration'] ?? $this->_time + $this->session_lifespan->inSeconds();
614
+		// now the user agent
615
+		if ($session_data['user_agent'] !== $this->_user_agent) {
616
+			return false;
617
+		}
618
+		// wait a minute... how old are you?
619
+		if ($this->_time > $this->_expiration) {
620
+			// yer too old fer me!
621
+			$this->_expired = true;
622
+			// wipe out everything that isn't a default session datum
623
+			$this->clear_session(__CLASS__, __FUNCTION__);
624
+		}
625
+		// make event espresso session data available to plugin
626
+		$this->_session_data = array_merge($this->_session_data, $session_data);
627
+		return true;
628
+	}
629
+
630
+	private function sessionKey(string $prefix = ''): string
631
+	{
632
+		return $prefix . EE_Session::session_id_prefix . $this->_sid;
633
+	}
634
+
635
+	private function hashCheckKey(): string
636
+	{
637
+		return EE_Session::hash_check_prefix . $this->_sid;
638
+	}
639
+
640
+
641
+	/**
642
+	 * _get_session_data
643
+	 * Retrieves the session data, and attempts to correct any encoding issues that can occur due to improperly setup
644
+	 * databases
645
+	 *
646
+	 * @return array
647
+	 * @throws EE_Error
648
+	 * @throws InvalidArgumentException
649
+	 * @throws InvalidSessionDataException
650
+	 * @throws InvalidDataTypeException
651
+	 * @throws InvalidInterfaceException
652
+	 * @throws RuntimeException
653
+	 * @throws ReflectionException
654
+	 */
655
+	protected function _retrieve_session_data(): array
656
+	{
657
+		try {
658
+			// we're using WP's Transient API to store session data using the PHP session ID as the option name
659
+			$session_data = $this->cache_storage->get($this->sessionKey(), false);
660
+			if (empty($session_data)) {
661
+				return [];
662
+			}
663
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
664
+				$hash_check = $this->cache_storage->get($this->hashCheckKey(), false);
665
+				if ($hash_check && $hash_check !== md5($session_data)) {
666
+					EE_Error::add_error(
667
+						sprintf(
668
+							esc_html__(
669
+								'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.',
670
+								'event_espresso'
671
+							),
672
+							$this->sessionKey()
673
+						),
674
+						__FILE__,
675
+						__FUNCTION__,
676
+						__LINE__
677
+					);
678
+				}
679
+			}
680
+		} catch (Exception $e) {
681
+			// let's just eat that error for now and attempt to correct any corrupted data
682
+			global $wpdb;
683
+			$row          = $wpdb->get_row(
684
+				$wpdb->prepare(
685
+					"SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
686
+					$this->sessionKey('_transient_')
687
+				)
688
+			);
689
+			$session_data = is_object($row) ? $row->option_value : null;
690
+			if ($session_data) {
691
+				$session_data = preg_replace_callback(
692
+					'!s:(d+):"(.*?)";!',
693
+					function ($match) {
694
+						return $match[1] === strlen($match[2])
695
+							? $match[0]
696
+							: 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
697
+					},
698
+					$session_data
699
+				);
700
+			}
701
+			$session_data = maybe_unserialize($session_data);
702
+		}
703
+		// in case the data is encoded... try to decode it
704
+		$session_data = $this->_use_encryption
705
+			? $this->encryption->decodeString($session_data)
706
+			: $session_data;
707
+		if (! is_array($session_data)) {
708
+			try {
709
+				$session_data = maybe_unserialize($session_data);
710
+			} catch (Exception $e) {
711
+				$msg = esc_html__(
712
+					'An error occurred while attempting to unserialize the session data.',
713
+					'event_espresso'
714
+				);
715
+				$msg .= WP_DEBUG
716
+					? '<br><pre>'
717
+					  . print_r($session_data, true)
718
+					  . '</pre><br>'
719
+					  . $this->find_serialize_error($session_data)
720
+					: '';
721
+				$this->cache_storage->delete($this->sessionKey());
722
+				throw new InvalidSessionDataException($msg, 0, $e);
723
+			}
724
+		}
725
+		// just a check to make sure the session array is indeed an array
726
+		if (! is_array($session_data)) {
727
+			// no?!?! then something is wrong
728
+			$msg = esc_html__(
729
+				'The session data is missing, invalid, or corrupted.',
730
+				'event_espresso'
731
+			);
732
+			$msg .= WP_DEBUG
733
+				? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
734
+				: '';
735
+			$this->cache_storage->delete($this->sessionKey());
736
+			throw new InvalidSessionDataException($msg);
737
+		}
738
+		if (isset($session_data['transaction']) && absint($session_data['transaction']) !== 0) {
739
+			$session_data['transaction'] = EEM_Transaction::instance()->get_one_by_ID(
740
+				$session_data['transaction']
741
+			);
742
+		}
743
+		return $session_data;
744
+	}
745
+
746
+
747
+	/**
748
+	 * _generate_session_id
749
+	 * Retrieves the PHP session id either directly from the PHP session,
750
+	 * or from the request array if it was passed in from an AJAX request.
751
+	 * The session id is then salted and hashed (mmm sounds tasty)
752
+	 * so that it can be safely used as a request param
753
+	 *
754
+	 * @return string
755
+	 */
756
+	protected function _generate_session_id(): string
757
+	{
758
+		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
759
+		$session_id = $this->request->requestParamIsSet('EESID')
760
+			? $this->request->getRequestParam('EESID')
761
+			: md5(session_id() . get_current_blog_id() . $this->_get_sid_salt());
762
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
763
+	}
764
+
765
+
766
+	/**
767
+	 * _get_sid_salt
768
+	 *
769
+	 * @return string
770
+	 */
771
+	protected function _get_sid_salt(): string
772
+	{
773
+		// was session id salt already saved to db ?
774
+		if (empty($this->_sid_salt)) {
775
+			// no?  then maybe use WP defined constant
776
+			if (defined('AUTH_SALT')) {
777
+				$this->_sid_salt = AUTH_SALT;
778
+			}
779
+			// if salt doesn't exist or is too short
780
+			if (strlen($this->_sid_salt) < 32) {
781
+				// create a new one
782
+				$this->_sid_salt = wp_generate_password(64);
783
+			}
784
+			// and save it as a permanent session setting
785
+			$this->updateSessionSettings(['sid_salt' => $this->_sid_salt]);
786
+		}
787
+		return $this->_sid_salt;
788
+	}
789
+
790
+
791
+	/**
792
+	 * _set_init_access_and_expiration
793
+	 *
794
+	 * @return void
795
+	 */
796
+	protected function _set_init_access_and_expiration()
797
+	{
798
+		$this->_time       = time();
799
+		$this->_expiration = $this->_time + $this->session_lifespan->inSeconds();
800
+		// set initial site access time
801
+		$this->_session_data['init_access'] = $this->_time;
802
+		// and the session expiration
803
+		$this->_session_data['expiration'] = $this->_expiration;
804
+	}
805
+
806
+
807
+	/**
808
+	 * @update session data  prior to saving to the db
809
+	 * @param bool $new_session
810
+	 * @return bool TRUE on success, FALSE on fail
811
+	 * @throws EE_Error
812
+	 * @throws InvalidArgumentException
813
+	 * @throws InvalidDataTypeException
814
+	 * @throws InvalidInterfaceException
815
+	 * @throws ReflectionException
816
+	 */
817
+	public function update(bool $new_session = false): bool
818
+	{
819
+		$this->_session_data = isset($this->_session_data['id']) ? $this->_session_data : [];
820
+		if (empty($this->_session_data)) {
821
+			$this->_set_defaults();
822
+		}
823
+		$session_data = [];
824
+		foreach ($this->_session_data as $key => $value) {
825
+			switch ($key) {
826
+				case 'id':
827
+					// session ID
828
+					$session_data['id'] = $this->_sid;
829
+					break;
830
+				case 'ip_address':
831
+					// visitor ip address
832
+					$session_data['ip_address'] = $this->request->ipAddress();
833
+					break;
834
+				case 'user_agent':
835
+					// visitor user_agent
836
+					$session_data['user_agent'] = $this->_user_agent;
837
+					break;
838
+				case 'init_access':
839
+					$session_data['init_access'] = absint($value);
840
+					break;
841
+				case 'last_access':
842
+					// current access time
843
+					$session_data['last_access'] = $this->_time;
844
+					break;
845
+				case 'expiration':
846
+					// when the session expires
847
+					$session_data['expiration'] = ! empty($this->_expiration)
848
+						? $this->_expiration
849
+						: $session_data['init_access'] + $this->session_lifespan->inSeconds();
850
+					break;
851
+				case 'user_id':
852
+					// current user if logged in
853
+					$session_data['user_id'] = $this->_wp_user_id();
854
+					break;
855
+				case 'pages_visited':
856
+					$page_visit = $this->_get_page_visit();
857
+					if ($page_visit) {
858
+						// set pages visited where the first will be the http referrer
859
+						$this->_session_data['pages_visited'][ $this->_time ] = $page_visit;
860
+						// we'll only save the last 10 page visits.
861
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
862
+					}
863
+					break;
864
+				default:
865
+					// carry any other data over
866
+					$session_data[ $key ] = $this->_session_data[ $key ];
867
+			}
868
+		}
869
+		$this->_session_data = $session_data;
870
+		// creating a new session does not require saving to the db just yet
871
+		if (! $new_session) {
872
+			// ready? let's save
873
+			if ($this->_save_session_to_db()) {
874
+				return true;
875
+			}
876
+			return false;
877
+		}
878
+		// meh, why not?
879
+		return true;
880
+	}
881
+
882
+
883
+	/**
884
+	 * @create session data array
885
+	 * @throws EE_Error
886
+	 * @throws InvalidArgumentException
887
+	 * @throws InvalidDataTypeException
888
+	 * @throws InvalidInterfaceException
889
+	 * @throws ReflectionException
890
+	 */
891
+	private function _create_espresso_session()
892
+	{
893
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
894
+		// use the update function for now with $new_session arg set to TRUE
895
+		$this->update(true);
896
+	}
897
+
898
+
899
+	/**
900
+	 * Detects if there is anything worth saving in the session (eg the cart is a good one, notices are pretty good
901
+	 * too). This is used when determining if we want to save the session or not.
902
+	 *
903
+	 * @return bool
904
+	 * @since 4.9.67.p
905
+	 */
906
+	private function sessionHasStuffWorthSaving(): bool
907
+	{
908
+		if ($this->save_state === EE_Session::SAVE_STATE_DIRTY) {
909
+			return true;
910
+		}
911
+		$default_session_vars = array_keys($this->_default_session_vars);
912
+		foreach ($this->_session_data as $key => $sessionDatum) {
913
+			if (in_array($key, $default_session_vars, true)) {
914
+				continue;
915
+			}
916
+			if (! empty($sessionDatum)) {
917
+				return true;
918
+			}
919
+			if (
920
+				$key === 'ee_notices'
921
+				&& (
922
+					! empty($this->_session_data['ee_notices']['attention'])
923
+					|| ! empty($this->_session_data['ee_notices']['errors'])
924
+					|| ! empty($this->_session_data['ee_notices']['success'])
925
+				)
926
+			) {
927
+				return true;
928
+			}
929
+		}
930
+		return false;
931
+	}
932
+
933
+
934
+	/**
935
+	 * _save_session_to_db
936
+	 *
937
+	 * @param bool $clear_session
938
+	 * @return bool
939
+	 * @throws EE_Error
940
+	 * @throws InvalidArgumentException
941
+	 * @throws InvalidDataTypeException
942
+	 * @throws InvalidInterfaceException
943
+	 * @throws ReflectionException
944
+	 */
945
+	private function _save_session_to_db(bool $clear_session = false): bool
946
+	{
947
+		// don't save sessions for crawlers
948
+		// and unless we're deleting the session data, don't save anything if there isn't a cart
949
+		if (
950
+			$this->request->isBot()
951
+			|| (
952
+				! $clear_session
953
+				&& ! $this->sessionHasStuffWorthSaving()
954
+				&& apply_filters('FHEE__EE_Session___save_session_to_db__abort_session_save', true)
955
+			)
956
+		) {
957
+			return false;
958
+		}
959
+		$transaction = $this->transaction();
960
+		if ($transaction instanceof EE_Transaction) {
961
+			if (! $transaction->ID()) {
962
+				$transaction->save();
963
+			}
964
+			$this->_session_data['transaction'] = $transaction->ID();
965
+		}
966
+		// then serialize all of our session data
967
+		$session_data = serialize($this->_session_data);
968
+		// do we need to also encode it to avoid corrupted data when saved to the db?
969
+		$session_data = $this->_use_encryption
970
+			? $this->encryption->encodeString($session_data)
971
+			: $session_data;
972
+		// maybe save hash check
973
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
974
+			$this->cache_storage->add(
975
+				$this->hashCheckKey(),
976
+				md5($session_data),
977
+				$this->session_lifespan->inSeconds()
978
+			);
979
+		}
980
+		// we're using the Transient API for storing session data,
981
+		$saved = $this->cache_storage->add(
982
+			$this->sessionKey(),
983
+			$session_data,
984
+			$this->session_lifespan->inSeconds()
985
+		);
986
+		$this->setSaveState(EE_Session::SAVE_STATE_CLEAN);
987
+		return $saved;
988
+	}
989
+
990
+
991
+	/**
992
+	 * @get    the full page request the visitor is accessing
993
+	 * @return string
994
+	 */
995
+	public function _get_page_visit(): string
996
+	{
997
+		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
998
+		// check for request url
999
+		if ($this->request->serverParamIsSet('REQUEST_URI')) {
1000
+			$page_id     = '?';
1001
+			$e_reg       = '';
1002
+			$request_uri = $this->request->getServerParam('REQUEST_URI');
1003
+			$ru_bits     = explode('?', $request_uri);
1004
+			$request_uri = $ru_bits[0];
1005
+			$http_host   = $this->request->getServerParam('HTTP_HOST');
1006
+			// check for page_id in SERVER REQUEST
1007
+			if ($this->request->requestParamIsSet('page_id')) {
1008
+				// rebuild $e_reg without any of the extra parameters
1009
+				$page_id .= 'page_id=' . $this->request->getRequestParam('page_id', 0, 'int') . '&amp;';
1010
+			}
1011
+			// check for $e_reg in SERVER REQUEST
1012
+			if ($this->request->requestParamIsSet('ee')) {
1013
+				// rebuild $e_reg without any of the extra parameters
1014
+				$e_reg = 'ee=' . $this->request->getRequestParam('ee');
1015
+			}
1016
+			$page_visit = esc_url(rtrim($http_host . $request_uri . $page_id . $e_reg, '?'));
1017
+		}
1018
+		return $page_visit !== home_url('/wp-admin/admin-ajax.php')
1019
+			? $page_visit
1020
+			: '';
1021
+	}
1022
+
1023
+
1024
+	/**
1025
+	 * @the    current wp user id
1026
+	 * @return int
1027
+	 */
1028
+	public function _wp_user_id(): int
1029
+	{
1030
+		// if I need to explain the following lines of code, then you shouldn't be looking at this!
1031
+		return get_current_user_id();
1032
+	}
1033
+
1034
+
1035
+	/**
1036
+	 * Clear EE_Session data
1037
+	 *
1038
+	 * @param string $class
1039
+	 * @param string $function
1040
+	 * @return void
1041
+	 * @throws EE_Error
1042
+	 * @throws InvalidArgumentException
1043
+	 * @throws InvalidDataTypeException
1044
+	 * @throws InvalidInterfaceException
1045
+	 * @throws ReflectionException
1046
+	 */
1047
+	public function clear_session(string $class = '', string $function = '')
1048
+	{
1049
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' . $function . '()');
1050
+		$this->reset_cart();
1051
+		$this->reset_checkout();
1052
+		$this->reset_transaction();
1053
+		// wipe out everything that isn't a default session datum
1054
+		$this->reset_data(array_keys($this->_session_data));
1055
+		// reset initial site access time and the session expiration
1056
+		$this->_set_init_access_and_expiration();
1057
+		$this->setSaveState();
1058
+		$this->_save_session_to_db(true);
1059
+	}
1060
+
1061
+
1062
+	/**
1063
+	 * resets all non-default session vars. Returns TRUE on success, FALSE on fail
1064
+	 *
1065
+	 * @param array|mixed $keys_to_reset
1066
+	 * @param bool        $show_all_notices
1067
+	 * @return bool
1068
+	 */
1069
+	public function reset_data($keys_to_reset = [], bool $show_all_notices = false): bool
1070
+	{
1071
+		$keys_to_reset = (array) apply_filters(
1072
+			'FHEE__EE_Session__reset_data__session_data_keys_to_reset',
1073
+			(array) $keys_to_reset
1074
+		);
1075
+		// nothing ??? go home!
1076
+		if (empty($keys_to_reset)) {
1077
+			EE_Error::add_error(
1078
+				esc_html__(
1079
+					'No session data could be reset, because no session var name was provided.',
1080
+					'event_espresso'
1081
+				),
1082
+				__FILE__,
1083
+				__FUNCTION__,
1084
+				__LINE__
1085
+			);
1086
+			return false;
1087
+		}
1088
+		$return_value = true;
1089
+		// since $keys_to_reset is an array, cycle through the values
1090
+		foreach ($keys_to_reset as $key_to_reset) {
1091
+			// first check to make sure it is a valid session var
1092
+			if (! isset($this->_session_data[ $key_to_reset ]) && $show_all_notices) {
1093
+				// oops! that session var does not exist!
1094
+				EE_Error::add_error(
1095
+					sprintf(
1096
+						esc_html__(
1097
+							'The session item provided, %s, is invalid or does not exist.',
1098
+							'event_espresso'
1099
+						),
1100
+						$key_to_reset
1101
+					),
1102
+					__FILE__,
1103
+					__FUNCTION__,
1104
+					__LINE__
1105
+				);
1106
+				$return_value = false;
1107
+				continue;
1108
+			}
1109
+			// then check to make sure it is not a default var
1110
+			if (array_key_exists($key_to_reset, $this->_default_session_vars)) {
1111
+				// yeeeeeeeeerrrrrrrrrrr OUT !!!!
1112
+				if ($show_all_notices) {
1113
+					EE_Error::add_error(
1114
+						sprintf(
1115
+							esc_html__(
1116
+								'Sorry! %s is a default session datum and can not be reset.',
1117
+								'event_espresso'
1118
+							),
1119
+							$key_to_reset
1120
+						),
1121
+						__FILE__,
1122
+						__FUNCTION__,
1123
+						__LINE__
1124
+					);
1125
+				}
1126
+				$return_value = false;
1127
+				continue;
1128
+			}
1129
+			// remove session var
1130
+			unset($this->_session_data[ $key_to_reset ]);
1131
+			$this->setSaveState();
1132
+			if ($show_all_notices) {
1133
+				EE_Error::add_success(
1134
+					sprintf(
1135
+						esc_html__('The session variable %s was removed.', 'event_espresso'),
1136
+						$key_to_reset
1137
+					),
1138
+					__FILE__,
1139
+					__FUNCTION__,
1140
+					__LINE__
1141
+				);
1142
+			}
1143
+		} // end of foreach
1144
+		return $return_value;
1145
+	}
1146
+
1147
+
1148
+	/**
1149
+	 *   wp_loaded
1150
+	 *
1151
+	 * @throws EE_Error
1152
+	 * @throws InvalidDataTypeException
1153
+	 * @throws InvalidInterfaceException
1154
+	 * @throws InvalidArgumentException
1155
+	 * @throws ReflectionException
1156
+	 */
1157
+	public function wp_loaded()
1158
+	{
1159
+		if ($this->request->requestParamIsSet('clear_session')) {
1160
+			$this->clear_session(__CLASS__, __FUNCTION__);
1161
+		}
1162
+	}
1163
+
1164
+
1165
+	/**
1166
+	 * Used to reset the entire object (for tests).
1167
+	 *
1168
+	 * @throws EE_Error
1169
+	 * @throws InvalidDataTypeException
1170
+	 * @throws InvalidInterfaceException
1171
+	 * @throws InvalidArgumentException
1172
+	 * @throws ReflectionException
1173
+	 * @since 4.3.0
1174
+	 */
1175
+	public function reset_instance()
1176
+	{
1177
+		$this->clear_session();
1178
+		self::$_instance = null;
1179
+	}
1180
+
1181
+
1182
+	public function configure_garbage_collection_filters()
1183
+	{
1184
+		// run old filter we had for controlling session cleanup
1185
+		$expired_session_transient_delete_query_limit = absint(
1186
+			apply_filters(
1187
+				'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit',
1188
+				50
1189
+			)
1190
+		);
1191
+		// is there a value? or one that is different from the default 50 records?
1192
+		if ($expired_session_transient_delete_query_limit === 0) {
1193
+			// hook into TransientCacheStorage in case Session cleanup was turned off
1194
+			add_filter('FHEE__TransientCacheStorage__transient_cleanup_schedule', '__return_zero');
1195
+		} elseif ($expired_session_transient_delete_query_limit !== 50) {
1196
+			// or use that for the new transient cleanup query limit
1197
+			add_filter(
1198
+				'FHEE__TransientCacheStorage__clearExpiredTransients__limit',
1199
+				function () use ($expired_session_transient_delete_query_limit) {
1200
+					return $expired_session_transient_delete_query_limit;
1201
+				}
1202
+			);
1203
+		}
1204
+	}
1205
+
1206
+
1207
+	/**
1208
+	 * @see http://stackoverflow.com/questions/10152904/unserialize-function-unserialize-error-at-offset/21389439#10152996
1209
+	 * @param string $data1
1210
+	 * @return string
1211
+	 */
1212
+	private function find_serialize_error(string $data1): string
1213
+	{
1214
+		$error = '<pre>';
1215
+		$data2 = preg_replace_callback(
1216
+			'!s:(\d+):"(.*?)";!',
1217
+			function ($match) {
1218
+				return ($match[1] === strlen($match[2]))
1219
+					? $match[0]
1220
+					: 's:'
1221
+					  . strlen($match[2])
1222
+					  . ':"'
1223
+					  . $match[2]
1224
+					  . '";';
1225
+			},
1226
+			$data1
1227
+		);
1228
+		$max   = (strlen($data1) > strlen($data2))
1229
+			? strlen($data1)
1230
+			: strlen($data2);
1231
+		$error .= $data1 . PHP_EOL;
1232
+		$error .= $data2 . PHP_EOL;
1233
+		for ($i = 0; $i < $max; $i++) {
1234
+			if (@$data1[ $i ] !== @$data2[ $i ]) {
1235
+				$error  .= 'Difference ' . @$data1[ $i ] . ' != ' . @$data2[ $i ] . PHP_EOL;
1236
+				$error  .= "\t-> ORD number " . ord(@$data1[ $i ]) . ' != ' . ord(@$data2[ $i ]) . PHP_EOL;
1237
+				$error  .= "\t-> Line Number = $i" . PHP_EOL;
1238
+				$start  = ($i - 20);
1239
+				$start  = ($start < 0)
1240
+					? 0
1241
+					: $start;
1242
+				$length = 40;
1243
+				$point  = $max - $i;
1244
+				if ($point < 20) {
1245
+					$rlength = 1;
1246
+					$rpoint  = -$point;
1247
+				} else {
1248
+					$rpoint  = $length - 20;
1249
+					$rlength = 1;
1250
+				}
1251
+				$error .= "\t-> Section Data1  = ";
1252
+				$error .= substr_replace(
1253
+					substr($data1, $start, $length),
1254
+					"<b style=\"color:green\">$i</b>",
1255
+					$rpoint,
1256
+					$rlength
1257
+				);
1258
+				$error .= PHP_EOL;
1259
+				$error .= "\t-> Section Data2  = ";
1260
+				$error .= substr_replace(
1261
+					substr($data2, $start, $length),
1262
+					"<b style=\"color:red\">$i</b>",
1263
+					$rpoint,
1264
+					$rlength
1265
+				);
1266
+				$error .= PHP_EOL;
1267
+			}
1268
+		}
1269
+		$error .= '</pre>';
1270
+		return $error;
1271
+	}
1272
+
1273
+
1274
+	/**
1275
+	 * Saves an  array of settings used for configuring aspects of session behaviour
1276
+	 *
1277
+	 * @param array $updated_settings
1278
+	 */
1279
+	private function updateSessionSettings(array $updated_settings = [])
1280
+	{
1281
+		// add existing settings, but only if not included in incoming $updated_settings array
1282
+		$updated_settings += get_option(EE_Session::OPTION_NAME_SETTINGS, []);
1283
+		update_option(EE_Session::OPTION_NAME_SETTINGS, $updated_settings);
1284
+	}
1285
+
1286
+
1287
+	/**
1288
+	 * garbage_collection
1289
+	 */
1290
+	public function garbageCollection()
1291
+	{
1292
+		// only perform during regular requests if last garbage collection was over an hour ago
1293
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && (time() - HOUR_IN_SECONDS) >= $this->_last_gc) {
1294
+			$this->_last_gc = time();
1295
+			$this->updateSessionSettings(['last_gc' => $this->_last_gc]);
1296
+			/** @type WPDB $wpdb */
1297
+			global $wpdb;
1298
+			// filter the query limit. Set to 0 to turn off garbage collection
1299
+			$expired_session_transient_delete_query_limit = absint(
1300
+				apply_filters(
1301
+					'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit',
1302
+					50
1303
+				)
1304
+			);
1305
+			// non-zero LIMIT means take out the trash
1306
+			if ($expired_session_transient_delete_query_limit) {
1307
+				$session_key    = str_replace('_', '\_', EE_Session::session_id_prefix);
1308
+				$hash_check_key = str_replace('_', '\_', EE_Session::hash_check_prefix);
1309
+				// since transient expiration timestamps are set in the future, we can compare against NOW,
1310
+				// but we only want to pick up any trash that's been around for more than a day
1311
+				$expiration = time() - DAY_IN_SECONDS;
1312
+				$SQL        = "
1313 1313
                     SELECT option_name
1314 1314
                     FROM $wpdb->options
1315 1315
                     WHERE
@@ -1318,17 +1318,17 @@  discard block
 block discarded – undo
1318 1318
                     AND option_value < $expiration
1319 1319
                     LIMIT $expired_session_transient_delete_query_limit
1320 1320
                 ";
1321
-                // produces something like:
1322
-                // SELECT option_name FROM wp_options
1323
-                // WHERE ( option_name LIKE '\_transient\_timeout\_ee\_ssn\_%'
1324
-                // OR option_name LIKE '\_transient\_timeout\_ee\_shc\_%' )
1325
-                // AND option_value < 1508368198 LIMIT 50
1326
-                $expired_sessions = $wpdb->get_col($SQL);
1327
-                // valid results?
1328
-                if (! empty($expired_sessions)) {
1329
-                    $this->cache_storage->deleteMany($expired_sessions, true);
1330
-                }
1331
-            }
1332
-        }
1333
-    }
1321
+				// produces something like:
1322
+				// SELECT option_name FROM wp_options
1323
+				// WHERE ( option_name LIKE '\_transient\_timeout\_ee\_ssn\_%'
1324
+				// OR option_name LIKE '\_transient\_timeout\_ee\_shc\_%' )
1325
+				// AND option_value < 1508368198 LIMIT 50
1326
+				$expired_sessions = $wpdb->get_col($SQL);
1327
+				// valid results?
1328
+				if (! empty($expired_sessions)) {
1329
+					$this->cache_storage->deleteMany($expired_sessions, true);
1330
+				}
1331
+			}
1332
+		}
1333
+	}
1334 1334
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -212,22 +212,22 @@  discard block
 block discarded – undo
212 212
         // but prior to the 'AHEE__EE_System__core_loaded_and_ready' hook
213 213
         // (which currently fires on the init hook at priority 9),
214 214
         // can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
215
-        if (! apply_filters('FHEE_load_EE_Session', true)) {
215
+        if ( ! apply_filters('FHEE_load_EE_Session', true)) {
216 216
             return;
217 217
         }
218 218
         $this->session_start_handler = $session_start_handler;
219 219
         $this->session_lifespan      = $lifespan;
220 220
         $this->request               = $request;
221
-        if (! defined('ESPRESSO_SESSION')) {
221
+        if ( ! defined('ESPRESSO_SESSION')) {
222 222
             define('ESPRESSO_SESSION', true);
223 223
         }
224 224
         // retrieve session options from db
225 225
         $session_settings = (array) get_option(EE_Session::OPTION_NAME_SETTINGS, []);
226
-        if (! empty($session_settings)) {
226
+        if ( ! empty($session_settings)) {
227 227
             // cycle though existing session options
228 228
             foreach ($session_settings as $var_name => $session_setting) {
229 229
                 // set values for class properties
230
-                $var_name          = '_' . $var_name;
230
+                $var_name          = '_'.$var_name;
231 231
                 $this->{$var_name} = $session_setting;
232 232
             }
233 233
         }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      */
337 337
     public function extend_expiration(int $time = 0)
338 338
     {
339
-        $time              = $time
339
+        $time = $time
340 340
             ?: $this->extension();
341 341
         $this->_expiration += absint($time);
342 342
     }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             EE_Session::SAVE_STATE_CLEAN,
367 367
             EE_Session::SAVE_STATE_DIRTY,
368 368
         ];
369
-        if (! in_array($save_state, $valid_save_states, true)) {
369
+        if ( ! in_array($save_state, $valid_save_states, true)) {
370 370
             $save_state = EE_Session::SAVE_STATE_DIRTY;
371 371
         }
372 372
         $this->save_state = $save_state;
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
         // set some defaults
384 384
         foreach ($this->_default_session_vars as $key => $default_var) {
385 385
             if (is_array($default_var)) {
386
-                $this->_session_data[ $key ] = [];
386
+                $this->_session_data[$key] = [];
387 387
             } else {
388
-                $this->_session_data[ $key ] = '';
388
+                $this->_session_data[$key] = '';
389 389
             }
390 390
         }
391 391
     }
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
             $this->reset_checkout();
523 523
             $this->reset_transaction();
524 524
         }
525
-        if (! empty($key)) {
526
-            return $this->_session_data[ $key ] ?? null;
525
+        if ( ! empty($key)) {
526
+            return $this->_session_data[$key] ?? null;
527 527
         }
528 528
         return $this->_session_data;
529 529
     }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
             return false;
552 552
         }
553 553
         foreach ($data as $key => $value) {
554
-            if (isset($this->_default_session_vars[ $key ])) {
554
+            if (isset($this->_default_session_vars[$key])) {
555 555
                 EE_Error::add_error(
556 556
                     sprintf(
557 557
                         esc_html__(
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                 );
567 567
                 return false;
568 568
             }
569
-            $this->_session_data[ $key ] = $value;
569
+            $this->_session_data[$key] = $value;
570 570
             $this->setSaveState();
571 571
         }
572 572
         return true;
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
             // set initial site access time and the session expiration
600 600
             $this->_set_init_access_and_expiration();
601 601
             // set referer
602
-            $this->_session_data['pages_visited'][ $this->_session_data['init_access'] ] = esc_attr(
602
+            $this->_session_data['pages_visited'][$this->_session_data['init_access']] = esc_attr(
603 603
                 $this->request->getServerParam('HTTP_REFERER')
604 604
             );
605 605
             // no previous session = go back and create one (on top of the data above)
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
 
630 630
     private function sessionKey(string $prefix = ''): string
631 631
     {
632
-        return $prefix . EE_Session::session_id_prefix . $this->_sid;
632
+        return $prefix.EE_Session::session_id_prefix.$this->_sid;
633 633
     }
634 634
 
635 635
     private function hashCheckKey(): string
636 636
     {
637
-        return EE_Session::hash_check_prefix . $this->_sid;
637
+        return EE_Session::hash_check_prefix.$this->_sid;
638 638
     }
639 639
 
640 640
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
         } catch (Exception $e) {
681 681
             // let's just eat that error for now and attempt to correct any corrupted data
682 682
             global $wpdb;
683
-            $row          = $wpdb->get_row(
683
+            $row = $wpdb->get_row(
684 684
                 $wpdb->prepare(
685 685
                     "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
686 686
                     $this->sessionKey('_transient_')
@@ -690,10 +690,10 @@  discard block
 block discarded – undo
690 690
             if ($session_data) {
691 691
                 $session_data = preg_replace_callback(
692 692
                     '!s:(d+):"(.*?)";!',
693
-                    function ($match) {
693
+                    function($match) {
694 694
                         return $match[1] === strlen($match[2])
695 695
                             ? $match[0]
696
-                            : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
696
+                            : 's:'.strlen($match[2]).':"'.$match[2].'";';
697 697
                     },
698 698
                     $session_data
699 699
                 );
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         $session_data = $this->_use_encryption
705 705
             ? $this->encryption->decodeString($session_data)
706 706
             : $session_data;
707
-        if (! is_array($session_data)) {
707
+        if ( ! is_array($session_data)) {
708 708
             try {
709 709
                 $session_data = maybe_unserialize($session_data);
710 710
             } catch (Exception $e) {
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
             }
724 724
         }
725 725
         // just a check to make sure the session array is indeed an array
726
-        if (! is_array($session_data)) {
726
+        if ( ! is_array($session_data)) {
727 727
             // no?!?! then something is wrong
728 728
             $msg = esc_html__(
729 729
                 'The session data is missing, invalid, or corrupted.',
730 730
                 'event_espresso'
731 731
             );
732 732
             $msg .= WP_DEBUG
733
-                ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
733
+                ? '<br><pre>'.print_r($session_data, true).'</pre><br>'.$this->find_serialize_error($session_data)
734 734
                 : '';
735 735
             $this->cache_storage->delete($this->sessionKey());
736 736
             throw new InvalidSessionDataException($msg);
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         // check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
759 759
         $session_id = $this->request->requestParamIsSet('EESID')
760 760
             ? $this->request->getRequestParam('EESID')
761
-            : md5(session_id() . get_current_blog_id() . $this->_get_sid_salt());
761
+            : md5(session_id().get_current_blog_id().$this->_get_sid_salt());
762 762
         return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
763 763
     }
764 764
 
@@ -856,19 +856,19 @@  discard block
 block discarded – undo
856 856
                     $page_visit = $this->_get_page_visit();
857 857
                     if ($page_visit) {
858 858
                         // set pages visited where the first will be the http referrer
859
-                        $this->_session_data['pages_visited'][ $this->_time ] = $page_visit;
859
+                        $this->_session_data['pages_visited'][$this->_time] = $page_visit;
860 860
                         // we'll only save the last 10 page visits.
861 861
                         $session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
862 862
                     }
863 863
                     break;
864 864
                 default:
865 865
                     // carry any other data over
866
-                    $session_data[ $key ] = $this->_session_data[ $key ];
866
+                    $session_data[$key] = $this->_session_data[$key];
867 867
             }
868 868
         }
869 869
         $this->_session_data = $session_data;
870 870
         // creating a new session does not require saving to the db just yet
871
-        if (! $new_session) {
871
+        if ( ! $new_session) {
872 872
             // ready? let's save
873 873
             if ($this->_save_session_to_db()) {
874 874
                 return true;
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
             if (in_array($key, $default_session_vars, true)) {
914 914
                 continue;
915 915
             }
916
-            if (! empty($sessionDatum)) {
916
+            if ( ! empty($sessionDatum)) {
917 917
                 return true;
918 918
             }
919 919
             if (
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
         }
959 959
         $transaction = $this->transaction();
960 960
         if ($transaction instanceof EE_Transaction) {
961
-            if (! $transaction->ID()) {
961
+            if ( ! $transaction->ID()) {
962 962
                 $transaction->save();
963 963
             }
964 964
             $this->_session_data['transaction'] = $transaction->ID();
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
      */
995 995
     public function _get_page_visit(): string
996 996
     {
997
-        $page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
997
+        $page_visit = home_url('/').'wp-admin/admin-ajax.php';
998 998
         // check for request url
999 999
         if ($this->request->serverParamIsSet('REQUEST_URI')) {
1000 1000
             $page_id     = '?';
@@ -1006,14 +1006,14 @@  discard block
 block discarded – undo
1006 1006
             // check for page_id in SERVER REQUEST
1007 1007
             if ($this->request->requestParamIsSet('page_id')) {
1008 1008
                 // rebuild $e_reg without any of the extra parameters
1009
-                $page_id .= 'page_id=' . $this->request->getRequestParam('page_id', 0, 'int') . '&amp;';
1009
+                $page_id .= 'page_id='.$this->request->getRequestParam('page_id', 0, 'int').'&amp;';
1010 1010
             }
1011 1011
             // check for $e_reg in SERVER REQUEST
1012 1012
             if ($this->request->requestParamIsSet('ee')) {
1013 1013
                 // rebuild $e_reg without any of the extra parameters
1014
-                $e_reg = 'ee=' . $this->request->getRequestParam('ee');
1014
+                $e_reg = 'ee='.$this->request->getRequestParam('ee');
1015 1015
             }
1016
-            $page_visit = esc_url(rtrim($http_host . $request_uri . $page_id . $e_reg, '?'));
1016
+            $page_visit = esc_url(rtrim($http_host.$request_uri.$page_id.$e_reg, '?'));
1017 1017
         }
1018 1018
         return $page_visit !== home_url('/wp-admin/admin-ajax.php')
1019 1019
             ? $page_visit
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
      */
1047 1047
     public function clear_session(string $class = '', string $function = '')
1048 1048
     {
1049
-        do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' . $function . '()');
1049
+        do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
1050 1050
         $this->reset_cart();
1051 1051
         $this->reset_checkout();
1052 1052
         $this->reset_transaction();
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
         // since $keys_to_reset is an array, cycle through the values
1090 1090
         foreach ($keys_to_reset as $key_to_reset) {
1091 1091
             // first check to make sure it is a valid session var
1092
-            if (! isset($this->_session_data[ $key_to_reset ]) && $show_all_notices) {
1092
+            if ( ! isset($this->_session_data[$key_to_reset]) && $show_all_notices) {
1093 1093
                 // oops! that session var does not exist!
1094 1094
                 EE_Error::add_error(
1095 1095
                     sprintf(
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
                 continue;
1128 1128
             }
1129 1129
             // remove session var
1130
-            unset($this->_session_data[ $key_to_reset ]);
1130
+            unset($this->_session_data[$key_to_reset]);
1131 1131
             $this->setSaveState();
1132 1132
             if ($show_all_notices) {
1133 1133
                 EE_Error::add_success(
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
             // or use that for the new transient cleanup query limit
1197 1197
             add_filter(
1198 1198
                 'FHEE__TransientCacheStorage__clearExpiredTransients__limit',
1199
-                function () use ($expired_session_transient_delete_query_limit) {
1199
+                function() use ($expired_session_transient_delete_query_limit) {
1200 1200
                     return $expired_session_transient_delete_query_limit;
1201 1201
                 }
1202 1202
             );
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
         $error = '<pre>';
1215 1215
         $data2 = preg_replace_callback(
1216 1216
             '!s:(\d+):"(.*?)";!',
1217
-            function ($match) {
1217
+            function($match) {
1218 1218
                 return ($match[1] === strlen($match[2]))
1219 1219
                     ? $match[0]
1220 1220
                     : 's:'
@@ -1225,16 +1225,16 @@  discard block
 block discarded – undo
1225 1225
             },
1226 1226
             $data1
1227 1227
         );
1228
-        $max   = (strlen($data1) > strlen($data2))
1228
+        $max = (strlen($data1) > strlen($data2))
1229 1229
             ? strlen($data1)
1230 1230
             : strlen($data2);
1231
-        $error .= $data1 . PHP_EOL;
1232
-        $error .= $data2 . PHP_EOL;
1231
+        $error .= $data1.PHP_EOL;
1232
+        $error .= $data2.PHP_EOL;
1233 1233
         for ($i = 0; $i < $max; $i++) {
1234
-            if (@$data1[ $i ] !== @$data2[ $i ]) {
1235
-                $error  .= 'Difference ' . @$data1[ $i ] . ' != ' . @$data2[ $i ] . PHP_EOL;
1236
-                $error  .= "\t-> ORD number " . ord(@$data1[ $i ]) . ' != ' . ord(@$data2[ $i ]) . PHP_EOL;
1237
-                $error  .= "\t-> Line Number = $i" . PHP_EOL;
1234
+            if (@$data1[$i] !== @$data2[$i]) {
1235
+                $error  .= 'Difference '.@$data1[$i].' != '.@$data2[$i].PHP_EOL;
1236
+                $error  .= "\t-> ORD number ".ord(@$data1[$i]).' != '.ord(@$data2[$i]).PHP_EOL;
1237
+                $error  .= "\t-> Line Number = $i".PHP_EOL;
1238 1238
                 $start  = ($i - 20);
1239 1239
                 $start  = ($start < 0)
1240 1240
                     ? 0
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
     public function garbageCollection()
1291 1291
     {
1292 1292
         // only perform during regular requests if last garbage collection was over an hour ago
1293
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && (time() - HOUR_IN_SECONDS) >= $this->_last_gc) {
1293
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX) && (time() - HOUR_IN_SECONDS) >= $this->_last_gc) {
1294 1294
             $this->_last_gc = time();
1295 1295
             $this->updateSessionSettings(['last_gc' => $this->_last_gc]);
1296 1296
             /** @type WPDB $wpdb */
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
                 // AND option_value < 1508368198 LIMIT 50
1326 1326
                 $expired_sessions = $wpdb->get_col($SQL);
1327 1327
                 // valid results?
1328
-                if (! empty($expired_sessions)) {
1328
+                if ( ! empty($expired_sessions)) {
1329 1329
                     $this->cache_storage->deleteMany($expired_sessions, true);
1330 1330
                 }
1331 1331
             }
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 2 patches
Indentation   +2064 added lines, -2064 removed lines patch added patch discarded remove patch
@@ -27,1056 +27,1056 @@  discard block
 block discarded – undo
27 27
  */
28 28
 class EEH_Form_Fields
29 29
 {
30
-    /**
31
-     *  Generates HTML for the forms used on admin pages
32
-     *
33
-     *
34
-     * @static
35
-     * @access public
36
-     * @param array $input_vars - array of input field details
37
-     *                          format:
38
-     *                          $template_form_fields['field-id'] = array(
39
-     *                          'name' => 'name_attribute',
40
-     *                          'label' => esc_html__('Field Label', 'event_espresso'), //or false
41
-     *                          'input' => 'hidden', //field input type can be 'text', 'select', 'textarea', 'hidden',
42
-     *                          'checkbox', 'wp_editor'
43
-     *                          'type' => 'int', //what "type" the value is (i.e. string, int etc)
44
-     *                          'required' => false, //boolean for whether the field is required
45
-     *                          'validation' => true, //boolean, whether to validate the field (todo)
46
-     *                          'value' => 'some_value_for_field', //what value is used for field
47
-     *                          'format' => '%d', //what format the value is (%d, %f, or %s)
48
-     *                          'db-col' => 'column_in_db' //used to indicate which column the field corresponds with
49
-     *                          in the db
50
-     *                          'options' => optiona, optionb || array('value' => 'label', '') //if the input type is
51
-     *                          "select", this allows you to set the args for the different <option> tags.
52
-     *                          'tabindex' => 1 //this allows you to set the tabindex for the field.
53
-     *                          'append_content' => '' //this allows you to send in html content to append to the
54
-     *                          field.
55
-     *                          )
56
-     * @param array $form_id    - used for defining unique identifiers for the form.
57
-     * @return string
58
-     * @todo   : at some point we can break this down into other static methods to abstract it a bit better.
59
-     */
60
-    public static function get_form_fields($input_vars = [], $form_id = false)
61
-    {
62
-
63
-        if (empty($input_vars)) {
64
-            EE_Error::add_error(
65
-                esc_html__('missing required variables for the form field generator', 'event_espresso'),
66
-                __FILE__,
67
-                __FUNCTION__,
68
-                __LINE__
69
-            );
70
-            return false;
71
-        }
72
-
73
-        $output        = "";
74
-        $inputs        = [];
75
-        $hidden_inputs = [];
76
-
77
-        // cycle thru inputs
78
-        foreach ($input_vars as $input_key => $input_value) {
79
-            $defaults = [
80
-                'append_content' => '',
81
-                'css_class'      => '',
82
-                'cols'           => 80,
83
-                'db-col'         => 'column_in_db',
84
-                'format'         => '%d',
85
-                'input'          => 'hidden',
86
-                'label'          => esc_html__('No label', 'event_espresso'),
87
-                'name'           => $input_key,
88
-                'options'        => [],
89
-                'required'       => false,
90
-                'tabindex'       => 0,
91
-                'rows'           => 10,
92
-                'type'           => 'int',
93
-                'validation'     => true,
94
-                'value'          => 'some_value_for_field',
95
-            ];
96
-
97
-            $input_value = wp_parse_args($input_value, $defaults);
98
-
99
-            $append_content = $input_value['append_content'];
100
-            $css_class      = $input_value['css_class'];
101
-            $cols           = $input_value['cols'];
102
-            $label          = $input_value['label'];
103
-            $name           = $input_value['name'];
104
-            $options        = $input_value['options'];
105
-            $required       = $input_value['required'];
106
-            $tab_index      = $input_value['tabindex'];
107
-            $rows           = $input_value['rows'];
108
-            $type           = $input_value['input'];
109
-            $value          = $input_value['value'];
110
-
111
-            $id    = $form_id ? $form_id . '-' . $input_key : $input_key;
112
-            $class = $required ? 'required ' . $css_class : $css_class;
113
-
114
-            // what type of input are we dealing with ?
115
-            switch ($type) {
116
-                case 'checkbox':
117
-                case 'radio':
118
-                    $field = self::adminMulti($value, $class, $id, $name, $required, $tab_index, $type, 1, $label);
119
-                    $field .= $append_content ?: '';
120
-                    break;
121
-
122
-                case 'hidden':
123
-                    $field           = null;
124
-                    $hidden_inputs[] = self::adminHidden($css_class, $id, $name, $value);
125
-                    break;
126
-
127
-                case 'select':
128
-                    $options = is_array($options) ? $options : explode(',', $options);
129
-                    $field   = self::adminLabel($id, $label, $required);
130
-                    $field   .= self::adminSelect($value, $class, $id, $name, $required, $tab_index, $options);
131
-                    $field   .= $append_content ?: '';
132
-                    break;
133
-
134
-                case 'textarea':
135
-                    $field = self::adminLabel($id, $label, $required);
136
-                    $field .= self::adminTextarea($class, $cols, $id, $name, $required, $rows, $tab_index, $value);
137
-                    $field .= $append_content ?: '';
138
-                    break;
139
-
140
-                case 'wp_editor':
141
-                    $label = esc_html($label);
142
-                    $field = "<h4>{$label}</h4>";
143
-                    $field .= $append_content ?: '';
144
-                    $field .= self::adminWpEditor(
145
-                        $class,
146
-                        $id,
147
-                        $name,
148
-                        $rows,
149
-                        $tab_index,
150
-                        $value
151
-                    );
152
-                    break;
153
-
154
-                default:
155
-                    $field = self::adminLabel($id, $label, $required);
156
-                    $field .= self::adminText($class, $id, $name, $required, $tab_index, $value);
157
-                    $field .= $append_content ?: '';
158
-            }
159
-            if ($field) {
160
-                $inputs[] = $field;
161
-            }
162
-        } // end foreach( $input_vars as $input_key => $input_value )
163
-
164
-        if (! empty($inputs)) {
165
-            $glue   = "
30
+	/**
31
+	 *  Generates HTML for the forms used on admin pages
32
+	 *
33
+	 *
34
+	 * @static
35
+	 * @access public
36
+	 * @param array $input_vars - array of input field details
37
+	 *                          format:
38
+	 *                          $template_form_fields['field-id'] = array(
39
+	 *                          'name' => 'name_attribute',
40
+	 *                          'label' => esc_html__('Field Label', 'event_espresso'), //or false
41
+	 *                          'input' => 'hidden', //field input type can be 'text', 'select', 'textarea', 'hidden',
42
+	 *                          'checkbox', 'wp_editor'
43
+	 *                          'type' => 'int', //what "type" the value is (i.e. string, int etc)
44
+	 *                          'required' => false, //boolean for whether the field is required
45
+	 *                          'validation' => true, //boolean, whether to validate the field (todo)
46
+	 *                          'value' => 'some_value_for_field', //what value is used for field
47
+	 *                          'format' => '%d', //what format the value is (%d, %f, or %s)
48
+	 *                          'db-col' => 'column_in_db' //used to indicate which column the field corresponds with
49
+	 *                          in the db
50
+	 *                          'options' => optiona, optionb || array('value' => 'label', '') //if the input type is
51
+	 *                          "select", this allows you to set the args for the different <option> tags.
52
+	 *                          'tabindex' => 1 //this allows you to set the tabindex for the field.
53
+	 *                          'append_content' => '' //this allows you to send in html content to append to the
54
+	 *                          field.
55
+	 *                          )
56
+	 * @param array $form_id    - used for defining unique identifiers for the form.
57
+	 * @return string
58
+	 * @todo   : at some point we can break this down into other static methods to abstract it a bit better.
59
+	 */
60
+	public static function get_form_fields($input_vars = [], $form_id = false)
61
+	{
62
+
63
+		if (empty($input_vars)) {
64
+			EE_Error::add_error(
65
+				esc_html__('missing required variables for the form field generator', 'event_espresso'),
66
+				__FILE__,
67
+				__FUNCTION__,
68
+				__LINE__
69
+			);
70
+			return false;
71
+		}
72
+
73
+		$output        = "";
74
+		$inputs        = [];
75
+		$hidden_inputs = [];
76
+
77
+		// cycle thru inputs
78
+		foreach ($input_vars as $input_key => $input_value) {
79
+			$defaults = [
80
+				'append_content' => '',
81
+				'css_class'      => '',
82
+				'cols'           => 80,
83
+				'db-col'         => 'column_in_db',
84
+				'format'         => '%d',
85
+				'input'          => 'hidden',
86
+				'label'          => esc_html__('No label', 'event_espresso'),
87
+				'name'           => $input_key,
88
+				'options'        => [],
89
+				'required'       => false,
90
+				'tabindex'       => 0,
91
+				'rows'           => 10,
92
+				'type'           => 'int',
93
+				'validation'     => true,
94
+				'value'          => 'some_value_for_field',
95
+			];
96
+
97
+			$input_value = wp_parse_args($input_value, $defaults);
98
+
99
+			$append_content = $input_value['append_content'];
100
+			$css_class      = $input_value['css_class'];
101
+			$cols           = $input_value['cols'];
102
+			$label          = $input_value['label'];
103
+			$name           = $input_value['name'];
104
+			$options        = $input_value['options'];
105
+			$required       = $input_value['required'];
106
+			$tab_index      = $input_value['tabindex'];
107
+			$rows           = $input_value['rows'];
108
+			$type           = $input_value['input'];
109
+			$value          = $input_value['value'];
110
+
111
+			$id    = $form_id ? $form_id . '-' . $input_key : $input_key;
112
+			$class = $required ? 'required ' . $css_class : $css_class;
113
+
114
+			// what type of input are we dealing with ?
115
+			switch ($type) {
116
+				case 'checkbox':
117
+				case 'radio':
118
+					$field = self::adminMulti($value, $class, $id, $name, $required, $tab_index, $type, 1, $label);
119
+					$field .= $append_content ?: '';
120
+					break;
121
+
122
+				case 'hidden':
123
+					$field           = null;
124
+					$hidden_inputs[] = self::adminHidden($css_class, $id, $name, $value);
125
+					break;
126
+
127
+				case 'select':
128
+					$options = is_array($options) ? $options : explode(',', $options);
129
+					$field   = self::adminLabel($id, $label, $required);
130
+					$field   .= self::adminSelect($value, $class, $id, $name, $required, $tab_index, $options);
131
+					$field   .= $append_content ?: '';
132
+					break;
133
+
134
+				case 'textarea':
135
+					$field = self::adminLabel($id, $label, $required);
136
+					$field .= self::adminTextarea($class, $cols, $id, $name, $required, $rows, $tab_index, $value);
137
+					$field .= $append_content ?: '';
138
+					break;
139
+
140
+				case 'wp_editor':
141
+					$label = esc_html($label);
142
+					$field = "<h4>{$label}</h4>";
143
+					$field .= $append_content ?: '';
144
+					$field .= self::adminWpEditor(
145
+						$class,
146
+						$id,
147
+						$name,
148
+						$rows,
149
+						$tab_index,
150
+						$value
151
+					);
152
+					break;
153
+
154
+				default:
155
+					$field = self::adminLabel($id, $label, $required);
156
+					$field .= self::adminText($class, $id, $name, $required, $tab_index, $value);
157
+					$field .= $append_content ?: '';
158
+			}
159
+			if ($field) {
160
+				$inputs[] = $field;
161
+			}
162
+		} // end foreach( $input_vars as $input_key => $input_value )
163
+
164
+		if (! empty($inputs)) {
165
+			$glue   = "
166 166
                 </li>
167 167
                 <li>
168 168
                     ";
169
-            $inputs = implode($glue, $inputs);
170
-            $output = "
169
+			$inputs = implode($glue, $inputs);
170
+			$output = "
171 171
             <ul>
172 172
                 <li>
173 173
                 {$inputs}
174 174
                 </li>
175 175
             </ul>
176 176
             ";
177
-        }
178
-        return $output . implode("\n", $hidden_inputs);
179
-    }
180
-
181
-
182
-    /**
183
-     * form_fields_array
184
-     * This utility function assembles form fields from a given structured array with field information.
185
-     * //TODO: This is an alternate generator that we may want to use instead.
186
-     *
187
-     * @param array $fields structured array of fields to assemble in the following format:
188
-     *                      [field_name] => array(
189
-     *                      ['label'] => 'label for field',
190
-     *                      ['labels'] => array('label_1', 'label_2'); //optional - if the field type is a multi select
191
-     *                      type of field you can indicated the labels for each option via this index
192
-     *                      ['extra_desc'] => 'extra description for the field', //optional
193
-     *                      ['type'] => 'textarea'|'text'|'wp_editor'|'checkbox'|'radio'|'hidden'|'select', //defaults
194
-     *                      to text
195
-     *                      ['value'] => 'value that goes in the field', //(if multi then this is an array of values
196
-     *                      and the 'default' paramater will be used for what is selected)
197
-     *                      ['default'] => 'default if the field type is multi (i.e. select or radios or checkboxes)',
198
-     *                      ['class'] => 'name-of-class(es)-for-input',
199
-     *                      ['classes'] => array('class_1', 'class_2'); //optional - if the field type is a multi
200
-     *                      select type of field you can indicate the css class for each option via this index.
201
-     *                      ['id'] => 'css-id-for-input') //defaults to 'field_name'
202
-     *                      ['unique_id'] => 1 //defaults to empty string.  This is useful for when the fields
203
-     *                      generated are going to be used in a loop and you want to make sure that the field
204
-     *                      identifiers are unique from each other.
205
-     *                      ['dimensions'] => array(100,300), //defaults to empty array.  This is used by field types
206
-     *                      such as textarea to indicate cols/rows.
207
-     *                      ['tabindex'] => '' //this allows you to set the tabindex for the field.
208
-     *                      ['wpeditor_args'] => array() //if the type of field is wpeditor then this can optionally
209
-     *                      contain an array of arguments for the editor setup.
210
-     *
211
-     * @return array         an array of inputs for form indexed by field name, and in the following structure:
212
-     *     [field_name] => array( 'label' => '{label_html}', 'field' => '{input_html}'
213
-     */
214
-    public static function get_form_fields_array($fields)
215
-    {
216
-
217
-        $form_fields = [];
218
-        $fields      = (array) $fields;
219
-
220
-        foreach ($fields as $field_name => $field_atts) {
221
-            // defaults:
222
-            $defaults = [
223
-                'class'         => '',
224
-                'classes'       => '',
225
-                'default'       => '',
226
-                'dimensions'    => ['10', '5'],
227
-                'extra_desc'    => '',
228
-                'id'            => $field_name,
229
-                'label'         => '',
230
-                'labels'        => '',
231
-                'required'      => false,
232
-                'tabindex'      => 0,
233
-                'type'          => 'text',
234
-                'unique_id'     => '',
235
-                'value'         => '',
236
-                'wpeditor_args' => [],
237
-            ];
238
-            // merge defaults with passed arguments
239
-            $_fields = wp_parse_args($field_atts, $defaults);
240
-
241
-            $class          = $_fields['class'];
242
-            $classes        = $_fields['classes'];
243
-            $default        = $_fields['default'];
244
-            $dims           = $_fields['dimensions'];
245
-            $extra_desc     = $_fields['extra_desc'];
246
-            $id             = $_fields['id'];
247
-            $label          = $_fields['label'];
248
-            $labels         = $_fields['labels'];
249
-            $required       = $_fields['required'];
250
-            $tab_index      = $_fields['tabindex'];
251
-            $type           = $_fields['type'];
252
-            $unique_id      = $_fields['unique_id'];
253
-            $value          = $_fields['value'];
254
-            $wp_editor_args = $_fields['wpeditor_args'];
255
-
256
-            // generate label
257
-            $label = ! empty($label) ? self::adminLabel($id, $label, $required) : '';
258
-            // generate field name
259
-            $name = ! empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
260
-
261
-            // we determine what we're building based on the type
262
-            switch ($type) {
263
-                case 'checkbox':
264
-                case 'radio':
265
-                    if (is_array($value)) {
266
-                        $c_input = '';
267
-                        foreach ($value as $key => $val) {
268
-                            $c_input .= self::adminMulti(
269
-                                $default,
270
-                                isset($classes[ $key ]) ? $classes[ $key ] : '',
271
-                                $field_name . '_' . $value,
272
-                                $name,
273
-                                $required,
274
-                                $tab_index,
275
-                                $type,
276
-                                $val,
277
-                                isset($labels[ $key ]) ? $labels[ $key ] : ''
278
-                            );
279
-                        }
280
-                        $field = $c_input;
281
-                    } else {
282
-                        $field = self::adminMulti(
283
-                            $default,
284
-                            $class,
285
-                            $id,
286
-                            $name,
287
-                            $required,
288
-                            $tab_index,
289
-                            $type,
290
-                            $value,
291
-                            $_fields['label']
292
-                        );
293
-                    }
294
-                    break;
295
-
296
-                case 'hidden':
297
-                    $field = self::adminHidden($class, $id, $name, $value);
298
-                    break;
299
-
300
-                case 'select':
301
-                    $options = [];
302
-                    foreach ($value as $key => $val) {
303
-                        $options[ $val ] = isset($labels[ $key ]) ? $labels[ $key ] : '';
304
-                    }
305
-                    $field = self::adminSelect($default, $class, $id, $name, $required, $tab_index, $options);
306
-                    break;
307
-
308
-                case 'textarea':
309
-                    $field =
310
-                        self::adminTextarea($class, $dims[0], $id, $name, $required, $dims[1], $tab_index, $value);
311
-                    break;
312
-
313
-                case 'wp_editor':
314
-                    $field = self::adminWpEditor(
315
-                        $class,
316
-                        $_fields['id'],
317
-                        $name,
318
-                        $dims[1],
319
-                        $tab_index,
320
-                        $value,
321
-                        $wp_editor_args
322
-                    );
323
-                    break;
324
-
325
-                default:
326
-                    $field = self::adminText($class, $id, $name, $required, $tab_index, $value);
327
-            }
328
-
329
-            $form_fields[ $field_name ] = ['label' => $label, 'field' => $field . $extra_desc];
330
-        }
331
-
332
-        return $form_fields;
333
-    }
334
-
335
-
336
-    /**
337
-     * @param string $class
338
-     * @param string $id
339
-     * @param string $name
340
-     * @param string $value
341
-     * @return string
342
-     * @since   4.10.14.p
343
-     */
344
-    private static function adminHidden($class, $id, $name, $value)
345
-    {
346
-        $id    = esc_attr($id);
347
-        $name  = esc_attr($name);
348
-        $class = esc_attr($class);
349
-        return "
177
+		}
178
+		return $output . implode("\n", $hidden_inputs);
179
+	}
180
+
181
+
182
+	/**
183
+	 * form_fields_array
184
+	 * This utility function assembles form fields from a given structured array with field information.
185
+	 * //TODO: This is an alternate generator that we may want to use instead.
186
+	 *
187
+	 * @param array $fields structured array of fields to assemble in the following format:
188
+	 *                      [field_name] => array(
189
+	 *                      ['label'] => 'label for field',
190
+	 *                      ['labels'] => array('label_1', 'label_2'); //optional - if the field type is a multi select
191
+	 *                      type of field you can indicated the labels for each option via this index
192
+	 *                      ['extra_desc'] => 'extra description for the field', //optional
193
+	 *                      ['type'] => 'textarea'|'text'|'wp_editor'|'checkbox'|'radio'|'hidden'|'select', //defaults
194
+	 *                      to text
195
+	 *                      ['value'] => 'value that goes in the field', //(if multi then this is an array of values
196
+	 *                      and the 'default' paramater will be used for what is selected)
197
+	 *                      ['default'] => 'default if the field type is multi (i.e. select or radios or checkboxes)',
198
+	 *                      ['class'] => 'name-of-class(es)-for-input',
199
+	 *                      ['classes'] => array('class_1', 'class_2'); //optional - if the field type is a multi
200
+	 *                      select type of field you can indicate the css class for each option via this index.
201
+	 *                      ['id'] => 'css-id-for-input') //defaults to 'field_name'
202
+	 *                      ['unique_id'] => 1 //defaults to empty string.  This is useful for when the fields
203
+	 *                      generated are going to be used in a loop and you want to make sure that the field
204
+	 *                      identifiers are unique from each other.
205
+	 *                      ['dimensions'] => array(100,300), //defaults to empty array.  This is used by field types
206
+	 *                      such as textarea to indicate cols/rows.
207
+	 *                      ['tabindex'] => '' //this allows you to set the tabindex for the field.
208
+	 *                      ['wpeditor_args'] => array() //if the type of field is wpeditor then this can optionally
209
+	 *                      contain an array of arguments for the editor setup.
210
+	 *
211
+	 * @return array         an array of inputs for form indexed by field name, and in the following structure:
212
+	 *     [field_name] => array( 'label' => '{label_html}', 'field' => '{input_html}'
213
+	 */
214
+	public static function get_form_fields_array($fields)
215
+	{
216
+
217
+		$form_fields = [];
218
+		$fields      = (array) $fields;
219
+
220
+		foreach ($fields as $field_name => $field_atts) {
221
+			// defaults:
222
+			$defaults = [
223
+				'class'         => '',
224
+				'classes'       => '',
225
+				'default'       => '',
226
+				'dimensions'    => ['10', '5'],
227
+				'extra_desc'    => '',
228
+				'id'            => $field_name,
229
+				'label'         => '',
230
+				'labels'        => '',
231
+				'required'      => false,
232
+				'tabindex'      => 0,
233
+				'type'          => 'text',
234
+				'unique_id'     => '',
235
+				'value'         => '',
236
+				'wpeditor_args' => [],
237
+			];
238
+			// merge defaults with passed arguments
239
+			$_fields = wp_parse_args($field_atts, $defaults);
240
+
241
+			$class          = $_fields['class'];
242
+			$classes        = $_fields['classes'];
243
+			$default        = $_fields['default'];
244
+			$dims           = $_fields['dimensions'];
245
+			$extra_desc     = $_fields['extra_desc'];
246
+			$id             = $_fields['id'];
247
+			$label          = $_fields['label'];
248
+			$labels         = $_fields['labels'];
249
+			$required       = $_fields['required'];
250
+			$tab_index      = $_fields['tabindex'];
251
+			$type           = $_fields['type'];
252
+			$unique_id      = $_fields['unique_id'];
253
+			$value          = $_fields['value'];
254
+			$wp_editor_args = $_fields['wpeditor_args'];
255
+
256
+			// generate label
257
+			$label = ! empty($label) ? self::adminLabel($id, $label, $required) : '';
258
+			// generate field name
259
+			$name = ! empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
260
+
261
+			// we determine what we're building based on the type
262
+			switch ($type) {
263
+				case 'checkbox':
264
+				case 'radio':
265
+					if (is_array($value)) {
266
+						$c_input = '';
267
+						foreach ($value as $key => $val) {
268
+							$c_input .= self::adminMulti(
269
+								$default,
270
+								isset($classes[ $key ]) ? $classes[ $key ] : '',
271
+								$field_name . '_' . $value,
272
+								$name,
273
+								$required,
274
+								$tab_index,
275
+								$type,
276
+								$val,
277
+								isset($labels[ $key ]) ? $labels[ $key ] : ''
278
+							);
279
+						}
280
+						$field = $c_input;
281
+					} else {
282
+						$field = self::adminMulti(
283
+							$default,
284
+							$class,
285
+							$id,
286
+							$name,
287
+							$required,
288
+							$tab_index,
289
+							$type,
290
+							$value,
291
+							$_fields['label']
292
+						);
293
+					}
294
+					break;
295
+
296
+				case 'hidden':
297
+					$field = self::adminHidden($class, $id, $name, $value);
298
+					break;
299
+
300
+				case 'select':
301
+					$options = [];
302
+					foreach ($value as $key => $val) {
303
+						$options[ $val ] = isset($labels[ $key ]) ? $labels[ $key ] : '';
304
+					}
305
+					$field = self::adminSelect($default, $class, $id, $name, $required, $tab_index, $options);
306
+					break;
307
+
308
+				case 'textarea':
309
+					$field =
310
+						self::adminTextarea($class, $dims[0], $id, $name, $required, $dims[1], $tab_index, $value);
311
+					break;
312
+
313
+				case 'wp_editor':
314
+					$field = self::adminWpEditor(
315
+						$class,
316
+						$_fields['id'],
317
+						$name,
318
+						$dims[1],
319
+						$tab_index,
320
+						$value,
321
+						$wp_editor_args
322
+					);
323
+					break;
324
+
325
+				default:
326
+					$field = self::adminText($class, $id, $name, $required, $tab_index, $value);
327
+			}
328
+
329
+			$form_fields[ $field_name ] = ['label' => $label, 'field' => $field . $extra_desc];
330
+		}
331
+
332
+		return $form_fields;
333
+	}
334
+
335
+
336
+	/**
337
+	 * @param string $class
338
+	 * @param string $id
339
+	 * @param string $name
340
+	 * @param string $value
341
+	 * @return string
342
+	 * @since   4.10.14.p
343
+	 */
344
+	private static function adminHidden($class, $id, $name, $value)
345
+	{
346
+		$id    = esc_attr($id);
347
+		$name  = esc_attr($name);
348
+		$class = esc_attr($class);
349
+		return "
350 350
         <input name='{$name}' type='hidden' id='{$id}' class='{$class}' value='{$value}' />";
351
-    }
352
-
353
-
354
-    /**
355
-     * @param string $id
356
-     * @param string $label
357
-     * @param string $required
358
-     * @return string
359
-     * @since   4.10.14.p
360
-     */
361
-    private static function adminLabel($id, $label, $required)
362
-    {
363
-        $id       = esc_attr($id);
364
-        $label    = esc_html($label);
365
-        $required = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? " <span>*</span>" : '';
366
-        return "<label for='{$id}'>{$label}{$required}</label>";
367
-    }
368
-
369
-
370
-    /**
371
-     * @param string $default
372
-     * @param string $class
373
-     * @param string $id
374
-     * @param string $name
375
-     * @param string $required
376
-     * @param int    $tab_index
377
-     * @param string $type
378
-     * @param string $value
379
-     * @param string $label
380
-     * @return string
381
-     * @since   4.10.14.p
382
-     */
383
-    private static function adminMulti($default, $class, $id, $name, $required, $tab_index, $type, $value, $label = '')
384
-    {
385
-        $id        = esc_attr($id);
386
-        $name      = esc_attr($name);
387
-        $class     = esc_attr($class);
388
-        $tab_index = absint($tab_index);
389
-        $checked   = ! empty($default) && $default == $value ? 'checked ' : '';
390
-        $required  = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? 'required' : '';
391
-        $input     = "
351
+	}
352
+
353
+
354
+	/**
355
+	 * @param string $id
356
+	 * @param string $label
357
+	 * @param string $required
358
+	 * @return string
359
+	 * @since   4.10.14.p
360
+	 */
361
+	private static function adminLabel($id, $label, $required)
362
+	{
363
+		$id       = esc_attr($id);
364
+		$label    = esc_html($label);
365
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? " <span>*</span>" : '';
366
+		return "<label for='{$id}'>{$label}{$required}</label>";
367
+	}
368
+
369
+
370
+	/**
371
+	 * @param string $default
372
+	 * @param string $class
373
+	 * @param string $id
374
+	 * @param string $name
375
+	 * @param string $required
376
+	 * @param int    $tab_index
377
+	 * @param string $type
378
+	 * @param string $value
379
+	 * @param string $label
380
+	 * @return string
381
+	 * @since   4.10.14.p
382
+	 */
383
+	private static function adminMulti($default, $class, $id, $name, $required, $tab_index, $type, $value, $label = '')
384
+	{
385
+		$id        = esc_attr($id);
386
+		$name      = esc_attr($name);
387
+		$class     = esc_attr($class);
388
+		$tab_index = absint($tab_index);
389
+		$checked   = ! empty($default) && $default == $value ? 'checked ' : '';
390
+		$required  = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? 'required' : '';
391
+		$input     = "
392 392
         <input name='{$name}[]' type='{$type}' id='{$id}' class='{$class}' value='{$value}' {$checked} {$required} tabindex='{$tab_index}'/>";
393
-        if ($label === '') {
394
-            return $input;
395
-        }
396
-        $label = esc_html($label);
397
-        $label_class = self::appendInputSizeClass('', $label);
398
-        $label_class = $label_class ? ' class="' . $label_class . '"' : '';
399
-        return "
393
+		if ($label === '') {
394
+			return $input;
395
+		}
396
+		$label = esc_html($label);
397
+		$label_class = self::appendInputSizeClass('', $label);
398
+		$label_class = $label_class ? ' class="' . $label_class . '"' : '';
399
+		return "
400 400
         <label for='$id'{$label_class}>
401 401
             {$input}
402 402
             {$label}
403 403
         </label>";
404
-    }
405
-
406
-
407
-    /**
408
-     * @param string $default
409
-     * @param string $class
410
-     * @param string $id
411
-     * @param string $name
412
-     * @param string $required
413
-     * @param int    $tab_index
414
-     * @param array  $options
415
-     * @return string
416
-     * @since   4.10.14.p
417
-     */
418
-    private static function adminSelect($default, $class, $id, $name, $required, $tab_index, $options = [])
419
-    {
420
-        $options_array = [];
421
-        foreach ($options as $value => $label) {
422
-            $selected        = ! empty($default) && $default == $value ? 'selected' : '';
423
-            $value           = esc_attr($value);
424
-            $label           = wp_strip_all_tags($label);
425
-            $options_array[] = "<option value='{$value}' {$selected}>{$label}</option>";
426
-        }
427
-        $options_html = implode("\n", $options_array);
428
-        $id           = esc_attr($id);
429
-        $name         = esc_attr($name);
430
-        $class        = esc_attr($class);
431
-        $tab_index    = absint($tab_index);
432
-        $required     = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? 'required' : '';
433
-
434
-        $class = self::appendInputSizeClass($class, $options);
435
-
436
-        return "
404
+	}
405
+
406
+
407
+	/**
408
+	 * @param string $default
409
+	 * @param string $class
410
+	 * @param string $id
411
+	 * @param string $name
412
+	 * @param string $required
413
+	 * @param int    $tab_index
414
+	 * @param array  $options
415
+	 * @return string
416
+	 * @since   4.10.14.p
417
+	 */
418
+	private static function adminSelect($default, $class, $id, $name, $required, $tab_index, $options = [])
419
+	{
420
+		$options_array = [];
421
+		foreach ($options as $value => $label) {
422
+			$selected        = ! empty($default) && $default == $value ? 'selected' : '';
423
+			$value           = esc_attr($value);
424
+			$label           = wp_strip_all_tags($label);
425
+			$options_array[] = "<option value='{$value}' {$selected}>{$label}</option>";
426
+		}
427
+		$options_html = implode("\n", $options_array);
428
+		$id           = esc_attr($id);
429
+		$name         = esc_attr($name);
430
+		$class        = esc_attr($class);
431
+		$tab_index    = absint($tab_index);
432
+		$required     = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? 'required' : '';
433
+
434
+		$class = self::appendInputSizeClass($class, $options);
435
+
436
+		return "
437 437
         <select name='{$name}' id='{$id}' class='{$class}' {$required} tabindex='{$tab_index}'>
438 438
             {$options_html}
439 439
         </select>";
440
-    }
441
-
442
-
443
-    /**
444
-     * @param string $class
445
-     * @param string $id
446
-     * @param string $name
447
-     * @param string $required
448
-     * @param int    $tab_index
449
-     * @param string $value
450
-     * @return string
451
-     * @since   4.10.14.p
452
-     */
453
-    private static function adminText($class, $id, $name, $required, $tab_index, $value)
454
-    {
455
-        $id        = esc_attr($id);
456
-        $name      = esc_attr($name);
457
-        $class     = esc_attr($class);
458
-        $tab_index = absint($tab_index);
459
-        $required  = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? 'required' : '';
460
-        $class     = self::appendInputSizeClass($class, $value);
461
-        $value     = esc_attr($value);
462
-        return "
440
+	}
441
+
442
+
443
+	/**
444
+	 * @param string $class
445
+	 * @param string $id
446
+	 * @param string $name
447
+	 * @param string $required
448
+	 * @param int    $tab_index
449
+	 * @param string $value
450
+	 * @return string
451
+	 * @since   4.10.14.p
452
+	 */
453
+	private static function adminText($class, $id, $name, $required, $tab_index, $value)
454
+	{
455
+		$id        = esc_attr($id);
456
+		$name      = esc_attr($name);
457
+		$class     = esc_attr($class);
458
+		$tab_index = absint($tab_index);
459
+		$required  = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? 'required' : '';
460
+		$class     = self::appendInputSizeClass($class, $value);
461
+		$value     = esc_attr($value);
462
+		return "
463 463
         <input name='{$name}' type='text' id='{$id}' class='{$class}' value='{$value}' {$required} tabindex='{$tab_index}'/>";
464
-    }
465
-
466
-
467
-    /**
468
-     * @param string $class
469
-     * @param int    $cols
470
-     * @param string $id
471
-     * @param string $name
472
-     * @param string $required
473
-     * @param int    $rows
474
-     * @param int    $tab_index
475
-     * @param string $value
476
-     * @return string
477
-     * @since   4.10.14.p
478
-     */
479
-    private static function adminTextarea($class, $cols, $id, $name, $required, $rows, $tab_index, $value)
480
-    {
481
-        $id        = esc_attr($id);
482
-        $name      = esc_attr($name);
483
-        $class     = esc_attr($class);
484
-        $cols      = absint($cols);
485
-        $rows      = absint($rows);
486
-        $value     = esc_textarea($value);
487
-        $tab_index = absint($tab_index);
488
-        $required  = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? 'required' : '';
489
-        return "
464
+	}
465
+
466
+
467
+	/**
468
+	 * @param string $class
469
+	 * @param int    $cols
470
+	 * @param string $id
471
+	 * @param string $name
472
+	 * @param string $required
473
+	 * @param int    $rows
474
+	 * @param int    $tab_index
475
+	 * @param string $value
476
+	 * @return string
477
+	 * @since   4.10.14.p
478
+	 */
479
+	private static function adminTextarea($class, $cols, $id, $name, $required, $rows, $tab_index, $value)
480
+	{
481
+		$id        = esc_attr($id);
482
+		$name      = esc_attr($name);
483
+		$class     = esc_attr($class);
484
+		$cols      = absint($cols);
485
+		$rows      = absint($rows);
486
+		$value     = esc_textarea($value);
487
+		$tab_index = absint($tab_index);
488
+		$required  = filter_var($required, FILTER_VALIDATE_BOOLEAN) ? 'required' : '';
489
+		return "
490 490
         <textarea name='{$name}' id='{$id}' class='{$class}' rows='{$rows}' cols='{$cols}' {$required} tabindex='{$tab_index}'>{$value}</textarea>";
491
-    }
492
-
493
-
494
-    /**
495
-     * @param string $class
496
-     * @param string $id
497
-     * @param string $name
498
-     * @param int    $rows
499
-     * @param int    $tab_index
500
-     * @param string $value
501
-     * @param array  $wp_editor_args
502
-     * @return false|string
503
-     * @since   4.10.14.p
504
-     */
505
-    private static function adminWpEditor($class, $id, $name, $rows, $tab_index, $value, $wp_editor_args = [])
506
-    {
507
-        $editor_settings = $wp_editor_args + [
508
-                'textarea_name' => esc_attr($name),
509
-                'textarea_rows' => absint($rows),
510
-                'editor_class'  => esc_attr($class),
511
-                'tabindex'      => absint($tab_index),
512
-            ];
513
-        ob_start();
514
-        wp_editor($value, esc_attr($id), $editor_settings);
515
-        return ob_get_clean();
516
-    }
517
-
518
-
519
-    /**
520
-     * espresso admin page select_input
521
-     * Turns an array into a select fields
522
-     *
523
-     * @static
524
-     * @access public
525
-     * @param string  $name       field name
526
-     * @param array   $values     option values, numbered array starting at 0, where each value is an array with a key
527
-     *                            'text' (meaning text to display' and 'id' (meaning the internal value) eg:
528
-     *                            array(1=>array('text'=>'Monday','id'=>1),2=>array('text'=>'Tuesday','id'=>2)...). or
529
-     *                            as an array of key-value pairs, where the key is to be used for the select input's
530
-     *                            name, and the value will be the text shown to the user.  Optionally you can also
531
-     *                            include an additional key of "class" which will add a specific class to the option
532
-     *                            for that value.
533
-     * @param string  $default    default value
534
-     * @param string  $parameters extra parameters
535
-     * @param string  $class      css class
536
-     * @param boolean $autosize   whether to autosize the select or not
537
-     * @return string              html string for the select input
538
-     */
539
-    public static function select_input(
540
-        $name,
541
-        $values,
542
-        $default = '',
543
-        $parameters = '',
544
-        $class = '',
545
-        $autosize = true
546
-    ) {
547
-        // if $values was submitted in the wrong format, convert it over
548
-        if (! empty($values) && (! array_key_exists(0, $values) || ! is_array($values[0]))) {
549
-            $converted_values = [];
550
-            foreach ($values as $id => $text) {
551
-                $converted_values[] = ['id' => $id, 'text' => $text];
552
-            }
553
-            $values = $converted_values;
554
-        }
555
-
556
-        $field =
557
-            '<select id="' . EEH_Formatter::ee_tep_output_string($name)
558
-            . '" name="' . EEH_Formatter::ee_tep_output_string($name)
559
-            . '"';
560
-
561
-        if (EEH_Formatter::ee_tep_not_null($parameters)) {
562
-            $field .= ' ' . $parameters;
563
-        }
564
-        $class = $autosize ? self::appendInputSizeClass($class, $values) : '';
565
-
566
-        $field .= ' class="' . $class . '">';
567
-
568
-        if (empty($default) && isset($GLOBALS[ $name ])) {
569
-            $default = stripslashes($GLOBALS[ $name ]);
570
-        }
571
-
572
-        $field .= self::selectInputOption($values, $default);
573
-        $field .= '</select>';
574
-
575
-        return $field;
576
-    }
577
-
578
-
579
-    private static function selectInputOption(array $values, $default): string
580
-    {
581
-        if (isset($values['id'], $values['text'])) {
582
-            $id = is_scalar($values['id']) ? $values['id'] : '';
583
-            $text = is_scalar($values['text']) ? $values['text'] : '';
584
-            $selected = $default == $values['id'] ? ' selected = "selected"' : '';
585
-            $html_class = isset($values['class']) ? ' class="' . $values['class'] . '"' : '';
586
-            return "<option value='{$id}'{$selected}{$html_class}>{$text}</option>";
587
-        }
588
-        $options = '';
589
-        foreach ($values as $value) {
590
-            $options .= self::selectInputOption($value, $default);
591
-        }
592
-        return $options;
593
-    }
594
-
595
-
596
-    /**
597
-     * @param mixed $value
598
-     * @return int
599
-     * @since   5.0.0.p
600
-     */
601
-    private static function getInputValueLength($value): int
602
-    {
603
-        if ($value instanceof EE_Question_Option) {
604
-            return self::getInputValueLength($value->desc());
605
-        }
606
-        if (is_array($value)) {
607
-            $chars = 0;
608
-            foreach ($value as $val) {
609
-                $length = self::getInputValueLength($val);
610
-                $chars = max($length, $chars);
611
-            }
612
-            return $chars;
613
-        }
614
-        // not a primitive? return something big
615
-        if (! is_scalar($value)) {
616
-            return 500;
617
-        }
618
-        return strlen((string) $value);
619
-    }
620
-
621
-
622
-    /**
623
-     * @param string $class
624
-     * @param mixed $value
625
-     * @return string
626
-     * @since   5.0.0.p
627
-     */
628
-    private static function appendInputSizeClass(string $class, $value): string
629
-    {
630
-        if (strpos($class, 'ee-input-width--') !== false) {
631
-            return $class;
632
-        }
633
-        $chars = self::getInputValueLength($value);
634
-        if ($chars && $chars < 5) {
635
-            return "{$class} ee-input-width--tiny";
636
-        }
637
-        if ($chars && $chars < 25) {
638
-            return "{$class} ee-input-width--small";
639
-        }
640
-        if ($chars && $chars > 100) {
641
-            return "{$class} ee-input-width--big";
642
-        }
643
-        return "{$class} ee-input-width--reg";
644
-    }
645
-
646
-
647
-    /**
648
-     * generate_question_groups_html
649
-     *
650
-     * @param array  $question_groups
651
-     * @param string $group_wrapper
652
-     * @return string HTML
653
-     * @throws EE_Error
654
-     * @throws ReflectionException
655
-     */
656
-    public static function generate_question_groups_html($question_groups = [], $group_wrapper = 'fieldset')
657
-    {
658
-
659
-        $html                            = '';
660
-        $before_question_group_questions =
661
-            apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
662
-        $after_question_group_questions  =
663
-            apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
664
-
665
-        if (! empty($question_groups)) {
666
-            // loop thru question groups
667
-            foreach ($question_groups as $QSG) {
668
-                // check that questions exist
669
-                if (! empty($QSG['QSG_questions'])) {
670
-                    // use fieldsets
671
-                    $html .= "\n\t"
672
-                             . '<'
673
-                             . $group_wrapper
674
-                             . ' class="espresso-question-group-wrap" id="'
675
-                             . $QSG['QSG_identifier']
676
-                             . '">';
677
-                    // group_name
678
-                    $html .= $QSG['QSG_show_group_name']
679
-                        ? "\n\t\t"
680
-                          . '<h5 class="espresso-question-group-title-h5 section-title">'
681
-                          . self::prep_answer($QSG['QSG_name'])
682
-                          . '</h5>'
683
-                        : '';
684
-                    // group_desc
685
-                    $html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc'])
686
-                        ? '<div class="espresso-question-group-desc-pg">'
687
-                          . self::prep_answer($QSG['QSG_desc'])
688
-                          . '</div>'
689
-                        : '';
690
-
691
-                    $html .= $before_question_group_questions;
692
-                    // loop thru questions
693
-                    foreach ($QSG['QSG_questions'] as $question) {
694
-                        $QFI  = new EE_Question_Form_Input(
695
-                            $question['qst_obj'],
696
-                            $question['ans_obj'],
697
-                            $question
698
-                        );
699
-                        $html .= self::generate_form_input($QFI);
700
-                    }
701
-                    $html .= $after_question_group_questions;
702
-                    $html .= "\n\t" . '</' . $group_wrapper . '>';
703
-                }
704
-            }
705
-        }
706
-
707
-        return $html;
708
-    }
709
-
710
-
711
-    /**
712
-     * generate_question_groups_html
713
-     *
714
-     * @param array  $question_groups
715
-     * @param array  $q_meta
716
-     * @param bool   $from_admin
717
-     * @param string $group_wrapper
718
-     * @return string HTML
719
-     * @throws EE_Error
720
-     * @throws ReflectionException
721
-     */
722
-    public static function generate_question_groups_html2(
723
-        $question_groups = [],
724
-        $q_meta = [],
725
-        $from_admin = false,
726
-        $group_wrapper = 'fieldset'
727
-    ) {
728
-
729
-        $html                            = '';
730
-        $before_question_group_questions =
731
-            apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
732
-        $after_question_group_questions  =
733
-            apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
734
-
735
-        $default_q_meta = [
736
-            'att_nmbr'    => 1,
737
-            'ticket_id'   => '',
738
-            'input_name'  => '',
739
-            'input_id'    => '',
740
-            'input_class' => '',
741
-        ];
742
-        $q_meta         = array_merge($default_q_meta, $q_meta);
743
-
744
-        if (! empty($question_groups)) {
745
-            // loop thru question groups
746
-            foreach ($question_groups as $QSG) {
747
-                if ($QSG instanceof EE_Question_Group) {
748
-                    // check that questions exist
749
-
750
-                    $where = ['QST_deleted' => 0];
751
-                    if (! $from_admin) {
752
-                        $where['QST_admin_only'] = 0;
753
-                    }
754
-                    $questions =
755
-                        $QSG->questions([$where, 'order_by' => ['Question_Group_Question.QGQ_order' => 'ASC']]);
756
-                    if (! empty($questions)) {
757
-                        // use fieldsets
758
-                        $html .= "\n\t"
759
-                                 . '<' . $group_wrapper . ' class="espresso-question-group-wrap" '
760
-                                 . 'id="' . $QSG->get('QSG_identifier') . '">';
761
-                        // group_name
762
-                        if ($QSG->show_group_name()) {
763
-                            $html .= "\n\t\t"
764
-                                     . '<h5 class="espresso-question-group-title-h5 section-title">'
765
-                                     . $QSG->get_pretty('QSG_name')
766
-                                     . '</h5>';
767
-                        }
768
-                        // group_desc
769
-                        if ($QSG->show_group_desc()) {
770
-                            $html .= '<div class="espresso-question-group-desc-pg">'
771
-                                     . $QSG->get_pretty('QSG_desc')
772
-                                     . '</div>';
773
-                        }
774
-
775
-                        $html .= $before_question_group_questions;
776
-                        // loop thru questions
777
-                        foreach ($questions as $QST) {
778
-                            $qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
779
-
780
-                            $answer = null;
781
-
782
-                            /** @var RequestInterface $request */
783
-                            $request      = LoaderFactory::getLoader()->getShared(RequestInterface::class);
784
-                            $request_qstn = $request->getRequestParam('qstn', [], 'string', true);
785
-                            if (! empty($request_qstn) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
786
-                                // check for answer in $request_qstn in case we are reprocessing a form after an error
787
-                                if (isset($request_qstn[ $q_meta['input_id'] ][ $qstn_id ])) {
788
-                                    $answer = is_array($request_qstn[ $q_meta['input_id'] ][ $qstn_id ])
789
-                                        ? $request_qstn[ $q_meta['input_id'] ][ $qstn_id ]
790
-                                        : sanitize_text_field($request_qstn[ $q_meta['input_id'] ][ $qstn_id ]);
791
-                                }
792
-                            } elseif (isset($q_meta['attendee']) && $q_meta['attendee']) {
793
-                                // attendee data from the session
794
-                                $answer =
795
-                                    isset($q_meta['attendee'][ $qstn_id ]) ? $q_meta['attendee'][ $qstn_id ] : null;
796
-                            }
797
-
798
-
799
-                            $QFI  = new EE_Question_Form_Input(
800
-                                $QST,
801
-                                EE_Answer::new_instance(
802
-                                    [
803
-                                        'ANS_ID'    => 0,
804
-                                        'QST_ID'    => 0,
805
-                                        'REG_ID'    => 0,
806
-                                        'ANS_value' => $answer,
807
-                                    ]
808
-                                ),
809
-                                $q_meta
810
-                            );
811
-                            $html .= self::generate_form_input($QFI);
812
-                        }
813
-                        $html .= $after_question_group_questions;
814
-                        $html .= "\n\t" . '</' . $group_wrapper . '>';
815
-                    }
816
-                }
817
-            }
818
-        }
819
-        return $html;
820
-    }
821
-
822
-
823
-    /**
824
-     * generate_form_input
825
-     *
826
-     * @param EE_Question_Form_Input $QFI
827
-     * @return string HTML
828
-     * @throws EE_Error
829
-     * @throws ReflectionException
830
-     */
831
-    public static function generate_form_input(EE_Question_Form_Input $QFI)
832
-    {
833
-        if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
834
-            return '';
835
-        }
836
-        /** @var RequestInterface $request */
837
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
838
-
839
-        $QFI = self::_load_system_dropdowns($QFI);
840
-        $QFI = self::_load_specialized_dropdowns($QFI);
841
-
842
-        // we also need to verify
843
-
844
-        $display_text = (string) $QFI->get('QST_display_text');
845
-        $input_name   = (string) $QFI->get('QST_input_name');
846
-        $answer       = $request->getRequestParam($input_name, $QFI->get('ANS_value'));
847
-        $input_id     = (string) $QFI->get('QST_input_id');
848
-        $input_class  = (string) $QFI->get('QST_input_class');
849
-        //      $disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
850
-        $disabled          = (bool) $QFI->get('QST_disabled');
851
-        $required_label    = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
852
-        $QST_required      = (bool) $QFI->get('QST_required');
853
-        $required          = $QST_required
854
-            ? ['label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required]
855
-            : [];
856
-        $use_html_entities = $QFI->get_meta('htmlentities');
857
-        $required_text     = (string) $QFI->get('QST_required_text') !== ''
858
-            ? (string) $QFI->get('QST_required_text')
859
-            : esc_html__('This field is required', 'event_espresso');
860
-        $required_text     = $QST_required
861
-            ? "\n\t\t\t"
862
-              . '<div class="required-text hidden">'
863
-              . self::prep_answer($required_text, $use_html_entities)
864
-              . '</div>'
865
-            : '';
866
-        $label_class       = (string) $QFI->get('label_class');
867
-        $label_class       = $label_class ? "{$label_class} espresso-form-input-lbl" : 'espresso-form-input-lbl';
868
-        $QST_options       = $QFI->options(true, $answer);
869
-        $options           = is_array($QST_options) ? self::prep_answer_options($QST_options) : [];
870
-        $system_ID         = (string) $QFI->get('QST_system');
871
-        $label_b4          = (bool) $QFI->get_meta('label_b4');
872
-        $use_desc_4_label  = (bool) $QFI->get_meta('use_desc_4_label');
873
-        $add_mobile_label  = (bool) $QFI->get_meta('add_mobile_label');
874
-
875
-
876
-        switch ($QFI->get('QST_type')) {
877
-            case 'TEXTAREA':
878
-                return EEH_Form_Fields::textarea(
879
-                    $display_text,
880
-                    $answer,
881
-                    $input_name,
882
-                    $input_id,
883
-                    $input_class,
884
-                    [],
885
-                    $required,
886
-                    $required_text,
887
-                    $label_class,
888
-                    $disabled,
889
-                    $system_ID,
890
-                    $use_html_entities,
891
-                    $add_mobile_label
892
-                );
893
-
894
-            case 'DROPDOWN':
895
-                return EEH_Form_Fields::select(
896
-                    $display_text,
897
-                    $answer,
898
-                    $options,
899
-                    $input_name,
900
-                    $input_id,
901
-                    $input_class,
902
-                    $required,
903
-                    $required_text,
904
-                    $label_class,
905
-                    $disabled,
906
-                    $system_ID,
907
-                    $use_html_entities,
908
-                    true,
909
-                    $add_mobile_label
910
-                );
911
-
912
-
913
-            case 'RADIO_BTN':
914
-                return EEH_Form_Fields::radio(
915
-                    $display_text,
916
-                    $answer,
917
-                    $options,
918
-                    $input_name,
919
-                    $input_id,
920
-                    $input_class,
921
-                    $required,
922
-                    $required_text,
923
-                    $label_class,
924
-                    $disabled,
925
-                    $system_ID,
926
-                    $use_html_entities,
927
-                    $label_b4,
928
-                    $use_desc_4_label,
929
-                    $add_mobile_label
930
-                );
931
-
932
-            case 'CHECKBOX':
933
-                return EEH_Form_Fields::checkbox(
934
-                    $display_text,
935
-                    $answer,
936
-                    $options,
937
-                    $input_name,
938
-                    $input_id,
939
-                    $input_class,
940
-                    $required,
941
-                    $required_text,
942
-                    $label_class,
943
-                    $disabled,
944
-                    $label_b4,
945
-                    $system_ID,
946
-                    $use_html_entities,
947
-                    $add_mobile_label
948
-                );
949
-
950
-            case 'DATE':
951
-                return EEH_Form_Fields::datepicker(
952
-                    $display_text,
953
-                    $answer,
954
-                    $input_name,
955
-                    $input_id,
956
-                    $input_class,
957
-                    $required,
958
-                    $required_text,
959
-                    $label_class,
960
-                    $disabled,
961
-                    $system_ID,
962
-                    $use_html_entities,
963
-                    $add_mobile_label
964
-                );
965
-
966
-            case 'TEXT':
967
-            default:
968
-                return EEH_Form_Fields::text(
969
-                    $display_text,
970
-                    $answer,
971
-                    $input_name,
972
-                    $input_id,
973
-                    $input_class,
974
-                    $required,
975
-                    $required_text,
976
-                    $label_class,
977
-                    $disabled,
978
-                    $system_ID,
979
-                    $use_html_entities,
980
-                    $add_mobile_label
981
-                );
982
-        }
983
-    }
984
-
985
-
986
-    public static function label(
987
-        string $question,
988
-        string $required_text = '',
989
-        string $required_label = '',
990
-        string $name = '',
991
-        string $label_class = '',
992
-        bool $filter = true
993
-    ): string {
994
-        $for   = ! empty($name) ? " for='{$name}'" : '';
995
-        $class = ! empty($label_class) ? " class='{$label_class}'" : '';
996
-        $label = self::prep_question($question) . $required_label;
997
-        $label_html = "
491
+	}
492
+
493
+
494
+	/**
495
+	 * @param string $class
496
+	 * @param string $id
497
+	 * @param string $name
498
+	 * @param int    $rows
499
+	 * @param int    $tab_index
500
+	 * @param string $value
501
+	 * @param array  $wp_editor_args
502
+	 * @return false|string
503
+	 * @since   4.10.14.p
504
+	 */
505
+	private static function adminWpEditor($class, $id, $name, $rows, $tab_index, $value, $wp_editor_args = [])
506
+	{
507
+		$editor_settings = $wp_editor_args + [
508
+				'textarea_name' => esc_attr($name),
509
+				'textarea_rows' => absint($rows),
510
+				'editor_class'  => esc_attr($class),
511
+				'tabindex'      => absint($tab_index),
512
+			];
513
+		ob_start();
514
+		wp_editor($value, esc_attr($id), $editor_settings);
515
+		return ob_get_clean();
516
+	}
517
+
518
+
519
+	/**
520
+	 * espresso admin page select_input
521
+	 * Turns an array into a select fields
522
+	 *
523
+	 * @static
524
+	 * @access public
525
+	 * @param string  $name       field name
526
+	 * @param array   $values     option values, numbered array starting at 0, where each value is an array with a key
527
+	 *                            'text' (meaning text to display' and 'id' (meaning the internal value) eg:
528
+	 *                            array(1=>array('text'=>'Monday','id'=>1),2=>array('text'=>'Tuesday','id'=>2)...). or
529
+	 *                            as an array of key-value pairs, where the key is to be used for the select input's
530
+	 *                            name, and the value will be the text shown to the user.  Optionally you can also
531
+	 *                            include an additional key of "class" which will add a specific class to the option
532
+	 *                            for that value.
533
+	 * @param string  $default    default value
534
+	 * @param string  $parameters extra parameters
535
+	 * @param string  $class      css class
536
+	 * @param boolean $autosize   whether to autosize the select or not
537
+	 * @return string              html string for the select input
538
+	 */
539
+	public static function select_input(
540
+		$name,
541
+		$values,
542
+		$default = '',
543
+		$parameters = '',
544
+		$class = '',
545
+		$autosize = true
546
+	) {
547
+		// if $values was submitted in the wrong format, convert it over
548
+		if (! empty($values) && (! array_key_exists(0, $values) || ! is_array($values[0]))) {
549
+			$converted_values = [];
550
+			foreach ($values as $id => $text) {
551
+				$converted_values[] = ['id' => $id, 'text' => $text];
552
+			}
553
+			$values = $converted_values;
554
+		}
555
+
556
+		$field =
557
+			'<select id="' . EEH_Formatter::ee_tep_output_string($name)
558
+			. '" name="' . EEH_Formatter::ee_tep_output_string($name)
559
+			. '"';
560
+
561
+		if (EEH_Formatter::ee_tep_not_null($parameters)) {
562
+			$field .= ' ' . $parameters;
563
+		}
564
+		$class = $autosize ? self::appendInputSizeClass($class, $values) : '';
565
+
566
+		$field .= ' class="' . $class . '">';
567
+
568
+		if (empty($default) && isset($GLOBALS[ $name ])) {
569
+			$default = stripslashes($GLOBALS[ $name ]);
570
+		}
571
+
572
+		$field .= self::selectInputOption($values, $default);
573
+		$field .= '</select>';
574
+
575
+		return $field;
576
+	}
577
+
578
+
579
+	private static function selectInputOption(array $values, $default): string
580
+	{
581
+		if (isset($values['id'], $values['text'])) {
582
+			$id = is_scalar($values['id']) ? $values['id'] : '';
583
+			$text = is_scalar($values['text']) ? $values['text'] : '';
584
+			$selected = $default == $values['id'] ? ' selected = "selected"' : '';
585
+			$html_class = isset($values['class']) ? ' class="' . $values['class'] . '"' : '';
586
+			return "<option value='{$id}'{$selected}{$html_class}>{$text}</option>";
587
+		}
588
+		$options = '';
589
+		foreach ($values as $value) {
590
+			$options .= self::selectInputOption($value, $default);
591
+		}
592
+		return $options;
593
+	}
594
+
595
+
596
+	/**
597
+	 * @param mixed $value
598
+	 * @return int
599
+	 * @since   5.0.0.p
600
+	 */
601
+	private static function getInputValueLength($value): int
602
+	{
603
+		if ($value instanceof EE_Question_Option) {
604
+			return self::getInputValueLength($value->desc());
605
+		}
606
+		if (is_array($value)) {
607
+			$chars = 0;
608
+			foreach ($value as $val) {
609
+				$length = self::getInputValueLength($val);
610
+				$chars = max($length, $chars);
611
+			}
612
+			return $chars;
613
+		}
614
+		// not a primitive? return something big
615
+		if (! is_scalar($value)) {
616
+			return 500;
617
+		}
618
+		return strlen((string) $value);
619
+	}
620
+
621
+
622
+	/**
623
+	 * @param string $class
624
+	 * @param mixed $value
625
+	 * @return string
626
+	 * @since   5.0.0.p
627
+	 */
628
+	private static function appendInputSizeClass(string $class, $value): string
629
+	{
630
+		if (strpos($class, 'ee-input-width--') !== false) {
631
+			return $class;
632
+		}
633
+		$chars = self::getInputValueLength($value);
634
+		if ($chars && $chars < 5) {
635
+			return "{$class} ee-input-width--tiny";
636
+		}
637
+		if ($chars && $chars < 25) {
638
+			return "{$class} ee-input-width--small";
639
+		}
640
+		if ($chars && $chars > 100) {
641
+			return "{$class} ee-input-width--big";
642
+		}
643
+		return "{$class} ee-input-width--reg";
644
+	}
645
+
646
+
647
+	/**
648
+	 * generate_question_groups_html
649
+	 *
650
+	 * @param array  $question_groups
651
+	 * @param string $group_wrapper
652
+	 * @return string HTML
653
+	 * @throws EE_Error
654
+	 * @throws ReflectionException
655
+	 */
656
+	public static function generate_question_groups_html($question_groups = [], $group_wrapper = 'fieldset')
657
+	{
658
+
659
+		$html                            = '';
660
+		$before_question_group_questions =
661
+			apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
662
+		$after_question_group_questions  =
663
+			apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
664
+
665
+		if (! empty($question_groups)) {
666
+			// loop thru question groups
667
+			foreach ($question_groups as $QSG) {
668
+				// check that questions exist
669
+				if (! empty($QSG['QSG_questions'])) {
670
+					// use fieldsets
671
+					$html .= "\n\t"
672
+							 . '<'
673
+							 . $group_wrapper
674
+							 . ' class="espresso-question-group-wrap" id="'
675
+							 . $QSG['QSG_identifier']
676
+							 . '">';
677
+					// group_name
678
+					$html .= $QSG['QSG_show_group_name']
679
+						? "\n\t\t"
680
+						  . '<h5 class="espresso-question-group-title-h5 section-title">'
681
+						  . self::prep_answer($QSG['QSG_name'])
682
+						  . '</h5>'
683
+						: '';
684
+					// group_desc
685
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc'])
686
+						? '<div class="espresso-question-group-desc-pg">'
687
+						  . self::prep_answer($QSG['QSG_desc'])
688
+						  . '</div>'
689
+						: '';
690
+
691
+					$html .= $before_question_group_questions;
692
+					// loop thru questions
693
+					foreach ($QSG['QSG_questions'] as $question) {
694
+						$QFI  = new EE_Question_Form_Input(
695
+							$question['qst_obj'],
696
+							$question['ans_obj'],
697
+							$question
698
+						);
699
+						$html .= self::generate_form_input($QFI);
700
+					}
701
+					$html .= $after_question_group_questions;
702
+					$html .= "\n\t" . '</' . $group_wrapper . '>';
703
+				}
704
+			}
705
+		}
706
+
707
+		return $html;
708
+	}
709
+
710
+
711
+	/**
712
+	 * generate_question_groups_html
713
+	 *
714
+	 * @param array  $question_groups
715
+	 * @param array  $q_meta
716
+	 * @param bool   $from_admin
717
+	 * @param string $group_wrapper
718
+	 * @return string HTML
719
+	 * @throws EE_Error
720
+	 * @throws ReflectionException
721
+	 */
722
+	public static function generate_question_groups_html2(
723
+		$question_groups = [],
724
+		$q_meta = [],
725
+		$from_admin = false,
726
+		$group_wrapper = 'fieldset'
727
+	) {
728
+
729
+		$html                            = '';
730
+		$before_question_group_questions =
731
+			apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
732
+		$after_question_group_questions  =
733
+			apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
734
+
735
+		$default_q_meta = [
736
+			'att_nmbr'    => 1,
737
+			'ticket_id'   => '',
738
+			'input_name'  => '',
739
+			'input_id'    => '',
740
+			'input_class' => '',
741
+		];
742
+		$q_meta         = array_merge($default_q_meta, $q_meta);
743
+
744
+		if (! empty($question_groups)) {
745
+			// loop thru question groups
746
+			foreach ($question_groups as $QSG) {
747
+				if ($QSG instanceof EE_Question_Group) {
748
+					// check that questions exist
749
+
750
+					$where = ['QST_deleted' => 0];
751
+					if (! $from_admin) {
752
+						$where['QST_admin_only'] = 0;
753
+					}
754
+					$questions =
755
+						$QSG->questions([$where, 'order_by' => ['Question_Group_Question.QGQ_order' => 'ASC']]);
756
+					if (! empty($questions)) {
757
+						// use fieldsets
758
+						$html .= "\n\t"
759
+								 . '<' . $group_wrapper . ' class="espresso-question-group-wrap" '
760
+								 . 'id="' . $QSG->get('QSG_identifier') . '">';
761
+						// group_name
762
+						if ($QSG->show_group_name()) {
763
+							$html .= "\n\t\t"
764
+									 . '<h5 class="espresso-question-group-title-h5 section-title">'
765
+									 . $QSG->get_pretty('QSG_name')
766
+									 . '</h5>';
767
+						}
768
+						// group_desc
769
+						if ($QSG->show_group_desc()) {
770
+							$html .= '<div class="espresso-question-group-desc-pg">'
771
+									 . $QSG->get_pretty('QSG_desc')
772
+									 . '</div>';
773
+						}
774
+
775
+						$html .= $before_question_group_questions;
776
+						// loop thru questions
777
+						foreach ($questions as $QST) {
778
+							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
779
+
780
+							$answer = null;
781
+
782
+							/** @var RequestInterface $request */
783
+							$request      = LoaderFactory::getLoader()->getShared(RequestInterface::class);
784
+							$request_qstn = $request->getRequestParam('qstn', [], 'string', true);
785
+							if (! empty($request_qstn) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
786
+								// check for answer in $request_qstn in case we are reprocessing a form after an error
787
+								if (isset($request_qstn[ $q_meta['input_id'] ][ $qstn_id ])) {
788
+									$answer = is_array($request_qstn[ $q_meta['input_id'] ][ $qstn_id ])
789
+										? $request_qstn[ $q_meta['input_id'] ][ $qstn_id ]
790
+										: sanitize_text_field($request_qstn[ $q_meta['input_id'] ][ $qstn_id ]);
791
+								}
792
+							} elseif (isset($q_meta['attendee']) && $q_meta['attendee']) {
793
+								// attendee data from the session
794
+								$answer =
795
+									isset($q_meta['attendee'][ $qstn_id ]) ? $q_meta['attendee'][ $qstn_id ] : null;
796
+							}
797
+
798
+
799
+							$QFI  = new EE_Question_Form_Input(
800
+								$QST,
801
+								EE_Answer::new_instance(
802
+									[
803
+										'ANS_ID'    => 0,
804
+										'QST_ID'    => 0,
805
+										'REG_ID'    => 0,
806
+										'ANS_value' => $answer,
807
+									]
808
+								),
809
+								$q_meta
810
+							);
811
+							$html .= self::generate_form_input($QFI);
812
+						}
813
+						$html .= $after_question_group_questions;
814
+						$html .= "\n\t" . '</' . $group_wrapper . '>';
815
+					}
816
+				}
817
+			}
818
+		}
819
+		return $html;
820
+	}
821
+
822
+
823
+	/**
824
+	 * generate_form_input
825
+	 *
826
+	 * @param EE_Question_Form_Input $QFI
827
+	 * @return string HTML
828
+	 * @throws EE_Error
829
+	 * @throws ReflectionException
830
+	 */
831
+	public static function generate_form_input(EE_Question_Form_Input $QFI)
832
+	{
833
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
834
+			return '';
835
+		}
836
+		/** @var RequestInterface $request */
837
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
838
+
839
+		$QFI = self::_load_system_dropdowns($QFI);
840
+		$QFI = self::_load_specialized_dropdowns($QFI);
841
+
842
+		// we also need to verify
843
+
844
+		$display_text = (string) $QFI->get('QST_display_text');
845
+		$input_name   = (string) $QFI->get('QST_input_name');
846
+		$answer       = $request->getRequestParam($input_name, $QFI->get('ANS_value'));
847
+		$input_id     = (string) $QFI->get('QST_input_id');
848
+		$input_class  = (string) $QFI->get('QST_input_class');
849
+		//      $disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
850
+		$disabled          = (bool) $QFI->get('QST_disabled');
851
+		$required_label    = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
852
+		$QST_required      = (bool) $QFI->get('QST_required');
853
+		$required          = $QST_required
854
+			? ['label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required]
855
+			: [];
856
+		$use_html_entities = $QFI->get_meta('htmlentities');
857
+		$required_text     = (string) $QFI->get('QST_required_text') !== ''
858
+			? (string) $QFI->get('QST_required_text')
859
+			: esc_html__('This field is required', 'event_espresso');
860
+		$required_text     = $QST_required
861
+			? "\n\t\t\t"
862
+			  . '<div class="required-text hidden">'
863
+			  . self::prep_answer($required_text, $use_html_entities)
864
+			  . '</div>'
865
+			: '';
866
+		$label_class       = (string) $QFI->get('label_class');
867
+		$label_class       = $label_class ? "{$label_class} espresso-form-input-lbl" : 'espresso-form-input-lbl';
868
+		$QST_options       = $QFI->options(true, $answer);
869
+		$options           = is_array($QST_options) ? self::prep_answer_options($QST_options) : [];
870
+		$system_ID         = (string) $QFI->get('QST_system');
871
+		$label_b4          = (bool) $QFI->get_meta('label_b4');
872
+		$use_desc_4_label  = (bool) $QFI->get_meta('use_desc_4_label');
873
+		$add_mobile_label  = (bool) $QFI->get_meta('add_mobile_label');
874
+
875
+
876
+		switch ($QFI->get('QST_type')) {
877
+			case 'TEXTAREA':
878
+				return EEH_Form_Fields::textarea(
879
+					$display_text,
880
+					$answer,
881
+					$input_name,
882
+					$input_id,
883
+					$input_class,
884
+					[],
885
+					$required,
886
+					$required_text,
887
+					$label_class,
888
+					$disabled,
889
+					$system_ID,
890
+					$use_html_entities,
891
+					$add_mobile_label
892
+				);
893
+
894
+			case 'DROPDOWN':
895
+				return EEH_Form_Fields::select(
896
+					$display_text,
897
+					$answer,
898
+					$options,
899
+					$input_name,
900
+					$input_id,
901
+					$input_class,
902
+					$required,
903
+					$required_text,
904
+					$label_class,
905
+					$disabled,
906
+					$system_ID,
907
+					$use_html_entities,
908
+					true,
909
+					$add_mobile_label
910
+				);
911
+
912
+
913
+			case 'RADIO_BTN':
914
+				return EEH_Form_Fields::radio(
915
+					$display_text,
916
+					$answer,
917
+					$options,
918
+					$input_name,
919
+					$input_id,
920
+					$input_class,
921
+					$required,
922
+					$required_text,
923
+					$label_class,
924
+					$disabled,
925
+					$system_ID,
926
+					$use_html_entities,
927
+					$label_b4,
928
+					$use_desc_4_label,
929
+					$add_mobile_label
930
+				);
931
+
932
+			case 'CHECKBOX':
933
+				return EEH_Form_Fields::checkbox(
934
+					$display_text,
935
+					$answer,
936
+					$options,
937
+					$input_name,
938
+					$input_id,
939
+					$input_class,
940
+					$required,
941
+					$required_text,
942
+					$label_class,
943
+					$disabled,
944
+					$label_b4,
945
+					$system_ID,
946
+					$use_html_entities,
947
+					$add_mobile_label
948
+				);
949
+
950
+			case 'DATE':
951
+				return EEH_Form_Fields::datepicker(
952
+					$display_text,
953
+					$answer,
954
+					$input_name,
955
+					$input_id,
956
+					$input_class,
957
+					$required,
958
+					$required_text,
959
+					$label_class,
960
+					$disabled,
961
+					$system_ID,
962
+					$use_html_entities,
963
+					$add_mobile_label
964
+				);
965
+
966
+			case 'TEXT':
967
+			default:
968
+				return EEH_Form_Fields::text(
969
+					$display_text,
970
+					$answer,
971
+					$input_name,
972
+					$input_id,
973
+					$input_class,
974
+					$required,
975
+					$required_text,
976
+					$label_class,
977
+					$disabled,
978
+					$system_ID,
979
+					$use_html_entities,
980
+					$add_mobile_label
981
+				);
982
+		}
983
+	}
984
+
985
+
986
+	public static function label(
987
+		string $question,
988
+		string $required_text = '',
989
+		string $required_label = '',
990
+		string $name = '',
991
+		string $label_class = '',
992
+		bool $filter = true
993
+	): string {
994
+		$for   = ! empty($name) ? " for='{$name}'" : '';
995
+		$class = ! empty($label_class) ? " class='{$label_class}'" : '';
996
+		$label = self::prep_question($question) . $required_label;
997
+		$label_html = "
998 998
             {$required_text}
999 999
             <label{$for}{$class}>{$label}</label>";
1000
-        // filter label but ensure required text comes before it
1001
-        return $filter
1002
-            ? apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text)
1003
-            : $label_html;
1004
-    }
1005
-
1006
-
1007
-
1008
-    public static function mobileLabel(
1009
-        bool $add_mobile_label,
1010
-        string $question,
1011
-        string $required_text = '',
1012
-        string $required_label = '',
1013
-        string $label_class = '',
1014
-        string $name = ''
1015
-    ): string {
1016
-        return $add_mobile_label
1017
-            ? self::label($question, $required_text, $required_label, $name, $label_class, false)
1018
-            : '';
1019
-    }
1020
-
1021
-
1022
-    /**
1023
-     * generates HTML for a form text input
1024
-     *
1025
-     * @param string $question    label content
1026
-     * @param string $answer      form input value attribute
1027
-     * @param string $name        form input name attribute
1028
-     * @param string $id          form input css id attribute
1029
-     * @param string $class       form input css class attribute
1030
-     * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1031
-     *                            required 'class', and required 'msg' attribute
1032
-     * @param string $label_class css class attribute for the label
1033
-     * @param string $disabled    disabled="disabled" or null
1034
-     * @return string HTML
1035
-     */
1036
-    public static function text(
1037
-        $question = false,
1038
-        $answer = null,
1039
-        $name = false,
1040
-        $id = '',
1041
-        $class = '',
1042
-        $required = false,
1043
-        $required_text = '',
1044
-        $label_class = '',
1045
-        $disabled = false,
1046
-        $system_ID = false,
1047
-        $use_html_entities = true,
1048
-        $add_mobile_label = false,
1049
-        $extra_attributes = ''
1050
-    ) {
1051
-        // need these
1052
-        if (! $question || ! $name) {
1053
-            return null;
1054
-        }
1055
-        // prep the answer
1056
-        $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1057
-        // prep the required array
1058
-        $required = self::prep_required($required);
1059
-        // set disabled tag
1060
-        $disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1061
-        // ya gots ta have style man!!!
1062
-        $txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
1063
-        $class     = empty($class) ? $txt_class : $class;
1064
-        $class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1065
-        $class = self::appendInputSizeClass($class, $answer);
1066
-        $class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1067
-        $extra_attributes = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', $extra_attributes);
1068
-
1069
-        $label_html = self::label($question, $required_text, $required['label'], $name, $label_class);
1070
-        $mobile_label = self::mobileLabel(
1071
-            $add_mobile_label,
1072
-            $question,
1073
-            $required_text,
1074
-            $required['label'],
1075
-            $label_class,
1076
-            $name
1077
-        );
1078
-
1079
-        $input_html = $mobile_label . '
1000
+		// filter label but ensure required text comes before it
1001
+		return $filter
1002
+			? apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text)
1003
+			: $label_html;
1004
+	}
1005
+
1006
+
1007
+
1008
+	public static function mobileLabel(
1009
+		bool $add_mobile_label,
1010
+		string $question,
1011
+		string $required_text = '',
1012
+		string $required_label = '',
1013
+		string $label_class = '',
1014
+		string $name = ''
1015
+	): string {
1016
+		return $add_mobile_label
1017
+			? self::label($question, $required_text, $required_label, $name, $label_class, false)
1018
+			: '';
1019
+	}
1020
+
1021
+
1022
+	/**
1023
+	 * generates HTML for a form text input
1024
+	 *
1025
+	 * @param string $question    label content
1026
+	 * @param string $answer      form input value attribute
1027
+	 * @param string $name        form input name attribute
1028
+	 * @param string $id          form input css id attribute
1029
+	 * @param string $class       form input css class attribute
1030
+	 * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1031
+	 *                            required 'class', and required 'msg' attribute
1032
+	 * @param string $label_class css class attribute for the label
1033
+	 * @param string $disabled    disabled="disabled" or null
1034
+	 * @return string HTML
1035
+	 */
1036
+	public static function text(
1037
+		$question = false,
1038
+		$answer = null,
1039
+		$name = false,
1040
+		$id = '',
1041
+		$class = '',
1042
+		$required = false,
1043
+		$required_text = '',
1044
+		$label_class = '',
1045
+		$disabled = false,
1046
+		$system_ID = false,
1047
+		$use_html_entities = true,
1048
+		$add_mobile_label = false,
1049
+		$extra_attributes = ''
1050
+	) {
1051
+		// need these
1052
+		if (! $question || ! $name) {
1053
+			return null;
1054
+		}
1055
+		// prep the answer
1056
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1057
+		// prep the required array
1058
+		$required = self::prep_required($required);
1059
+		// set disabled tag
1060
+		$disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1061
+		// ya gots ta have style man!!!
1062
+		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
1063
+		$class     = empty($class) ? $txt_class : $class;
1064
+		$class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1065
+		$class = self::appendInputSizeClass($class, $answer);
1066
+		$class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1067
+		$extra_attributes = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', $extra_attributes);
1068
+
1069
+		$label_html = self::label($question, $required_text, $required['label'], $name, $label_class);
1070
+		$mobile_label = self::mobileLabel(
1071
+			$add_mobile_label,
1072
+			$question,
1073
+			$required_text,
1074
+			$required['label'],
1075
+			$label_class,
1076
+			$name
1077
+		);
1078
+
1079
+		$input_html = $mobile_label . '
1080 1080
             <input  type="text"
1081 1081
                     name="' . $name . '"
1082 1082
                     id="' . $id . '"
@@ -1086,1040 +1086,1040 @@  discard block
 block discarded – undo
1086 1086
                     ' . $disabled . ' ' . $extra_attributes . '
1087 1087
             />';
1088 1088
 
1089
-        $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1090
-        return $label_html . $input_html;
1091
-    }
1092
-
1093
-
1094
-    /**
1095
-     * generates HTML for a form textarea
1096
-     *
1097
-     * @param string $question    label content
1098
-     * @param string $answer      form input value attribute
1099
-     * @param string $name        form input name attribute
1100
-     * @param string $id          form input css id attribute
1101
-     * @param string $class       form input css class attribute
1102
-     * @param array  $dimensions  array of form input rows and cols attributes : array( 'rows' => 3, 'cols' => 40 )
1103
-     * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1104
-     *                            required 'class', and required 'msg' attribute
1105
-     * @param string $label_class css class attribute for the label
1106
-     * @param string $disabled    disabled="disabled" or null
1107
-     * @return string HTML
1108
-     */
1109
-    public static function textarea(
1110
-        $question = false,
1111
-        $answer = null,
1112
-        $name = false,
1113
-        $id = '',
1114
-        $class = '',
1115
-        $dimensions = false,
1116
-        $required = false,
1117
-        $required_text = '',
1118
-        $label_class = '',
1119
-        $disabled = false,
1120
-        $system_ID = false,
1121
-        $use_html_entities = true,
1122
-        $add_mobile_label = false
1123
-    ) {
1124
-        // need these
1125
-        if (! $question || ! $name) {
1126
-            return null;
1127
-        }
1128
-        // prep the answer
1129
-        $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1130
-        // prep the required array
1131
-        $required = self::prep_required($required);
1132
-        // make sure $dimensions is an array
1133
-        $dimensions = is_array($dimensions) ? $dimensions : [];
1134
-        // and set some defaults
1135
-        $dimensions = array_merge(['rows' => 3, 'cols' => 40], $dimensions);
1136
-        // set disabled tag
1137
-        $disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1138
-        // ya gots ta have style man!!!
1139
-        $class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1140
-        $class     .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1141
-        $extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1142
-
1143
-        $label_html   = self::label($question, $required_text, $required['label'], $name, $label_class);
1144
-        $mobile_label = self::mobileLabel(
1145
-            $add_mobile_label,
1146
-            $question,
1147
-            $required_text,
1148
-            $required['label'],
1149
-            $label_class,
1150
-            $name
1151
-        );
1152
-
1153
-        $input_html = $mobile_label
1154
-            . '<textarea name="' . $name . '" id="' . $id . '" class="' . trim($class) . '" '
1155
-            . 'rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  '
1156
-            . 'aria-label="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>'
1157
-             . esc_textarea($answer)
1158
-              . '</textarea>';
1159
-
1160
-        $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1161
-        return $label_html . $input_html;
1162
-    }
1163
-
1164
-
1165
-    /**
1166
-     * generates HTML for a form select input
1167
-     *
1168
-     * @param string $question    label content
1169
-     * @param string $answer      form input value attribute
1170
-     * @param array  $options     array of answer options where array key = option value and array value = option
1171
-     *                            display text
1172
-     * @param string $name        form input name attribute
1173
-     * @param string $id          form input css id attribute
1174
-     * @param string $class       form input css class attribute
1175
-     * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1176
-     *                            required 'class', and required 'msg' attribute
1177
-     * @param string $label_class css class attribute for the label
1178
-     * @param string $disabled    disabled="disabled" or null
1179
-     * @return string HTML
1180
-     */
1181
-    public static function select(
1182
-        $question = false,
1183
-        $answer = null,
1184
-        $options = false,
1185
-        $name = false,
1186
-        $id = '',
1187
-        $class = '',
1188
-        $required = false,
1189
-        $required_text = '',
1190
-        $label_class = '',
1191
-        $disabled = false,
1192
-        $system_ID = false,
1193
-        $use_html_entities = true,
1194
-        $add_please_select_option = false,
1195
-        $add_mobile_label = false
1196
-    ) {
1197
-
1198
-        // need these
1199
-        if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1200
-            return null;
1201
-        }
1202
-        // prep the answer
1203
-        $answer = is_array($answer)
1204
-            ? self::prep_answer(array_shift($answer), $use_html_entities)
1205
-            : self::prep_answer($answer, $use_html_entities);
1206
-        // prep the required array
1207
-        $required = self::prep_required($required);
1208
-        // set disabled tag
1209
-        $disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1210
-        // ya gots ta have style man!!!
1211
-        $class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1212
-        $class = self::appendInputSizeClass($class, $options);
1213
-        $extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1214
-
1215
-        $label_html   = self::label($question, $required_text, $required['label'], $name, $label_class);
1216
-        $mobile_label = self::mobileLabel(
1217
-            $add_mobile_label,
1218
-            $question,
1219
-            $required_text,
1220
-            $required['label'],
1221
-            $label_class,
1222
-            $name
1223
-        );
1224
-
1225
-        $input_html = $mobile_label
1226
-            . '<select name="' . $name . '" id="' . $id . '" class="' . trim($class) . ' ' . $required['class'] . '" '
1227
-            . 'aria-label="' . esc_attr($required['msg']) . '"' . $disabled . ' ' . $extra . '>';
1228
-        // recursively count array elements, to determine total number of options
1229
-        $only_option = count($options, 1) == 1;
1230
-        if (! $only_option) {
1231
-            // if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
1232
-            $selected   = $answer === null ? ' selected' : '';
1233
-            $input_html .= $add_please_select_option
1234
-                ? "\n\t\t\t\t"
1235
-                  . '<option value=""' . $selected . '>'
1236
-                  . esc_html__(' - please select - ', 'event_espresso')
1237
-                  . '</option>'
1238
-                : '';
1239
-        }
1240
-        foreach ($options as $key => $value) {
1241
-            // if value is an array, then create option groups, else create regular ol' options
1242
-            $input_html .= is_array($value)
1243
-                ? self::_generate_select_option_group(
1244
-                    $key,
1245
-                    $value,
1246
-                    $answer,
1247
-                    $use_html_entities
1248
-                )
1249
-                : self::_generate_select_option(
1250
-                    $value->value(),
1251
-                    $value->desc(),
1252
-                    $answer,
1253
-                    $only_option,
1254
-                    $use_html_entities
1255
-                );
1256
-        }
1257
-
1258
-        $input_html .= "\n\t\t\t" . '</select>';
1259
-
1260
-        $input_html =
1261
-            apply_filters(
1262
-                'FHEE__EEH_Form_Fields__select__before_end_wrapper',
1263
-                $input_html,
1264
-                $question,
1265
-                $answer,
1266
-                $name,
1267
-                $id,
1268
-                $class,
1269
-                $system_ID
1270
-            );
1271
-
1272
-        $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1273
-        return $label_html . $input_html;
1274
-    }
1275
-
1276
-
1277
-    /**
1278
-     *  _generate_select_option_group
1279
-     *
1280
-     *  if  $value for a select box is an array, then the key will be used as the optgroup label
1281
-     *  and the value array will be looped thru and the elements sent to _generate_select_option
1282
-     *
1283
-     * @param mixed   $opt_group
1284
-     * @param mixed   $QSOs
1285
-     * @param mixed   $answer
1286
-     * @param boolean $use_html_entities
1287
-     * @return string
1288
-     */
1289
-    private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true)
1290
-    {
1291
-        $html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value($opt_group) . '">';
1292
-        foreach ($QSOs as $QSO) {
1293
-            $html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities);
1294
-        }
1295
-        $html .= "\n\t\t\t\t" . '</optgroup>';
1296
-        return $html;
1297
-    }
1298
-
1299
-
1300
-    /**
1301
-     *  _generate_select_option
1302
-     *
1303
-     * @param mixed   $key
1304
-     * @param mixed   $value
1305
-     * @param mixed   $answer
1306
-     * @param int     $only_option
1307
-     * @param boolean $use_html_entities
1308
-     * @return string
1309
-     */
1310
-    private static function _generate_select_option(
1311
-        $key,
1312
-        $value,
1313
-        $answer,
1314
-        $only_option = false,
1315
-        $use_html_entities = true
1316
-    ) {
1317
-        $key      = self::prep_answer($key, $use_html_entities);
1318
-        $value    = self::prep_answer($value, $use_html_entities);
1319
-        $value    = ! empty($value) ? $value : $key;
1320
-        $selected = ($answer == $key || $only_option) ? 'selected' : '';
1321
-        return "\n\t\t\t\t"
1322
-               . '<option value="' . self::prep_option_value($key) . '" ' . $selected . '> '
1323
-               . $value
1324
-               . '&nbsp;&nbsp;&nbsp;</option>';
1325
-    }
1326
-
1327
-
1328
-    /**
1329
-     * generates HTML for form radio button inputs
1330
-     *
1331
-     * @param string      $question    label content
1332
-     * @param string|int  $answer      form input value attribute
1333
-     * @param array|bool  $options     array of answer options where array key = option value and array value = option
1334
-     *                                 display text
1335
-     * @param string $name        form input name attribute
1336
-     * @param string      $id          form input css id attribute
1337
-     * @param string      $class       form input css class attribute
1338
-     * @param array|bool  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1339
-     *                                 required 'class', and required 'msg' attribute
1340
-     * @param string      $required_text
1341
-     * @param string      $label_class css class attribute for the label
1342
-     * @param bool|string $disabled    disabled="disabled" or null
1343
-     * @param string      $system_ID
1344
-     * @param bool        $use_html_entities
1345
-     * @param bool        $label_b4
1346
-     * @param bool        $use_desc_4_label
1347
-     * @return string HTML
1348
-     */
1349
-    public static function radio(
1350
-        string $question = '',
1351
-        $answer = null,
1352
-        $options = false,
1353
-        string $name = '',
1354
-        string $id = '',
1355
-        string $class = '',
1356
-        $required = false,
1357
-        string $required_text = '',
1358
-        string $label_class = '',
1359
-        bool $disabled = false,
1360
-        string $system_ID = '',
1361
-        bool $use_html_entities = true,
1362
-        bool $label_b4 = false,
1363
-        bool $use_desc_4_label = false,
1364
-        bool $add_mobile_label = false
1365
-    ) {
1366
-        // need these
1367
-        if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1368
-            return null;
1369
-        }
1370
-        // prep the answer
1371
-        $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1372
-        // prep the required array
1373
-        $required = self::prep_required($required);
1374
-        // set disabled tag
1375
-        $disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1376
-        // ya gots ta have style man!!!
1377
-        $radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
1378
-        $class       = ! empty($class) ? $class : 'espresso-radio-btn-inp';
1379
-        $extra       = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1380
-
1381
-        $label_html = self::label($question, $required_text, $required['label'], '', $label_class);
1382
-        $mobile_label = self::mobileLabel(
1383
-            $add_mobile_label,
1384
-            $question,
1385
-            $required_text,
1386
-            $required['label'],
1387
-            $label_class
1388
-        );
1389
-
1390
-        $input_html = $mobile_label
1391
-            . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $class . '-ul">';
1392
-
1393
-        $class .= ! empty($system_ID) ? ' ' . $system_ID : '';
1394
-        $class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1395
-
1396
-        foreach ($options as $OPT) {
1397
-            if ($OPT instanceof EE_Question_Option) {
1398
-                $value   = self::prep_option_value($OPT->value());
1399
-                $label   = $use_desc_4_label ? $OPT->desc() : $OPT->value();
1400
-                $size    = $use_desc_4_label
1401
-                    ? self::get_label_size_class($OPT->value() . ' ' . $OPT->desc())
1402
-                    : self::get_label_size_class($OPT->value());
1403
-                $desc    = $OPT->desc();// no self::prep_answer
1404
-                $answer  = is_numeric($value) && empty($answer) ? 0 : $answer;
1405
-                $value  = is_numeric($answer) && empty($value) ? 0 : $value;
1406
-                $checked = (string) $value == (string) $answer ? ' checked' : '';
1407
-                $opt     = '-' . sanitize_key($value);
1408
-
1409
-                $input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
1410
-                $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
1411
-                $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>&nbsp;' : '';
1412
-                $input_html .= "\n\t\t\t\t\t\t"
1413
-                               . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" '
1414
-                               . 'class="' . $class . '" value="' . $value . '" '
1415
-                               . 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled
1416
-                               . $checked . ' ' . $extra . '/>';
1417
-                $input_html .= ! $label_b4
1418
-                    ? "\n\t\t\t\t\t\t"
1419
-                      . '&nbsp;<span class="espresso-radio-btn-desc">'
1420
-                      . $label
1421
-                      . '</span>'
1422
-                    : '';
1423
-                $input_html .= "\n\t\t\t\t\t" . '</label>';
1424
-                $input_html .= $use_desc_4_label
1425
-                    ? ''
1426
-                    : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
1427
-                $input_html .= "\n\t\t\t\t" . '</li>';
1428
-            }
1429
-        }
1430
-
1431
-        $input_html .= "\n\t\t\t" . '</ul>';
1432
-
1433
-        $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1434
-        return $label_html . $input_html;
1435
-    }
1436
-
1437
-
1438
-    /**
1439
-     * generates HTML for form checkbox inputs
1440
-     *
1441
-     * @param string $question    label content
1442
-     * @param string $answer      form input value attribute
1443
-     * @param array  $options     array of options where array key = option value and array value = option display text
1444
-     * @param string $name        form input name attribute
1445
-     * @param string $id          form input css id attribute
1446
-     * @param string $class       form input css class attribute
1447
-     * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1448
-     *                            required 'class', and required 'msg' attribute
1449
-     * @param string $label_class css class attribute for the label
1450
-     * @param string $disabled    disabled="disabled" or null
1451
-     * @return string HTML
1452
-     */
1453
-    public static function checkbox(
1454
-        $question = false,
1455
-        $answer = null,
1456
-        $options = false,
1457
-        $name = false,
1458
-        $id = '',
1459
-        $class = '',
1460
-        $required = false,
1461
-        $required_text = '',
1462
-        $label_class = '',
1463
-        $disabled = false,
1464
-        $label_b4 = false,
1465
-        $system_ID = false,
1466
-        $use_html_entities = true,
1467
-        $add_mobile_label = false
1468
-    ) {
1469
-        // need these
1470
-        if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1471
-            return null;
1472
-        }
1473
-        $answer = maybe_unserialize($answer);
1474
-
1475
-        // prep the answer(s)
1476
-        $answer = is_array($answer) ? $answer : [sanitize_key($answer) => $answer];
1477
-
1478
-        foreach ($answer as $key => $value) {
1479
-            $key            = self::prep_option_value($key);
1480
-            $answer[ $key ] = self::prep_answer($value, $use_html_entities);
1481
-        }
1482
-
1483
-        // prep the required array
1484
-        $required = self::prep_required($required);
1485
-        // set disabled tag
1486
-        $disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1487
-        // ya gots ta have style man!!!
1488
-        $radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
1489
-        $class       = empty($class) ? 'espresso-radio-btn-inp' : $class;
1490
-        $extra       = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1491
-
1492
-        $label_html   = self::label($question, $required_text, $required['label'], '', $label_class);
1493
-        $mobile_label = self::mobileLabel(
1494
-            $add_mobile_label,
1495
-            $question,
1496
-            $required_text,
1497
-            $required['label'],
1498
-            $label_class
1499
-        );
1500
-
1501
-        $input_html = $mobile_label
1502
-            . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $class . '-ul">';
1503
-
1504
-        $class .= ! empty($system_ID) ? ' ' . $system_ID : '';
1505
-        $class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1506
-
1507
-        foreach ($options as $OPT) {
1508
-            $value = $OPT->value();// self::prep_option_value( $OPT->value() );
1509
-            $size  = self::get_label_size_class($OPT->value() . ' ' . $OPT->desc());
1510
-            $text  = self::prep_answer($OPT->value());
1511
-            $desc  = $OPT->desc();
1512
-            $opt   = '-' . sanitize_key($value);
1513
-
1514
-            $checked = is_array($answer) && in_array($text, $answer) ? ' checked' : '';
1515
-
1516
-            $input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
1517
-            $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
1518
-            $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>&nbsp;' : '';
1519
-            $input_html .= "\n\t\t\t\t\t\t"
1520
-                           . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" '
1521
-                           . 'id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" '
1522
-                           . 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
1523
-            $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '&nbsp;<span>' . $text . '</span>' : '';
1524
-            $input_html .= "\n\t\t\t\t\t" . '</label>';
1525
-            if (! empty($desc) && $desc != $text) {
1526
-                $input_html .= "\n\t\t\t\t\t"
1527
-                               . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'
1528
-                               . $desc
1529
-                               . '</div>';
1530
-            }
1531
-            $input_html .= "\n\t\t\t\t" . '</li>';
1532
-        }
1533
-
1534
-        $input_html .= "\n\t\t\t" . '</ul>';
1535
-
1536
-        $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1537
-        return $label_html . $input_html;
1538
-    }
1539
-
1540
-
1541
-    /**
1542
-     * generates HTML for a form datepicker input
1543
-     *
1544
-     * @param string $question    label content
1545
-     * @param string $answer      form input value attribute
1546
-     * @param string $name        form input name attribute
1547
-     * @param string $id          form input css id attribute
1548
-     * @param string $class       form input css class attribute
1549
-     * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1550
-     *                            required 'class', and required 'msg' attribute
1551
-     * @param string $label_class css class attribute for the label
1552
-     * @param string $disabled    disabled="disabled" or null
1553
-     * @return string HTML
1554
-     */
1555
-    public static function datepicker(
1556
-        $question = false,
1557
-        $answer = null,
1558
-        $name = false,
1559
-        $id = '',
1560
-        $class = '',
1561
-        $required = false,
1562
-        $required_text = '',
1563
-        $label_class = '',
1564
-        $disabled = false,
1565
-        $system_ID = false,
1566
-        $use_html_entities = true,
1567
-        $add_mobile_label = false
1568
-    ) {
1569
-        // need these
1570
-        if (! $question || ! $name) {
1571
-            return null;
1572
-        }
1573
-        // prep the answer
1574
-        $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1575
-        // prep the required array
1576
-        $required = self::prep_required($required);
1577
-        // set disabled tag
1578
-        $disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1579
-        // ya gots ta have style man!!!
1580
-        $txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1581
-        $class     = empty($class) ? $txt_class : $class;
1582
-        $class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1583
-        $class = self::appendInputSizeClass($class, $answer);
1584
-        $extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1585
-
1586
-        $label_html   = self::label($question, $required_text, $required['label'], '', $label_class);
1587
-        $mobile_label = self::mobileLabel(
1588
-            $add_mobile_label,
1589
-            $question,
1590
-            $required_text,
1591
-            $required['label'],
1592
-            $label_class,
1593
-            $name
1594
-        );
1595
-
1596
-        $input_html = $mobile_label
1597
-            . '<input type="text" name="' . $name . '" id="' . $id . '" '
1598
-            . 'class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  '
1599
-            . 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled . ' ' . $extra . '/>';
1600
-
1601
-        // enqueue scripts
1602
-        wp_register_style(
1603
-            'espresso-ui-theme',
1604
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1605
-            [],
1606
-            EVENT_ESPRESSO_VERSION
1607
-        );
1608
-        wp_enqueue_style('espresso-ui-theme');
1609
-        wp_enqueue_script('jquery-ui-datepicker');
1610
-
1611
-        $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1612
-        return $label_html . $input_html;
1613
-    }
1614
-
1615
-
1616
-    /**
1617
-     *  remove_label_keep_required_msg
1618
-     *  this will strip out a form input's label HTML while keeping the required text HTML that MUST be before the label
1619
-     *
1620
-     * @access public
1621
-     * @return     string
1622
-     */
1623
-    public static function remove_label_keep_required_msg($label_html, $required_text)
1624
-    {
1625
-        return $required_text;
1626
-    }
1627
-
1628
-
1629
-    /**
1630
-     * Simply returns the HTML for a hidden input of the given name and value.
1631
-     *
1632
-     * @param string $name
1633
-     * @param string $value
1634
-     * @return string HTML
1635
-     */
1636
-    public static function hidden_input($name, $value, $id = '')
1637
-    {
1638
-        $id = ! empty($id) ? $id : $name;
1639
-        return '<input id="' . $id . '" type="hidden" name="' . $name . '" value="' . $value . '"/>';
1640
-    }
1641
-
1642
-
1643
-    /**
1644
-     * prep_question
1645
-     *
1646
-     * @param string $question
1647
-     * @return string
1648
-     */
1649
-    public static function prep_question($question)
1650
-    {
1651
-        return $question;
1652
-    }
1653
-
1654
-
1655
-    /**
1656
-     *  prep_answer
1657
-     *
1658
-     * @param mixed $answer
1659
-     * @return string
1660
-     */
1661
-    public static function prep_answer($answer, $use_html_entities = true)
1662
-    {
1663
-        // make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired,
1664
-        // we want "0".
1665
-        if (is_bool($answer)) {
1666
-            $answer = $answer ? 1 : 0;
1667
-        }
1668
-        $answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1669
-        return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1670
-    }
1671
-
1672
-
1673
-    /**
1674
-     *  prep_answer_options
1675
-     *
1676
-     * @param array $QSOs array of EE_Question_Option objects
1677
-     * @return array
1678
-     */
1679
-    public static function prep_answer_options($QSOs = [])
1680
-    {
1681
-        $prepped_answer_options = [];
1682
-        if (is_array($QSOs) && ! empty($QSOs)) {
1683
-            foreach ($QSOs as $key => $QSO) {
1684
-                if (! $QSO instanceof EE_Question_Option) {
1685
-                    $QSO = EE_Question_Option::new_instance(
1686
-                        [
1687
-                            'QSO_value' => is_array($QSO) && isset($QSO['id'])
1688
-                                ? (string) $QSO['id']
1689
-                                : (string) $key,
1690
-                            'QSO_desc'  => is_array($QSO) && isset($QSO['text'])
1691
-                                ? (string) $QSO['text']
1692
-                                : (string) $QSO,
1693
-                        ]
1694
-                    );
1695
-                }
1696
-                if ($QSO->opt_group()) {
1697
-                    $prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1698
-                } else {
1699
-                    $prepped_answer_options[] = $QSO;
1700
-                }
1701
-            }
1702
-        }
1703
-        //      d( $prepped_answer_options );
1704
-        return $prepped_answer_options;
1705
-    }
1706
-
1707
-
1708
-    /**
1709
-     *  prep_option_value
1710
-     *
1711
-     * @param string|int $option_value
1712
-     * @return string
1713
-     */
1714
-    public static function prep_option_value($option_value)
1715
-    {
1716
-        return esc_attr(trim(stripslashes($option_value)));
1717
-    }
1718
-
1719
-
1720
-    /**
1721
-     *  prep_required
1722
-     *
1723
-     * @param string|array $required
1724
-     * @return array
1725
-     */
1726
-    public static function prep_required($required = [])
1727
-    {
1728
-        // make sure required is an array
1729
-        $required = is_array($required) ? $required : [];
1730
-        // and set some defaults
1731
-        return array_merge(['label' => '', 'class' => '', 'msg' => ''], $required);
1732
-    }
1733
-
1734
-
1735
-    /**
1736
-     *  get_label_size_class
1737
-     *
1738
-     * @param string $value
1739
-     * @return string
1740
-     */
1741
-    public static function get_label_size_class($value = false)
1742
-    {
1743
-        if ($value === false || $value === '') {
1744
-            return ' class="medium-lbl"';
1745
-        }
1746
-        // determine length of option value
1747
-        $val_size = strlen($value);
1748
-        switch ($val_size) {
1749
-            case $val_size < 3:
1750
-                $size = ' class="nano-lbl"';
1751
-                break;
1752
-            case $val_size < 6:
1753
-                $size = ' class="micro-lbl"';
1754
-                break;
1755
-            case $val_size < 12:
1756
-                $size = ' class="tiny-lbl"';
1757
-                break;
1758
-            case $val_size < 25:
1759
-                $size = ' class="small-lbl"';
1760
-                break;
1761
-            case $val_size > 100:
1762
-                $size = ' class="big-lbl"';
1763
-                break;
1764
-            default:
1765
-                $size = ' class="medium-lbl"';
1766
-                break;
1767
-        }
1768
-        return $size;
1769
-    }
1770
-
1771
-
1772
-    /**
1773
-     *  _load_system_dropdowns
1774
-     *
1775
-     * @param EE_Question_Form_Input $QFI
1776
-     * @return array
1777
-     * @throws EE_Error
1778
-     * @throws ReflectionException
1779
-     */
1780
-    private static function _load_system_dropdowns($QFI)
1781
-    {
1782
-        $QST_system = $QFI->get('QST_system');
1783
-        switch ($QST_system) {
1784
-            case 'state':
1785
-                $QFI = self::generate_state_dropdown($QFI);
1786
-                break;
1787
-            case 'country':
1788
-                $QFI = self::generate_country_dropdown($QFI);
1789
-                break;
1790
-            case 'admin-state':
1791
-                $QFI = self::generate_state_dropdown($QFI, true);
1792
-                break;
1793
-            case 'admin-country':
1794
-                $QFI = self::generate_country_dropdown($QFI, true);
1795
-                break;
1796
-        }
1797
-        return $QFI;
1798
-    }
1799
-
1800
-
1801
-    /**
1802
-     * This preps dropdowns that are specialized.
1803
-     *
1804
-     * @param EE_Question_Form_Input $QFI
1805
-     *
1806
-     * @return EE_Question_Form_Input
1807
-     * @throws EE_Error
1808
-     * @throws ReflectionException
1809
-     * @since  4.6.0
1810
-     */
1811
-    protected static function _load_specialized_dropdowns($QFI)
1812
-    {
1813
-        switch ($QFI->get('QST_type')) {
1814
-            case 'STATE':
1815
-                $QFI = self::generate_state_dropdown($QFI);
1816
-                break;
1817
-            case 'COUNTRY':
1818
-                $QFI = self::generate_country_dropdown($QFI);
1819
-                break;
1820
-        }
1821
-        return $QFI;
1822
-    }
1823
-
1824
-
1825
-    /**
1826
-     *    generate_state_dropdown
1827
-     *
1828
-     * @param EE_Question_Form_Input $QST
1829
-     * @param bool                   $get_all
1830
-     * @return EE_Question_Form_Input
1831
-     * @throws EE_Error
1832
-     * @throws ReflectionException
1833
-     */
1834
-    public static function generate_state_dropdown($QST, $get_all = false)
1835
-    {
1836
-        $states = $get_all
1837
-            ? EEM_State::instance()->get_all_states()
1838
-            : EEM_State::instance()->get_all_states_of_active_countries();
1839
-        if ($states && count($states) != count($QST->options())) {
1840
-            $QST->set('QST_type', 'DROPDOWN');
1841
-            // if multiple countries, we'll create option groups within the dropdown
1842
-            foreach ($states as $state) {
1843
-                if ($state instanceof EE_State) {
1844
-                    $QSO = EE_Question_Option::new_instance(
1845
-                        [
1846
-                            'QSO_value'   => $state->ID(),
1847
-                            'QSO_desc'    => $state->name(),
1848
-                            'QST_ID'      => $QST->get('QST_ID'),
1849
-                            'QSO_deleted' => false,
1850
-                        ]
1851
-                    );
1852
-                    // set option group
1853
-                    $QSO->set_opt_group($state->country()->name());
1854
-                    // add option to question
1855
-                    $QST->add_temp_option($QSO);
1856
-                }
1857
-            }
1858
-        }
1859
-        return $QST;
1860
-    }
1861
-
1862
-
1863
-    /**
1864
-     *    generate_country_dropdown
1865
-     *
1866
-     * @param      $QST
1867
-     * @param bool $get_all
1868
-     * @return array
1869
-     * @throws EE_Error
1870
-     * @throws ReflectionException
1871
-     * @internal param array $question
1872
-     */
1873
-    public static function generate_country_dropdown($QST, $get_all = false)
1874
-    {
1875
-        $countries = $get_all
1876
-            ? EEM_Country::instance()->get_all_countries()
1877
-            : EEM_Country::instance()->get_all_active_countries();
1878
-        if ($countries && count($countries) != count($QST->options())) {
1879
-            $QST->set('QST_type', 'DROPDOWN');
1880
-            // now add countries
1881
-            foreach ($countries as $country) {
1882
-                if ($country instanceof EE_Country) {
1883
-                    $QSO = EE_Question_Option::new_instance(
1884
-                        [
1885
-                            'QSO_value'   => $country->ID(),
1886
-                            'QSO_desc'    => $country->name(),
1887
-                            'QST_ID'      => $QST->get('QST_ID'),
1888
-                            'QSO_deleted' => false,
1889
-                        ]
1890
-                    );
1891
-                    $QST->add_temp_option($QSO);
1892
-                }
1893
-            }
1894
-        }
1895
-        return $QST;
1896
-    }
1897
-
1898
-
1899
-    /**
1900
-     *  generates options for a month dropdown selector with numbers from 01 to 12
1901
-     *
1902
-     * @return array()
1903
-     */
1904
-    public static function two_digit_months_dropdown_options()
1905
-    {
1906
-        $options = [];
1907
-        for ($x = 1; $x <= 12; $x++) {
1908
-            $mm             = str_pad($x, 2, '0', STR_PAD_LEFT);
1909
-            $options[ $mm ] = $mm;
1910
-        }
1911
-        return EEH_Form_Fields::prep_answer_options($options);
1912
-    }
1913
-
1914
-
1915
-    /**
1916
-     *  generates a year dropdown selector with numbers for the next ten years
1917
-     *
1918
-     * @return array
1919
-     */
1920
-    public static function next_decade_two_digit_year_dropdown_options()
1921
-    {
1922
-        $options      = [];
1923
-        $current_year = date('y');
1924
-        $next_decade  = $current_year + 10;
1925
-        for ($x = $current_year; $x <= $next_decade; $x++) {
1926
-            $yy             = str_pad($x, 2, '0', STR_PAD_LEFT);
1927
-            $options[ $yy ] = $yy;
1928
-        }
1929
-        return EEH_Form_Fields::prep_answer_options($options);
1930
-    }
1931
-
1932
-
1933
-    /**
1934
-     * generates a month/year dropdown selector for all registrations matching the given criteria.  Typically used for
1935
-     * list table filter.
1936
-     *
1937
-     * @param string  $cur_date     any currently selected date can be entered here.
1938
-     * @param string  $status       Registration status
1939
-     * @param integer $evt_category Event Category ID if the Event Category filter is selected
1940
-     * @return string                html
1941
-     * @throws EE_Error
1942
-     */
1943
-    public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0)
1944
-    {
1945
-        $_where = [];
1946
-        if (! empty($status)) {
1947
-            $_where['STS_ID'] = $status;
1948
-        }
1949
-
1950
-        if ($evt_category > 0) {
1951
-            $_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1952
-        }
1953
-
1954
-        $regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1955
-
1956
-        // setup vals for select input helper
1957
-        $options = [
1958
-            0 => [
1959
-                'text' => esc_html__('Select a Month/Year', 'event_espresso'),
1960
-                'id'   => '',
1961
-            ],
1962
-        ];
1963
-
1964
-        foreach ($regdtts as $regdtt) {
1965
-            $date      = $regdtt->reg_month . ' ' . $regdtt->reg_year;
1966
-            $options[] = [
1967
-                'text' => $date,
1968
-                'id'   => $date,
1969
-            ];
1970
-        }
1971
-
1972
-        return self::select_input('month_range', $options, $cur_date);
1973
-    }
1974
-
1975
-
1976
-    /**
1977
-     * generates a month/year dropdown selector for all events matching the given criteria
1978
-     * Typically used for list table filter
1979
-     *
1980
-     * @param string $cur_date          any currently selected date can be entered here.
1981
-     * @param string $status            "view" (i.e. all, today, month, draft)
1982
-     * @param int    $evt_category      category event belongs to
1983
-     * @param string $evt_active_status "upcoming", "expired", "active", or "inactive"
1984
-     * @return string                    html
1985
-     * @throws EE_Error
1986
-     */
1987
-    public static function generate_event_months_dropdown(
1988
-        $cur_date = '',
1989
-        $status = null,
1990
-        $evt_category = null,
1991
-        $evt_active_status = null
1992
-    ) {
1993
-        // determine what post_status our condition will have for the query.
1994
-        // phpcs:disable PSR2.ControlStructures.SwitchDeclaration.TerminatingComment
1995
-        switch ($status) {
1996
-            case 'month':
1997
-            case 'today':
1998
-            case null:
1999
-            case 'all':
2000
-                $where['Event.status'] = ['NOT IN', ['trash']];
2001
-                break;
2002
-            case 'draft':
2003
-                $where['Event.status'] = ['IN', ['draft', 'auto-draft']];
2004
-                break;
2005
-            default:
2006
-                $where['Event.status'] = $status;
2007
-        }
2008
-
2009
-        // phpcs:enable
2010
-
2011
-        // categories?
2012
-
2013
-
2014
-        if (! empty($evt_category) and $evt_category > 0) {
2015
-            $where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
2016
-            $where['Event.Term_Taxonomy.term_id']  = $evt_category;
2017
-        }
2018
-
2019
-
2020
-        //      $where['DTT_is_primary'] = 1;
2021
-
2022
-        $DTTS = EEM_Datetime::instance()->get_dtt_months_and_years($where, $evt_active_status);
2023
-
2024
-        // let's setup vals for select input helper
2025
-        $options = [
2026
-            0 => [
2027
-                'text' => esc_html__('Select a Month/Year', 'event_espresso'),
2028
-                'id'   => "",
2029
-            ],
2030
-        ];
2031
-
2032
-
2033
-        // translate month and date
2034
-        global $wp_locale;
2035
-
2036
-        foreach ($DTTS as $DTT) {
2037
-            $localized_date = $wp_locale->get_month($DTT->dtt_month_num) . ' ' . $DTT->dtt_year;
2038
-            $id             = $DTT->dtt_month . ' ' . $DTT->dtt_year;
2039
-            $options[]      = [
2040
-                'text' => $localized_date,
2041
-                'id'   => $id,
2042
-            ];
2043
-        }
2044
-
2045
-
2046
-        return self::select_input('month_range', $options, $cur_date);
2047
-    }
2048
-
2049
-
2050
-    /**
2051
-     * generates the dropdown selector for event categories
2052
-     * typically used as a filter on list tables.
2053
-     *
2054
-     * @param integer $current_cat currently selected category
2055
-     * @return string               html for dropdown
2056
-     * @throws EE_Error
2057
-     * @throws ReflectionException
2058
-     */
2059
-    public static function generate_event_category_dropdown($current_cat = -1)
2060
-    {
2061
-        $categories = EEM_Term::instance()->get_all_ee_categories(true);
2062
-        $options    = [
2063
-            '0' => [
2064
-                'text' => esc_html__('All Categories', 'event_espresso'),
2065
-                'id'   => -1,
2066
-            ],
2067
-        ];
2068
-
2069
-        // setup categories for dropdown
2070
-        foreach ($categories as $category) {
2071
-            $options[] = [
2072
-                'text' => $category->get('name'),
2073
-                'id'   => $category->ID(),
2074
-            ];
2075
-        }
2076
-
2077
-        return self::select_input('EVT_CAT', $options, $current_cat);
2078
-    }
2079
-
2080
-
2081
-    /**
2082
-     *    generate a submit button with or without it's own microform
2083
-     *    this is the only way to create buttons that are compatible across all themes
2084
-     *
2085
-     * @access    public
2086
-     * @param string      $url              - the form action
2087
-     * @param string      $ID               - some kind of unique ID, appended with "-sbmt" for the input and "-frm"
2088
-     *                                      for the form
2089
-     * @param string      $class            - css classes (separated by spaces if more than one)
2090
-     * @param string      $text             - what appears on the button
2091
-     * @param string      $nonce_action     - if using nonces
2092
-     * @param bool|string $input_only       - whether to print form header and footer. TRUE returns the input without
2093
-     *                                      the form
2094
-     * @param string      $extra_attributes - any extra attributes that need to be attached to the form input
2095
-     * @return    string
2096
-     */
2097
-    public static function submit_button(
2098
-        $url = '',
2099
-        $ID = '',
2100
-        $class = '',
2101
-        $text = '',
2102
-        $nonce_action = '',
2103
-        $input_only = false,
2104
-        $extra_attributes = ''
2105
-    ) {
2106
-        $btn = '';
2107
-        if (empty($url) || empty($ID)) {
2108
-            return $btn;
2109
-        }
2110
-        $text = ! empty($text) ? $text : esc_html__('Submit', 'event_espresso');
2111
-        $btn  .= '<input id="' . $ID . '-btn" class="' . $class . '" '
2112
-                 . 'type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
2113
-        if (! $input_only) {
2114
-            $btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
2115
-            $btn_frm .= ! empty($nonce_action)
2116
-                ? wp_nonce_field($nonce_action, $nonce_action . '_nonce', true, false)
2117
-                : '';
2118
-            $btn_frm .= $btn;
2119
-            $btn_frm .= '</form>';
2120
-            $btn     = $btn_frm;
2121
-            unset($btn_frm);
2122
-        }
2123
-        return $btn;
2124
-    }
1089
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1090
+		return $label_html . $input_html;
1091
+	}
1092
+
1093
+
1094
+	/**
1095
+	 * generates HTML for a form textarea
1096
+	 *
1097
+	 * @param string $question    label content
1098
+	 * @param string $answer      form input value attribute
1099
+	 * @param string $name        form input name attribute
1100
+	 * @param string $id          form input css id attribute
1101
+	 * @param string $class       form input css class attribute
1102
+	 * @param array  $dimensions  array of form input rows and cols attributes : array( 'rows' => 3, 'cols' => 40 )
1103
+	 * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1104
+	 *                            required 'class', and required 'msg' attribute
1105
+	 * @param string $label_class css class attribute for the label
1106
+	 * @param string $disabled    disabled="disabled" or null
1107
+	 * @return string HTML
1108
+	 */
1109
+	public static function textarea(
1110
+		$question = false,
1111
+		$answer = null,
1112
+		$name = false,
1113
+		$id = '',
1114
+		$class = '',
1115
+		$dimensions = false,
1116
+		$required = false,
1117
+		$required_text = '',
1118
+		$label_class = '',
1119
+		$disabled = false,
1120
+		$system_ID = false,
1121
+		$use_html_entities = true,
1122
+		$add_mobile_label = false
1123
+	) {
1124
+		// need these
1125
+		if (! $question || ! $name) {
1126
+			return null;
1127
+		}
1128
+		// prep the answer
1129
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1130
+		// prep the required array
1131
+		$required = self::prep_required($required);
1132
+		// make sure $dimensions is an array
1133
+		$dimensions = is_array($dimensions) ? $dimensions : [];
1134
+		// and set some defaults
1135
+		$dimensions = array_merge(['rows' => 3, 'cols' => 40], $dimensions);
1136
+		// set disabled tag
1137
+		$disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1138
+		// ya gots ta have style man!!!
1139
+		$class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1140
+		$class     .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1141
+		$extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1142
+
1143
+		$label_html   = self::label($question, $required_text, $required['label'], $name, $label_class);
1144
+		$mobile_label = self::mobileLabel(
1145
+			$add_mobile_label,
1146
+			$question,
1147
+			$required_text,
1148
+			$required['label'],
1149
+			$label_class,
1150
+			$name
1151
+		);
1152
+
1153
+		$input_html = $mobile_label
1154
+			. '<textarea name="' . $name . '" id="' . $id . '" class="' . trim($class) . '" '
1155
+			. 'rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  '
1156
+			. 'aria-label="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>'
1157
+			 . esc_textarea($answer)
1158
+			  . '</textarea>';
1159
+
1160
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1161
+		return $label_html . $input_html;
1162
+	}
1163
+
1164
+
1165
+	/**
1166
+	 * generates HTML for a form select input
1167
+	 *
1168
+	 * @param string $question    label content
1169
+	 * @param string $answer      form input value attribute
1170
+	 * @param array  $options     array of answer options where array key = option value and array value = option
1171
+	 *                            display text
1172
+	 * @param string $name        form input name attribute
1173
+	 * @param string $id          form input css id attribute
1174
+	 * @param string $class       form input css class attribute
1175
+	 * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1176
+	 *                            required 'class', and required 'msg' attribute
1177
+	 * @param string $label_class css class attribute for the label
1178
+	 * @param string $disabled    disabled="disabled" or null
1179
+	 * @return string HTML
1180
+	 */
1181
+	public static function select(
1182
+		$question = false,
1183
+		$answer = null,
1184
+		$options = false,
1185
+		$name = false,
1186
+		$id = '',
1187
+		$class = '',
1188
+		$required = false,
1189
+		$required_text = '',
1190
+		$label_class = '',
1191
+		$disabled = false,
1192
+		$system_ID = false,
1193
+		$use_html_entities = true,
1194
+		$add_please_select_option = false,
1195
+		$add_mobile_label = false
1196
+	) {
1197
+
1198
+		// need these
1199
+		if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1200
+			return null;
1201
+		}
1202
+		// prep the answer
1203
+		$answer = is_array($answer)
1204
+			? self::prep_answer(array_shift($answer), $use_html_entities)
1205
+			: self::prep_answer($answer, $use_html_entities);
1206
+		// prep the required array
1207
+		$required = self::prep_required($required);
1208
+		// set disabled tag
1209
+		$disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1210
+		// ya gots ta have style man!!!
1211
+		$class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1212
+		$class = self::appendInputSizeClass($class, $options);
1213
+		$extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1214
+
1215
+		$label_html   = self::label($question, $required_text, $required['label'], $name, $label_class);
1216
+		$mobile_label = self::mobileLabel(
1217
+			$add_mobile_label,
1218
+			$question,
1219
+			$required_text,
1220
+			$required['label'],
1221
+			$label_class,
1222
+			$name
1223
+		);
1224
+
1225
+		$input_html = $mobile_label
1226
+			. '<select name="' . $name . '" id="' . $id . '" class="' . trim($class) . ' ' . $required['class'] . '" '
1227
+			. 'aria-label="' . esc_attr($required['msg']) . '"' . $disabled . ' ' . $extra . '>';
1228
+		// recursively count array elements, to determine total number of options
1229
+		$only_option = count($options, 1) == 1;
1230
+		if (! $only_option) {
1231
+			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
1232
+			$selected   = $answer === null ? ' selected' : '';
1233
+			$input_html .= $add_please_select_option
1234
+				? "\n\t\t\t\t"
1235
+				  . '<option value=""' . $selected . '>'
1236
+				  . esc_html__(' - please select - ', 'event_espresso')
1237
+				  . '</option>'
1238
+				: '';
1239
+		}
1240
+		foreach ($options as $key => $value) {
1241
+			// if value is an array, then create option groups, else create regular ol' options
1242
+			$input_html .= is_array($value)
1243
+				? self::_generate_select_option_group(
1244
+					$key,
1245
+					$value,
1246
+					$answer,
1247
+					$use_html_entities
1248
+				)
1249
+				: self::_generate_select_option(
1250
+					$value->value(),
1251
+					$value->desc(),
1252
+					$answer,
1253
+					$only_option,
1254
+					$use_html_entities
1255
+				);
1256
+		}
1257
+
1258
+		$input_html .= "\n\t\t\t" . '</select>';
1259
+
1260
+		$input_html =
1261
+			apply_filters(
1262
+				'FHEE__EEH_Form_Fields__select__before_end_wrapper',
1263
+				$input_html,
1264
+				$question,
1265
+				$answer,
1266
+				$name,
1267
+				$id,
1268
+				$class,
1269
+				$system_ID
1270
+			);
1271
+
1272
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1273
+		return $label_html . $input_html;
1274
+	}
1275
+
1276
+
1277
+	/**
1278
+	 *  _generate_select_option_group
1279
+	 *
1280
+	 *  if  $value for a select box is an array, then the key will be used as the optgroup label
1281
+	 *  and the value array will be looped thru and the elements sent to _generate_select_option
1282
+	 *
1283
+	 * @param mixed   $opt_group
1284
+	 * @param mixed   $QSOs
1285
+	 * @param mixed   $answer
1286
+	 * @param boolean $use_html_entities
1287
+	 * @return string
1288
+	 */
1289
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true)
1290
+	{
1291
+		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value($opt_group) . '">';
1292
+		foreach ($QSOs as $QSO) {
1293
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities);
1294
+		}
1295
+		$html .= "\n\t\t\t\t" . '</optgroup>';
1296
+		return $html;
1297
+	}
1298
+
1299
+
1300
+	/**
1301
+	 *  _generate_select_option
1302
+	 *
1303
+	 * @param mixed   $key
1304
+	 * @param mixed   $value
1305
+	 * @param mixed   $answer
1306
+	 * @param int     $only_option
1307
+	 * @param boolean $use_html_entities
1308
+	 * @return string
1309
+	 */
1310
+	private static function _generate_select_option(
1311
+		$key,
1312
+		$value,
1313
+		$answer,
1314
+		$only_option = false,
1315
+		$use_html_entities = true
1316
+	) {
1317
+		$key      = self::prep_answer($key, $use_html_entities);
1318
+		$value    = self::prep_answer($value, $use_html_entities);
1319
+		$value    = ! empty($value) ? $value : $key;
1320
+		$selected = ($answer == $key || $only_option) ? 'selected' : '';
1321
+		return "\n\t\t\t\t"
1322
+			   . '<option value="' . self::prep_option_value($key) . '" ' . $selected . '> '
1323
+			   . $value
1324
+			   . '&nbsp;&nbsp;&nbsp;</option>';
1325
+	}
1326
+
1327
+
1328
+	/**
1329
+	 * generates HTML for form radio button inputs
1330
+	 *
1331
+	 * @param string      $question    label content
1332
+	 * @param string|int  $answer      form input value attribute
1333
+	 * @param array|bool  $options     array of answer options where array key = option value and array value = option
1334
+	 *                                 display text
1335
+	 * @param string $name        form input name attribute
1336
+	 * @param string      $id          form input css id attribute
1337
+	 * @param string      $class       form input css class attribute
1338
+	 * @param array|bool  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1339
+	 *                                 required 'class', and required 'msg' attribute
1340
+	 * @param string      $required_text
1341
+	 * @param string      $label_class css class attribute for the label
1342
+	 * @param bool|string $disabled    disabled="disabled" or null
1343
+	 * @param string      $system_ID
1344
+	 * @param bool        $use_html_entities
1345
+	 * @param bool        $label_b4
1346
+	 * @param bool        $use_desc_4_label
1347
+	 * @return string HTML
1348
+	 */
1349
+	public static function radio(
1350
+		string $question = '',
1351
+		$answer = null,
1352
+		$options = false,
1353
+		string $name = '',
1354
+		string $id = '',
1355
+		string $class = '',
1356
+		$required = false,
1357
+		string $required_text = '',
1358
+		string $label_class = '',
1359
+		bool $disabled = false,
1360
+		string $system_ID = '',
1361
+		bool $use_html_entities = true,
1362
+		bool $label_b4 = false,
1363
+		bool $use_desc_4_label = false,
1364
+		bool $add_mobile_label = false
1365
+	) {
1366
+		// need these
1367
+		if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1368
+			return null;
1369
+		}
1370
+		// prep the answer
1371
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1372
+		// prep the required array
1373
+		$required = self::prep_required($required);
1374
+		// set disabled tag
1375
+		$disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1376
+		// ya gots ta have style man!!!
1377
+		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
1378
+		$class       = ! empty($class) ? $class : 'espresso-radio-btn-inp';
1379
+		$extra       = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1380
+
1381
+		$label_html = self::label($question, $required_text, $required['label'], '', $label_class);
1382
+		$mobile_label = self::mobileLabel(
1383
+			$add_mobile_label,
1384
+			$question,
1385
+			$required_text,
1386
+			$required['label'],
1387
+			$label_class
1388
+		);
1389
+
1390
+		$input_html = $mobile_label
1391
+			. '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $class . '-ul">';
1392
+
1393
+		$class .= ! empty($system_ID) ? ' ' . $system_ID : '';
1394
+		$class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1395
+
1396
+		foreach ($options as $OPT) {
1397
+			if ($OPT instanceof EE_Question_Option) {
1398
+				$value   = self::prep_option_value($OPT->value());
1399
+				$label   = $use_desc_4_label ? $OPT->desc() : $OPT->value();
1400
+				$size    = $use_desc_4_label
1401
+					? self::get_label_size_class($OPT->value() . ' ' . $OPT->desc())
1402
+					: self::get_label_size_class($OPT->value());
1403
+				$desc    = $OPT->desc();// no self::prep_answer
1404
+				$answer  = is_numeric($value) && empty($answer) ? 0 : $answer;
1405
+				$value  = is_numeric($answer) && empty($value) ? 0 : $value;
1406
+				$checked = (string) $value == (string) $answer ? ' checked' : '';
1407
+				$opt     = '-' . sanitize_key($value);
1408
+
1409
+				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
1410
+				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
1411
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>&nbsp;' : '';
1412
+				$input_html .= "\n\t\t\t\t\t\t"
1413
+							   . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" '
1414
+							   . 'class="' . $class . '" value="' . $value . '" '
1415
+							   . 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled
1416
+							   . $checked . ' ' . $extra . '/>';
1417
+				$input_html .= ! $label_b4
1418
+					? "\n\t\t\t\t\t\t"
1419
+					  . '&nbsp;<span class="espresso-radio-btn-desc">'
1420
+					  . $label
1421
+					  . '</span>'
1422
+					: '';
1423
+				$input_html .= "\n\t\t\t\t\t" . '</label>';
1424
+				$input_html .= $use_desc_4_label
1425
+					? ''
1426
+					: '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
1427
+				$input_html .= "\n\t\t\t\t" . '</li>';
1428
+			}
1429
+		}
1430
+
1431
+		$input_html .= "\n\t\t\t" . '</ul>';
1432
+
1433
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1434
+		return $label_html . $input_html;
1435
+	}
1436
+
1437
+
1438
+	/**
1439
+	 * generates HTML for form checkbox inputs
1440
+	 *
1441
+	 * @param string $question    label content
1442
+	 * @param string $answer      form input value attribute
1443
+	 * @param array  $options     array of options where array key = option value and array value = option display text
1444
+	 * @param string $name        form input name attribute
1445
+	 * @param string $id          form input css id attribute
1446
+	 * @param string $class       form input css class attribute
1447
+	 * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1448
+	 *                            required 'class', and required 'msg' attribute
1449
+	 * @param string $label_class css class attribute for the label
1450
+	 * @param string $disabled    disabled="disabled" or null
1451
+	 * @return string HTML
1452
+	 */
1453
+	public static function checkbox(
1454
+		$question = false,
1455
+		$answer = null,
1456
+		$options = false,
1457
+		$name = false,
1458
+		$id = '',
1459
+		$class = '',
1460
+		$required = false,
1461
+		$required_text = '',
1462
+		$label_class = '',
1463
+		$disabled = false,
1464
+		$label_b4 = false,
1465
+		$system_ID = false,
1466
+		$use_html_entities = true,
1467
+		$add_mobile_label = false
1468
+	) {
1469
+		// need these
1470
+		if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1471
+			return null;
1472
+		}
1473
+		$answer = maybe_unserialize($answer);
1474
+
1475
+		// prep the answer(s)
1476
+		$answer = is_array($answer) ? $answer : [sanitize_key($answer) => $answer];
1477
+
1478
+		foreach ($answer as $key => $value) {
1479
+			$key            = self::prep_option_value($key);
1480
+			$answer[ $key ] = self::prep_answer($value, $use_html_entities);
1481
+		}
1482
+
1483
+		// prep the required array
1484
+		$required = self::prep_required($required);
1485
+		// set disabled tag
1486
+		$disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1487
+		// ya gots ta have style man!!!
1488
+		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
1489
+		$class       = empty($class) ? 'espresso-radio-btn-inp' : $class;
1490
+		$extra       = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1491
+
1492
+		$label_html   = self::label($question, $required_text, $required['label'], '', $label_class);
1493
+		$mobile_label = self::mobileLabel(
1494
+			$add_mobile_label,
1495
+			$question,
1496
+			$required_text,
1497
+			$required['label'],
1498
+			$label_class
1499
+		);
1500
+
1501
+		$input_html = $mobile_label
1502
+			. '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $class . '-ul">';
1503
+
1504
+		$class .= ! empty($system_ID) ? ' ' . $system_ID : '';
1505
+		$class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1506
+
1507
+		foreach ($options as $OPT) {
1508
+			$value = $OPT->value();// self::prep_option_value( $OPT->value() );
1509
+			$size  = self::get_label_size_class($OPT->value() . ' ' . $OPT->desc());
1510
+			$text  = self::prep_answer($OPT->value());
1511
+			$desc  = $OPT->desc();
1512
+			$opt   = '-' . sanitize_key($value);
1513
+
1514
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked' : '';
1515
+
1516
+			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
1517
+			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
1518
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>&nbsp;' : '';
1519
+			$input_html .= "\n\t\t\t\t\t\t"
1520
+						   . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" '
1521
+						   . 'id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" '
1522
+						   . 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
1523
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '&nbsp;<span>' . $text . '</span>' : '';
1524
+			$input_html .= "\n\t\t\t\t\t" . '</label>';
1525
+			if (! empty($desc) && $desc != $text) {
1526
+				$input_html .= "\n\t\t\t\t\t"
1527
+							   . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'
1528
+							   . $desc
1529
+							   . '</div>';
1530
+			}
1531
+			$input_html .= "\n\t\t\t\t" . '</li>';
1532
+		}
1533
+
1534
+		$input_html .= "\n\t\t\t" . '</ul>';
1535
+
1536
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1537
+		return $label_html . $input_html;
1538
+	}
1539
+
1540
+
1541
+	/**
1542
+	 * generates HTML for a form datepicker input
1543
+	 *
1544
+	 * @param string $question    label content
1545
+	 * @param string $answer      form input value attribute
1546
+	 * @param string $name        form input name attribute
1547
+	 * @param string $id          form input css id attribute
1548
+	 * @param string $class       form input css class attribute
1549
+	 * @param array  $required    'label', 'class', and 'msg' - array of values for required "label" content, css
1550
+	 *                            required 'class', and required 'msg' attribute
1551
+	 * @param string $label_class css class attribute for the label
1552
+	 * @param string $disabled    disabled="disabled" or null
1553
+	 * @return string HTML
1554
+	 */
1555
+	public static function datepicker(
1556
+		$question = false,
1557
+		$answer = null,
1558
+		$name = false,
1559
+		$id = '',
1560
+		$class = '',
1561
+		$required = false,
1562
+		$required_text = '',
1563
+		$label_class = '',
1564
+		$disabled = false,
1565
+		$system_ID = false,
1566
+		$use_html_entities = true,
1567
+		$add_mobile_label = false
1568
+	) {
1569
+		// need these
1570
+		if (! $question || ! $name) {
1571
+			return null;
1572
+		}
1573
+		// prep the answer
1574
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1575
+		// prep the required array
1576
+		$required = self::prep_required($required);
1577
+		// set disabled tag
1578
+		$disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1579
+		// ya gots ta have style man!!!
1580
+		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1581
+		$class     = empty($class) ? $txt_class : $class;
1582
+		$class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1583
+		$class = self::appendInputSizeClass($class, $answer);
1584
+		$extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1585
+
1586
+		$label_html   = self::label($question, $required_text, $required['label'], '', $label_class);
1587
+		$mobile_label = self::mobileLabel(
1588
+			$add_mobile_label,
1589
+			$question,
1590
+			$required_text,
1591
+			$required['label'],
1592
+			$label_class,
1593
+			$name
1594
+		);
1595
+
1596
+		$input_html = $mobile_label
1597
+			. '<input type="text" name="' . $name . '" id="' . $id . '" '
1598
+			. 'class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  '
1599
+			. 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled . ' ' . $extra . '/>';
1600
+
1601
+		// enqueue scripts
1602
+		wp_register_style(
1603
+			'espresso-ui-theme',
1604
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1605
+			[],
1606
+			EVENT_ESPRESSO_VERSION
1607
+		);
1608
+		wp_enqueue_style('espresso-ui-theme');
1609
+		wp_enqueue_script('jquery-ui-datepicker');
1610
+
1611
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1612
+		return $label_html . $input_html;
1613
+	}
1614
+
1615
+
1616
+	/**
1617
+	 *  remove_label_keep_required_msg
1618
+	 *  this will strip out a form input's label HTML while keeping the required text HTML that MUST be before the label
1619
+	 *
1620
+	 * @access public
1621
+	 * @return     string
1622
+	 */
1623
+	public static function remove_label_keep_required_msg($label_html, $required_text)
1624
+	{
1625
+		return $required_text;
1626
+	}
1627
+
1628
+
1629
+	/**
1630
+	 * Simply returns the HTML for a hidden input of the given name and value.
1631
+	 *
1632
+	 * @param string $name
1633
+	 * @param string $value
1634
+	 * @return string HTML
1635
+	 */
1636
+	public static function hidden_input($name, $value, $id = '')
1637
+	{
1638
+		$id = ! empty($id) ? $id : $name;
1639
+		return '<input id="' . $id . '" type="hidden" name="' . $name . '" value="' . $value . '"/>';
1640
+	}
1641
+
1642
+
1643
+	/**
1644
+	 * prep_question
1645
+	 *
1646
+	 * @param string $question
1647
+	 * @return string
1648
+	 */
1649
+	public static function prep_question($question)
1650
+	{
1651
+		return $question;
1652
+	}
1653
+
1654
+
1655
+	/**
1656
+	 *  prep_answer
1657
+	 *
1658
+	 * @param mixed $answer
1659
+	 * @return string
1660
+	 */
1661
+	public static function prep_answer($answer, $use_html_entities = true)
1662
+	{
1663
+		// make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired,
1664
+		// we want "0".
1665
+		if (is_bool($answer)) {
1666
+			$answer = $answer ? 1 : 0;
1667
+		}
1668
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1669
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1670
+	}
1671
+
1672
+
1673
+	/**
1674
+	 *  prep_answer_options
1675
+	 *
1676
+	 * @param array $QSOs array of EE_Question_Option objects
1677
+	 * @return array
1678
+	 */
1679
+	public static function prep_answer_options($QSOs = [])
1680
+	{
1681
+		$prepped_answer_options = [];
1682
+		if (is_array($QSOs) && ! empty($QSOs)) {
1683
+			foreach ($QSOs as $key => $QSO) {
1684
+				if (! $QSO instanceof EE_Question_Option) {
1685
+					$QSO = EE_Question_Option::new_instance(
1686
+						[
1687
+							'QSO_value' => is_array($QSO) && isset($QSO['id'])
1688
+								? (string) $QSO['id']
1689
+								: (string) $key,
1690
+							'QSO_desc'  => is_array($QSO) && isset($QSO['text'])
1691
+								? (string) $QSO['text']
1692
+								: (string) $QSO,
1693
+						]
1694
+					);
1695
+				}
1696
+				if ($QSO->opt_group()) {
1697
+					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1698
+				} else {
1699
+					$prepped_answer_options[] = $QSO;
1700
+				}
1701
+			}
1702
+		}
1703
+		//      d( $prepped_answer_options );
1704
+		return $prepped_answer_options;
1705
+	}
1706
+
1707
+
1708
+	/**
1709
+	 *  prep_option_value
1710
+	 *
1711
+	 * @param string|int $option_value
1712
+	 * @return string
1713
+	 */
1714
+	public static function prep_option_value($option_value)
1715
+	{
1716
+		return esc_attr(trim(stripslashes($option_value)));
1717
+	}
1718
+
1719
+
1720
+	/**
1721
+	 *  prep_required
1722
+	 *
1723
+	 * @param string|array $required
1724
+	 * @return array
1725
+	 */
1726
+	public static function prep_required($required = [])
1727
+	{
1728
+		// make sure required is an array
1729
+		$required = is_array($required) ? $required : [];
1730
+		// and set some defaults
1731
+		return array_merge(['label' => '', 'class' => '', 'msg' => ''], $required);
1732
+	}
1733
+
1734
+
1735
+	/**
1736
+	 *  get_label_size_class
1737
+	 *
1738
+	 * @param string $value
1739
+	 * @return string
1740
+	 */
1741
+	public static function get_label_size_class($value = false)
1742
+	{
1743
+		if ($value === false || $value === '') {
1744
+			return ' class="medium-lbl"';
1745
+		}
1746
+		// determine length of option value
1747
+		$val_size = strlen($value);
1748
+		switch ($val_size) {
1749
+			case $val_size < 3:
1750
+				$size = ' class="nano-lbl"';
1751
+				break;
1752
+			case $val_size < 6:
1753
+				$size = ' class="micro-lbl"';
1754
+				break;
1755
+			case $val_size < 12:
1756
+				$size = ' class="tiny-lbl"';
1757
+				break;
1758
+			case $val_size < 25:
1759
+				$size = ' class="small-lbl"';
1760
+				break;
1761
+			case $val_size > 100:
1762
+				$size = ' class="big-lbl"';
1763
+				break;
1764
+			default:
1765
+				$size = ' class="medium-lbl"';
1766
+				break;
1767
+		}
1768
+		return $size;
1769
+	}
1770
+
1771
+
1772
+	/**
1773
+	 *  _load_system_dropdowns
1774
+	 *
1775
+	 * @param EE_Question_Form_Input $QFI
1776
+	 * @return array
1777
+	 * @throws EE_Error
1778
+	 * @throws ReflectionException
1779
+	 */
1780
+	private static function _load_system_dropdowns($QFI)
1781
+	{
1782
+		$QST_system = $QFI->get('QST_system');
1783
+		switch ($QST_system) {
1784
+			case 'state':
1785
+				$QFI = self::generate_state_dropdown($QFI);
1786
+				break;
1787
+			case 'country':
1788
+				$QFI = self::generate_country_dropdown($QFI);
1789
+				break;
1790
+			case 'admin-state':
1791
+				$QFI = self::generate_state_dropdown($QFI, true);
1792
+				break;
1793
+			case 'admin-country':
1794
+				$QFI = self::generate_country_dropdown($QFI, true);
1795
+				break;
1796
+		}
1797
+		return $QFI;
1798
+	}
1799
+
1800
+
1801
+	/**
1802
+	 * This preps dropdowns that are specialized.
1803
+	 *
1804
+	 * @param EE_Question_Form_Input $QFI
1805
+	 *
1806
+	 * @return EE_Question_Form_Input
1807
+	 * @throws EE_Error
1808
+	 * @throws ReflectionException
1809
+	 * @since  4.6.0
1810
+	 */
1811
+	protected static function _load_specialized_dropdowns($QFI)
1812
+	{
1813
+		switch ($QFI->get('QST_type')) {
1814
+			case 'STATE':
1815
+				$QFI = self::generate_state_dropdown($QFI);
1816
+				break;
1817
+			case 'COUNTRY':
1818
+				$QFI = self::generate_country_dropdown($QFI);
1819
+				break;
1820
+		}
1821
+		return $QFI;
1822
+	}
1823
+
1824
+
1825
+	/**
1826
+	 *    generate_state_dropdown
1827
+	 *
1828
+	 * @param EE_Question_Form_Input $QST
1829
+	 * @param bool                   $get_all
1830
+	 * @return EE_Question_Form_Input
1831
+	 * @throws EE_Error
1832
+	 * @throws ReflectionException
1833
+	 */
1834
+	public static function generate_state_dropdown($QST, $get_all = false)
1835
+	{
1836
+		$states = $get_all
1837
+			? EEM_State::instance()->get_all_states()
1838
+			: EEM_State::instance()->get_all_states_of_active_countries();
1839
+		if ($states && count($states) != count($QST->options())) {
1840
+			$QST->set('QST_type', 'DROPDOWN');
1841
+			// if multiple countries, we'll create option groups within the dropdown
1842
+			foreach ($states as $state) {
1843
+				if ($state instanceof EE_State) {
1844
+					$QSO = EE_Question_Option::new_instance(
1845
+						[
1846
+							'QSO_value'   => $state->ID(),
1847
+							'QSO_desc'    => $state->name(),
1848
+							'QST_ID'      => $QST->get('QST_ID'),
1849
+							'QSO_deleted' => false,
1850
+						]
1851
+					);
1852
+					// set option group
1853
+					$QSO->set_opt_group($state->country()->name());
1854
+					// add option to question
1855
+					$QST->add_temp_option($QSO);
1856
+				}
1857
+			}
1858
+		}
1859
+		return $QST;
1860
+	}
1861
+
1862
+
1863
+	/**
1864
+	 *    generate_country_dropdown
1865
+	 *
1866
+	 * @param      $QST
1867
+	 * @param bool $get_all
1868
+	 * @return array
1869
+	 * @throws EE_Error
1870
+	 * @throws ReflectionException
1871
+	 * @internal param array $question
1872
+	 */
1873
+	public static function generate_country_dropdown($QST, $get_all = false)
1874
+	{
1875
+		$countries = $get_all
1876
+			? EEM_Country::instance()->get_all_countries()
1877
+			: EEM_Country::instance()->get_all_active_countries();
1878
+		if ($countries && count($countries) != count($QST->options())) {
1879
+			$QST->set('QST_type', 'DROPDOWN');
1880
+			// now add countries
1881
+			foreach ($countries as $country) {
1882
+				if ($country instanceof EE_Country) {
1883
+					$QSO = EE_Question_Option::new_instance(
1884
+						[
1885
+							'QSO_value'   => $country->ID(),
1886
+							'QSO_desc'    => $country->name(),
1887
+							'QST_ID'      => $QST->get('QST_ID'),
1888
+							'QSO_deleted' => false,
1889
+						]
1890
+					);
1891
+					$QST->add_temp_option($QSO);
1892
+				}
1893
+			}
1894
+		}
1895
+		return $QST;
1896
+	}
1897
+
1898
+
1899
+	/**
1900
+	 *  generates options for a month dropdown selector with numbers from 01 to 12
1901
+	 *
1902
+	 * @return array()
1903
+	 */
1904
+	public static function two_digit_months_dropdown_options()
1905
+	{
1906
+		$options = [];
1907
+		for ($x = 1; $x <= 12; $x++) {
1908
+			$mm             = str_pad($x, 2, '0', STR_PAD_LEFT);
1909
+			$options[ $mm ] = $mm;
1910
+		}
1911
+		return EEH_Form_Fields::prep_answer_options($options);
1912
+	}
1913
+
1914
+
1915
+	/**
1916
+	 *  generates a year dropdown selector with numbers for the next ten years
1917
+	 *
1918
+	 * @return array
1919
+	 */
1920
+	public static function next_decade_two_digit_year_dropdown_options()
1921
+	{
1922
+		$options      = [];
1923
+		$current_year = date('y');
1924
+		$next_decade  = $current_year + 10;
1925
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1926
+			$yy             = str_pad($x, 2, '0', STR_PAD_LEFT);
1927
+			$options[ $yy ] = $yy;
1928
+		}
1929
+		return EEH_Form_Fields::prep_answer_options($options);
1930
+	}
1931
+
1932
+
1933
+	/**
1934
+	 * generates a month/year dropdown selector for all registrations matching the given criteria.  Typically used for
1935
+	 * list table filter.
1936
+	 *
1937
+	 * @param string  $cur_date     any currently selected date can be entered here.
1938
+	 * @param string  $status       Registration status
1939
+	 * @param integer $evt_category Event Category ID if the Event Category filter is selected
1940
+	 * @return string                html
1941
+	 * @throws EE_Error
1942
+	 */
1943
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0)
1944
+	{
1945
+		$_where = [];
1946
+		if (! empty($status)) {
1947
+			$_where['STS_ID'] = $status;
1948
+		}
1949
+
1950
+		if ($evt_category > 0) {
1951
+			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1952
+		}
1953
+
1954
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1955
+
1956
+		// setup vals for select input helper
1957
+		$options = [
1958
+			0 => [
1959
+				'text' => esc_html__('Select a Month/Year', 'event_espresso'),
1960
+				'id'   => '',
1961
+			],
1962
+		];
1963
+
1964
+		foreach ($regdtts as $regdtt) {
1965
+			$date      = $regdtt->reg_month . ' ' . $regdtt->reg_year;
1966
+			$options[] = [
1967
+				'text' => $date,
1968
+				'id'   => $date,
1969
+			];
1970
+		}
1971
+
1972
+		return self::select_input('month_range', $options, $cur_date);
1973
+	}
1974
+
1975
+
1976
+	/**
1977
+	 * generates a month/year dropdown selector for all events matching the given criteria
1978
+	 * Typically used for list table filter
1979
+	 *
1980
+	 * @param string $cur_date          any currently selected date can be entered here.
1981
+	 * @param string $status            "view" (i.e. all, today, month, draft)
1982
+	 * @param int    $evt_category      category event belongs to
1983
+	 * @param string $evt_active_status "upcoming", "expired", "active", or "inactive"
1984
+	 * @return string                    html
1985
+	 * @throws EE_Error
1986
+	 */
1987
+	public static function generate_event_months_dropdown(
1988
+		$cur_date = '',
1989
+		$status = null,
1990
+		$evt_category = null,
1991
+		$evt_active_status = null
1992
+	) {
1993
+		// determine what post_status our condition will have for the query.
1994
+		// phpcs:disable PSR2.ControlStructures.SwitchDeclaration.TerminatingComment
1995
+		switch ($status) {
1996
+			case 'month':
1997
+			case 'today':
1998
+			case null:
1999
+			case 'all':
2000
+				$where['Event.status'] = ['NOT IN', ['trash']];
2001
+				break;
2002
+			case 'draft':
2003
+				$where['Event.status'] = ['IN', ['draft', 'auto-draft']];
2004
+				break;
2005
+			default:
2006
+				$where['Event.status'] = $status;
2007
+		}
2008
+
2009
+		// phpcs:enable
2010
+
2011
+		// categories?
2012
+
2013
+
2014
+		if (! empty($evt_category) and $evt_category > 0) {
2015
+			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
2016
+			$where['Event.Term_Taxonomy.term_id']  = $evt_category;
2017
+		}
2018
+
2019
+
2020
+		//      $where['DTT_is_primary'] = 1;
2021
+
2022
+		$DTTS = EEM_Datetime::instance()->get_dtt_months_and_years($where, $evt_active_status);
2023
+
2024
+		// let's setup vals for select input helper
2025
+		$options = [
2026
+			0 => [
2027
+				'text' => esc_html__('Select a Month/Year', 'event_espresso'),
2028
+				'id'   => "",
2029
+			],
2030
+		];
2031
+
2032
+
2033
+		// translate month and date
2034
+		global $wp_locale;
2035
+
2036
+		foreach ($DTTS as $DTT) {
2037
+			$localized_date = $wp_locale->get_month($DTT->dtt_month_num) . ' ' . $DTT->dtt_year;
2038
+			$id             = $DTT->dtt_month . ' ' . $DTT->dtt_year;
2039
+			$options[]      = [
2040
+				'text' => $localized_date,
2041
+				'id'   => $id,
2042
+			];
2043
+		}
2044
+
2045
+
2046
+		return self::select_input('month_range', $options, $cur_date);
2047
+	}
2048
+
2049
+
2050
+	/**
2051
+	 * generates the dropdown selector for event categories
2052
+	 * typically used as a filter on list tables.
2053
+	 *
2054
+	 * @param integer $current_cat currently selected category
2055
+	 * @return string               html for dropdown
2056
+	 * @throws EE_Error
2057
+	 * @throws ReflectionException
2058
+	 */
2059
+	public static function generate_event_category_dropdown($current_cat = -1)
2060
+	{
2061
+		$categories = EEM_Term::instance()->get_all_ee_categories(true);
2062
+		$options    = [
2063
+			'0' => [
2064
+				'text' => esc_html__('All Categories', 'event_espresso'),
2065
+				'id'   => -1,
2066
+			],
2067
+		];
2068
+
2069
+		// setup categories for dropdown
2070
+		foreach ($categories as $category) {
2071
+			$options[] = [
2072
+				'text' => $category->get('name'),
2073
+				'id'   => $category->ID(),
2074
+			];
2075
+		}
2076
+
2077
+		return self::select_input('EVT_CAT', $options, $current_cat);
2078
+	}
2079
+
2080
+
2081
+	/**
2082
+	 *    generate a submit button with or without it's own microform
2083
+	 *    this is the only way to create buttons that are compatible across all themes
2084
+	 *
2085
+	 * @access    public
2086
+	 * @param string      $url              - the form action
2087
+	 * @param string      $ID               - some kind of unique ID, appended with "-sbmt" for the input and "-frm"
2088
+	 *                                      for the form
2089
+	 * @param string      $class            - css classes (separated by spaces if more than one)
2090
+	 * @param string      $text             - what appears on the button
2091
+	 * @param string      $nonce_action     - if using nonces
2092
+	 * @param bool|string $input_only       - whether to print form header and footer. TRUE returns the input without
2093
+	 *                                      the form
2094
+	 * @param string      $extra_attributes - any extra attributes that need to be attached to the form input
2095
+	 * @return    string
2096
+	 */
2097
+	public static function submit_button(
2098
+		$url = '',
2099
+		$ID = '',
2100
+		$class = '',
2101
+		$text = '',
2102
+		$nonce_action = '',
2103
+		$input_only = false,
2104
+		$extra_attributes = ''
2105
+	) {
2106
+		$btn = '';
2107
+		if (empty($url) || empty($ID)) {
2108
+			return $btn;
2109
+		}
2110
+		$text = ! empty($text) ? $text : esc_html__('Submit', 'event_espresso');
2111
+		$btn  .= '<input id="' . $ID . '-btn" class="' . $class . '" '
2112
+				 . 'type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
2113
+		if (! $input_only) {
2114
+			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
2115
+			$btn_frm .= ! empty($nonce_action)
2116
+				? wp_nonce_field($nonce_action, $nonce_action . '_nonce', true, false)
2117
+				: '';
2118
+			$btn_frm .= $btn;
2119
+			$btn_frm .= '</form>';
2120
+			$btn     = $btn_frm;
2121
+			unset($btn_frm);
2122
+		}
2123
+		return $btn;
2124
+	}
2125 2125
 }
Please login to merge, or discard this patch.
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
             $type           = $input_value['input'];
109 109
             $value          = $input_value['value'];
110 110
 
111
-            $id    = $form_id ? $form_id . '-' . $input_key : $input_key;
112
-            $class = $required ? 'required ' . $css_class : $css_class;
111
+            $id    = $form_id ? $form_id.'-'.$input_key : $input_key;
112
+            $class = $required ? 'required '.$css_class : $css_class;
113 113
 
114 114
             // what type of input are we dealing with ?
115 115
             switch ($type) {
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
             }
162 162
         } // end foreach( $input_vars as $input_key => $input_value )
163 163
 
164
-        if (! empty($inputs)) {
165
-            $glue   = "
164
+        if ( ! empty($inputs)) {
165
+            $glue = "
166 166
                 </li>
167 167
                 <li>
168 168
                     ";
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             </ul>
176 176
             ";
177 177
         }
178
-        return $output . implode("\n", $hidden_inputs);
178
+        return $output.implode("\n", $hidden_inputs);
179 179
     }
180 180
 
181 181
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             // generate label
257 257
             $label = ! empty($label) ? self::adminLabel($id, $label, $required) : '';
258 258
             // generate field name
259
-            $name = ! empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
259
+            $name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
260 260
 
261 261
             // we determine what we're building based on the type
262 262
             switch ($type) {
@@ -267,14 +267,14 @@  discard block
 block discarded – undo
267 267
                         foreach ($value as $key => $val) {
268 268
                             $c_input .= self::adminMulti(
269 269
                                 $default,
270
-                                isset($classes[ $key ]) ? $classes[ $key ] : '',
271
-                                $field_name . '_' . $value,
270
+                                isset($classes[$key]) ? $classes[$key] : '',
271
+                                $field_name.'_'.$value,
272 272
                                 $name,
273 273
                                 $required,
274 274
                                 $tab_index,
275 275
                                 $type,
276 276
                                 $val,
277
-                                isset($labels[ $key ]) ? $labels[ $key ] : ''
277
+                                isset($labels[$key]) ? $labels[$key] : ''
278 278
                             );
279 279
                         }
280 280
                         $field = $c_input;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
                 case 'select':
301 301
                     $options = [];
302 302
                     foreach ($value as $key => $val) {
303
-                        $options[ $val ] = isset($labels[ $key ]) ? $labels[ $key ] : '';
303
+                        $options[$val] = isset($labels[$key]) ? $labels[$key] : '';
304 304
                     }
305 305
                     $field = self::adminSelect($default, $class, $id, $name, $required, $tab_index, $options);
306 306
                     break;
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                     $field = self::adminText($class, $id, $name, $required, $tab_index, $value);
327 327
             }
328 328
 
329
-            $form_fields[ $field_name ] = ['label' => $label, 'field' => $field . $extra_desc];
329
+            $form_fields[$field_name] = ['label' => $label, 'field' => $field.$extra_desc];
330 330
         }
331 331
 
332 332
         return $form_fields;
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         }
396 396
         $label = esc_html($label);
397 397
         $label_class = self::appendInputSizeClass('', $label);
398
-        $label_class = $label_class ? ' class="' . $label_class . '"' : '';
398
+        $label_class = $label_class ? ' class="'.$label_class.'"' : '';
399 399
         return "
400 400
         <label for='$id'{$label_class}>
401 401
             {$input}
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
         $autosize = true
546 546
     ) {
547 547
         // if $values was submitted in the wrong format, convert it over
548
-        if (! empty($values) && (! array_key_exists(0, $values) || ! is_array($values[0]))) {
548
+        if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
549 549
             $converted_values = [];
550 550
             foreach ($values as $id => $text) {
551 551
                 $converted_values[] = ['id' => $id, 'text' => $text];
@@ -554,19 +554,19 @@  discard block
 block discarded – undo
554 554
         }
555 555
 
556 556
         $field =
557
-            '<select id="' . EEH_Formatter::ee_tep_output_string($name)
558
-            . '" name="' . EEH_Formatter::ee_tep_output_string($name)
557
+            '<select id="'.EEH_Formatter::ee_tep_output_string($name)
558
+            . '" name="'.EEH_Formatter::ee_tep_output_string($name)
559 559
             . '"';
560 560
 
561 561
         if (EEH_Formatter::ee_tep_not_null($parameters)) {
562
-            $field .= ' ' . $parameters;
562
+            $field .= ' '.$parameters;
563 563
         }
564 564
         $class = $autosize ? self::appendInputSizeClass($class, $values) : '';
565 565
 
566
-        $field .= ' class="' . $class . '">';
566
+        $field .= ' class="'.$class.'">';
567 567
 
568
-        if (empty($default) && isset($GLOBALS[ $name ])) {
569
-            $default = stripslashes($GLOBALS[ $name ]);
568
+        if (empty($default) && isset($GLOBALS[$name])) {
569
+            $default = stripslashes($GLOBALS[$name]);
570 570
         }
571 571
 
572 572
         $field .= self::selectInputOption($values, $default);
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
             $id = is_scalar($values['id']) ? $values['id'] : '';
583 583
             $text = is_scalar($values['text']) ? $values['text'] : '';
584 584
             $selected = $default == $values['id'] ? ' selected = "selected"' : '';
585
-            $html_class = isset($values['class']) ? ' class="' . $values['class'] . '"' : '';
585
+            $html_class = isset($values['class']) ? ' class="'.$values['class'].'"' : '';
586 586
             return "<option value='{$id}'{$selected}{$html_class}>{$text}</option>";
587 587
         }
588 588
         $options = '';
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
             return $chars;
613 613
         }
614 614
         // not a primitive? return something big
615
-        if (! is_scalar($value)) {
615
+        if ( ! is_scalar($value)) {
616 616
             return 500;
617 617
         }
618 618
         return strlen((string) $value);
@@ -662,11 +662,11 @@  discard block
 block discarded – undo
662 662
         $after_question_group_questions  =
663 663
             apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
664 664
 
665
-        if (! empty($question_groups)) {
665
+        if ( ! empty($question_groups)) {
666 666
             // loop thru question groups
667 667
             foreach ($question_groups as $QSG) {
668 668
                 // check that questions exist
669
-                if (! empty($QSG['QSG_questions'])) {
669
+                if ( ! empty($QSG['QSG_questions'])) {
670 670
                     // use fieldsets
671 671
                     $html .= "\n\t"
672 672
                              . '<'
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                     $html .= $before_question_group_questions;
692 692
                     // loop thru questions
693 693
                     foreach ($QSG['QSG_questions'] as $question) {
694
-                        $QFI  = new EE_Question_Form_Input(
694
+                        $QFI = new EE_Question_Form_Input(
695 695
                             $question['qst_obj'],
696 696
                             $question['ans_obj'],
697 697
                             $question
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
                         $html .= self::generate_form_input($QFI);
700 700
                     }
701 701
                     $html .= $after_question_group_questions;
702
-                    $html .= "\n\t" . '</' . $group_wrapper . '>';
702
+                    $html .= "\n\t".'</'.$group_wrapper.'>';
703 703
                 }
704 704
             }
705 705
         }
@@ -739,25 +739,25 @@  discard block
 block discarded – undo
739 739
             'input_id'    => '',
740 740
             'input_class' => '',
741 741
         ];
742
-        $q_meta         = array_merge($default_q_meta, $q_meta);
742
+        $q_meta = array_merge($default_q_meta, $q_meta);
743 743
 
744
-        if (! empty($question_groups)) {
744
+        if ( ! empty($question_groups)) {
745 745
             // loop thru question groups
746 746
             foreach ($question_groups as $QSG) {
747 747
                 if ($QSG instanceof EE_Question_Group) {
748 748
                     // check that questions exist
749 749
 
750 750
                     $where = ['QST_deleted' => 0];
751
-                    if (! $from_admin) {
751
+                    if ( ! $from_admin) {
752 752
                         $where['QST_admin_only'] = 0;
753 753
                     }
754 754
                     $questions =
755 755
                         $QSG->questions([$where, 'order_by' => ['Question_Group_Question.QGQ_order' => 'ASC']]);
756
-                    if (! empty($questions)) {
756
+                    if ( ! empty($questions)) {
757 757
                         // use fieldsets
758 758
                         $html .= "\n\t"
759
-                                 . '<' . $group_wrapper . ' class="espresso-question-group-wrap" '
760
-                                 . 'id="' . $QSG->get('QSG_identifier') . '">';
759
+                                 . '<'.$group_wrapper.' class="espresso-question-group-wrap" '
760
+                                 . 'id="'.$QSG->get('QSG_identifier').'">';
761 761
                         // group_name
762 762
                         if ($QSG->show_group_name()) {
763 763
                             $html .= "\n\t\t"
@@ -782,21 +782,21 @@  discard block
 block discarded – undo
782 782
                             /** @var RequestInterface $request */
783 783
                             $request      = LoaderFactory::getLoader()->getShared(RequestInterface::class);
784 784
                             $request_qstn = $request->getRequestParam('qstn', [], 'string', true);
785
-                            if (! empty($request_qstn) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
785
+                            if ( ! empty($request_qstn) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
786 786
                                 // check for answer in $request_qstn in case we are reprocessing a form after an error
787
-                                if (isset($request_qstn[ $q_meta['input_id'] ][ $qstn_id ])) {
788
-                                    $answer = is_array($request_qstn[ $q_meta['input_id'] ][ $qstn_id ])
789
-                                        ? $request_qstn[ $q_meta['input_id'] ][ $qstn_id ]
790
-                                        : sanitize_text_field($request_qstn[ $q_meta['input_id'] ][ $qstn_id ]);
787
+                                if (isset($request_qstn[$q_meta['input_id']][$qstn_id])) {
788
+                                    $answer = is_array($request_qstn[$q_meta['input_id']][$qstn_id])
789
+                                        ? $request_qstn[$q_meta['input_id']][$qstn_id]
790
+                                        : sanitize_text_field($request_qstn[$q_meta['input_id']][$qstn_id]);
791 791
                                 }
792 792
                             } elseif (isset($q_meta['attendee']) && $q_meta['attendee']) {
793 793
                                 // attendee data from the session
794 794
                                 $answer =
795
-                                    isset($q_meta['attendee'][ $qstn_id ]) ? $q_meta['attendee'][ $qstn_id ] : null;
795
+                                    isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : null;
796 796
                             }
797 797
 
798 798
 
799
-                            $QFI  = new EE_Question_Form_Input(
799
+                            $QFI = new EE_Question_Form_Input(
800 800
                                 $QST,
801 801
                                 EE_Answer::new_instance(
802 802
                                     [
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                             $html .= self::generate_form_input($QFI);
812 812
                         }
813 813
                         $html .= $after_question_group_questions;
814
-                        $html .= "\n\t" . '</' . $group_wrapper . '>';
814
+                        $html .= "\n\t".'</'.$group_wrapper.'>';
815 815
                     }
816 816
                 }
817 817
             }
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
     ): string {
994 994
         $for   = ! empty($name) ? " for='{$name}'" : '';
995 995
         $class = ! empty($label_class) ? " class='{$label_class}'" : '';
996
-        $label = self::prep_question($question) . $required_label;
996
+        $label = self::prep_question($question).$required_label;
997 997
         $label_html = "
998 998
             {$required_text}
999 999
             <label{$for}{$class}>{$label}</label>";
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
         $extra_attributes = ''
1050 1050
     ) {
1051 1051
         // need these
1052
-        if (! $question || ! $name) {
1052
+        if ( ! $question || ! $name) {
1053 1053
             return null;
1054 1054
         }
1055 1055
         // prep the answer
@@ -1061,9 +1061,9 @@  discard block
 block discarded – undo
1061 1061
         // ya gots ta have style man!!!
1062 1062
         $txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
1063 1063
         $class     = empty($class) ? $txt_class : $class;
1064
-        $class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1064
+        $class .= ! empty($system_ID) ? ' '.$system_ID : '';
1065 1065
         $class = self::appendInputSizeClass($class, $answer);
1066
-        $class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1066
+        $class .= ! empty($required['class']) ? ' '.$required['class'] : '';
1067 1067
         $extra_attributes = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', $extra_attributes);
1068 1068
 
1069 1069
         $label_html = self::label($question, $required_text, $required['label'], $name, $label_class);
@@ -1076,18 +1076,18 @@  discard block
 block discarded – undo
1076 1076
             $name
1077 1077
         );
1078 1078
 
1079
-        $input_html = $mobile_label . '
1079
+        $input_html = $mobile_label.'
1080 1080
             <input  type="text"
1081
-                    name="' . $name . '"
1082
-                    id="' . $id . '"
1083
-                    class="' . trim($class) . '"
1084
-                    value="' . esc_attr($answer) . '"
1085
-                    aria-label="' . esc_attr($required['msg']) . '"
1086
-                    ' . $disabled . ' ' . $extra_attributes . '
1081
+                    name="' . $name.'"
1082
+                    id="' . $id.'"
1083
+                    class="' . trim($class).'"
1084
+                    value="' . esc_attr($answer).'"
1085
+                    aria-label="' . esc_attr($required['msg']).'"
1086
+                    ' . $disabled.' '.$extra_attributes.'
1087 1087
             />';
1088 1088
 
1089 1089
         $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1090
-        return $label_html . $input_html;
1090
+        return $label_html.$input_html;
1091 1091
     }
1092 1092
 
1093 1093
 
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
         $add_mobile_label = false
1123 1123
     ) {
1124 1124
         // need these
1125
-        if (! $question || ! $name) {
1125
+        if ( ! $question || ! $name) {
1126 1126
             return null;
1127 1127
         }
1128 1128
         // prep the answer
@@ -1136,9 +1136,9 @@  discard block
 block discarded – undo
1136 1136
         // set disabled tag
1137 1137
         $disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1138 1138
         // ya gots ta have style man!!!
1139
-        $class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1140
-        $class     .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1141
-        $extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1139
+        $class     .= ! empty($system_ID) ? ' '.$system_ID : '';
1140
+        $class     .= ! empty($required['class']) ? ' '.$required['class'] : '';
1141
+        $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1142 1142
 
1143 1143
         $label_html   = self::label($question, $required_text, $required['label'], $name, $label_class);
1144 1144
         $mobile_label = self::mobileLabel(
@@ -1151,14 +1151,14 @@  discard block
 block discarded – undo
1151 1151
         );
1152 1152
 
1153 1153
         $input_html = $mobile_label
1154
-            . '<textarea name="' . $name . '" id="' . $id . '" class="' . trim($class) . '" '
1155
-            . 'rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  '
1156
-            . 'aria-label="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>'
1154
+            . '<textarea name="'.$name.'" id="'.$id.'" class="'.trim($class).'" '
1155
+            . 'rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'"  '
1156
+            . 'aria-label="'.$required['msg'].'" '.$disabled.' '.$extra.'>'
1157 1157
              . esc_textarea($answer)
1158 1158
               . '</textarea>';
1159 1159
 
1160 1160
         $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1161
-        return $label_html . $input_html;
1161
+        return $label_html.$input_html;
1162 1162
     }
1163 1163
 
1164 1164
 
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
     ) {
1197 1197
 
1198 1198
         // need these
1199
-        if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1199
+        if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1200 1200
             return null;
1201 1201
         }
1202 1202
         // prep the answer
@@ -1208,9 +1208,9 @@  discard block
 block discarded – undo
1208 1208
         // set disabled tag
1209 1209
         $disabled = $answer === null || ! $disabled ? '' : ' disabled="disabled"';
1210 1210
         // ya gots ta have style man!!!
1211
-        $class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1211
+        $class .= ! empty($system_ID) ? ' '.$system_ID : '';
1212 1212
         $class = self::appendInputSizeClass($class, $options);
1213
-        $extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1213
+        $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1214 1214
 
1215 1215
         $label_html   = self::label($question, $required_text, $required['label'], $name, $label_class);
1216 1216
         $mobile_label = self::mobileLabel(
@@ -1223,16 +1223,16 @@  discard block
 block discarded – undo
1223 1223
         );
1224 1224
 
1225 1225
         $input_html = $mobile_label
1226
-            . '<select name="' . $name . '" id="' . $id . '" class="' . trim($class) . ' ' . $required['class'] . '" '
1227
-            . 'aria-label="' . esc_attr($required['msg']) . '"' . $disabled . ' ' . $extra . '>';
1226
+            . '<select name="'.$name.'" id="'.$id.'" class="'.trim($class).' '.$required['class'].'" '
1227
+            . 'aria-label="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
1228 1228
         // recursively count array elements, to determine total number of options
1229 1229
         $only_option = count($options, 1) == 1;
1230
-        if (! $only_option) {
1230
+        if ( ! $only_option) {
1231 1231
             // if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
1232
-            $selected   = $answer === null ? ' selected' : '';
1232
+            $selected = $answer === null ? ' selected' : '';
1233 1233
             $input_html .= $add_please_select_option
1234 1234
                 ? "\n\t\t\t\t"
1235
-                  . '<option value=""' . $selected . '>'
1235
+                  . '<option value=""'.$selected.'>'
1236 1236
                   . esc_html__(' - please select - ', 'event_espresso')
1237 1237
                   . '</option>'
1238 1238
                 : '';
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
                 );
1256 1256
         }
1257 1257
 
1258
-        $input_html .= "\n\t\t\t" . '</select>';
1258
+        $input_html .= "\n\t\t\t".'</select>';
1259 1259
 
1260 1260
         $input_html =
1261 1261
             apply_filters(
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
             );
1271 1271
 
1272 1272
         $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1273
-        return $label_html . $input_html;
1273
+        return $label_html.$input_html;
1274 1274
     }
1275 1275
 
1276 1276
 
@@ -1288,11 +1288,11 @@  discard block
 block discarded – undo
1288 1288
      */
1289 1289
     private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true)
1290 1290
     {
1291
-        $html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value($opt_group) . '">';
1291
+        $html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
1292 1292
         foreach ($QSOs as $QSO) {
1293 1293
             $html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities);
1294 1294
         }
1295
-        $html .= "\n\t\t\t\t" . '</optgroup>';
1295
+        $html .= "\n\t\t\t\t".'</optgroup>';
1296 1296
         return $html;
1297 1297
     }
1298 1298
 
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
         $value    = ! empty($value) ? $value : $key;
1320 1320
         $selected = ($answer == $key || $only_option) ? 'selected' : '';
1321 1321
         return "\n\t\t\t\t"
1322
-               . '<option value="' . self::prep_option_value($key) . '" ' . $selected . '> '
1322
+               . '<option value="'.self::prep_option_value($key).'" '.$selected.'> '
1323 1323
                . $value
1324 1324
                . '&nbsp;&nbsp;&nbsp;</option>';
1325 1325
     }
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
         bool $add_mobile_label = false
1365 1365
     ) {
1366 1366
         // need these
1367
-        if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1367
+        if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1368 1368
             return null;
1369 1369
         }
1370 1370
         // prep the answer
@@ -1388,50 +1388,50 @@  discard block
 block discarded – undo
1388 1388
         );
1389 1389
 
1390 1390
         $input_html = $mobile_label
1391
-            . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $class . '-ul">';
1391
+            . '<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$class.'-ul">';
1392 1392
 
1393
-        $class .= ! empty($system_ID) ? ' ' . $system_ID : '';
1394
-        $class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1393
+        $class .= ! empty($system_ID) ? ' '.$system_ID : '';
1394
+        $class .= ! empty($required['class']) ? ' '.$required['class'] : '';
1395 1395
 
1396 1396
         foreach ($options as $OPT) {
1397 1397
             if ($OPT instanceof EE_Question_Option) {
1398 1398
                 $value   = self::prep_option_value($OPT->value());
1399 1399
                 $label   = $use_desc_4_label ? $OPT->desc() : $OPT->value();
1400 1400
                 $size    = $use_desc_4_label
1401
-                    ? self::get_label_size_class($OPT->value() . ' ' . $OPT->desc())
1401
+                    ? self::get_label_size_class($OPT->value().' '.$OPT->desc())
1402 1402
                     : self::get_label_size_class($OPT->value());
1403
-                $desc    = $OPT->desc();// no self::prep_answer
1403
+                $desc    = $OPT->desc(); // no self::prep_answer
1404 1404
                 $answer  = is_numeric($value) && empty($answer) ? 0 : $answer;
1405
-                $value  = is_numeric($answer) && empty($value) ? 0 : $value;
1405
+                $value = is_numeric($answer) && empty($value) ? 0 : $value;
1406 1406
                 $checked = (string) $value == (string) $answer ? ' checked' : '';
1407
-                $opt     = '-' . sanitize_key($value);
1407
+                $opt     = '-'.sanitize_key($value);
1408 1408
 
1409
-                $input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
1410
-                $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
1411
-                $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>&nbsp;' : '';
1409
+                $input_html .= "\n\t\t\t\t".'<li'.$size.'>';
1410
+                $input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
1411
+                $input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>&nbsp;' : '';
1412 1412
                 $input_html .= "\n\t\t\t\t\t\t"
1413
-                               . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" '
1414
-                               . 'class="' . $class . '" value="' . $value . '" '
1415
-                               . 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled
1416
-                               . $checked . ' ' . $extra . '/>';
1413
+                               . '<input type="radio" name="'.$name.'" id="'.$id.$opt.'" '
1414
+                               . 'class="'.$class.'" value="'.$value.'" '
1415
+                               . 'aria-label="'.esc_attr($required['msg']).'" '.$disabled
1416
+                               . $checked.' '.$extra.'/>';
1417 1417
                 $input_html .= ! $label_b4
1418 1418
                     ? "\n\t\t\t\t\t\t"
1419 1419
                       . '&nbsp;<span class="espresso-radio-btn-desc">'
1420 1420
                       . $label
1421 1421
                       . '</span>'
1422 1422
                     : '';
1423
-                $input_html .= "\n\t\t\t\t\t" . '</label>';
1423
+                $input_html .= "\n\t\t\t\t\t".'</label>';
1424 1424
                 $input_html .= $use_desc_4_label
1425 1425
                     ? ''
1426
-                    : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
1427
-                $input_html .= "\n\t\t\t\t" . '</li>';
1426
+                    : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
1427
+                $input_html .= "\n\t\t\t\t".'</li>';
1428 1428
             }
1429 1429
         }
1430 1430
 
1431
-        $input_html .= "\n\t\t\t" . '</ul>';
1431
+        $input_html .= "\n\t\t\t".'</ul>';
1432 1432
 
1433 1433
         $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1434
-        return $label_html . $input_html;
1434
+        return $label_html.$input_html;
1435 1435
     }
1436 1436
 
1437 1437
 
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
         $add_mobile_label = false
1468 1468
     ) {
1469 1469
         // need these
1470
-        if (! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1470
+        if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
1471 1471
             return null;
1472 1472
         }
1473 1473
         $answer = maybe_unserialize($answer);
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 
1478 1478
         foreach ($answer as $key => $value) {
1479 1479
             $key            = self::prep_option_value($key);
1480
-            $answer[ $key ] = self::prep_answer($value, $use_html_entities);
1480
+            $answer[$key] = self::prep_answer($value, $use_html_entities);
1481 1481
         }
1482 1482
 
1483 1483
         // prep the required array
@@ -1499,42 +1499,42 @@  discard block
 block discarded – undo
1499 1499
         );
1500 1500
 
1501 1501
         $input_html = $mobile_label
1502
-            . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $class . '-ul">';
1502
+            . '<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$class.'-ul">';
1503 1503
 
1504
-        $class .= ! empty($system_ID) ? ' ' . $system_ID : '';
1505
-        $class .= ! empty($required['class']) ? ' ' . $required['class'] : '';
1504
+        $class .= ! empty($system_ID) ? ' '.$system_ID : '';
1505
+        $class .= ! empty($required['class']) ? ' '.$required['class'] : '';
1506 1506
 
1507 1507
         foreach ($options as $OPT) {
1508
-            $value = $OPT->value();// self::prep_option_value( $OPT->value() );
1509
-            $size  = self::get_label_size_class($OPT->value() . ' ' . $OPT->desc());
1508
+            $value = $OPT->value(); // self::prep_option_value( $OPT->value() );
1509
+            $size  = self::get_label_size_class($OPT->value().' '.$OPT->desc());
1510 1510
             $text  = self::prep_answer($OPT->value());
1511 1511
             $desc  = $OPT->desc();
1512
-            $opt   = '-' . sanitize_key($value);
1512
+            $opt   = '-'.sanitize_key($value);
1513 1513
 
1514 1514
             $checked = is_array($answer) && in_array($text, $answer) ? ' checked' : '';
1515 1515
 
1516
-            $input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
1517
-            $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
1518
-            $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>&nbsp;' : '';
1516
+            $input_html .= "\n\t\t\t\t".'<li'.$size.'>';
1517
+            $input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
1518
+            $input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>&nbsp;' : '';
1519 1519
             $input_html .= "\n\t\t\t\t\t\t"
1520
-                           . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" '
1521
-                           . 'id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" '
1522
-                           . 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
1523
-            $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '&nbsp;<span>' . $text . '</span>' : '';
1524
-            $input_html .= "\n\t\t\t\t\t" . '</label>';
1525
-            if (! empty($desc) && $desc != $text) {
1520
+                           . '<input type="checkbox" name="'.$name.'['.$OPT->ID().']" '
1521
+                           . 'id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" '
1522
+                           . 'aria-label="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
1523
+            $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'&nbsp;<span>'.$text.'</span>' : '';
1524
+            $input_html .= "\n\t\t\t\t\t".'</label>';
1525
+            if ( ! empty($desc) && $desc != $text) {
1526 1526
                 $input_html .= "\n\t\t\t\t\t"
1527 1527
                                . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'
1528 1528
                                . $desc
1529 1529
                                . '</div>';
1530 1530
             }
1531
-            $input_html .= "\n\t\t\t\t" . '</li>';
1531
+            $input_html .= "\n\t\t\t\t".'</li>';
1532 1532
         }
1533 1533
 
1534
-        $input_html .= "\n\t\t\t" . '</ul>';
1534
+        $input_html .= "\n\t\t\t".'</ul>';
1535 1535
 
1536 1536
         $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1537
-        return $label_html . $input_html;
1537
+        return $label_html.$input_html;
1538 1538
     }
1539 1539
 
1540 1540
 
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
         $add_mobile_label = false
1568 1568
     ) {
1569 1569
         // need these
1570
-        if (! $question || ! $name) {
1570
+        if ( ! $question || ! $name) {
1571 1571
             return null;
1572 1572
         }
1573 1573
         // prep the answer
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
         // ya gots ta have style man!!!
1580 1580
         $txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1581 1581
         $class     = empty($class) ? $txt_class : $class;
1582
-        $class     .= ! empty($system_ID) ? ' ' . $system_ID : '';
1582
+        $class .= ! empty($system_ID) ? ' '.$system_ID : '';
1583 1583
         $class = self::appendInputSizeClass($class, $answer);
1584 1584
         $extra     = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1585 1585
 
@@ -1594,14 +1594,14 @@  discard block
 block discarded – undo
1594 1594
         );
1595 1595
 
1596 1596
         $input_html = $mobile_label
1597
-            . '<input type="text" name="' . $name . '" id="' . $id . '" '
1598
-            . 'class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  '
1599
-            . 'aria-label="' . esc_attr($required['msg']) . '" ' . $disabled . ' ' . $extra . '/>';
1597
+            . '<input type="text" name="'.$name.'" id="'.$id.'" '
1598
+            . 'class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'"  '
1599
+            . 'aria-label="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
1600 1600
 
1601 1601
         // enqueue scripts
1602 1602
         wp_register_style(
1603 1603
             'espresso-ui-theme',
1604
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1604
+            EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
1605 1605
             [],
1606 1606
             EVENT_ESPRESSO_VERSION
1607 1607
         );
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
         wp_enqueue_script('jquery-ui-datepicker');
1610 1610
 
1611 1611
         $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1612
-        return $label_html . $input_html;
1612
+        return $label_html.$input_html;
1613 1613
     }
1614 1614
 
1615 1615
 
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
     public static function hidden_input($name, $value, $id = '')
1637 1637
     {
1638 1638
         $id = ! empty($id) ? $id : $name;
1639
-        return '<input id="' . $id . '" type="hidden" name="' . $name . '" value="' . $value . '"/>';
1639
+        return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1640 1640
     }
1641 1641
 
1642 1642
 
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
         $prepped_answer_options = [];
1682 1682
         if (is_array($QSOs) && ! empty($QSOs)) {
1683 1683
             foreach ($QSOs as $key => $QSO) {
1684
-                if (! $QSO instanceof EE_Question_Option) {
1684
+                if ( ! $QSO instanceof EE_Question_Option) {
1685 1685
                     $QSO = EE_Question_Option::new_instance(
1686 1686
                         [
1687 1687
                             'QSO_value' => is_array($QSO) && isset($QSO['id'])
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
                     );
1695 1695
                 }
1696 1696
                 if ($QSO->opt_group()) {
1697
-                    $prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1697
+                    $prepped_answer_options[$QSO->opt_group()][] = $QSO;
1698 1698
                 } else {
1699 1699
                     $prepped_answer_options[] = $QSO;
1700 1700
                 }
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
         $options = [];
1907 1907
         for ($x = 1; $x <= 12; $x++) {
1908 1908
             $mm             = str_pad($x, 2, '0', STR_PAD_LEFT);
1909
-            $options[ $mm ] = $mm;
1909
+            $options[$mm] = $mm;
1910 1910
         }
1911 1911
         return EEH_Form_Fields::prep_answer_options($options);
1912 1912
     }
@@ -1924,7 +1924,7 @@  discard block
 block discarded – undo
1924 1924
         $next_decade  = $current_year + 10;
1925 1925
         for ($x = $current_year; $x <= $next_decade; $x++) {
1926 1926
             $yy             = str_pad($x, 2, '0', STR_PAD_LEFT);
1927
-            $options[ $yy ] = $yy;
1927
+            $options[$yy] = $yy;
1928 1928
         }
1929 1929
         return EEH_Form_Fields::prep_answer_options($options);
1930 1930
     }
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
     public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0)
1944 1944
     {
1945 1945
         $_where = [];
1946
-        if (! empty($status)) {
1946
+        if ( ! empty($status)) {
1947 1947
             $_where['STS_ID'] = $status;
1948 1948
         }
1949 1949
 
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
         ];
1963 1963
 
1964 1964
         foreach ($regdtts as $regdtt) {
1965
-            $date      = $regdtt->reg_month . ' ' . $regdtt->reg_year;
1965
+            $date      = $regdtt->reg_month.' '.$regdtt->reg_year;
1966 1966
             $options[] = [
1967 1967
                 'text' => $date,
1968 1968
                 'id'   => $date,
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
         // categories?
2012 2012
 
2013 2013
 
2014
-        if (! empty($evt_category) and $evt_category > 0) {
2014
+        if ( ! empty($evt_category) and $evt_category > 0) {
2015 2015
             $where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
2016 2016
             $where['Event.Term_Taxonomy.term_id']  = $evt_category;
2017 2017
         }
@@ -2034,8 +2034,8 @@  discard block
 block discarded – undo
2034 2034
         global $wp_locale;
2035 2035
 
2036 2036
         foreach ($DTTS as $DTT) {
2037
-            $localized_date = $wp_locale->get_month($DTT->dtt_month_num) . ' ' . $DTT->dtt_year;
2038
-            $id             = $DTT->dtt_month . ' ' . $DTT->dtt_year;
2037
+            $localized_date = $wp_locale->get_month($DTT->dtt_month_num).' '.$DTT->dtt_year;
2038
+            $id             = $DTT->dtt_month.' '.$DTT->dtt_year;
2039 2039
             $options[]      = [
2040 2040
                 'text' => $localized_date,
2041 2041
                 'id'   => $id,
@@ -2108,16 +2108,16 @@  discard block
 block discarded – undo
2108 2108
             return $btn;
2109 2109
         }
2110 2110
         $text = ! empty($text) ? $text : esc_html__('Submit', 'event_espresso');
2111
-        $btn  .= '<input id="' . $ID . '-btn" class="' . $class . '" '
2112
-                 . 'type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
2113
-        if (! $input_only) {
2114
-            $btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
2111
+        $btn .= '<input id="'.$ID.'-btn" class="'.$class.'" '
2112
+                 . 'type="submit" value="'.$text.'" '.$extra_attributes.'/>';
2113
+        if ( ! $input_only) {
2114
+            $btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
2115 2115
             $btn_frm .= ! empty($nonce_action)
2116
-                ? wp_nonce_field($nonce_action, $nonce_action . '_nonce', true, false)
2116
+                ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', true, false)
2117 2117
                 : '';
2118 2118
             $btn_frm .= $btn;
2119 2119
             $btn_frm .= '</form>';
2120
-            $btn     = $btn_frm;
2120
+            $btn = $btn_frm;
2121 2121
             unset($btn_frm);
2122 2122
         }
2123 2123
         return $btn;
Please login to merge, or discard this patch.
core/helpers/EEH_Export.helper.php 2 patches
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -13,172 +13,172 @@
 block discarded – undo
13 13
  */
14 14
 class EEH_Export
15 15
 {
16
-    /**
17
-     * Gets the 'normal' column named for fields
18
-     * @param EE_Model_Field_Base $field
19
-     * @return string
20
-     * @throws EE_Error
21
-     */
22
-    public static function get_column_name_for_field(EE_Model_Field_Base $field)
23
-    {
24
-        $column_name = wp_specialchars_decode($field->get_nicename(), ENT_QUOTES);
25
-        if (
26
-            apply_filters(
27
-                'FHEE__EEH_Export__get_column_name_for_field__add_field_name',
28
-                false,
29
-                $column_name,
30
-                $field
31
-            )
32
-        ) {
33
-            $column_name .= "["
34
-                . wp_specialchars_decode($field->get_name(), ENT_QUOTES)
35
-                . "]";
36
-        }
37
-        return $column_name;
38
-    }
39
-
40
-
41
-    /**
42
-     * Writes $data to the csv file open in $filehandle. uses the array indices of $data for column headers
43
-     *
44
-     * @param string $filepath
45
-     * @param array  $data                  2D array,first numerically-indexed,
46
-     *                                      and next-level-down preferably indexed by string
47
-     * @param bool   $write_column_headers  whether or not we should add the keys in the bottom-most array
48
-     *                                      as a row for headers in the CSV.
49
-     *                                      Eg, if $data looked like:
50
-     *                                          array(
51
-     *                                              0=>array('EVT_ID'=>1,'EVT_name'=>'monkey'...),
52
-     *                                              1=>array(...,...)
53
-     *                                          )
54
-     * @param bool   $headers_only          if true then we won't print any data, just headers. defaults to false
55
-     * @return boolean                      if we successfully wrote to the CSV or not. If there's no $data,
56
-     *                                      we consider that a success (because we wrote everything there was...nothing)
57
-     * @throws EE_Error
58
-     */
59
-    public static function write_data_array_to_csv(
60
-        string $filepath,
61
-        array $data,
62
-        bool $write_column_headers = true,
63
-        bool $headers_only = false
64
-    ) {
65
-        // determine if $data is actually a 2d array
66
-        if ($data && is_array($data) && is_array(EEH_Array::get_one_item_from_array($data))) {
67
-            // make sure top level is numerically indexed,
68
-            if (EEH_Array::is_associative_array($data)) {
69
-                throw new EE_Error(sprintf(esc_html__("top-level array must be numerically indexed. Does these look like numbers to you? %s", "event_espresso"), implode(",", array_keys($data))));
70
-            }
71
-            $new_file_contents = '';
72
-            $item_in_top_level_array = EEH_Array::get_one_item_from_array($data);
73
-            // now, is the last item in the top-level array of $data an associative or numeric array?
74
-            if ($write_column_headers && EEH_Array::is_associative_array($item_in_top_level_array)) {
75
-                // its associative, so we want to output its keys as column headers
76
-                $keys = array_keys($item_in_top_level_array);
77
-                $new_file_contents .=  EEH_Export::get_csv_row($keys);
78
-                if ($headers_only) {
79
-                    return EEH_File::write_to_file(
80
-                        $filepath,
81
-                        EEH_File::get_file_contents($filepath) . $new_file_contents
82
-                    );
83
-                }
84
-            }
85
-            // start writing data
86
-            foreach ($data as $data_row) {
87
-                $new_row = EEH_Export::get_csv_row($data_row);
88
-                $new_file_contents .= $new_row ?: '';
89
-            }
90
-            return EEH_File::write_to_file($filepath, EEH_File::get_file_contents($filepath) . $new_file_contents);
91
-        }
92
-        // no data TO write... so we can assume that's a success
93
-        return true;
94
-    }
95
-
96
-
97
-
98
-     /**
99
-      *
100
-     *  Writes a row to the csv file
101
-     *  @param array $row - individual row of csv data
102
-     *  @param string $delimiter - csv delimiter
103
-     *  @param string $enclosure - csv enclosure
104
-     *  @param bool $mysql_null - allows php NULL to be overridden with MySQl's insertable NULL value
105
-     *  @return string of text for teh csv file
106
-     */
107
-    public static function get_csv_row(array $row, $delimiter = ',', $enclosure = '"', $mysql_null = false)
108
-    {
109
-        // Allow user to filter the csv delimiter and enclosure for other countries csv standards
110
-        $delimiter = apply_filters('FHEE__EE_CSV__fputcsv2__delimiter', $delimiter);
111
-        $enclosure = apply_filters('FHEE__EE_CSV__fputcsv2__enclosure', $enclosure);
112
-
113
-        $delimiter_esc = preg_quote($delimiter, '/');
114
-        $enclosure_esc = preg_quote($enclosure, '/');
115
-
116
-        $output = array();
117
-        foreach ($row as $field_value) {
118
-            if (is_object($field_value) || is_array($field_value)) {
119
-                $field_value = serialize($field_value);
120
-            }
121
-            if ($field_value === null && $mysql_null) {
122
-                $output[] = 'NULL';
123
-                continue;
124
-            }
125
-
126
-            $output[] = $field_value && preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field_value)
127
-                ? ( $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field_value) . $enclosure )
128
-                : $field_value;
129
-        }
130
-
131
-        return  implode($delimiter, $output) . PHP_EOL;
132
-    }
133
-
134
-
135
-
136
-    /**
137
-     * Shortcut for preparing a database result for display
138
-     * @param EEM_Base $model
139
-     * @param string $field_name
140
-     * @param string $raw_db_value
141
-     * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
142
-     * @return string
143
-     */
144
-    public static function prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true)
145
-    {
146
-        $field_obj = $model->field_settings_for($field_name);
147
-        $value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
148
-        if ($field_obj instanceof EE_Datetime_Field) {
149
-            $field_obj->set_date_format(EEH_Export::get_date_format_for_export($field_obj->get_date_format($pretty_schema)), $pretty_schema);
150
-            $field_obj->set_time_format(EEH_Export::get_time_format_for_export($field_obj->get_time_format($pretty_schema)), $pretty_schema);
151
-        }
152
-        if ($pretty_schema === true) {
153
-            return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
154
-        } elseif (is_string($pretty_schema)) {
155
-            return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
156
-        } else {
157
-            return $field_obj->prepare_for_get($value_on_model_obj);
158
-        }
159
-    }
160
-
161
-
162
-
163
-    /**
164
-     * Gets the date format to use in exports. filterable
165
-     * @param string $current_format
166
-     * @return string
167
-     */
168
-    public static function get_date_format_for_export($current_format = null)
169
-    {
170
-        return apply_filters('FHEE__EE_CSV__get_date_format_for_csv__format', 'Y-m-d', $current_format);
171
-    }
172
-
173
-
174
-
175
-    /**
176
-     * Gets the time format we want to use in exports. Filterable
177
-     * @param string $current_format
178
-     * @return string
179
-     */
180
-    public static function get_time_format_for_export($current_format = null)
181
-    {
182
-        return apply_filters('FHEE__EE_CSV__get_time_format_for_csv__format', 'H:i:s', $current_format);
183
-    }
16
+	/**
17
+	 * Gets the 'normal' column named for fields
18
+	 * @param EE_Model_Field_Base $field
19
+	 * @return string
20
+	 * @throws EE_Error
21
+	 */
22
+	public static function get_column_name_for_field(EE_Model_Field_Base $field)
23
+	{
24
+		$column_name = wp_specialchars_decode($field->get_nicename(), ENT_QUOTES);
25
+		if (
26
+			apply_filters(
27
+				'FHEE__EEH_Export__get_column_name_for_field__add_field_name',
28
+				false,
29
+				$column_name,
30
+				$field
31
+			)
32
+		) {
33
+			$column_name .= "["
34
+				. wp_specialchars_decode($field->get_name(), ENT_QUOTES)
35
+				. "]";
36
+		}
37
+		return $column_name;
38
+	}
39
+
40
+
41
+	/**
42
+	 * Writes $data to the csv file open in $filehandle. uses the array indices of $data for column headers
43
+	 *
44
+	 * @param string $filepath
45
+	 * @param array  $data                  2D array,first numerically-indexed,
46
+	 *                                      and next-level-down preferably indexed by string
47
+	 * @param bool   $write_column_headers  whether or not we should add the keys in the bottom-most array
48
+	 *                                      as a row for headers in the CSV.
49
+	 *                                      Eg, if $data looked like:
50
+	 *                                          array(
51
+	 *                                              0=>array('EVT_ID'=>1,'EVT_name'=>'monkey'...),
52
+	 *                                              1=>array(...,...)
53
+	 *                                          )
54
+	 * @param bool   $headers_only          if true then we won't print any data, just headers. defaults to false
55
+	 * @return boolean                      if we successfully wrote to the CSV or not. If there's no $data,
56
+	 *                                      we consider that a success (because we wrote everything there was...nothing)
57
+	 * @throws EE_Error
58
+	 */
59
+	public static function write_data_array_to_csv(
60
+		string $filepath,
61
+		array $data,
62
+		bool $write_column_headers = true,
63
+		bool $headers_only = false
64
+	) {
65
+		// determine if $data is actually a 2d array
66
+		if ($data && is_array($data) && is_array(EEH_Array::get_one_item_from_array($data))) {
67
+			// make sure top level is numerically indexed,
68
+			if (EEH_Array::is_associative_array($data)) {
69
+				throw new EE_Error(sprintf(esc_html__("top-level array must be numerically indexed. Does these look like numbers to you? %s", "event_espresso"), implode(",", array_keys($data))));
70
+			}
71
+			$new_file_contents = '';
72
+			$item_in_top_level_array = EEH_Array::get_one_item_from_array($data);
73
+			// now, is the last item in the top-level array of $data an associative or numeric array?
74
+			if ($write_column_headers && EEH_Array::is_associative_array($item_in_top_level_array)) {
75
+				// its associative, so we want to output its keys as column headers
76
+				$keys = array_keys($item_in_top_level_array);
77
+				$new_file_contents .=  EEH_Export::get_csv_row($keys);
78
+				if ($headers_only) {
79
+					return EEH_File::write_to_file(
80
+						$filepath,
81
+						EEH_File::get_file_contents($filepath) . $new_file_contents
82
+					);
83
+				}
84
+			}
85
+			// start writing data
86
+			foreach ($data as $data_row) {
87
+				$new_row = EEH_Export::get_csv_row($data_row);
88
+				$new_file_contents .= $new_row ?: '';
89
+			}
90
+			return EEH_File::write_to_file($filepath, EEH_File::get_file_contents($filepath) . $new_file_contents);
91
+		}
92
+		// no data TO write... so we can assume that's a success
93
+		return true;
94
+	}
95
+
96
+
97
+
98
+	 /**
99
+	  *
100
+	  *  Writes a row to the csv file
101
+	  *  @param array $row - individual row of csv data
102
+	  *  @param string $delimiter - csv delimiter
103
+	  *  @param string $enclosure - csv enclosure
104
+	  *  @param bool $mysql_null - allows php NULL to be overridden with MySQl's insertable NULL value
105
+	  *  @return string of text for teh csv file
106
+	  */
107
+	public static function get_csv_row(array $row, $delimiter = ',', $enclosure = '"', $mysql_null = false)
108
+	{
109
+		// Allow user to filter the csv delimiter and enclosure for other countries csv standards
110
+		$delimiter = apply_filters('FHEE__EE_CSV__fputcsv2__delimiter', $delimiter);
111
+		$enclosure = apply_filters('FHEE__EE_CSV__fputcsv2__enclosure', $enclosure);
112
+
113
+		$delimiter_esc = preg_quote($delimiter, '/');
114
+		$enclosure_esc = preg_quote($enclosure, '/');
115
+
116
+		$output = array();
117
+		foreach ($row as $field_value) {
118
+			if (is_object($field_value) || is_array($field_value)) {
119
+				$field_value = serialize($field_value);
120
+			}
121
+			if ($field_value === null && $mysql_null) {
122
+				$output[] = 'NULL';
123
+				continue;
124
+			}
125
+
126
+			$output[] = $field_value && preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field_value)
127
+				? ( $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field_value) . $enclosure )
128
+				: $field_value;
129
+		}
130
+
131
+		return  implode($delimiter, $output) . PHP_EOL;
132
+	}
133
+
134
+
135
+
136
+	/**
137
+	 * Shortcut for preparing a database result for display
138
+	 * @param EEM_Base $model
139
+	 * @param string $field_name
140
+	 * @param string $raw_db_value
141
+	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
142
+	 * @return string
143
+	 */
144
+	public static function prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true)
145
+	{
146
+		$field_obj = $model->field_settings_for($field_name);
147
+		$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
148
+		if ($field_obj instanceof EE_Datetime_Field) {
149
+			$field_obj->set_date_format(EEH_Export::get_date_format_for_export($field_obj->get_date_format($pretty_schema)), $pretty_schema);
150
+			$field_obj->set_time_format(EEH_Export::get_time_format_for_export($field_obj->get_time_format($pretty_schema)), $pretty_schema);
151
+		}
152
+		if ($pretty_schema === true) {
153
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
154
+		} elseif (is_string($pretty_schema)) {
155
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
156
+		} else {
157
+			return $field_obj->prepare_for_get($value_on_model_obj);
158
+		}
159
+	}
160
+
161
+
162
+
163
+	/**
164
+	 * Gets the date format to use in exports. filterable
165
+	 * @param string $current_format
166
+	 * @return string
167
+	 */
168
+	public static function get_date_format_for_export($current_format = null)
169
+	{
170
+		return apply_filters('FHEE__EE_CSV__get_date_format_for_csv__format', 'Y-m-d', $current_format);
171
+	}
172
+
173
+
174
+
175
+	/**
176
+	 * Gets the time format we want to use in exports. Filterable
177
+	 * @param string $current_format
178
+	 * @return string
179
+	 */
180
+	public static function get_time_format_for_export($current_format = null)
181
+	{
182
+		return apply_filters('FHEE__EE_CSV__get_time_format_for_csv__format', 'H:i:s', $current_format);
183
+	}
184 184
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
             if ($write_column_headers && EEH_Array::is_associative_array($item_in_top_level_array)) {
75 75
                 // its associative, so we want to output its keys as column headers
76 76
                 $keys = array_keys($item_in_top_level_array);
77
-                $new_file_contents .=  EEH_Export::get_csv_row($keys);
77
+                $new_file_contents .= EEH_Export::get_csv_row($keys);
78 78
                 if ($headers_only) {
79 79
                     return EEH_File::write_to_file(
80 80
                         $filepath,
81
-                        EEH_File::get_file_contents($filepath) . $new_file_contents
81
+                        EEH_File::get_file_contents($filepath).$new_file_contents
82 82
                     );
83 83
                 }
84 84
             }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 $new_row = EEH_Export::get_csv_row($data_row);
88 88
                 $new_file_contents .= $new_row ?: '';
89 89
             }
90
-            return EEH_File::write_to_file($filepath, EEH_File::get_file_contents($filepath) . $new_file_contents);
90
+            return EEH_File::write_to_file($filepath, EEH_File::get_file_contents($filepath).$new_file_contents);
91 91
         }
92 92
         // no data TO write... so we can assume that's a success
93 93
         return true;
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
             }
125 125
 
126 126
             $output[] = $field_value && preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field_value)
127
-                ? ( $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field_value) . $enclosure )
127
+                ? ($enclosure.str_replace($enclosure, $enclosure.$enclosure, $field_value).$enclosure)
128 128
                 : $field_value;
129 129
         }
130 130
 
131
-        return  implode($delimiter, $output) . PHP_EOL;
131
+        return  implode($delimiter, $output).PHP_EOL;
132 132
     }
133 133
 
134 134
 
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 2 patches
Indentation   +924 added lines, -924 removed lines patch added patch discarded remove patch
@@ -7,36 +7,36 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\services\request\sanitizers\AllowedTags;
8 8
 
9 9
 if (! function_exists('espresso_get_template_part')) {
10
-    /**
11
-     * espresso_get_template_part
12
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
13
-     * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
14
-     *
15
-     * @param string $slug The slug name for the generic template.
16
-     * @param string $name The name of the specialised template.
17
-     */
18
-    function espresso_get_template_part($slug = null, $name = null)
19
-    {
20
-        EEH_Template::get_template_part($slug, $name);
21
-    }
10
+	/**
11
+	 * espresso_get_template_part
12
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
13
+	 * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
14
+	 *
15
+	 * @param string $slug The slug name for the generic template.
16
+	 * @param string $name The name of the specialised template.
17
+	 */
18
+	function espresso_get_template_part($slug = null, $name = null)
19
+	{
20
+		EEH_Template::get_template_part($slug, $name);
21
+	}
22 22
 }
23 23
 
24 24
 
25 25
 if (! function_exists('espresso_get_object_css_class')) {
26
-    /**
27
-     * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
28
-     *
29
-     * @param EE_Base_Class $object the EE object the css class is being generated for
30
-     * @param string        $prefix added to the beginning of the generated class
31
-     * @param string        $suffix added to the end of the generated class
32
-     * @return string
33
-     * @throws EE_Error
34
-     * @throws ReflectionException
35
-     */
36
-    function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
37
-    {
38
-        return EEH_Template::get_object_css_class($object, $prefix, $suffix);
39
-    }
26
+	/**
27
+	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
28
+	 *
29
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
30
+	 * @param string        $prefix added to the beginning of the generated class
31
+	 * @param string        $suffix added to the end of the generated class
32
+	 * @return string
33
+	 * @throws EE_Error
34
+	 * @throws ReflectionException
35
+	 */
36
+	function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
37
+	{
38
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
39
+	}
40 40
 }
41 41
 
42 42
 
@@ -50,651 +50,651 @@  discard block
 block discarded – undo
50 50
  */
51 51
 class EEH_Template
52 52
 {
53
-    private static $_espresso_themes = [];
54
-
55
-
56
-    /**
57
-     *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
58
-     *
59
-     * @return boolean
60
-     */
61
-    public static function is_espresso_theme()
62
-    {
63
-        return wp_get_theme()->get('TextDomain') === 'event_espresso';
64
-    }
65
-
66
-
67
-    /**
68
-     *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
69
-     *    load its functions.php file ( if not already loaded )
70
-     *
71
-     * @return void
72
-     */
73
-    public static function load_espresso_theme_functions()
74
-    {
75
-        if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
76
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
77
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
78
-            }
79
-        }
80
-    }
81
-
82
-
83
-    /**
84
-     *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
85
-     *
86
-     * @return array
87
-     */
88
-    public static function get_espresso_themes()
89
-    {
90
-        if (empty(EEH_Template::$_espresso_themes)) {
91
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
92
-            if (empty($espresso_themes)) {
93
-                return [];
94
-            }
95
-            if (($key = array_search('global_assets', $espresso_themes)) !== false) {
96
-                unset($espresso_themes[ $key ]);
97
-            }
98
-            EEH_Template::$_espresso_themes = [];
99
-            foreach ($espresso_themes as $espresso_theme) {
100
-                EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
101
-            }
102
-        }
103
-        return EEH_Template::$_espresso_themes;
104
-    }
105
-
106
-
107
-    /**
108
-     * EEH_Template::get_template_part
109
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
110
-     * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
111
-     * filtering based off of the entire template part name
112
-     *
113
-     * @param string $slug The slug name for the generic template.
114
-     * @param string $name The name of the specialised template.
115
-     * @param array  $template_args
116
-     * @param bool   $return_string
117
-     * @return string        the html output for the formatted money value
118
-     */
119
-    public static function get_template_part(
120
-        $slug = null,
121
-        $name = null,
122
-        $template_args = [],
123
-        $return_string = false
124
-    ) {
125
-        do_action("get_template_part_{$slug}-{$name}", $slug, $name);
126
-        $templates = [];
127
-        $name      = (string) $name;
128
-        if ($name != '') {
129
-            $templates[] = "{$slug}-{$name}.php";
130
-        }
131
-        // allow template parts to be turned off via something like:
132
-        // add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-        if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
134
-            return EEH_Template::locate_template($templates, $template_args, true, $return_string);
135
-        }
136
-        return '';
137
-    }
138
-
139
-
140
-    /**
141
-     *    locate_template
142
-     *    locate a template file by looking in the following places, in the following order:
143
-     *        <server path up to>/wp-content/themes/<current active WordPress theme>/
144
-     *        <assumed full absolute server path>
145
-     *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
146
-     *        <server path up to>/wp-content/uploads/espresso/templates/
147
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
148
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
149
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/
150
-     *    as soon as the template is found in one of these locations, it will be returned or loaded
151
-     *        Example:
152
-     *          You are using the WordPress Twenty Sixteen theme,
153
-     *        and you want to customize the "some-event.template.php" template,
154
-     *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
155
-     *          Assuming WP is installed on your server in the "/home/public_html/" folder,
156
-     *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
157
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
158
-     *        /relative/path/to/some-event.template.php
159
-     *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
160
-     *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
161
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
162
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
163
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
164
-     *          Had you passed an absolute path to your template that was in some other location,
165
-     *        ie: "/absolute/path/to/some-event.template.php"
166
-     *          then the search would have been :
167
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
168
-     *        /absolute/path/to/some-event.template.php
169
-     *          and stopped there upon finding it in the second location
170
-     *
171
-     * @param array|string $templates       array of template file names including extension (or just a single string)
172
-     * @param array        $template_args   an array of arguments to be extracted for use in the template
173
-     * @param boolean      $load            whether to pass the located template path on to the
174
-     *                                      EEH_Template::display_template() method or simply return it
175
-     * @param boolean      $return_string   whether to send output immediately to screen, or capture and return as a
176
-     *                                      string
177
-     * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
178
-     *                                      generate a custom template or not. Used in places where you don't actually
179
-     *                                      load the template, you just want to know if there's a custom version of it.
180
-     * @return mixed
181
-     * @throws DomainException
182
-     * @throws InvalidArgumentException
183
-     * @throws InvalidDataTypeException
184
-     * @throws InvalidInterfaceException
185
-     */
186
-    public static function locate_template(
187
-        $templates = [],
188
-        array $template_args = [],
189
-        bool $load = true,
190
-        bool $return_string = true,
191
-        bool $check_if_custom = false
192
-    ) {
193
-        // first use WP locate_template to check for template in the current theme folder
194
-        $template_path = locate_template($templates);
195
-
196
-        if ($check_if_custom && ! empty($template_path)) {
197
-            return true;
198
-        }
199
-
200
-        // not in the theme
201
-        if (empty($template_path)) {
202
-            // not even a template to look for ?
203
-            if (empty($templates)) {
204
-                $loader = LoaderFactory::getLoader();
205
-                /** @var RequestInterface $request */
206
-                $request = $loader->getShared(RequestInterface::class);
207
-                // get post_type
208
-                $post_type = $request->getRequestParam('post_type');
209
-                /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_types */
210
-                $custom_post_types = $loader->getShared(
211
-                    'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
212
-                );
213
-                // get array of EE Custom Post Types
214
-                $EE_CPTs = $custom_post_types->getDefinitions();
215
-                // build template name based on request
216
-                if (isset($EE_CPTs[ $post_type ])) {
217
-                    $archive_or_single = is_archive() ? 'archive' : '';
218
-                    $archive_or_single = is_single() ? 'single' : $archive_or_single;
219
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
220
-                }
221
-            }
222
-            // currently active EE template theme
223
-            $current_theme = EE_Config::get_current_theme();
224
-
225
-            // array of paths to folders that may contain templates
226
-            $template_folder_paths = [
227
-                // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
228
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
229
-                // then in the root of the /wp-content/uploads/espresso/templates/ folder
230
-                EVENT_ESPRESSO_TEMPLATE_DIR,
231
-            ];
232
-
233
-            // add core plugin folders for checking only if we're not $check_if_custom
234
-            if (! $check_if_custom) {
235
-                $core_paths            = [
236
-                    // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
237
-                    EE_PUBLIC . $current_theme,
238
-                    // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
239
-                    EE_TEMPLATES . $current_theme,
240
-                    // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
241
-                    EE_PLUGIN_DIR_PATH,
242
-                ];
243
-                $template_folder_paths = array_merge($template_folder_paths, $core_paths);
244
-            }
245
-
246
-            // now filter that array
247
-            $template_folder_paths = apply_filters(
248
-                'FHEE__EEH_Template__locate_template__template_folder_paths',
249
-                $template_folder_paths
250
-            );
251
-            $templates             = is_array($templates) ? $templates : [$templates];
252
-            $template_folder_paths =
253
-                is_array($template_folder_paths) ? $template_folder_paths : [$template_folder_paths];
254
-            // array to hold all possible template paths
255
-            $full_template_paths = [];
256
-            $file_name           = '';
257
-
258
-            // loop through $templates
259
-            foreach ($templates as $template) {
260
-                // normalize directory separators
261
-                $template                      = EEH_File::standardise_directory_separators($template);
262
-                $file_name                     = basename($template);
263
-                $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
264
-                // while looping through all template folder paths
265
-                foreach ($template_folder_paths as $template_folder_path) {
266
-                    // normalize directory separators
267
-                    $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
268
-                    // determine if any common base path exists between the two paths
269
-                    $common_base_path = EEH_Template::_find_common_base_path(
270
-                        [$template_folder_path, $template_path_minus_file_name]
271
-                    );
272
-                    if ($common_base_path !== '') {
273
-                        // both paths have a common base, so just tack the filename onto our search path
274
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
275
-                    } else {
276
-                        // no common base path, so let's just concatenate
277
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
278
-                    }
279
-                    // build up our template locations array by adding our resolved paths
280
-                    $full_template_paths[] = $resolved_path;
281
-                }
282
-                // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
283
-                array_unshift($full_template_paths, $template);
284
-                // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
285
-                array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
286
-            }
287
-            // filter final array of full template paths
288
-            $full_template_paths = apply_filters(
289
-                'FHEE__EEH_Template__locate_template__full_template_paths',
290
-                $full_template_paths,
291
-                $file_name
292
-            );
293
-            // now loop through our final array of template location paths and check each location
294
-            foreach ((array) $full_template_paths as $full_template_path) {
295
-                if (is_readable($full_template_path)) {
296
-                    $template_path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $full_template_path);
297
-                    break;
298
-                }
299
-            }
300
-        }
301
-
302
-        // Display a deprecated notice if the template file is located in the WordPress uploads directory
303
-        if (strpos($template_path, 'wp-content/uploads/espresso') !== false) {
304
-            EE_Error::doing_it_wrong(
305
-                __CLASS__,
306
-                esc_html__(
307
-                    'The use of the WordPress uploads directory as a location to override template files has been deprecated.',
308
-                    'event_espresso'
309
-                ),
310
-                '5.0.0'
311
-            );
312
-        }
313
-
314
-        // hook that can be used to display the full template path that will be used
315
-        do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
316
-
317
-        // if we got it and you want to see it...
318
-        if ($template_path && $load && ! $check_if_custom) {
319
-            if ($return_string) {
320
-                return EEH_Template::display_template($template_path, $template_args, true);
321
-            }
322
-            EEH_Template::display_template($template_path, $template_args);
323
-        }
324
-        return $check_if_custom && ! empty($template_path) ? true : $template_path;
325
-    }
326
-
327
-
328
-    /**
329
-     * _find_common_base_path
330
-     * given two paths, this determines if there is a common base path between the two
331
-     *
332
-     * @param array $paths
333
-     * @return string
334
-     */
335
-    protected static function _find_common_base_path($paths)
336
-    {
337
-        $last_offset      = 0;
338
-        $common_base_path = '';
339
-        while (($index = strpos($paths[0], '/', $last_offset)) !== false) {
340
-            $dir_length = $index - $last_offset + 1;
341
-            $directory  = substr($paths[0], $last_offset, $dir_length);
342
-            foreach ($paths as $path) {
343
-                if (substr($path, $last_offset, $dir_length) != $directory) {
344
-                    return $common_base_path;
345
-                }
346
-            }
347
-            $common_base_path .= $directory;
348
-            $last_offset      = $index + 1;
349
-        }
350
-        return substr($common_base_path, 0, -1);
351
-    }
352
-
353
-
354
-    /**
355
-     * load and display a template
356
-     *
357
-     * @param bool|string $template_path    server path to the file to be loaded, including file name and extension
358
-     * @param array       $template_args    an array of arguments to be extracted for use in the template
359
-     * @param boolean     $return_string    whether to send output immediately to screen, or capture and return as a
360
-     *                                      string
361
-     * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
362
-     *                                      not found or is not readable
363
-     * @return string
364
-     * @throws DomainException
365
-     */
366
-    public static function display_template(
367
-        $template_path = false,
368
-        $template_args = [],
369
-        $return_string = false,
370
-        $throw_exceptions = false
371
-    ) {
372
-        /**
373
-         * These two filters are intended for last minute changes to templates being loaded and/or template arg
374
-         * modifications.  NOTE... modifying these things can cause breakage as most templates running through
375
-         * the display_template method are templates we DON'T want modified (usually because of js
376
-         * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
377
-         * using this.
378
-         *
379
-         * @since 4.6.0
380
-         */
381
-        $template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
382
-        $template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
383
-
384
-        // you gimme nuttin - YOU GET NUTTIN !!
385
-        if (! $template_path || ! is_readable($template_path)) {
386
-            // ignore whether template is accessible ?
387
-            if ($throw_exceptions) {
388
-                throw new DomainException(
389
-                    esc_html__('Invalid, unreadable, or missing file.', 'event_espresso')
390
-                );
391
-            }
392
-            return '';
393
-        }
394
-        // if $template_args are not in an array, then make it so
395
-        if (! is_array($template_args) && ! is_object($template_args)) {
396
-            $template_args = [$template_args];
397
-        }
398
-        extract($template_args, EXTR_SKIP);
399
-
400
-        if ($return_string) {
401
-            // because we want to return a string, we are going to capture the output
402
-            ob_start();
403
-            include($template_path);
404
-            return ob_get_clean();
405
-        }
406
-        include($template_path);
407
-        return '';
408
-    }
409
-
410
-
411
-    /**
412
-     * get_object_css_class - attempts to generate a css class based on the type of EE object passed
413
-     *
414
-     * @param EE_Base_Class $object the EE object the css class is being generated for
415
-     * @param string        $prefix added to the beginning of the generated class
416
-     * @param string        $suffix added to the end of the generated class
417
-     * @return string
418
-     * @throws EE_Error
419
-     * @throws ReflectionException
420
-     */
421
-    public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
422
-    {
423
-        // in the beginning...
424
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
425
-        // da muddle
426
-        $class = '';
427
-        // the end
428
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
429
-        // is the passed object an EE object ?
430
-        if ($object instanceof EE_Base_Class) {
431
-            // grab the exact type of object
432
-            $obj_class = get_class($object);
433
-            // depending on the type of object...
434
-            switch ($obj_class) {
435
-                // no specifics just yet...
436
-                default:
437
-                    $class = strtolower(str_replace('_', '-', $obj_class));
438
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
439
-            }
440
-        }
441
-        return $prefix . $class . $suffix;
442
-    }
443
-
444
-
445
-    /**
446
-     * EEH_Template::format_currency
447
-     * This helper takes a raw float value and formats it according to the default config country currency settings, or
448
-     * the country currency settings from the supplied country ISO code
449
-     *
450
-     * @param float   $amount       raw money value
451
-     * @param boolean $return_raw   whether to return the formatted float value only with no currency sign or code
452
-     * @param boolean $display_code whether to display the country code (USD). Default = TRUE
453
-     * @param string  $CNT_ISO      2 letter ISO code for a country
454
-     * @param string  $cur_code_span_class
455
-     * @return string        the html output for the formatted money value
456
-     */
457
-    public static function format_currency(
458
-        $amount = null,
459
-        $return_raw = false,
460
-        $display_code = true,
461
-        $CNT_ISO = '',
462
-        $cur_code_span_class = 'currency-code'
463
-    ) {
464
-        // ensure amount was received
465
-        if ($amount === null) {
466
-            $msg = esc_html__('In order to format currency, an amount needs to be passed.', 'event_espresso');
467
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
468
-            return '';
469
-        }
470
-        // ensure amount is float
471
-        $amount  = (float) apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
472
-        $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
473
-        // filter raw amount (allows 0.00 to be changed to "free" for example)
474
-        $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
475
-        // still a number, or was amount converted to a string like "free" ?
476
-        if (! is_float($amount_formatted)) {
477
-            return esc_html($amount_formatted);
478
-        }
479
-        try {
480
-            // was a country ISO code passed ? if so generate currency config object for that country
481
-            $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
482
-        } catch (Exception $e) {
483
-            // eat exception
484
-            $mny = null;
485
-        }
486
-        // verify results
487
-        if (! $mny instanceof EE_Currency_Config) {
488
-            // set default config country currency settings
489
-            $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
490
-                ? EE_Registry::instance()->CFG->currency
491
-                : new EE_Currency_Config();
492
-        }
493
-        // format float
494
-        $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
495
-        // add formatting ?
496
-        if (! $return_raw) {
497
-            // add currency sign
498
-            if ($mny->sign_b4) {
499
-                if ($amount >= 0) {
500
-                    $amount_formatted = $mny->sign . $amount_formatted;
501
-                } else {
502
-                    $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
503
-                }
504
-            } else {
505
-                $amount_formatted = $amount_formatted . $mny->sign;
506
-            }
507
-
508
-            // filter to allow global setting of display_code
509
-            $display_code = (bool) apply_filters(
510
-                'FHEE__EEH_Template__format_currency__display_code',
511
-                $display_code
512
-            );
513
-
514
-            // add currency code ?
515
-            $amount_formatted = $display_code
516
-                ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">' . $mny->code . '</span>'
517
-                : $amount_formatted;
518
-        }
519
-        // filter results
520
-        $amount_formatted = apply_filters(
521
-            'FHEE__EEH_Template__format_currency__amount_formatted',
522
-            $amount_formatted,
523
-            $mny,
524
-            $return_raw
525
-        );
526
-        // clean up vars
527
-        unset($mny);
528
-        // return formatted currency amount
529
-        return $amount_formatted;
530
-    }
531
-
532
-
533
-    /**
534
-     * This function is used for outputting the localized label for a given status id in the schema requested (and
535
-     * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
536
-     * related status model or model object (i.e. in documentation etc.)
537
-     *
538
-     * @param string  $status_id  Status ID matching a registered status in the esp_status table.  If there is no
539
-     *                            match, then 'Unknown' will be returned.
540
-     * @param boolean $plural     Whether to return plural or not
541
-     * @param string  $schema     'UPPER', 'lower', or 'Sentence'
542
-     * @return string             The localized label for the status id.
543
-     * @throws EE_Error
544
-     */
545
-    public static function pretty_status($status_id, $plural = false, $schema = 'upper')
546
-    {
547
-        $status = EEM_Status::instance()->localized_status(
548
-            [$status_id => esc_html__('unknown', 'event_espresso')],
549
-            $plural,
550
-            $schema
551
-        );
552
-        return $status[ $status_id ];
553
-    }
554
-
555
-
556
-    /**
557
-     * This helper just returns a button or link for the given parameters
558
-     *
559
-     * @param string $url   the url for the link, note that `esc_url` will be called on it
560
-     * @param string $label What is the label you want displayed for the button
561
-     * @param string $class what class is used for the button (defaults to 'button--primary')
562
-     * @param string $icon
563
-     * @param string $title
564
-     * @return string the html output for the button
565
-     */
566
-    public static function get_button_or_link($url, $label, $class = 'button button--primary', $icon = '', $title = '')
567
-    {
568
-        $icon_html = '';
569
-        if (! empty($icon)) {
570
-            $dashicons = preg_split("(ee-icon |dashicons )", $icon);
571
-            $dashicons = array_filter($dashicons);
572
-            $count     = count($dashicons);
573
-            $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
574
-            foreach ($dashicons as $dashicon) {
575
-                $type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
576
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
577
-            }
578
-            $icon_html .= $count > 1 ? '</span>' : '';
579
-        }
580
-        // sanitize & escape
581
-        $id    = sanitize_title_with_dashes($label);
582
-        $url   = esc_url_raw($url);
583
-        $class = esc_attr($class);
584
-        $title = esc_attr($title);
585
-        $class .= $title ? ' ee-aria-tooltip' : '';
586
-        $title = $title ? " aria-label='{$title}'" : '';
587
-        $label = esc_html($label);
588
-        return "<a id='{$id}' href='{$url}' class='{$class}'{$title}>{$icon_html}{$label}</a>";
589
-    }
590
-
591
-
592
-    /**
593
-     * This returns a generated link that will load the related help tab on admin pages.
594
-     *
595
-     * @param string      $help_tab_id the id for the connected help tab
596
-     * @param bool|string $page        The page identifier for the page the help tab is on
597
-     * @param bool|string $action      The action (route) for the admin page the help tab is on.
598
-     * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
599
-     * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
600
-     * @return string              generated link
601
-     */
602
-    public static function get_help_tab_link(
603
-        $help_tab_id,
604
-        $page = false,
605
-        $action = false,
606
-        $icon_style = false,
607
-        $help_text = false
608
-    ) {
609
-        $allowedtags = AllowedTags::getAllowedTags();
610
-        /** @var RequestInterface $request */
611
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
612
-        $page    = $page ?: $request->getRequestParam('page', '', 'key');
613
-        $action  = $action ?: $request->getRequestParam('action', 'default', 'key');
614
-
615
-
616
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
617
-        $icon         = ! $icon_style ? 'dashicons-editor-help' : $icon_style;
618
-        $help_text    = ! $help_text ? '' : $help_text;
619
-        return '
53
+	private static $_espresso_themes = [];
54
+
55
+
56
+	/**
57
+	 *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
58
+	 *
59
+	 * @return boolean
60
+	 */
61
+	public static function is_espresso_theme()
62
+	{
63
+		return wp_get_theme()->get('TextDomain') === 'event_espresso';
64
+	}
65
+
66
+
67
+	/**
68
+	 *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
69
+	 *    load its functions.php file ( if not already loaded )
70
+	 *
71
+	 * @return void
72
+	 */
73
+	public static function load_espresso_theme_functions()
74
+	{
75
+		if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
76
+			if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
77
+				require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
78
+			}
79
+		}
80
+	}
81
+
82
+
83
+	/**
84
+	 *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
85
+	 *
86
+	 * @return array
87
+	 */
88
+	public static function get_espresso_themes()
89
+	{
90
+		if (empty(EEH_Template::$_espresso_themes)) {
91
+			$espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
92
+			if (empty($espresso_themes)) {
93
+				return [];
94
+			}
95
+			if (($key = array_search('global_assets', $espresso_themes)) !== false) {
96
+				unset($espresso_themes[ $key ]);
97
+			}
98
+			EEH_Template::$_espresso_themes = [];
99
+			foreach ($espresso_themes as $espresso_theme) {
100
+				EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
101
+			}
102
+		}
103
+		return EEH_Template::$_espresso_themes;
104
+	}
105
+
106
+
107
+	/**
108
+	 * EEH_Template::get_template_part
109
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
110
+	 * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
111
+	 * filtering based off of the entire template part name
112
+	 *
113
+	 * @param string $slug The slug name for the generic template.
114
+	 * @param string $name The name of the specialised template.
115
+	 * @param array  $template_args
116
+	 * @param bool   $return_string
117
+	 * @return string        the html output for the formatted money value
118
+	 */
119
+	public static function get_template_part(
120
+		$slug = null,
121
+		$name = null,
122
+		$template_args = [],
123
+		$return_string = false
124
+	) {
125
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
126
+		$templates = [];
127
+		$name      = (string) $name;
128
+		if ($name != '') {
129
+			$templates[] = "{$slug}-{$name}.php";
130
+		}
131
+		// allow template parts to be turned off via something like:
132
+		// add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
134
+			return EEH_Template::locate_template($templates, $template_args, true, $return_string);
135
+		}
136
+		return '';
137
+	}
138
+
139
+
140
+	/**
141
+	 *    locate_template
142
+	 *    locate a template file by looking in the following places, in the following order:
143
+	 *        <server path up to>/wp-content/themes/<current active WordPress theme>/
144
+	 *        <assumed full absolute server path>
145
+	 *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
146
+	 *        <server path up to>/wp-content/uploads/espresso/templates/
147
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
148
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
149
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/
150
+	 *    as soon as the template is found in one of these locations, it will be returned or loaded
151
+	 *        Example:
152
+	 *          You are using the WordPress Twenty Sixteen theme,
153
+	 *        and you want to customize the "some-event.template.php" template,
154
+	 *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
155
+	 *          Assuming WP is installed on your server in the "/home/public_html/" folder,
156
+	 *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
157
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
158
+	 *        /relative/path/to/some-event.template.php
159
+	 *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
160
+	 *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
161
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
162
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
163
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
164
+	 *          Had you passed an absolute path to your template that was in some other location,
165
+	 *        ie: "/absolute/path/to/some-event.template.php"
166
+	 *          then the search would have been :
167
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
168
+	 *        /absolute/path/to/some-event.template.php
169
+	 *          and stopped there upon finding it in the second location
170
+	 *
171
+	 * @param array|string $templates       array of template file names including extension (or just a single string)
172
+	 * @param array        $template_args   an array of arguments to be extracted for use in the template
173
+	 * @param boolean      $load            whether to pass the located template path on to the
174
+	 *                                      EEH_Template::display_template() method or simply return it
175
+	 * @param boolean      $return_string   whether to send output immediately to screen, or capture and return as a
176
+	 *                                      string
177
+	 * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
178
+	 *                                      generate a custom template or not. Used in places where you don't actually
179
+	 *                                      load the template, you just want to know if there's a custom version of it.
180
+	 * @return mixed
181
+	 * @throws DomainException
182
+	 * @throws InvalidArgumentException
183
+	 * @throws InvalidDataTypeException
184
+	 * @throws InvalidInterfaceException
185
+	 */
186
+	public static function locate_template(
187
+		$templates = [],
188
+		array $template_args = [],
189
+		bool $load = true,
190
+		bool $return_string = true,
191
+		bool $check_if_custom = false
192
+	) {
193
+		// first use WP locate_template to check for template in the current theme folder
194
+		$template_path = locate_template($templates);
195
+
196
+		if ($check_if_custom && ! empty($template_path)) {
197
+			return true;
198
+		}
199
+
200
+		// not in the theme
201
+		if (empty($template_path)) {
202
+			// not even a template to look for ?
203
+			if (empty($templates)) {
204
+				$loader = LoaderFactory::getLoader();
205
+				/** @var RequestInterface $request */
206
+				$request = $loader->getShared(RequestInterface::class);
207
+				// get post_type
208
+				$post_type = $request->getRequestParam('post_type');
209
+				/** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_types */
210
+				$custom_post_types = $loader->getShared(
211
+					'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
212
+				);
213
+				// get array of EE Custom Post Types
214
+				$EE_CPTs = $custom_post_types->getDefinitions();
215
+				// build template name based on request
216
+				if (isset($EE_CPTs[ $post_type ])) {
217
+					$archive_or_single = is_archive() ? 'archive' : '';
218
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
219
+					$templates         = $archive_or_single . '-' . $post_type . '.php';
220
+				}
221
+			}
222
+			// currently active EE template theme
223
+			$current_theme = EE_Config::get_current_theme();
224
+
225
+			// array of paths to folders that may contain templates
226
+			$template_folder_paths = [
227
+				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
228
+				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
229
+				// then in the root of the /wp-content/uploads/espresso/templates/ folder
230
+				EVENT_ESPRESSO_TEMPLATE_DIR,
231
+			];
232
+
233
+			// add core plugin folders for checking only if we're not $check_if_custom
234
+			if (! $check_if_custom) {
235
+				$core_paths            = [
236
+					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
237
+					EE_PUBLIC . $current_theme,
238
+					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
239
+					EE_TEMPLATES . $current_theme,
240
+					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
241
+					EE_PLUGIN_DIR_PATH,
242
+				];
243
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
244
+			}
245
+
246
+			// now filter that array
247
+			$template_folder_paths = apply_filters(
248
+				'FHEE__EEH_Template__locate_template__template_folder_paths',
249
+				$template_folder_paths
250
+			);
251
+			$templates             = is_array($templates) ? $templates : [$templates];
252
+			$template_folder_paths =
253
+				is_array($template_folder_paths) ? $template_folder_paths : [$template_folder_paths];
254
+			// array to hold all possible template paths
255
+			$full_template_paths = [];
256
+			$file_name           = '';
257
+
258
+			// loop through $templates
259
+			foreach ($templates as $template) {
260
+				// normalize directory separators
261
+				$template                      = EEH_File::standardise_directory_separators($template);
262
+				$file_name                     = basename($template);
263
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
264
+				// while looping through all template folder paths
265
+				foreach ($template_folder_paths as $template_folder_path) {
266
+					// normalize directory separators
267
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
268
+					// determine if any common base path exists between the two paths
269
+					$common_base_path = EEH_Template::_find_common_base_path(
270
+						[$template_folder_path, $template_path_minus_file_name]
271
+					);
272
+					if ($common_base_path !== '') {
273
+						// both paths have a common base, so just tack the filename onto our search path
274
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
275
+					} else {
276
+						// no common base path, so let's just concatenate
277
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
278
+					}
279
+					// build up our template locations array by adding our resolved paths
280
+					$full_template_paths[] = $resolved_path;
281
+				}
282
+				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
283
+				array_unshift($full_template_paths, $template);
284
+				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
285
+				array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
286
+			}
287
+			// filter final array of full template paths
288
+			$full_template_paths = apply_filters(
289
+				'FHEE__EEH_Template__locate_template__full_template_paths',
290
+				$full_template_paths,
291
+				$file_name
292
+			);
293
+			// now loop through our final array of template location paths and check each location
294
+			foreach ((array) $full_template_paths as $full_template_path) {
295
+				if (is_readable($full_template_path)) {
296
+					$template_path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $full_template_path);
297
+					break;
298
+				}
299
+			}
300
+		}
301
+
302
+		// Display a deprecated notice if the template file is located in the WordPress uploads directory
303
+		if (strpos($template_path, 'wp-content/uploads/espresso') !== false) {
304
+			EE_Error::doing_it_wrong(
305
+				__CLASS__,
306
+				esc_html__(
307
+					'The use of the WordPress uploads directory as a location to override template files has been deprecated.',
308
+					'event_espresso'
309
+				),
310
+				'5.0.0'
311
+			);
312
+		}
313
+
314
+		// hook that can be used to display the full template path that will be used
315
+		do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
316
+
317
+		// if we got it and you want to see it...
318
+		if ($template_path && $load && ! $check_if_custom) {
319
+			if ($return_string) {
320
+				return EEH_Template::display_template($template_path, $template_args, true);
321
+			}
322
+			EEH_Template::display_template($template_path, $template_args);
323
+		}
324
+		return $check_if_custom && ! empty($template_path) ? true : $template_path;
325
+	}
326
+
327
+
328
+	/**
329
+	 * _find_common_base_path
330
+	 * given two paths, this determines if there is a common base path between the two
331
+	 *
332
+	 * @param array $paths
333
+	 * @return string
334
+	 */
335
+	protected static function _find_common_base_path($paths)
336
+	{
337
+		$last_offset      = 0;
338
+		$common_base_path = '';
339
+		while (($index = strpos($paths[0], '/', $last_offset)) !== false) {
340
+			$dir_length = $index - $last_offset + 1;
341
+			$directory  = substr($paths[0], $last_offset, $dir_length);
342
+			foreach ($paths as $path) {
343
+				if (substr($path, $last_offset, $dir_length) != $directory) {
344
+					return $common_base_path;
345
+				}
346
+			}
347
+			$common_base_path .= $directory;
348
+			$last_offset      = $index + 1;
349
+		}
350
+		return substr($common_base_path, 0, -1);
351
+	}
352
+
353
+
354
+	/**
355
+	 * load and display a template
356
+	 *
357
+	 * @param bool|string $template_path    server path to the file to be loaded, including file name and extension
358
+	 * @param array       $template_args    an array of arguments to be extracted for use in the template
359
+	 * @param boolean     $return_string    whether to send output immediately to screen, or capture and return as a
360
+	 *                                      string
361
+	 * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
362
+	 *                                      not found or is not readable
363
+	 * @return string
364
+	 * @throws DomainException
365
+	 */
366
+	public static function display_template(
367
+		$template_path = false,
368
+		$template_args = [],
369
+		$return_string = false,
370
+		$throw_exceptions = false
371
+	) {
372
+		/**
373
+		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
374
+		 * modifications.  NOTE... modifying these things can cause breakage as most templates running through
375
+		 * the display_template method are templates we DON'T want modified (usually because of js
376
+		 * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
377
+		 * using this.
378
+		 *
379
+		 * @since 4.6.0
380
+		 */
381
+		$template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
382
+		$template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
383
+
384
+		// you gimme nuttin - YOU GET NUTTIN !!
385
+		if (! $template_path || ! is_readable($template_path)) {
386
+			// ignore whether template is accessible ?
387
+			if ($throw_exceptions) {
388
+				throw new DomainException(
389
+					esc_html__('Invalid, unreadable, or missing file.', 'event_espresso')
390
+				);
391
+			}
392
+			return '';
393
+		}
394
+		// if $template_args are not in an array, then make it so
395
+		if (! is_array($template_args) && ! is_object($template_args)) {
396
+			$template_args = [$template_args];
397
+		}
398
+		extract($template_args, EXTR_SKIP);
399
+
400
+		if ($return_string) {
401
+			// because we want to return a string, we are going to capture the output
402
+			ob_start();
403
+			include($template_path);
404
+			return ob_get_clean();
405
+		}
406
+		include($template_path);
407
+		return '';
408
+	}
409
+
410
+
411
+	/**
412
+	 * get_object_css_class - attempts to generate a css class based on the type of EE object passed
413
+	 *
414
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
415
+	 * @param string        $prefix added to the beginning of the generated class
416
+	 * @param string        $suffix added to the end of the generated class
417
+	 * @return string
418
+	 * @throws EE_Error
419
+	 * @throws ReflectionException
420
+	 */
421
+	public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
422
+	{
423
+		// in the beginning...
424
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
425
+		// da muddle
426
+		$class = '';
427
+		// the end
428
+		$suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
429
+		// is the passed object an EE object ?
430
+		if ($object instanceof EE_Base_Class) {
431
+			// grab the exact type of object
432
+			$obj_class = get_class($object);
433
+			// depending on the type of object...
434
+			switch ($obj_class) {
435
+				// no specifics just yet...
436
+				default:
437
+					$class = strtolower(str_replace('_', '-', $obj_class));
438
+					$class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
439
+			}
440
+		}
441
+		return $prefix . $class . $suffix;
442
+	}
443
+
444
+
445
+	/**
446
+	 * EEH_Template::format_currency
447
+	 * This helper takes a raw float value and formats it according to the default config country currency settings, or
448
+	 * the country currency settings from the supplied country ISO code
449
+	 *
450
+	 * @param float   $amount       raw money value
451
+	 * @param boolean $return_raw   whether to return the formatted float value only with no currency sign or code
452
+	 * @param boolean $display_code whether to display the country code (USD). Default = TRUE
453
+	 * @param string  $CNT_ISO      2 letter ISO code for a country
454
+	 * @param string  $cur_code_span_class
455
+	 * @return string        the html output for the formatted money value
456
+	 */
457
+	public static function format_currency(
458
+		$amount = null,
459
+		$return_raw = false,
460
+		$display_code = true,
461
+		$CNT_ISO = '',
462
+		$cur_code_span_class = 'currency-code'
463
+	) {
464
+		// ensure amount was received
465
+		if ($amount === null) {
466
+			$msg = esc_html__('In order to format currency, an amount needs to be passed.', 'event_espresso');
467
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
468
+			return '';
469
+		}
470
+		// ensure amount is float
471
+		$amount  = (float) apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
472
+		$CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
473
+		// filter raw amount (allows 0.00 to be changed to "free" for example)
474
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
475
+		// still a number, or was amount converted to a string like "free" ?
476
+		if (! is_float($amount_formatted)) {
477
+			return esc_html($amount_formatted);
478
+		}
479
+		try {
480
+			// was a country ISO code passed ? if so generate currency config object for that country
481
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
482
+		} catch (Exception $e) {
483
+			// eat exception
484
+			$mny = null;
485
+		}
486
+		// verify results
487
+		if (! $mny instanceof EE_Currency_Config) {
488
+			// set default config country currency settings
489
+			$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
490
+				? EE_Registry::instance()->CFG->currency
491
+				: new EE_Currency_Config();
492
+		}
493
+		// format float
494
+		$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
495
+		// add formatting ?
496
+		if (! $return_raw) {
497
+			// add currency sign
498
+			if ($mny->sign_b4) {
499
+				if ($amount >= 0) {
500
+					$amount_formatted = $mny->sign . $amount_formatted;
501
+				} else {
502
+					$amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
503
+				}
504
+			} else {
505
+				$amount_formatted = $amount_formatted . $mny->sign;
506
+			}
507
+
508
+			// filter to allow global setting of display_code
509
+			$display_code = (bool) apply_filters(
510
+				'FHEE__EEH_Template__format_currency__display_code',
511
+				$display_code
512
+			);
513
+
514
+			// add currency code ?
515
+			$amount_formatted = $display_code
516
+				? $amount_formatted . ' <span class="' . $cur_code_span_class . '">' . $mny->code . '</span>'
517
+				: $amount_formatted;
518
+		}
519
+		// filter results
520
+		$amount_formatted = apply_filters(
521
+			'FHEE__EEH_Template__format_currency__amount_formatted',
522
+			$amount_formatted,
523
+			$mny,
524
+			$return_raw
525
+		);
526
+		// clean up vars
527
+		unset($mny);
528
+		// return formatted currency amount
529
+		return $amount_formatted;
530
+	}
531
+
532
+
533
+	/**
534
+	 * This function is used for outputting the localized label for a given status id in the schema requested (and
535
+	 * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
536
+	 * related status model or model object (i.e. in documentation etc.)
537
+	 *
538
+	 * @param string  $status_id  Status ID matching a registered status in the esp_status table.  If there is no
539
+	 *                            match, then 'Unknown' will be returned.
540
+	 * @param boolean $plural     Whether to return plural or not
541
+	 * @param string  $schema     'UPPER', 'lower', or 'Sentence'
542
+	 * @return string             The localized label for the status id.
543
+	 * @throws EE_Error
544
+	 */
545
+	public static function pretty_status($status_id, $plural = false, $schema = 'upper')
546
+	{
547
+		$status = EEM_Status::instance()->localized_status(
548
+			[$status_id => esc_html__('unknown', 'event_espresso')],
549
+			$plural,
550
+			$schema
551
+		);
552
+		return $status[ $status_id ];
553
+	}
554
+
555
+
556
+	/**
557
+	 * This helper just returns a button or link for the given parameters
558
+	 *
559
+	 * @param string $url   the url for the link, note that `esc_url` will be called on it
560
+	 * @param string $label What is the label you want displayed for the button
561
+	 * @param string $class what class is used for the button (defaults to 'button--primary')
562
+	 * @param string $icon
563
+	 * @param string $title
564
+	 * @return string the html output for the button
565
+	 */
566
+	public static function get_button_or_link($url, $label, $class = 'button button--primary', $icon = '', $title = '')
567
+	{
568
+		$icon_html = '';
569
+		if (! empty($icon)) {
570
+			$dashicons = preg_split("(ee-icon |dashicons )", $icon);
571
+			$dashicons = array_filter($dashicons);
572
+			$count     = count($dashicons);
573
+			$icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
574
+			foreach ($dashicons as $dashicon) {
575
+				$type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
576
+				$icon_html .= '<span class="' . $type . $dashicon . '"></span>';
577
+			}
578
+			$icon_html .= $count > 1 ? '</span>' : '';
579
+		}
580
+		// sanitize & escape
581
+		$id    = sanitize_title_with_dashes($label);
582
+		$url   = esc_url_raw($url);
583
+		$class = esc_attr($class);
584
+		$title = esc_attr($title);
585
+		$class .= $title ? ' ee-aria-tooltip' : '';
586
+		$title = $title ? " aria-label='{$title}'" : '';
587
+		$label = esc_html($label);
588
+		return "<a id='{$id}' href='{$url}' class='{$class}'{$title}>{$icon_html}{$label}</a>";
589
+	}
590
+
591
+
592
+	/**
593
+	 * This returns a generated link that will load the related help tab on admin pages.
594
+	 *
595
+	 * @param string      $help_tab_id the id for the connected help tab
596
+	 * @param bool|string $page        The page identifier for the page the help tab is on
597
+	 * @param bool|string $action      The action (route) for the admin page the help tab is on.
598
+	 * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
599
+	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
600
+	 * @return string              generated link
601
+	 */
602
+	public static function get_help_tab_link(
603
+		$help_tab_id,
604
+		$page = false,
605
+		$action = false,
606
+		$icon_style = false,
607
+		$help_text = false
608
+	) {
609
+		$allowedtags = AllowedTags::getAllowedTags();
610
+		/** @var RequestInterface $request */
611
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
612
+		$page    = $page ?: $request->getRequestParam('page', '', 'key');
613
+		$action  = $action ?: $request->getRequestParam('action', 'default', 'key');
614
+
615
+
616
+		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
617
+		$icon         = ! $icon_style ? 'dashicons-editor-help' : $icon_style;
618
+		$help_text    = ! $help_text ? '' : $help_text;
619
+		return '
620 620
             <a id="' . esc_attr($help_tab_lnk) . '"
621 621
                class="espresso-help-tab-lnk ee-help-btn ee-aria-tooltip dashicons ' . esc_attr($icon) . '"
622 622
                aria-label="' . esc_attr__(
623
-                   'Click to open the \'Help\' tab for more information about this feature.',
624
-                   'event_espresso'
625
-               ) . '"
623
+				   'Click to open the \'Help\' tab for more information about this feature.',
624
+				   'event_espresso'
625
+			   ) . '"
626 626
             >
627 627
                 ' . wp_kses($help_text, $allowedtags) . '
628 628
             </a>';
629
-    }
630
-
631
-
632
-    /**
633
-     * This is a helper method to generate a status legend for a given status array.
634
-     * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
635
-     * status_array.
636
-     *
637
-     * @param array  $status_array   array of statuses that will make up the legend. In format:
638
-     *                               array(
639
-     *                               'status_item' => 'status_name'
640
-     *                               )
641
-     * @param string $active_status  This is used to indicate what the active status is IF that is to be highlighted in
642
-     *                               the legend.
643
-     * @return string               html structure for status.
644
-     * @throws EE_Error
645
-     */
646
-    public static function status_legend($status_array, $active_status = '')
647
-    {
648
-        if (! is_array($status_array)) {
649
-            throw new EE_Error(
650
-                esc_html__(
651
-                    'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
652
-                    'event_espresso'
653
-                )
654
-            );
655
-        }
656
-
657
-        $content = '
629
+	}
630
+
631
+
632
+	/**
633
+	 * This is a helper method to generate a status legend for a given status array.
634
+	 * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
635
+	 * status_array.
636
+	 *
637
+	 * @param array  $status_array   array of statuses that will make up the legend. In format:
638
+	 *                               array(
639
+	 *                               'status_item' => 'status_name'
640
+	 *                               )
641
+	 * @param string $active_status  This is used to indicate what the active status is IF that is to be highlighted in
642
+	 *                               the legend.
643
+	 * @return string               html structure for status.
644
+	 * @throws EE_Error
645
+	 */
646
+	public static function status_legend($status_array, $active_status = '')
647
+	{
648
+		if (! is_array($status_array)) {
649
+			throw new EE_Error(
650
+				esc_html__(
651
+					'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
652
+					'event_espresso'
653
+				)
654
+			);
655
+		}
656
+
657
+		$content = '
658 658
             <div class="ee-list-table-legend-container">
659 659
                 <h4 class="status-legend-title">
660 660
                     ' . esc_html__('Status Legend', 'event_espresso') . '
661 661
                 </h4>
662 662
                 <dl class="ee-list-table-legend">';
663 663
 
664
-        foreach ($status_array as $item => $status) {
665
-            $active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
666
-            $content      .= '
664
+		foreach ($status_array as $item => $status) {
665
+			$active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
666
+			$content      .= '
667 667
                     <dt id="' . esc_attr('ee-legend-item-tooltip-' . $item) . '" ' . $active_class . '>
668 668
                         <span class="' . esc_attr('ee-status-legend ee-status-bg--' . $status) . '"></span>
669 669
                         <span class="ee-legend-description">
670 670
                             ' . EEH_Template::pretty_status($status, false, 'sentence') . '
671 671
                         </span>
672 672
                     </dt>';
673
-        }
673
+		}
674 674
 
675
-        $content .= '
675
+		$content .= '
676 676
                 </dl>
677 677
             </div>
678 678
 ';
679
-        return $content;
680
-    }
681
-
682
-
683
-    /**
684
-     * Gets HTML for laying out a deeply-nested array (and objects) in a format
685
-     * that's nice for presenting in the wp admin
686
-     *
687
-     * @param mixed $data
688
-     * @return string
689
-     */
690
-    public static function layout_array_as_table($data)
691
-    {
692
-        if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
693
-            $data = (array) $data;
694
-        }
695
-        ob_start();
696
-        if (is_array($data)) {
697
-            if (EEH_Array::is_associative_array($data)) { ?>
679
+		return $content;
680
+	}
681
+
682
+
683
+	/**
684
+	 * Gets HTML for laying out a deeply-nested array (and objects) in a format
685
+	 * that's nice for presenting in the wp admin
686
+	 *
687
+	 * @param mixed $data
688
+	 * @return string
689
+	 */
690
+	public static function layout_array_as_table($data)
691
+	{
692
+		if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
693
+			$data = (array) $data;
694
+		}
695
+		ob_start();
696
+		if (is_array($data)) {
697
+			if (EEH_Array::is_associative_array($data)) { ?>
698 698
                 <table class="widefat">
699 699
                     <tbody>
700 700
                         <?php foreach ($data as $data_key => $data_values) { ?>
@@ -712,285 +712,285 @@  discard block
 block discarded – undo
712 712
             <?php } else { ?>
713 713
                 <ul>
714 714
                     <?php
715
-                    foreach ($data as $datum) {
716
-                        echo "<li>";
717
-                        echo self::layout_array_as_table($datum);
718
-                        echo "</li>";
719
-                    } ?>
715
+					foreach ($data as $datum) {
716
+						echo "<li>";
717
+						echo self::layout_array_as_table($datum);
718
+						echo "</li>";
719
+					} ?>
720 720
                 </ul>
721 721
             <?php }
722
-        } else {
723
-            // simple value
724
-            echo esc_html($data);
725
-        }
726
-        return ob_get_clean();
727
-    }
728
-
729
-
730
-    /**
731
-     * wrapper for self::get_paging_html() that simply echos the generated paging html
732
-     *
733
-     * @param        $total_items
734
-     * @param        $current
735
-     * @param        $per_page
736
-     * @param        $url
737
-     * @param bool   $show_num_field
738
-     * @param string $paged_arg_name
739
-     * @param array  $items_label
740
-     * @see   self:get_paging_html() for argument docs.
741
-     * @since 4.4.0
742
-     */
743
-    public static function paging_html(
744
-        $total_items,
745
-        $current,
746
-        $per_page,
747
-        $url,
748
-        $show_num_field = true,
749
-        $paged_arg_name = 'paged',
750
-        $items_label = []
751
-    ) {
752
-        echo self::get_paging_html(
753
-            $total_items,
754
-            $current,
755
-            $per_page,
756
-            $url,
757
-            $show_num_field,
758
-            $paged_arg_name,
759
-            $items_label
760
-        );
761
-    }
762
-
763
-
764
-    /**
765
-     * A method for generating paging similar to WP_List_Table
766
-     *
767
-     * @param int    $total_items       How many total items there are to page.
768
-     * @param int    $current           What the current page is.
769
-     * @param int    $per_page          How many items per page.
770
-     * @param string $url               What the base url for page links is.
771
-     * @param bool   $show_num_field    Whether to show the input for changing page number.
772
-     * @param string $paged_arg_name    The name of the key for the paged query argument.
773
-     * @param array  $items_label       An array of singular/plural values for the items label:
774
-     *                                  array(
775
-     *                                  'single' => 'item',
776
-     *                                  'plural' => 'items'
777
-     *                                  )
778
-     * @return  string
779
-     * @since    4.4.0
780
-     * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
781
-     */
782
-    public static function get_paging_html(
783
-        int $total_items,
784
-        int $current,
785
-        int $per_page,
786
-        string $url,
787
-        bool $show_num_field = true,
788
-        string $paged_arg_name = 'paged',
789
-        array $items_label = [],
790
-        string $button_size = 'small'
791
-    ): string {
792
-        $page_links     = [];
793
-        $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
794
-
795
-        // filter items_label
796
-        $items_label = apply_filters(
797
-            'FHEE__EEH_Template__get_paging_html__items_label',
798
-            $items_label
799
-        );
800
-
801
-        if (
802
-            empty($items_label)
803
-            || ! is_array($items_label)
804
-            || ! isset($items_label['single'])
805
-            || ! isset($items_label['plural'])
806
-        ) {
807
-            $items_label = [
808
-                'single' => esc_html__('1 item', 'event_espresso'),
809
-                'plural' => esc_html__('%s items', 'event_espresso'),
810
-            ];
811
-        } else {
812
-            $items_label = [
813
-                'single' => '1 ' . esc_html($items_label['single']),
814
-                'plural' => '%s ' . esc_html($items_label['plural']),
815
-            ];
816
-        }
817
-
818
-        $total_pages = (int) ceil($total_items / $per_page);
819
-
820
-        if ($total_pages <= 1) {
821
-            return '';
822
-        }
823
-
824
-        $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
825
-
826
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
827
-
828
-        $disable_first = $current === 1 ? 'disabled' : '';
829
-        $disable_last  = $current === $total_pages ? 'disabled' : '';
830
-
831
-        $button_size = in_array($button_size, ['tiny', 'small', 'default', 'big']) ? $button_size : 'small';
832
-        $button_classes = "button button--secondary button--icon-only button--$button_size";
833
-
834
-        $page_links[] = sprintf(
835
-            '<a class="%s" aria-label="%s" href="%s"><span class="ee-pagination-arrow">%s</span></a>',
836
-            esc_attr("first-page $button_classes $disable_first"),
837
-            esc_attr__('Go to the first page', 'event_espresso'),
838
-            esc_url_raw(remove_query_arg($paged_arg_name, $url)),
839
-            '&laquo;'
840
-        );
841
-
842
-        $page_links[] = sprintf(
843
-            '<a class="%s" aria-label="%s" href="%s"><span class="ee-pagination-arrow">%s</span></a>',
844
-            esc_attr("prev-page $button_classes $disable_first"),
845
-            esc_attr__('Go to the previous page', 'event_espresso'),
846
-            esc_url_raw(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
847
-            '&lsaquo;'
848
-        );
849
-
850
-        $html_current_page = $show_num_field
851
-            ? sprintf(
852
-                "<input class='current-page ee-input-size--small' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
853
-                esc_attr__('Current page', 'event_espresso'),
854
-                esc_attr($current),
855
-                strlen($total_pages)
856
-            )
857
-            : $current;
858
-
859
-        $html_total_pages = sprintf(
860
-            '<span class="total-pages">%s</span>',
861
-            number_format_i18n($total_pages)
862
-        );
863
-        $page_links[]     = sprintf(
864
-            _x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
865
-            "{$html_current_page}<span class='paging-input-of'>",
866
-            "</span>{$html_total_pages}",
867
-            '<span class="paging-input">',
868
-            '</span>'
869
-        );
870
-
871
-        $page_links[] = sprintf(
872
-            '<a class="%s" aria-label="%s" href="%s"><span class="ee-pagination-arrow">%s</span></a>',
873
-            esc_attr("next-page $button_classes $disable_last"),
874
-            esc_attr__('Go to the next page', 'event_espresso'),
875
-            esc_url_raw(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
876
-            '&rsaquo;'
877
-        );
878
-
879
-        $page_links[] = sprintf(
880
-            '<a class="%s" aria-label="%s" href="%s"><span class="ee-pagination-arrow">%s</span></a>',
881
-            esc_attr("last-page $button_classes $disable_last"),
882
-            esc_attr__('Go to the last page', 'event_espresso'),
883
-            esc_url_raw(add_query_arg($paged_arg_name, $total_pages, $url)),
884
-            '&raquo;'
885
-        );
886
-
887
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
888
-
889
-        $page_class = ' no-pages';
890
-        if ($total_pages) {
891
-            $page_class = $total_pages < 2 ? ' one-page' : '';
892
-        }
893
-
894
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
895
-    }
896
-
897
-
898
-    /**
899
-     * @param string $wrap_class
900
-     * @param string $wrap_id
901
-     * @return string
902
-     */
903
-    public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = [])
904
-    {
905
-        $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
906
-        if (
907
-            ! $admin
908
-            && ! apply_filters(
909
-                'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
910
-                EE_Registry::instance()->CFG->admin->show_reg_footer
911
-            )
912
-        ) {
913
-            return '';
914
-        }
915
-        $tag        = $admin ? 'span' : 'div';
916
-        $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
917
-        $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
918
-        $attributes .= ! empty($wrap_class)
919
-            ? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
920
-            : ' class="powered-by-event-espresso-credit"';
921
-        $query_args = array_merge(
922
-            [
923
-                'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
924
-                'utm_source'   => 'powered_by_event_espresso',
925
-                'utm_medium'   => 'link',
926
-                'utm_campaign' => 'powered_by',
927
-            ],
928
-            $query_args
929
-        );
930
-        $powered_by = apply_filters(
931
-            'FHEE__EEH_Template__powered_by_event_espresso_text',
932
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
933
-        );
934
-        $url        = add_query_arg($query_args, 'https://eventespresso.com/');
935
-        $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
936
-        return (string) apply_filters(
937
-            'FHEE__EEH_Template__powered_by_event_espresso__html',
938
-            sprintf(
939
-                esc_html_x(
940
-                    '%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
941
-                    'Online event registration and ticketing powered by [link to eventespresso.com]',
942
-                    'event_espresso'
943
-                ),
944
-                "<{$tag}{$attributes}>",
945
-                "<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
946
-                $admin ? '' : '<br />'
947
-            ),
948
-            $wrap_class,
949
-            $wrap_id
950
-        );
951
-    }
952
-
953
-
954
-    /**
955
-     * @param string $image_name
956
-     * @return string|null
957
-     * @since   4.10.14.p
958
-     */
959
-    public static function getScreenshotUrl($image_name)
960
-    {
961
-        return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
962
-    }
722
+		} else {
723
+			// simple value
724
+			echo esc_html($data);
725
+		}
726
+		return ob_get_clean();
727
+	}
728
+
729
+
730
+	/**
731
+	 * wrapper for self::get_paging_html() that simply echos the generated paging html
732
+	 *
733
+	 * @param        $total_items
734
+	 * @param        $current
735
+	 * @param        $per_page
736
+	 * @param        $url
737
+	 * @param bool   $show_num_field
738
+	 * @param string $paged_arg_name
739
+	 * @param array  $items_label
740
+	 * @see   self:get_paging_html() for argument docs.
741
+	 * @since 4.4.0
742
+	 */
743
+	public static function paging_html(
744
+		$total_items,
745
+		$current,
746
+		$per_page,
747
+		$url,
748
+		$show_num_field = true,
749
+		$paged_arg_name = 'paged',
750
+		$items_label = []
751
+	) {
752
+		echo self::get_paging_html(
753
+			$total_items,
754
+			$current,
755
+			$per_page,
756
+			$url,
757
+			$show_num_field,
758
+			$paged_arg_name,
759
+			$items_label
760
+		);
761
+	}
762
+
763
+
764
+	/**
765
+	 * A method for generating paging similar to WP_List_Table
766
+	 *
767
+	 * @param int    $total_items       How many total items there are to page.
768
+	 * @param int    $current           What the current page is.
769
+	 * @param int    $per_page          How many items per page.
770
+	 * @param string $url               What the base url for page links is.
771
+	 * @param bool   $show_num_field    Whether to show the input for changing page number.
772
+	 * @param string $paged_arg_name    The name of the key for the paged query argument.
773
+	 * @param array  $items_label       An array of singular/plural values for the items label:
774
+	 *                                  array(
775
+	 *                                  'single' => 'item',
776
+	 *                                  'plural' => 'items'
777
+	 *                                  )
778
+	 * @return  string
779
+	 * @since    4.4.0
780
+	 * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
781
+	 */
782
+	public static function get_paging_html(
783
+		int $total_items,
784
+		int $current,
785
+		int $per_page,
786
+		string $url,
787
+		bool $show_num_field = true,
788
+		string $paged_arg_name = 'paged',
789
+		array $items_label = [],
790
+		string $button_size = 'small'
791
+	): string {
792
+		$page_links     = [];
793
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
794
+
795
+		// filter items_label
796
+		$items_label = apply_filters(
797
+			'FHEE__EEH_Template__get_paging_html__items_label',
798
+			$items_label
799
+		);
800
+
801
+		if (
802
+			empty($items_label)
803
+			|| ! is_array($items_label)
804
+			|| ! isset($items_label['single'])
805
+			|| ! isset($items_label['plural'])
806
+		) {
807
+			$items_label = [
808
+				'single' => esc_html__('1 item', 'event_espresso'),
809
+				'plural' => esc_html__('%s items', 'event_espresso'),
810
+			];
811
+		} else {
812
+			$items_label = [
813
+				'single' => '1 ' . esc_html($items_label['single']),
814
+				'plural' => '%s ' . esc_html($items_label['plural']),
815
+			];
816
+		}
817
+
818
+		$total_pages = (int) ceil($total_items / $per_page);
819
+
820
+		if ($total_pages <= 1) {
821
+			return '';
822
+		}
823
+
824
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
825
+
826
+		$output = '<span class="displaying-num">' . $item_label . '</span>';
827
+
828
+		$disable_first = $current === 1 ? 'disabled' : '';
829
+		$disable_last  = $current === $total_pages ? 'disabled' : '';
830
+
831
+		$button_size = in_array($button_size, ['tiny', 'small', 'default', 'big']) ? $button_size : 'small';
832
+		$button_classes = "button button--secondary button--icon-only button--$button_size";
833
+
834
+		$page_links[] = sprintf(
835
+			'<a class="%s" aria-label="%s" href="%s"><span class="ee-pagination-arrow">%s</span></a>',
836
+			esc_attr("first-page $button_classes $disable_first"),
837
+			esc_attr__('Go to the first page', 'event_espresso'),
838
+			esc_url_raw(remove_query_arg($paged_arg_name, $url)),
839
+			'&laquo;'
840
+		);
841
+
842
+		$page_links[] = sprintf(
843
+			'<a class="%s" aria-label="%s" href="%s"><span class="ee-pagination-arrow">%s</span></a>',
844
+			esc_attr("prev-page $button_classes $disable_first"),
845
+			esc_attr__('Go to the previous page', 'event_espresso'),
846
+			esc_url_raw(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
847
+			'&lsaquo;'
848
+		);
849
+
850
+		$html_current_page = $show_num_field
851
+			? sprintf(
852
+				"<input class='current-page ee-input-size--small' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
853
+				esc_attr__('Current page', 'event_espresso'),
854
+				esc_attr($current),
855
+				strlen($total_pages)
856
+			)
857
+			: $current;
858
+
859
+		$html_total_pages = sprintf(
860
+			'<span class="total-pages">%s</span>',
861
+			number_format_i18n($total_pages)
862
+		);
863
+		$page_links[]     = sprintf(
864
+			_x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
865
+			"{$html_current_page}<span class='paging-input-of'>",
866
+			"</span>{$html_total_pages}",
867
+			'<span class="paging-input">',
868
+			'</span>'
869
+		);
870
+
871
+		$page_links[] = sprintf(
872
+			'<a class="%s" aria-label="%s" href="%s"><span class="ee-pagination-arrow">%s</span></a>',
873
+			esc_attr("next-page $button_classes $disable_last"),
874
+			esc_attr__('Go to the next page', 'event_espresso'),
875
+			esc_url_raw(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
876
+			'&rsaquo;'
877
+		);
878
+
879
+		$page_links[] = sprintf(
880
+			'<a class="%s" aria-label="%s" href="%s"><span class="ee-pagination-arrow">%s</span></a>',
881
+			esc_attr("last-page $button_classes $disable_last"),
882
+			esc_attr__('Go to the last page', 'event_espresso'),
883
+			esc_url_raw(add_query_arg($paged_arg_name, $total_pages, $url)),
884
+			'&raquo;'
885
+		);
886
+
887
+		$output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
888
+
889
+		$page_class = ' no-pages';
890
+		if ($total_pages) {
891
+			$page_class = $total_pages < 2 ? ' one-page' : '';
892
+		}
893
+
894
+		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
895
+	}
896
+
897
+
898
+	/**
899
+	 * @param string $wrap_class
900
+	 * @param string $wrap_id
901
+	 * @return string
902
+	 */
903
+	public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = [])
904
+	{
905
+		$admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
906
+		if (
907
+			! $admin
908
+			&& ! apply_filters(
909
+				'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
910
+				EE_Registry::instance()->CFG->admin->show_reg_footer
911
+			)
912
+		) {
913
+			return '';
914
+		}
915
+		$tag        = $admin ? 'span' : 'div';
916
+		$attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
917
+		$wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
918
+		$attributes .= ! empty($wrap_class)
919
+			? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
920
+			: ' class="powered-by-event-espresso-credit"';
921
+		$query_args = array_merge(
922
+			[
923
+				'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
924
+				'utm_source'   => 'powered_by_event_espresso',
925
+				'utm_medium'   => 'link',
926
+				'utm_campaign' => 'powered_by',
927
+			],
928
+			$query_args
929
+		);
930
+		$powered_by = apply_filters(
931
+			'FHEE__EEH_Template__powered_by_event_espresso_text',
932
+			$admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
933
+		);
934
+		$url        = add_query_arg($query_args, 'https://eventespresso.com/');
935
+		$url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
936
+		return (string) apply_filters(
937
+			'FHEE__EEH_Template__powered_by_event_espresso__html',
938
+			sprintf(
939
+				esc_html_x(
940
+					'%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
941
+					'Online event registration and ticketing powered by [link to eventespresso.com]',
942
+					'event_espresso'
943
+				),
944
+				"<{$tag}{$attributes}>",
945
+				"<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
946
+				$admin ? '' : '<br />'
947
+			),
948
+			$wrap_class,
949
+			$wrap_id
950
+		);
951
+	}
952
+
953
+
954
+	/**
955
+	 * @param string $image_name
956
+	 * @return string|null
957
+	 * @since   4.10.14.p
958
+	 */
959
+	public static function getScreenshotUrl($image_name)
960
+	{
961
+		return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
962
+	}
963 963
 }
964 964
 
965 965
 
966 966
 if (! function_exists('espresso_pagination')) {
967
-    /**
968
-     *    espresso_pagination
969
-     *
970
-     * @access    public
971
-     * @return    void
972
-     */
973
-    function espresso_pagination()
974
-    {
975
-        global $wp_query;
976
-        $big        = 999999999; // need an unlikely integer
977
-        $pagination = paginate_links(
978
-            [
979
-                'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
980
-                'format'       => '?paged=%#%',
981
-                'current'      => max(1, get_query_var('paged')),
982
-                'total'        => $wp_query->max_num_pages,
983
-                'show_all'     => true,
984
-                'end_size'     => 10,
985
-                'mid_size'     => 6,
986
-                'prev_next'    => true,
987
-                'prev_text'    => esc_html__('&lsaquo; PREV', 'event_espresso'),
988
-                'next_text'    => esc_html__('NEXT &rsaquo;', 'event_espresso'),
989
-                'type'         => 'plain',
990
-                'add_args'     => false,
991
-                'add_fragment' => '',
992
-            ]
993
-        );
994
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
995
-    }
967
+	/**
968
+	 *    espresso_pagination
969
+	 *
970
+	 * @access    public
971
+	 * @return    void
972
+	 */
973
+	function espresso_pagination()
974
+	{
975
+		global $wp_query;
976
+		$big        = 999999999; // need an unlikely integer
977
+		$pagination = paginate_links(
978
+			[
979
+				'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
980
+				'format'       => '?paged=%#%',
981
+				'current'      => max(1, get_query_var('paged')),
982
+				'total'        => $wp_query->max_num_pages,
983
+				'show_all'     => true,
984
+				'end_size'     => 10,
985
+				'mid_size'     => 6,
986
+				'prev_next'    => true,
987
+				'prev_text'    => esc_html__('&lsaquo; PREV', 'event_espresso'),
988
+				'next_text'    => esc_html__('NEXT &rsaquo;', 'event_espresso'),
989
+				'type'         => 'plain',
990
+				'add_args'     => false,
991
+				'add_fragment' => '',
992
+			]
993
+		);
994
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
995
+	}
996 996
 }
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\services\request\RequestInterface;
7 7
 use EventEspresso\core\services\request\sanitizers\AllowedTags;
8 8
 
9
-if (! function_exists('espresso_get_template_part')) {
9
+if ( ! function_exists('espresso_get_template_part')) {
10 10
     /**
11 11
      * espresso_get_template_part
12 12
      * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 }
23 23
 
24 24
 
25
-if (! function_exists('espresso_get_object_css_class')) {
25
+if ( ! function_exists('espresso_get_object_css_class')) {
26 26
     /**
27 27
      * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
28 28
      *
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public static function load_espresso_theme_functions()
74 74
     {
75
-        if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
76
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
77
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
75
+        if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
76
+            if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().'/functions.php')) {
77
+                require_once(EE_PUBLIC.EE_Config::get_current_theme().'/functions.php');
78 78
             }
79 79
         }
80 80
     }
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
     public static function get_espresso_themes()
89 89
     {
90 90
         if (empty(EEH_Template::$_espresso_themes)) {
91
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
91
+            $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
92 92
             if (empty($espresso_themes)) {
93 93
                 return [];
94 94
             }
95 95
             if (($key = array_search('global_assets', $espresso_themes)) !== false) {
96
-                unset($espresso_themes[ $key ]);
96
+                unset($espresso_themes[$key]);
97 97
             }
98 98
             EEH_Template::$_espresso_themes = [];
99 99
             foreach ($espresso_themes as $espresso_theme) {
100
-                EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
100
+                EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
101 101
             }
102 102
         }
103 103
         return EEH_Template::$_espresso_themes;
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
                 // get array of EE Custom Post Types
214 214
                 $EE_CPTs = $custom_post_types->getDefinitions();
215 215
                 // build template name based on request
216
-                if (isset($EE_CPTs[ $post_type ])) {
216
+                if (isset($EE_CPTs[$post_type])) {
217 217
                     $archive_or_single = is_archive() ? 'archive' : '';
218 218
                     $archive_or_single = is_single() ? 'single' : $archive_or_single;
219
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
219
+                    $templates         = $archive_or_single.'-'.$post_type.'.php';
220 220
                 }
221 221
             }
222 222
             // currently active EE template theme
@@ -225,18 +225,18 @@  discard block
 block discarded – undo
225 225
             // array of paths to folders that may contain templates
226 226
             $template_folder_paths = [
227 227
                 // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
228
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
228
+                EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
229 229
                 // then in the root of the /wp-content/uploads/espresso/templates/ folder
230 230
                 EVENT_ESPRESSO_TEMPLATE_DIR,
231 231
             ];
232 232
 
233 233
             // add core plugin folders for checking only if we're not $check_if_custom
234
-            if (! $check_if_custom) {
235
-                $core_paths            = [
234
+            if ( ! $check_if_custom) {
235
+                $core_paths = [
236 236
                     // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
237
-                    EE_PUBLIC . $current_theme,
237
+                    EE_PUBLIC.$current_theme,
238 238
                     // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
239
-                    EE_TEMPLATES . $current_theme,
239
+                    EE_TEMPLATES.$current_theme,
240 240
                     // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
241 241
                     EE_PLUGIN_DIR_PATH,
242 242
                 ];
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
                     );
272 272
                     if ($common_base_path !== '') {
273 273
                         // both paths have a common base, so just tack the filename onto our search path
274
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
274
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
275 275
                     } else {
276 276
                         // no common base path, so let's just concatenate
277
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
277
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
278 278
                     }
279 279
                     // build up our template locations array by adding our resolved paths
280 280
                     $full_template_paths[] = $resolved_path;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                 // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
283 283
                 array_unshift($full_template_paths, $template);
284 284
                 // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
285
-                array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
285
+                array_unshift($full_template_paths, get_stylesheet_directory().'/'.$file_name);
286 286
             }
287 287
             // filter final array of full template paths
288 288
             $full_template_paths = apply_filters(
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
                 }
346 346
             }
347 347
             $common_base_path .= $directory;
348
-            $last_offset      = $index + 1;
348
+            $last_offset = $index + 1;
349 349
         }
350 350
         return substr($common_base_path, 0, -1);
351 351
     }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         $template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
383 383
 
384 384
         // you gimme nuttin - YOU GET NUTTIN !!
385
-        if (! $template_path || ! is_readable($template_path)) {
385
+        if ( ! $template_path || ! is_readable($template_path)) {
386 386
             // ignore whether template is accessible ?
387 387
             if ($throw_exceptions) {
388 388
                 throw new DomainException(
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
             return '';
393 393
         }
394 394
         // if $template_args are not in an array, then make it so
395
-        if (! is_array($template_args) && ! is_object($template_args)) {
395
+        if ( ! is_array($template_args) && ! is_object($template_args)) {
396 396
             $template_args = [$template_args];
397 397
         }
398 398
         extract($template_args, EXTR_SKIP);
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
     public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
422 422
     {
423 423
         // in the beginning...
424
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
424
+        $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
425 425
         // da muddle
426 426
         $class = '';
427 427
         // the end
428
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
428
+        $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
429 429
         // is the passed object an EE object ?
430 430
         if ($object instanceof EE_Base_Class) {
431 431
             // grab the exact type of object
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
                 // no specifics just yet...
436 436
                 default:
437 437
                     $class = strtolower(str_replace('_', '-', $obj_class));
438
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
438
+                    $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
439 439
             }
440 440
         }
441
-        return $prefix . $class . $suffix;
441
+        return $prefix.$class.$suffix;
442 442
     }
443 443
 
444 444
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         // filter raw amount (allows 0.00 to be changed to "free" for example)
474 474
         $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
475 475
         // still a number, or was amount converted to a string like "free" ?
476
-        if (! is_float($amount_formatted)) {
476
+        if ( ! is_float($amount_formatted)) {
477 477
             return esc_html($amount_formatted);
478 478
         }
479 479
         try {
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
             $mny = null;
485 485
         }
486 486
         // verify results
487
-        if (! $mny instanceof EE_Currency_Config) {
487
+        if ( ! $mny instanceof EE_Currency_Config) {
488 488
             // set default config country currency settings
489 489
             $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
490 490
                 ? EE_Registry::instance()->CFG->currency
@@ -493,16 +493,16 @@  discard block
 block discarded – undo
493 493
         // format float
494 494
         $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
495 495
         // add formatting ?
496
-        if (! $return_raw) {
496
+        if ( ! $return_raw) {
497 497
             // add currency sign
498 498
             if ($mny->sign_b4) {
499 499
                 if ($amount >= 0) {
500
-                    $amount_formatted = $mny->sign . $amount_formatted;
500
+                    $amount_formatted = $mny->sign.$amount_formatted;
501 501
                 } else {
502
-                    $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
502
+                    $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
503 503
                 }
504 504
             } else {
505
-                $amount_formatted = $amount_formatted . $mny->sign;
505
+                $amount_formatted = $amount_formatted.$mny->sign;
506 506
             }
507 507
 
508 508
             // filter to allow global setting of display_code
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 
514 514
             // add currency code ?
515 515
             $amount_formatted = $display_code
516
-                ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">' . $mny->code . '</span>'
516
+                ? $amount_formatted.' <span class="'.$cur_code_span_class.'">'.$mny->code.'</span>'
517 517
                 : $amount_formatted;
518 518
         }
519 519
         // filter results
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
             $plural,
550 550
             $schema
551 551
         );
552
-        return $status[ $status_id ];
552
+        return $status[$status_id];
553 553
     }
554 554
 
555 555
 
@@ -566,14 +566,14 @@  discard block
 block discarded – undo
566 566
     public static function get_button_or_link($url, $label, $class = 'button button--primary', $icon = '', $title = '')
567 567
     {
568 568
         $icon_html = '';
569
-        if (! empty($icon)) {
569
+        if ( ! empty($icon)) {
570 570
             $dashicons = preg_split("(ee-icon |dashicons )", $icon);
571 571
             $dashicons = array_filter($dashicons);
572 572
             $count     = count($dashicons);
573 573
             $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
574 574
             foreach ($dashicons as $dashicon) {
575
-                $type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
576
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
575
+                $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
576
+                $icon_html .= '<span class="'.$type.$dashicon.'"></span>';
577 577
             }
578 578
             $icon_html .= $count > 1 ? '</span>' : '';
579 579
         }
@@ -613,18 +613,18 @@  discard block
 block discarded – undo
613 613
         $action  = $action ?: $request->getRequestParam('action', 'default', 'key');
614 614
 
615 615
 
616
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
616
+        $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
617 617
         $icon         = ! $icon_style ? 'dashicons-editor-help' : $icon_style;
618 618
         $help_text    = ! $help_text ? '' : $help_text;
619 619
         return '
620
-            <a id="' . esc_attr($help_tab_lnk) . '"
621
-               class="espresso-help-tab-lnk ee-help-btn ee-aria-tooltip dashicons ' . esc_attr($icon) . '"
620
+            <a id="' . esc_attr($help_tab_lnk).'"
621
+               class="espresso-help-tab-lnk ee-help-btn ee-aria-tooltip dashicons ' . esc_attr($icon).'"
622 622
                aria-label="' . esc_attr__(
623 623
                    'Click to open the \'Help\' tab for more information about this feature.',
624 624
                    'event_espresso'
625
-               ) . '"
625
+               ).'"
626 626
             >
627
-                ' . wp_kses($help_text, $allowedtags) . '
627
+                ' . wp_kses($help_text, $allowedtags).'
628 628
             </a>';
629 629
     }
630 630
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
      */
646 646
     public static function status_legend($status_array, $active_status = '')
647 647
     {
648
-        if (! is_array($status_array)) {
648
+        if ( ! is_array($status_array)) {
649 649
             throw new EE_Error(
650 650
                 esc_html__(
651 651
                     'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
@@ -657,17 +657,17 @@  discard block
 block discarded – undo
657 657
         $content = '
658 658
             <div class="ee-list-table-legend-container">
659 659
                 <h4 class="status-legend-title">
660
-                    ' . esc_html__('Status Legend', 'event_espresso') . '
660
+                    ' . esc_html__('Status Legend', 'event_espresso').'
661 661
                 </h4>
662 662
                 <dl class="ee-list-table-legend">';
663 663
 
664 664
         foreach ($status_array as $item => $status) {
665 665
             $active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
666
-            $content      .= '
667
-                    <dt id="' . esc_attr('ee-legend-item-tooltip-' . $item) . '" ' . $active_class . '>
668
-                        <span class="' . esc_attr('ee-status-legend ee-status-bg--' . $status) . '"></span>
666
+            $content .= '
667
+                    <dt id="' . esc_attr('ee-legend-item-tooltip-'.$item).'" '.$active_class.'>
668
+                        <span class="' . esc_attr('ee-status-legend ee-status-bg--'.$status).'"></span>
669 669
                         <span class="ee-legend-description">
670
-                            ' . EEH_Template::pretty_status($status, false, 'sentence') . '
670
+                            ' . EEH_Template::pretty_status($status, false, 'sentence').'
671 671
                         </span>
672 672
                     </dt>';
673 673
         }
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
             ];
811 811
         } else {
812 812
             $items_label = [
813
-                'single' => '1 ' . esc_html($items_label['single']),
814
-                'plural' => '%s ' . esc_html($items_label['plural']),
813
+                'single' => '1 '.esc_html($items_label['single']),
814
+                'plural' => '%s '.esc_html($items_label['plural']),
815 815
             ];
816 816
         }
817 817
 
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
         $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
825 825
 
826
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
826
+        $output = '<span class="displaying-num">'.$item_label.'</span>';
827 827
 
828 828
         $disable_first = $current === 1 ? 'disabled' : '';
829 829
         $disable_last  = $current === $total_pages ? 'disabled' : '';
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
             '<span class="total-pages">%s</span>',
861 861
             number_format_i18n($total_pages)
862 862
         );
863
-        $page_links[]     = sprintf(
863
+        $page_links[] = sprintf(
864 864
             _x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
865 865
             "{$html_current_page}<span class='paging-input-of'>",
866 866
             "</span>{$html_total_pages}",
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
             '&raquo;'
885 885
         );
886 886
 
887
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
887
+        $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
888 888
 
889 889
         $page_class = ' no-pages';
890 890
         if ($total_pages) {
891 891
             $page_class = $total_pages < 2 ? ' one-page' : '';
892 892
         }
893 893
 
894
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
894
+        return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
895 895
     }
896 896
 
897 897
 
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
         );
930 930
         $powered_by = apply_filters(
931 931
             'FHEE__EEH_Template__powered_by_event_espresso_text',
932
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
932
+            $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso'
933 933
         );
934 934
         $url        = add_query_arg($query_args, 'https://eventespresso.com/');
935 935
         $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
@@ -958,12 +958,12 @@  discard block
 block discarded – undo
958 958
      */
959 959
     public static function getScreenshotUrl($image_name)
960 960
     {
961
-        return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
961
+        return esc_url_raw(EE_GLOBAL_ASSETS_URL.'images/screenshots/'.$image_name.'.jpg');
962 962
     }
963 963
 }
964 964
 
965 965
 
966
-if (! function_exists('espresso_pagination')) {
966
+if ( ! function_exists('espresso_pagination')) {
967 967
     /**
968 968
      *    espresso_pagination
969 969
      *
@@ -991,6 +991,6 @@  discard block
 block discarded – undo
991 991
                 'add_fragment' => '',
992 992
             ]
993 993
         );
994
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
994
+        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">'.$pagination.'</div>' : '';
995 995
     }
996 996
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/4_1_0_stages/EE_DMS_4_1_0_gateways.dmsstage.php 1 patch
Indentation   +231 added lines, -231 removed lines patch added patch discarded remove patch
@@ -15,256 +15,256 @@
 block discarded – undo
15 15
 class EE_DMS_4_1_0_gateways extends EE_Data_Migration_Script_Stage
16 16
 {
17 17
 
18
-    private bool $_converted_active_gateways = false;
18
+	private bool $_converted_active_gateways = false;
19 19
 
20
-    protected array $_gateways_we_know_how_to_migrate = [
21
-        'aim'        => 'Aim',
22
-        'bank'       => 'Bank',
23
-        'check'      => 'Check',
24
-        'invoice'    => 'Invoice',
25
-        'paypal'     => 'Paypal_Standard',
26
-        'paypal_pro' => 'Paypal_Pro',
20
+	protected array $_gateways_we_know_how_to_migrate = [
21
+		'aim'        => 'Aim',
22
+		'bank'       => 'Bank',
23
+		'check'      => 'Check',
24
+		'invoice'    => 'Invoice',
25
+		'paypal'     => 'Paypal_Standard',
26
+		'paypal_pro' => 'Paypal_Pro',
27 27
 
28
-    ];
28
+	];
29 29
 
30
-    protected array $_gateways_we_leave_alone = [
31
-        '2checkout'        => '2checkout',
32
-        'anz'              => 'Anz',
33
-        'atos'             => 'Atos',
34
-        'authnet'          => 'Authnet',
35
-        'beanstream'       => 'Beanstream',
36
-        'evertec'          => 'Evertec',
37
-        'eway'             => 'Eway',
38
-        'eway_rapid3'      => 'Eway_Rapid3',
39
-        'exact'            => 'Exact',
40
-        'firstdata'        => 'Firstdata',
41
-        'firstdat_e4'      => 'Firstdata_E4',
42
-        'ideal'            => 'Ideal',
43
-        'infusion_payment' => 'InfusionSoft',
44
-        'luottokunta'      => 'Luottokunta',
45
-        'megasoft'         => 'Megasoft',
46
-        'moneris_hpp'      => 'Moneris_HPP',
47
-        'mwarrior'         => 'Mwarrior',
48
-        'nab'              => 'NAB',
49
-        'paychoice'        => 'Paychoice',
50
-        'paytrace'         => 'Paytrace',
51
-        'psigate'          => 'Psigate',
52
-        'purchase_order'   => 'Purchase_Order',
53
-        'qbms'             => 'QBMS',
54
-        'quickpay'         => 'Quickpay',
55
-        'realauth'         => 'Realauth',
56
-        'securepay_aus'    => 'Securepay_Aus',
57
-        'stripe'           => 'Stripe',
58
-        'usaepay_offsite'  => 'USAePay_Offsite',
59
-        'usaepay_onsite'   => 'USAePay_Onsite',
60
-        'wepay'            => 'Wepay',
61
-        'worldpay'         => 'Worldpay',
62
-    ];
30
+	protected array $_gateways_we_leave_alone = [
31
+		'2checkout'        => '2checkout',
32
+		'anz'              => 'Anz',
33
+		'atos'             => 'Atos',
34
+		'authnet'          => 'Authnet',
35
+		'beanstream'       => 'Beanstream',
36
+		'evertec'          => 'Evertec',
37
+		'eway'             => 'Eway',
38
+		'eway_rapid3'      => 'Eway_Rapid3',
39
+		'exact'            => 'Exact',
40
+		'firstdata'        => 'Firstdata',
41
+		'firstdat_e4'      => 'Firstdata_E4',
42
+		'ideal'            => 'Ideal',
43
+		'infusion_payment' => 'InfusionSoft',
44
+		'luottokunta'      => 'Luottokunta',
45
+		'megasoft'         => 'Megasoft',
46
+		'moneris_hpp'      => 'Moneris_HPP',
47
+		'mwarrior'         => 'Mwarrior',
48
+		'nab'              => 'NAB',
49
+		'paychoice'        => 'Paychoice',
50
+		'paytrace'         => 'Paytrace',
51
+		'psigate'          => 'Psigate',
52
+		'purchase_order'   => 'Purchase_Order',
53
+		'qbms'             => 'QBMS',
54
+		'quickpay'         => 'Quickpay',
55
+		'realauth'         => 'Realauth',
56
+		'securepay_aus'    => 'Securepay_Aus',
57
+		'stripe'           => 'Stripe',
58
+		'usaepay_offsite'  => 'USAePay_Offsite',
59
+		'usaepay_onsite'   => 'USAePay_Onsite',
60
+		'wepay'            => 'Wepay',
61
+		'worldpay'         => 'Worldpay',
62
+	];
63 63
 
64 64
 
65
-    public function __construct()
66
-    {
67
-        $this->_pretty_name = esc_html__("Gateways", "event_espresso");
68
-        parent::__construct();
69
-    }
65
+	public function __construct()
66
+	{
67
+		$this->_pretty_name = esc_html__("Gateways", "event_espresso");
68
+		parent::__construct();
69
+	}
70 70
 
71 71
 
72
-    public function _migration_step($num_items_to_migrate = 50)
73
-    {
74
-        // loads existing EE_Config from DB, if it exists
75
-        $new_gateway_config_obj  = EE_Config::instance()->gateway;
76
-        $items_actually_migrated = 0;
77
-        // convert settings
78
-        $gateways_to_deal_with = array_merge(
79
-            $this->_gateways_we_know_how_to_migrate,
80
-            $this->_gateways_we_leave_alone
81
-        );
82
-        // just do a part of them on this request
83
-        $gateways_to_deal_with = array_slice(
84
-            $gateways_to_deal_with,
85
-            $this->count_records_migrated(),
86
-            $num_items_to_migrate
87
-        );// $this->_gateways_we_know_how_to_migrate;
88
-        foreach ($gateways_to_deal_with as $old_gateway_slug => $new_gateway_slug) {
89
-            $old_gateway_wp_option_name = $this->_get_old_gateway_option_name($new_gateway_slug);
90
-            if (isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) {
91
-                // determine the old option's name
92
-                $old_gateway_settings = $this->_get_old_gateway_option($new_gateway_slug);
93
-                if (! $old_gateway_settings) {
94
-                    // no settings existed for this gateway anyways... weird...
95
-                    $items_actually_migrated++;
96
-                    continue;
97
-                }
98
-                // now prepare the settings to make sure they're in the 4.1 format
99
-                $new_gateway_settings = $this->_convert_gateway_settings(
100
-                    (array) $old_gateway_settings,
101
-                    $new_gateway_slug
102
-                );
72
+	public function _migration_step($num_items_to_migrate = 50)
73
+	{
74
+		// loads existing EE_Config from DB, if it exists
75
+		$new_gateway_config_obj  = EE_Config::instance()->gateway;
76
+		$items_actually_migrated = 0;
77
+		// convert settings
78
+		$gateways_to_deal_with = array_merge(
79
+			$this->_gateways_we_know_how_to_migrate,
80
+			$this->_gateways_we_leave_alone
81
+		);
82
+		// just do a part of them on this request
83
+		$gateways_to_deal_with = array_slice(
84
+			$gateways_to_deal_with,
85
+			$this->count_records_migrated(),
86
+			$num_items_to_migrate
87
+		);// $this->_gateways_we_know_how_to_migrate;
88
+		foreach ($gateways_to_deal_with as $old_gateway_slug => $new_gateway_slug) {
89
+			$old_gateway_wp_option_name = $this->_get_old_gateway_option_name($new_gateway_slug);
90
+			if (isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) {
91
+				// determine the old option's name
92
+				$old_gateway_settings = $this->_get_old_gateway_option($new_gateway_slug);
93
+				if (! $old_gateway_settings) {
94
+					// no settings existed for this gateway anyways... weird...
95
+					$items_actually_migrated++;
96
+					continue;
97
+				}
98
+				// now prepare the settings to make sure they're in the 4.1 format
99
+				$new_gateway_settings = $this->_convert_gateway_settings(
100
+					(array) $old_gateway_settings,
101
+					$new_gateway_slug
102
+				);
103 103
 
104
-                $new_gateway_config_obj->payment_settings[ $new_gateway_slug ] = $new_gateway_settings;
105
-                // and when we're done, remove the old option. Sometimes we'd prefer to do this in a different stage, but
106
-                // I think it's ok to do right away this time (we wont need gateway settings elsewhere)
107
-                delete_option($old_gateway_wp_option_name);
108
-            } else {// it must be one of the ones we mostly leave alone
109
-                global $wpdb;
110
-                // yeah we could do this all in one query... and if you're reading this and would like to, go ahead. Although you'll
111
-                // only be saving users 50 milliseconds the one time this runs...
112
-                $wpdb->query(
113
-                    $wpdb->prepare(
114
-                        "UPDATE " . $wpdb->options . " SET autoload='no' WHERE option_name=%s",
115
-                        $old_gateway_wp_option_name
116
-                    )
117
-                );
118
-            }
104
+				$new_gateway_config_obj->payment_settings[ $new_gateway_slug ] = $new_gateway_settings;
105
+				// and when we're done, remove the old option. Sometimes we'd prefer to do this in a different stage, but
106
+				// I think it's ok to do right away this time (we wont need gateway settings elsewhere)
107
+				delete_option($old_gateway_wp_option_name);
108
+			} else {// it must be one of the ones we mostly leave alone
109
+				global $wpdb;
110
+				// yeah we could do this all in one query... and if you're reading this and would like to, go ahead. Although you'll
111
+				// only be saving users 50 milliseconds the one time this runs...
112
+				$wpdb->query(
113
+					$wpdb->prepare(
114
+						"UPDATE " . $wpdb->options . " SET autoload='no' WHERE option_name=%s",
115
+						$old_gateway_wp_option_name
116
+					)
117
+				);
118
+			}
119 119
 
120
-            $items_actually_migrated++;
121
-        }
122
-        // if we can keep going, and it hasn't been done yet, convert active gateways
123
-        if ($items_actually_migrated < $num_items_to_migrate && ! $this->_converted_active_gateways) {
124
-            $this->_convert_active_gateways();
125
-            $this->_converted_active_gateways = true;
126
-            $items_actually_migrated++;
127
-        }
120
+			$items_actually_migrated++;
121
+		}
122
+		// if we can keep going, and it hasn't been done yet, convert active gateways
123
+		if ($items_actually_migrated < $num_items_to_migrate && ! $this->_converted_active_gateways) {
124
+			$this->_convert_active_gateways();
125
+			$this->_converted_active_gateways = true;
126
+			$items_actually_migrated++;
127
+		}
128 128
 
129
-        EE_Config::instance()->update_espresso_config(false, false);
130
-        if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
131
-            $this->set_completed();
132
-        }
133
-        return $items_actually_migrated;
134
-    }
129
+		EE_Config::instance()->update_espresso_config(false, false);
130
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
131
+			$this->set_completed();
132
+		}
133
+		return $items_actually_migrated;
134
+	}
135 135
 
136 136
 
137
-    public function _count_records_to_migrate(): int
138
-    {
139
-        $count_of_gateways_to_convert     = (int) count($this->_gateways_we_know_how_to_migrate);
140
-        $step_of_setting_active_gateways  = 1;
141
-        $count_of_gateways_to_leave_alone = (int) count($this->_gateways_we_leave_alone);
142
-        //  $button_images_to_update =
143
-        return $count_of_gateways_to_convert + $step_of_setting_active_gateways + $count_of_gateways_to_leave_alone;
144
-    }
137
+	public function _count_records_to_migrate(): int
138
+	{
139
+		$count_of_gateways_to_convert     = (int) count($this->_gateways_we_know_how_to_migrate);
140
+		$step_of_setting_active_gateways  = 1;
141
+		$count_of_gateways_to_leave_alone = (int) count($this->_gateways_we_leave_alone);
142
+		//  $button_images_to_update =
143
+		return $count_of_gateways_to_convert + $step_of_setting_active_gateways + $count_of_gateways_to_leave_alone;
144
+	}
145 145
 
146 146
 
147
-    /**
148
-     * Takes the old array of 3.1 gateway settings for this gateway and converts it
149
-     * into an array with all the 4.1 gateway setting array keys (often the keys were
150
-     * changed from 3.1 to 4.1)
151
-     *
152
-     * @param array  $old_gateway_settings
153
-     * @param string $new_gateway_slug
154
-     * @return array
155
-     */
156
-    private function _convert_gateway_settings(array $old_gateway_settings, string $new_gateway_slug): array
157
-    {
158
-        $new_gateway_settings = $old_gateway_settings;
159
-        switch ($new_gateway_slug) {
160
-            case 'Bank':
161
-                $new_gateway_settings['account_number'] = $old_gateway_settings['bank_account'];
162
-                $new_gateway_settings['page_title']     = $old_gateway_settings['bank_title'];
163
-                break;
164
-            case 'Invoice':
165
-                $new_gateway_settings['invoice_logo_url'] = $old_gateway_settings['image_url'];
166
-                // Dont' migrate the old invoice payee address. It was usually given dummy data. And in EE4
167
-                // it gets used in the receipts which are available to everyone. So usually it's best to not
168
-                // migrate this.
169
-                unset($new_gateway_settings['payment_address']);
170
-                break;
171
-            case 'Paypal_Pro':
172
-                $new_gateway_settings['email']        = $old_gateway_settings['paypal_pro_email'];
173
-                $new_gateway_settings['username']     = $old_gateway_settings['paypal_api_username'];
174
-                $new_gateway_settings['password']     = $old_gateway_settings['paypal_api_password'];
175
-                $new_gateway_settings['signature']    = $old_gateway_settings['paypal_api_signature'];
176
-                $new_gateway_settings['credit_cards'] = explode(",", $old_gateway_settings['paypal_api_credit_cards']);
177
-                $new_gateway_settings['use_sandbox']  = $old_gateway_settings['paypal_pro_use_sandbox'];
178
-                break;
179
-        }
180
-        return $new_gateway_settings;
181
-    }
147
+	/**
148
+	 * Takes the old array of 3.1 gateway settings for this gateway and converts it
149
+	 * into an array with all the 4.1 gateway setting array keys (often the keys were
150
+	 * changed from 3.1 to 4.1)
151
+	 *
152
+	 * @param array  $old_gateway_settings
153
+	 * @param string $new_gateway_slug
154
+	 * @return array
155
+	 */
156
+	private function _convert_gateway_settings(array $old_gateway_settings, string $new_gateway_slug): array
157
+	{
158
+		$new_gateway_settings = $old_gateway_settings;
159
+		switch ($new_gateway_slug) {
160
+			case 'Bank':
161
+				$new_gateway_settings['account_number'] = $old_gateway_settings['bank_account'];
162
+				$new_gateway_settings['page_title']     = $old_gateway_settings['bank_title'];
163
+				break;
164
+			case 'Invoice':
165
+				$new_gateway_settings['invoice_logo_url'] = $old_gateway_settings['image_url'];
166
+				// Dont' migrate the old invoice payee address. It was usually given dummy data. And in EE4
167
+				// it gets used in the receipts which are available to everyone. So usually it's best to not
168
+				// migrate this.
169
+				unset($new_gateway_settings['payment_address']);
170
+				break;
171
+			case 'Paypal_Pro':
172
+				$new_gateway_settings['email']        = $old_gateway_settings['paypal_pro_email'];
173
+				$new_gateway_settings['username']     = $old_gateway_settings['paypal_api_username'];
174
+				$new_gateway_settings['password']     = $old_gateway_settings['paypal_api_password'];
175
+				$new_gateway_settings['signature']    = $old_gateway_settings['paypal_api_signature'];
176
+				$new_gateway_settings['credit_cards'] = explode(",", $old_gateway_settings['paypal_api_credit_cards']);
177
+				$new_gateway_settings['use_sandbox']  = $old_gateway_settings['paypal_pro_use_sandbox'];
178
+				break;
179
+		}
180
+		return $new_gateway_settings;
181
+	}
182 182
 
183 183
 
184
-    /**
185
-     * Figures out the correct 3.1 gateway settings option name for the given 4.1 gateway
186
-     *
187
-     * @param string $new_gateway_slug
188
-     * @return string
189
-     */
190
-    private function _get_old_gateway_option(string $new_gateway_slug): ?string
191
-    {
192
-        return get_option(
193
-            $this->_get_old_gateway_option_name($new_gateway_slug),
194
-            null
195
-        );
196
-    }
184
+	/**
185
+	 * Figures out the correct 3.1 gateway settings option name for the given 4.1 gateway
186
+	 *
187
+	 * @param string $new_gateway_slug
188
+	 * @return string
189
+	 */
190
+	private function _get_old_gateway_option(string $new_gateway_slug): ?string
191
+	{
192
+		return get_option(
193
+			$this->_get_old_gateway_option_name($new_gateway_slug),
194
+			null
195
+		);
196
+	}
197 197
 
198 198
 
199
-    /**
200
-     * Just gets the old gateways slug
201
-     *
202
-     * @param string $new_gateway_slug
203
-     * @return string
204
-     */
205
-    private function _get_old_gateway_option_name(string $new_gateway_slug): string
206
-    {
207
-        $new_gateway_slugs_to_new = array_flip(
208
-            array_merge(
209
-                $this->_gateways_we_know_how_to_migrate,
210
-                $this->_gateways_we_leave_alone
211
-            )
212
-        );
213
-        $old_gateway_slug         = $new_gateway_slugs_to_new[ $new_gateway_slug ];
214
-        $normal_option_prefix     = 'event_espresso_';
215
-        $normal_option_postfix    = '_settings';
216
-        switch ($new_gateway_slug) {
217
-            case 'Bank':
218
-                $option_name = $normal_option_prefix . 'bank_deposit' . $normal_option_postfix;
219
-                break;
220
-            case 'Aim':
221
-                $option_name = $normal_option_prefix . 'authnet_aim' . $normal_option_postfix;
222
-                break;
223
-            case 'Check':
224
-                $option_name = $normal_option_prefix . 'check_payment' . $normal_option_postfix;
225
-                break;
226
-            case 'Ideal':
227
-                $option_name = $normal_option_prefix . 'ideal_mollie' . $normal_option_postfix;
228
-                break;
229
-            case 'Invoice':
230
-                $option_name = $normal_option_prefix . 'invoice_payment' . $normal_option_postfix;
231
-                break;
232
-            case 'Purchase_Order':
233
-                $option_name = $normal_option_prefix . 'purchase_order_payment' . $normal_option_postfix;
234
-                break;
235
-            case 'USAePay_Offsite':
236
-                $option_name = 'espresso_usaepay_offsite' . $normal_option_postfix;
237
-                break;
238
-            case 'USAePay_Onsite':
239
-                $option_name = 'espresso_usaepay_onsite' . $normal_option_postfix;
240
-                break;
241
-            default:
242
-                $option_name = apply_filters(
243
-                    'FHEE__EE_DMS_4_1_0_gateways__get_old_gateway_option',
244
-                    $normal_option_prefix . $old_gateway_slug . $normal_option_postfix
245
-                );
246
-        }
247
-        return $option_name;
248
-    }
199
+	/**
200
+	 * Just gets the old gateways slug
201
+	 *
202
+	 * @param string $new_gateway_slug
203
+	 * @return string
204
+	 */
205
+	private function _get_old_gateway_option_name(string $new_gateway_slug): string
206
+	{
207
+		$new_gateway_slugs_to_new = array_flip(
208
+			array_merge(
209
+				$this->_gateways_we_know_how_to_migrate,
210
+				$this->_gateways_we_leave_alone
211
+			)
212
+		);
213
+		$old_gateway_slug         = $new_gateway_slugs_to_new[ $new_gateway_slug ];
214
+		$normal_option_prefix     = 'event_espresso_';
215
+		$normal_option_postfix    = '_settings';
216
+		switch ($new_gateway_slug) {
217
+			case 'Bank':
218
+				$option_name = $normal_option_prefix . 'bank_deposit' . $normal_option_postfix;
219
+				break;
220
+			case 'Aim':
221
+				$option_name = $normal_option_prefix . 'authnet_aim' . $normal_option_postfix;
222
+				break;
223
+			case 'Check':
224
+				$option_name = $normal_option_prefix . 'check_payment' . $normal_option_postfix;
225
+				break;
226
+			case 'Ideal':
227
+				$option_name = $normal_option_prefix . 'ideal_mollie' . $normal_option_postfix;
228
+				break;
229
+			case 'Invoice':
230
+				$option_name = $normal_option_prefix . 'invoice_payment' . $normal_option_postfix;
231
+				break;
232
+			case 'Purchase_Order':
233
+				$option_name = $normal_option_prefix . 'purchase_order_payment' . $normal_option_postfix;
234
+				break;
235
+			case 'USAePay_Offsite':
236
+				$option_name = 'espresso_usaepay_offsite' . $normal_option_postfix;
237
+				break;
238
+			case 'USAePay_Onsite':
239
+				$option_name = 'espresso_usaepay_onsite' . $normal_option_postfix;
240
+				break;
241
+			default:
242
+				$option_name = apply_filters(
243
+					'FHEE__EE_DMS_4_1_0_gateways__get_old_gateway_option',
244
+					$normal_option_prefix . $old_gateway_slug . $normal_option_postfix
245
+				);
246
+		}
247
+		return $option_name;
248
+	}
249 249
 
250 250
 
251
-    private function _convert_active_gateways()
252
-    {
253
-        // just does it all one big swoop
254
-        $old_active_gateways = get_option('event_espresso_active_gateways');
255
-        $new_active_gateways = EE_Config::instance()->gateway->active_gateways;
256
-        foreach ($old_active_gateways as $old_gateway_slug => $filepath) {
257
-            if (! isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) {
258
-                $this->add_error(
259
-                    sprintf(esc_html__("The %s gateway does not exist in EE 4.1", "event_espresso"), $old_gateway_slug)
260
-                );
261
-                continue;
262
-            }
263
-            $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ];
251
+	private function _convert_active_gateways()
252
+	{
253
+		// just does it all one big swoop
254
+		$old_active_gateways = get_option('event_espresso_active_gateways');
255
+		$new_active_gateways = EE_Config::instance()->gateway->active_gateways;
256
+		foreach ($old_active_gateways as $old_gateway_slug => $filepath) {
257
+			if (! isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) {
258
+				$this->add_error(
259
+					sprintf(esc_html__("The %s gateway does not exist in EE 4.1", "event_espresso"), $old_gateway_slug)
260
+				);
261
+				continue;
262
+			}
263
+			$new_gateway_slug = $this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ];
264 264
 
265
-            // in the new format we can also upload gateways to the uploads directory and
266
-            $new_active_gateways[ $new_gateway_slug ] = false;
267
-        }
268
-        EE_Config::instance()->gateway->active_gateways = $new_active_gateways;
269
-    }
265
+			// in the new format we can also upload gateways to the uploads directory and
266
+			$new_active_gateways[ $new_gateway_slug ] = false;
267
+		}
268
+		EE_Config::instance()->gateway->active_gateways = $new_active_gateways;
269
+	}
270 270
 }
Please login to merge, or discard this patch.
data_migration_scripts/4_1_0_stages/EE_DMS_4_1_0_questions.dmsstage.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -67,159 +67,159 @@
 block discarded – undo
67 67
 class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage
68 68
 {
69 69
 
70
-    private string $_option_table;
70
+	private string $_option_table;
71 71
 
72 72
 
73
-    public function __construct()
74
-    {
75
-        global $wpdb;
76
-        $this->_pretty_name  = esc_html__("Questions", "event_espresso");
77
-        $this->_old_table    = $wpdb->prefix . "events_question";
78
-        $this->_new_table    = $wpdb->prefix . "esp_question";
79
-        $this->_option_table = $wpdb->prefix . "esp_question_option";
80
-        parent::__construct();
81
-    }
73
+	public function __construct()
74
+	{
75
+		global $wpdb;
76
+		$this->_pretty_name  = esc_html__("Questions", "event_espresso");
77
+		$this->_old_table    = $wpdb->prefix . "events_question";
78
+		$this->_new_table    = $wpdb->prefix . "esp_question";
79
+		$this->_option_table = $wpdb->prefix . "esp_question_option";
80
+		parent::__construct();
81
+	}
82 82
 
83 83
 
84
-    /**
85
-     * @throws EE_Error
86
-     */
87
-    public function _migration_step($num_items_to_migrate = 50)
88
-    {
89
-        global $wpdb;
90
-        $start_at_record         = $this->count_records_migrated();
91
-        $rows                    = $wpdb->get_results(
92
-            $wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items_to_migrate),
93
-            ARRAY_A
94
-        );
95
-        $items_actually_migrated = 0;
96
-        foreach ($rows as $question_row) {
97
-            $new_id = $this->_insert_new_question($question_row);
98
-            $this->get_migration_script()->set_mapping(
99
-                $this->_old_table,
100
-                $question_row['id'],
101
-                $this->_new_table,
102
-                $new_id
103
-            );
104
-            $items_actually_migrated++;
105
-        }
106
-        if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
107
-            $this->set_completed();
108
-        }
109
-        return $items_actually_migrated;
110
-    }
84
+	/**
85
+	 * @throws EE_Error
86
+	 */
87
+	public function _migration_step($num_items_to_migrate = 50)
88
+	{
89
+		global $wpdb;
90
+		$start_at_record         = $this->count_records_migrated();
91
+		$rows                    = $wpdb->get_results(
92
+			$wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items_to_migrate),
93
+			ARRAY_A
94
+		);
95
+		$items_actually_migrated = 0;
96
+		foreach ($rows as $question_row) {
97
+			$new_id = $this->_insert_new_question($question_row);
98
+			$this->get_migration_script()->set_mapping(
99
+				$this->_old_table,
100
+				$question_row['id'],
101
+				$this->_new_table,
102
+				$new_id
103
+			);
104
+			$items_actually_migrated++;
105
+		}
106
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
107
+			$this->set_completed();
108
+		}
109
+		return $items_actually_migrated;
110
+	}
111 111
 
112 112
 
113
-    public function _count_records_to_migrate()
114
-    {
115
-        global $wpdb;
116
-        return $wpdb->get_var("SELECT COUNT(id) FROM " . $this->_old_table);
117
-    }
113
+	public function _count_records_to_migrate()
114
+	{
115
+		global $wpdb;
116
+		return $wpdb->get_var("SELECT COUNT(id) FROM " . $this->_old_table);
117
+	}
118 118
 
119 119
 
120
-    private function _insert_new_question($old_question): int
121
-    {
122
-        global $wpdb;
123
-        // if this pretends to be a 'system' question, check if we already have a
124
-        // system question for that string. If so, pretend THAT new question
125
-        // is what we just inserted
126
-        if ($old_question['system_name']) {
127
-            $id_of_new_system_question = intval(
128
-                $wpdb->get_var(
129
-                    $wpdb->prepare(
130
-                        "SELECT QST_ID FROM $this->_new_table WHERE QST_system = %s",
131
-                        $old_question['system_name']
132
-                    )
133
-                )
134
-            );
135
-            if ($id_of_new_system_question) {
136
-                return $id_of_new_system_question;
137
-            }
138
-            // ok so this must be the first one. Carry on.
139
-        }
120
+	private function _insert_new_question($old_question): int
121
+	{
122
+		global $wpdb;
123
+		// if this pretends to be a 'system' question, check if we already have a
124
+		// system question for that string. If so, pretend THAT new question
125
+		// is what we just inserted
126
+		if ($old_question['system_name']) {
127
+			$id_of_new_system_question = intval(
128
+				$wpdb->get_var(
129
+					$wpdb->prepare(
130
+						"SELECT QST_ID FROM $this->_new_table WHERE QST_system = %s",
131
+						$old_question['system_name']
132
+					)
133
+				)
134
+			);
135
+			if ($id_of_new_system_question) {
136
+				return $id_of_new_system_question;
137
+			}
138
+			// ok so this must be the first one. Carry on.
139
+		}
140 140
 
141
-        $cols_n_values = [
142
-            'QST_display_text'  => stripslashes($old_question['question']),
143
-            'QST_admin_label'   => sanitize_title($old_question['question'] ?: ''),
144
-            'QST_system'        => (string) $old_question['system_name'],
145
-            'QST_type'          => $old_question['question_type'],
146
-            'QST_required'      => 'Y' == $old_question['required'],
147
-            'QST_required_text' => stripslashes($old_question['required_text'] ?: ''),
148
-            'QST_order'         => $old_question['sequence'],
149
-            'QST_admin_only'    => 'Y' == $old_question['admin_only'],
150
-            'QST_wp_user'       => $old_question['wp_user'],
151
-            'QST_deleted'       => false,
152
-        ];
153
-        $data_types    = [
154
-            '%s',// QST_display_text
155
-            '%s',// QST-admin_label
156
-            '%s',// QST_system
157
-            '%s',// QST_type
158
-            '%d',// QST_required
159
-            '%s',// QST_required_text
160
-            '%d',// QST_order
161
-            '%d',// QST_admin_only
162
-            '%d',// QST_wp_user
163
-            '%d',// QST_deleted
164
-        ];
165
-        $success       = $wpdb->insert($this->_new_table, $cols_n_values, $data_types);
166
-        if (! $success) {
167
-            $this->add_error(
168
-                $this->get_migration_script()->_create_error_message_for_db_insertion(
169
-                    $this->_old_table,
170
-                    $old_question,
171
-                    $this->_new_table,
172
-                    $cols_n_values,
173
-                    $data_types
174
-                )
175
-            );
176
-            return 0;
177
-        }
178
-        $new_id = $wpdb->insert_id;
179
-        // now take care of possibly adding question options
180
-        if (in_array($old_question['question_type'], ['DROPDOWN', 'SINGLE', 'MULTIPLE'])) {
181
-            $options = explode(",", $old_question['response']);
182
-            foreach ($options as $option) {
183
-                $this->_insert_question_option($option, $new_id);
184
-            }
185
-        }
186
-        return $new_id;
187
-    }
141
+		$cols_n_values = [
142
+			'QST_display_text'  => stripslashes($old_question['question']),
143
+			'QST_admin_label'   => sanitize_title($old_question['question'] ?: ''),
144
+			'QST_system'        => (string) $old_question['system_name'],
145
+			'QST_type'          => $old_question['question_type'],
146
+			'QST_required'      => 'Y' == $old_question['required'],
147
+			'QST_required_text' => stripslashes($old_question['required_text'] ?: ''),
148
+			'QST_order'         => $old_question['sequence'],
149
+			'QST_admin_only'    => 'Y' == $old_question['admin_only'],
150
+			'QST_wp_user'       => $old_question['wp_user'],
151
+			'QST_deleted'       => false,
152
+		];
153
+		$data_types    = [
154
+			'%s',// QST_display_text
155
+			'%s',// QST-admin_label
156
+			'%s',// QST_system
157
+			'%s',// QST_type
158
+			'%d',// QST_required
159
+			'%s',// QST_required_text
160
+			'%d',// QST_order
161
+			'%d',// QST_admin_only
162
+			'%d',// QST_wp_user
163
+			'%d',// QST_deleted
164
+		];
165
+		$success       = $wpdb->insert($this->_new_table, $cols_n_values, $data_types);
166
+		if (! $success) {
167
+			$this->add_error(
168
+				$this->get_migration_script()->_create_error_message_for_db_insertion(
169
+					$this->_old_table,
170
+					$old_question,
171
+					$this->_new_table,
172
+					$cols_n_values,
173
+					$data_types
174
+				)
175
+			);
176
+			return 0;
177
+		}
178
+		$new_id = $wpdb->insert_id;
179
+		// now take care of possibly adding question options
180
+		if (in_array($old_question['question_type'], ['DROPDOWN', 'SINGLE', 'MULTIPLE'])) {
181
+			$options = explode(",", $old_question['response']);
182
+			foreach ($options as $option) {
183
+				$this->_insert_question_option($option, $new_id);
184
+			}
185
+		}
186
+		return $new_id;
187
+	}
188 188
 
189 189
 
190
-    /**
191
-     * Adds a question option to the db
192
-     *
193
-     * @param string $option
194
-     * @param int    $question_id
195
-     * @return void
196
-     * @global wpdb  $wpdb
197
-     */
198
-    private function _insert_question_option(string $option, int $question_id): void
199
-    {
200
-        $option = trim($option);
201
-        global $wpdb;
202
-        $cols_n_values = [
203
-            'QST_ID'      => $question_id,
204
-            'QSO_value'   => $option,
205
-            'QSO_deleted' => false,
206
-        ];
207
-        $data_types    = [
208
-            '%d',// QST_ID
209
-            '%s',// QSO_value
210
-            '%d',// QSO_deleted
211
-        ];
212
-        $success       = $wpdb->insert($this->_option_table, $cols_n_values, $data_types);
213
-        if (! $success) {
214
-            $this->add_error(
215
-                $this->get_migration_script()->_create_error_message_for_db_insertion(
216
-                    $this->_old_table,
217
-                    ['option' => $option, 'new_question_id' => $question_id],
218
-                    $this->_option_table,
219
-                    $cols_n_values,
220
-                    $data_types
221
-                )
222
-            );
223
-        }
224
-    }
190
+	/**
191
+	 * Adds a question option to the db
192
+	 *
193
+	 * @param string $option
194
+	 * @param int    $question_id
195
+	 * @return void
196
+	 * @global wpdb  $wpdb
197
+	 */
198
+	private function _insert_question_option(string $option, int $question_id): void
199
+	{
200
+		$option = trim($option);
201
+		global $wpdb;
202
+		$cols_n_values = [
203
+			'QST_ID'      => $question_id,
204
+			'QSO_value'   => $option,
205
+			'QSO_deleted' => false,
206
+		];
207
+		$data_types    = [
208
+			'%d',// QST_ID
209
+			'%s',// QSO_value
210
+			'%d',// QSO_deleted
211
+		];
212
+		$success       = $wpdb->insert($this->_option_table, $cols_n_values, $data_types);
213
+		if (! $success) {
214
+			$this->add_error(
215
+				$this->get_migration_script()->_create_error_message_for_db_insertion(
216
+					$this->_old_table,
217
+					['option' => $option, 'new_question_id' => $question_id],
218
+					$this->_option_table,
219
+					$cols_n_values,
220
+					$data_types
221
+				)
222
+			);
223
+		}
224
+	}
225 225
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/4_1_0_stages/EE_DMS_4_1_0_events.dmsstage.php 2 patches
Indentation   +817 added lines, -817 removed lines patch added patch discarded remove patch
@@ -175,825 +175,825 @@
 block discarded – undo
175 175
 class EE_DMS_4_1_0_events extends EE_Data_Migration_Script_Stage
176 176
 {
177 177
 
178
-    private string $_old_start_end_table;
179
-
180
-    private string $_new_meta_table;
181
-
182
-    private string $_new_datetime_table;
183
-
184
-
185
-    /**
186
-     * Just initializes the status of the migration
187
-     */
188
-    public function __construct()
189
-    {
190
-        global $wpdb;
191
-        $this->_old_table           = $wpdb->prefix . "events_detail";
192
-        $this->_old_start_end_table = $wpdb->prefix . "events_start_end";
193
-        $this->_new_table           = $wpdb->prefix . "posts";
194
-        $this->_new_meta_table      = $wpdb->prefix . "esp_event_meta";
195
-        $this->_new_datetime_table  = $wpdb->prefix . "esp_datetime";
196
-        $this->_pretty_name         = esc_html__("Events", "event_espresso");
197
-        parent::__construct();
198
-    }
199
-
200
-
201
-    /**
202
-     * Counts the records to migrate; the public version may cache it
203
-     *
204
-     * @return int
205
-     */
206
-    public function _count_records_to_migrate(): int
207
-    {
208
-        global $wpdb;
209
-        return (int) $wpdb->get_var("SELECT COUNT(*) FROM " . $this->_old_table . ' WHERE event_status !="D"');
210
-    }
211
-
212
-
213
-    /**
214
-     * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property
215
-     * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that
216
-     * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the
217
-     * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees
218
-     * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at
219
-     * very least we MUST report/return 50 items migrated)
220
-     *
221
-     * @param int $num_items_to_migrate
222
-     * @return int number of items ACTUALLY migrated
223
-     * @throws EE_Error
224
-     */
225
-    protected function _migration_step($num_items_to_migrate = 50)
226
-    {
227
-        global $wpdb;
228
-        // because the migration of each event can be a LOT more work, make each step smaller
229
-        $num_items_to_migrate     = max(1, $num_items_to_migrate / 5);
230
-        $events                   =
231
-            $wpdb->get_results(
232
-                $wpdb->prepare(
233
-                    "SELECT * FROM $this->_old_table WHERE event_status!='D' LIMIT %d,%d",
234
-                    $this->count_records_migrated(),
235
-                    $num_items_to_migrate
236
-                ),
237
-                ARRAY_A
238
-            );
239
-        $items_migrated_this_step = 0;
240
-
241
-        foreach ($events as $event_row) {
242
-            $guid = null;
243
-            // insert new 4.1 Attendee object using $wpdb
244
-            $post_id = $this->_insert_cpt($event_row);
245
-            if ($post_id) {
246
-                $this->get_migration_script()->set_mapping(
247
-                    $this->_old_table,
248
-                    $event_row['id'],
249
-                    $this->_new_table,
250
-                    $post_id
251
-                );
252
-                $meta_id = $this->_insert_event_meta($event_row, $post_id);
253
-                if ($meta_id) {
254
-                    $this->get_migration_script()->set_mapping(
255
-                        $this->_old_table,
256
-                        $event_row['id'],
257
-                        $this->_new_meta_table,
258
-                        $meta_id
259
-                    );
260
-                }
261
-                $this->_convert_start_end_times($event_row, $post_id);
262
-                $event_meta = maybe_unserialize($event_row['event_meta']);
263
-                $guid       = $event_meta['event_thumbnail_url'] ?? null;
264
-                if ($guid) {
265
-                    $this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post(
266
-                        $guid,
267
-                        $post_id,
268
-                        $this
269
-                    );
270
-                }
271
-                // maybe create a venue from info on the event?
272
-                $new_venue_id = $this->_maybe_create_venue($event_row);
273
-                if ($new_venue_id) {
274
-                    $this->_insert_new_venue_to_event($post_id, $new_venue_id);
275
-                }
276
-                $this->_add_post_metas($event_row, $post_id);
277
-            }
278
-            $items_migrated_this_step++;
279
-            if ($guid) {
280
-                // if we had to check for an image attachment
281
-                // then let's call it a day (avoid timing out, because this took a long time)
282
-                break;
283
-            }
284
-        }
285
-        if ($this->count_records_migrated() + $items_migrated_this_step >= $this->count_records_to_migrate()) {
286
-            $this->set_status(EE_Data_Migration_Manager::status_completed);
287
-        }
288
-        return $items_migrated_this_step;
289
-    }
290
-
291
-
292
-    /**
293
-     * Stores any extra 3.1 "event_meta" column things as post meta
294
-     *
295
-     * @param array $old_event
296
-     * @param int   $post_id
297
-     * @return void
298
-     */
299
-    private function _add_post_metas(array $old_event, int $post_id)
300
-    {
301
-        $event_meta = maybe_unserialize($old_event['event_meta']);
302
-        if (! $event_meta || ! is_array($event_meta)) {
303
-            return;
304
-        }
305
-        unset($event_meta['date_submitted']);              // factored into CPT
306
-        unset($event_meta['additional_attendee_reg_info']);// factored into event meta table
307
-        unset($event_meta['default_payment_status']);      // dido
308
-        unset($event_meta['event_thumbnail_url']);         // used to find post featured image
309
-        foreach ($event_meta as $meta_key => $meta_value) {
310
-            if ($meta_key) {// if the meta key is just an empty string, ignore it
311
-                $success = add_post_meta($post_id, $meta_key, $meta_value, true);
312
-                if (! $success) {
313
-                    $this->add_error(
314
-                        sprintf(
315
-                            esc_html__(
316
-                                "Could not add post meta for CPT with ID #%d. Meta key: '%s',meta value:'%d' for 3.1 event: %s",
317
-                                "event_espresso"
318
-                            ),
319
-                            $post_id,
320
-                            $meta_key,
321
-                            $meta_value,
322
-                            implode(",", $old_event)
323
-                        )
324
-                    );
325
-                }
326
-            }
327
-        }
328
-        if ($old_event['alt_email']) {
329
-            add_post_meta($post_id, 'alt_email', $old_event['alt_email']);
330
-        }
331
-        if ($old_event['recurrence_id']) {
332
-            add_post_meta($post_id, 'recurrence_id', $old_event['recurrence_id']);
333
-        }
334
-    }
335
-
336
-
337
-    /**
338
-     * Finds a unique slug for this event, given its name (we could have simply used
339
-     * the old unique_identifier column, but it added a long string of seemingly random characters onto the end
340
-     * and really wasn't that pretty for a slug, so we decided we'd make our own slug again)
341
-     *
342
-     * @param string $event_name      (the name of the event for reading by humans)
343
-     * @param string $old_identifier  the old EE3 identifier (a long unique string)
344
-     * @param string $new_post_status a post status
345
-     * @return string
346
-     */
347
-    private function _find_unique_slug(
348
-        string $event_name,
349
-        string $old_identifier = '',
350
-        string $new_post_status = 'publish'
351
-    ): string {
352
-        $original_name = $event_name ? sanitize_title($event_name) : $old_identifier;
353
-        return wp_unique_post_slug($original_name, 0, $new_post_status, 'espresso_events', 0);
354
-    }
355
-
356
-
357
-    /**
358
-     * returns whether there is a post that has this same slug (post_title)
359
-     *
360
-     * @param string $slug
361
-     * @return boolean
362
-     * @global wpdb  $wpdb
363
-     */
364
-    private function _other_post_exists_with_that_slug(string $slug): bool
365
-    {
366
-        global $wpdb;
367
-        $query =
368
-            $wpdb->prepare(
369
-                "SELECT COUNT(ID) FROM $this->_new_table WHERE event_status != 'D' AND post_name = %s",
370
-                $slug
371
-            );
372
-        $count = $wpdb->get_var($query);
373
-        return (bool) intval($count);
374
-    }
375
-
376
-
377
-    /**
378
-     * @param $old_event
379
-     * @return int
380
-     */
381
-    private function _insert_cpt($old_event): int
382
-    {
383
-        global $wpdb;
384
-        // convert 3.1 event status to 4.1 CPT status
385
-        // for reference, 3.1 event stati available for setting are:
386
-        //      $status = array(array('id' => 'A', 'text' => esc_html__('Public', 'event_espresso')), array('id' => 'S', 'text' => esc_html__('Waitlist', 'event_espresso')), array('id' => 'O', 'text' => esc_html__('Ongoing', 'event_espresso')), array('id' => 'R', 'text' => esc_html__('Draft', 'event_espresso')), array('id' => 'D', 'text' => esc_html__('Deleted', 'event_espresso')));
387
-        //      and the json api uses the following to convert from 3.1 to 4.0
388
-        //      'S'=>'secondary/waitlist',
389
-        //      'A'=>'active',
390
-        //      'X'=>'denied',
391
-        //      'IA'=>'inactive',
392
-        //      'O'=>'ongoing',
393
-        //      'P'=>'pending',
394
-        //      'R'=>'draft',
395
-        //      'D'=>'deleted');
396
-        //      4.1 Event Post stati are the normal post statis
397
-        //      (publish,future,draft,pending,private,trash,auto-draft,inherit)
398
-        //      and 3 custom ones: cancelled,postponed,sold_out
399
-        $status_conversions = [
400
-            'R'  => 'draft',
401
-            'X'  => 'draft',
402
-            // 4.1 doesn't have a "not approved for publishing" status. this is what posts are set to that aren't approved
403
-            'P'  => 'pending',
404
-            'IA' => 'draft',
405
-            // draft and in the past
406
-            // IA=inactive in 3.1: events were switched to this when they expired. in 4.1 that's just calculated
407
-            'O'  => 'publish',
408
-            // @todo: will be an event type later; if this is the status, set the end date WAAAY later; and add term for 'ongoing'
409
-            'A'  => 'publish',
410
-            'S'  => 'draft',
411
-            // @todo: is it ok to just mark secondary/waitlist events as DRAFTS?
412
-            'D'  => 'trash',
413
-        ];
414
-        $post_status        = $status_conversions[ $old_event['event_status'] ];
415
-        // check if we've sold out
416
-        if (intval($old_event['reg_limit']) <= self::count_registrations($old_event['id'])) {
417
-            $post_status = 'sold_out';
418
-        }
419
-        //      FYI postponed and cancelled don't exist in 3.1
420
-        $cols_n_values                      = [
421
-            'post_title'        => stripslashes($old_event['event_name']),// EVT_name
422
-            'post_content'      => stripslashes($old_event['event_desc']),// EVT_desc
423
-            'post_name'         => $this->_find_unique_slug(
424
-                $old_event['event_name'],
425
-                $old_event['event_identifier'],
426
-                $post_status
427
-            ),// EVT_slug
428
-            'post_date'         => $old_event['submitted'],// EVT_created NOT
429
-            'post_date_gmt'     => get_gmt_from_date($old_event['submitted']),
430
-            'post_excerpt'      => '',// EVT_short_desc
431
-            'post_modified'     => $old_event['submitted'],// EVT_modified
432
-            'post_modified_gmt' => get_gmt_from_date($old_event['submitted']),
433
-            'post_author'       => $old_event['wp_user'],// EVT_wp_user
434
-            'post_parent'       => 0,// parent maybe get this from some REM field?
435
-            'menu_order'        => 0,// EVT_order
436
-            'post_type'         => 'espresso_events',// post_type
437
-            'post_status'       => $post_status,// status
438
-        ];
439
-        $cols_n_values_with_no_invalid_text = [];
440
-        foreach ($cols_n_values as $col => $value) {
441
-            $value_sans_invalid_chars = $wpdb->strip_invalid_text_for_column($this->_new_table, $col, $value);
442
-            if (! is_wp_error($value_sans_invalid_chars)) {
443
-                $cols_n_values_with_no_invalid_text[ $col ] = $value_sans_invalid_chars;
444
-            } else {
445
-                // otherwise leave it as-is. It will blow everything up and stop the migration
446
-                $cols_n_values_with_no_invalid_text[ $col ] = $value;
447
-            }
448
-        }
449
-        $cols_n_values = $cols_n_values_with_no_invalid_text;
450
-        $data_types    = [
451
-            '%s',// EVT_name
452
-            '%s',// EVT_desc
453
-            '%s',// EVT_slug
454
-            '%s',// EVT_created
455
-            '%s',
456
-            '%s',// EVT_short_desc
457
-            '%s',// EVT_modified
458
-            '%s',
459
-            '%s',// EVT_wp_user
460
-            '%d',// post_parent
461
-            '%d',// EVT_order
462
-            '%s',// post_type
463
-            '%s',// status
464
-        ];
465
-        $success       = $wpdb->insert(
466
-            $this->_new_table,
467
-            $cols_n_values,
468
-            $data_types
469
-        );
470
-        if (! $success) {
471
-            $this->add_error(
472
-                $this->get_migration_script()->_create_error_message_for_db_insertion(
473
-                    $this->_old_table,
474
-                    $old_event,
475
-                    $this->_new_table,
476
-                    $cols_n_values,
477
-                    $data_types
478
-                )
479
-            );
480
-            return 0;
481
-        }
482
-        return $wpdb->insert_id;
483
-    }
484
-
485
-
486
-    /**
487
-     * Counts all the registrations for the event in the 3.1 DB. (takes into account attendee rows which represent
488
-     * various registrations)
489
-     *
490
-     * @param int   $event_id
491
-     * @return int
492
-     * @global wpdb $wpdb
493
-     */
494
-    public static function count_registrations(int $event_id): int
495
-    {
496
-        global $wpdb;
497
-        return (int) $wpdb->get_var(
498
-            $wpdb->prepare("SELECT sum(quantity) FROM {$wpdb->prefix}events_attendee WHERE event_id=%d", $event_id)
499
-        );
500
-    }
501
-
502
-
503
-    /**
504
-     * @param $old_event
505
-     * @param $new_cpt_id
506
-     * @return int
507
-     */
508
-    private function _insert_event_meta($old_event, $new_cpt_id): int
509
-    {
510
-        global $wpdb;
511
-        $event_meta = maybe_unserialize($old_event['event_meta']);
512
-        //      for reference, 3.1 'default_payment_status' are: $default_payment_status = array(
513
-        //  array('id' => "", 'text' => 'No Change'),
514
-        //  array('id' => 'Incomplete', 'text' => 'Incomplete'),
515
-        //  array('id' => 'Pending', 'text' => 'Pending'),
516
-        //  //array('id' => 'Completed', 'text' => 'Completed')
517
-        // );
518
-        $default_reg_status =
519
-            $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID(
520
-                $event_meta['default_payment_status'] ?? '',
521
-                intval($old_event['require_pre_approval'])
522
-            );
523
-        $cols_n_values      = [
524
-            'EVT_ID'                          => $new_cpt_id,// EVT_ID_fk
525
-            'EVT_display_desc'                => 'Y' == $old_event['display_desc'],
526
-            'EVT_display_ticket_selector'     => 'Y' == $old_event['display_reg_form'],
527
-            'EVT_visible_on'                  => $this->get_migration_script()->convert_date_string_to_utc(
528
-                $this,
529
-                $old_event,
530
-                current_time(
531
-                    'mysql'
532
-                ),
533
-                $old_event['timezone_string']
534
-            ),// don't use the old 'visible_on', as it wasn't ever used
535
-            'EVT_additional_limit'            => $old_event['allow_multiple'] == 'N' ? 1
536
-                : $old_event['additional_limit'],
537
-            'EVT_default_registration_status' => $default_reg_status,
538
-            'EVT_member_only'                 => $old_event['member_only'],
539
-            'EVT_phone'                       => $old_event['phone'],
540
-            'EVT_allow_overflow'              => 'Y' == $old_event['allow_overflow'],
541
-            'EVT_timezone_string'             => $old_event['timezone_string'],
542
-            'EVT_external_URL'                => $old_event['externalURL'],
543
-            'EVT_donations'                   => false,// doesn't exist in 3.1
544
-
545
-        ];
546
-        $data_types         = [
547
-            '%s',// EVT_ID
548
-            '%d',// EVT_display_desc
549
-            '%d',// EVT_display_ticket_selector
550
-            '%s',// EVT_visible_on
551
-            '%d',// EVT_additional_limit
552
-            '%s',// EVT_default_registration_status
553
-            '%d',// EVT_member_only
554
-            '%s',// EVT_phone
555
-            '%d',// EVT_allow_overflow
556
-            '%s',// EVT_timezone_string
557
-            '%s',// EVT_external_URL
558
-            '%d',// EVT_donations
559
-        ];
560
-        $success            = $wpdb->insert(
561
-            $this->_new_meta_table,
562
-            $cols_n_values,
563
-            $data_types
564
-        );
565
-        if (! $success) {
566
-            $this->add_error(
567
-                $this->get_migration_script()->_create_error_message_for_db_insertion(
568
-                    $this->_old_table,
569
-                    $old_event,
570
-                    $this->_new_meta_table,
571
-                    $cols_n_values,
572
-                    $data_types
573
-                )
574
-            );
575
-            return 0;
576
-        }
577
-        return $wpdb->insert_id;
578
-    }
579
-
580
-
581
-    /**
582
-     * @param $old_event
583
-     * @return int
584
-     */
585
-    private function _maybe_create_venue($old_event): int
586
-    {
587
-        if (
588
-            $old_event['address'] ||
589
-            $old_event['address2'] ||
590
-            $old_event['city'] ||
591
-            $old_event['state'] ||
592
-            $old_event['zip'] ||
593
-            $old_event['venue_title'] ||
594
-            $old_event['venue_url'] ||
595
-            $old_event['venue_image'] ||
596
-            $old_event['venue_phone'] ||
597
-            $old_event['virtual_url'] ||
598
-            $old_event['virtual_phone']
599
-        ) {
600
-            $old_id = $this->_duplicate_venue_exists($old_event);
601
-            if ($old_id) {
602
-                return $old_id;
603
-            }
604
-            $new_id = $this->_insert_venue_into_posts($old_event);
605
-            if ($new_id) {
606
-                $this->_insert_venue_into_meta_table($new_id, $old_event);
607
-                $guid = $old_event['venue_image'] ?? null;
608
-                if($guid) {
609
-                    $this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post(
610
-                        $guid,
611
-                        $new_id,
612
-                        $this
613
-                    );
614
-                }
615
-            }
616
-            // we don't bother recording the conversion from old events to venues as that
617
-            // will complicate finding the conversion from old venues to new events
618
-            return $new_id;
619
-        }
620
-        return 0;
621
-    }
622
-
623
-
624
-    /**
625
-     * Assuming there is venue data on this event, check if there is a duplicate venue already in the system for it.
626
-     * If so, return it. Otherwise, return NULL.
627
-     *
628
-     * @param array $old_event
629
-     * @return int duplicate venue id
630
-     */
631
-    private function _duplicate_venue_exists(array $old_event): int
632
-    {
633
-        global $wpdb;
634
-        $conditions     = [
635
-            'VNU_address'       => $old_event ['address'],
636
-            'VNU_address2'      => $old_event['address2'],
637
-            'VNU_city'          => $old_event['city'],
638
-            'VNU_zip'           => $old_event['zip'],
639
-            'post_title'        => $this->_get_venue_title_for_event($old_event),
640
-            'VNU_phone'         => $old_event['venue_phone'],// VNU_phone
641
-            'VNU_url'           => $old_event['venue_url'],// VNU_url
642
-            'VNU_virtual_phone' => $old_event['virtual_phone'],// VNU_virtual_phone
643
-            'VNU_virtual_url'   => $old_event['virtual_url'],// VNU_virtual_url
644
-        ];
645
-        $sql_conditions = [];
646
-        foreach ($conditions as $column => $value) {
647
-            $sql_conditions [] = $wpdb->prepare("$column = %s", $value);
648
-        }
649
-        $query = "SELECT VNU_ID
178
+	private string $_old_start_end_table;
179
+
180
+	private string $_new_meta_table;
181
+
182
+	private string $_new_datetime_table;
183
+
184
+
185
+	/**
186
+	 * Just initializes the status of the migration
187
+	 */
188
+	public function __construct()
189
+	{
190
+		global $wpdb;
191
+		$this->_old_table           = $wpdb->prefix . "events_detail";
192
+		$this->_old_start_end_table = $wpdb->prefix . "events_start_end";
193
+		$this->_new_table           = $wpdb->prefix . "posts";
194
+		$this->_new_meta_table      = $wpdb->prefix . "esp_event_meta";
195
+		$this->_new_datetime_table  = $wpdb->prefix . "esp_datetime";
196
+		$this->_pretty_name         = esc_html__("Events", "event_espresso");
197
+		parent::__construct();
198
+	}
199
+
200
+
201
+	/**
202
+	 * Counts the records to migrate; the public version may cache it
203
+	 *
204
+	 * @return int
205
+	 */
206
+	public function _count_records_to_migrate(): int
207
+	{
208
+		global $wpdb;
209
+		return (int) $wpdb->get_var("SELECT COUNT(*) FROM " . $this->_old_table . ' WHERE event_status !="D"');
210
+	}
211
+
212
+
213
+	/**
214
+	 * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property
215
+	 * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that
216
+	 * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the
217
+	 * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees
218
+	 * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at
219
+	 * very least we MUST report/return 50 items migrated)
220
+	 *
221
+	 * @param int $num_items_to_migrate
222
+	 * @return int number of items ACTUALLY migrated
223
+	 * @throws EE_Error
224
+	 */
225
+	protected function _migration_step($num_items_to_migrate = 50)
226
+	{
227
+		global $wpdb;
228
+		// because the migration of each event can be a LOT more work, make each step smaller
229
+		$num_items_to_migrate     = max(1, $num_items_to_migrate / 5);
230
+		$events                   =
231
+			$wpdb->get_results(
232
+				$wpdb->prepare(
233
+					"SELECT * FROM $this->_old_table WHERE event_status!='D' LIMIT %d,%d",
234
+					$this->count_records_migrated(),
235
+					$num_items_to_migrate
236
+				),
237
+				ARRAY_A
238
+			);
239
+		$items_migrated_this_step = 0;
240
+
241
+		foreach ($events as $event_row) {
242
+			$guid = null;
243
+			// insert new 4.1 Attendee object using $wpdb
244
+			$post_id = $this->_insert_cpt($event_row);
245
+			if ($post_id) {
246
+				$this->get_migration_script()->set_mapping(
247
+					$this->_old_table,
248
+					$event_row['id'],
249
+					$this->_new_table,
250
+					$post_id
251
+				);
252
+				$meta_id = $this->_insert_event_meta($event_row, $post_id);
253
+				if ($meta_id) {
254
+					$this->get_migration_script()->set_mapping(
255
+						$this->_old_table,
256
+						$event_row['id'],
257
+						$this->_new_meta_table,
258
+						$meta_id
259
+					);
260
+				}
261
+				$this->_convert_start_end_times($event_row, $post_id);
262
+				$event_meta = maybe_unserialize($event_row['event_meta']);
263
+				$guid       = $event_meta['event_thumbnail_url'] ?? null;
264
+				if ($guid) {
265
+					$this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post(
266
+						$guid,
267
+						$post_id,
268
+						$this
269
+					);
270
+				}
271
+				// maybe create a venue from info on the event?
272
+				$new_venue_id = $this->_maybe_create_venue($event_row);
273
+				if ($new_venue_id) {
274
+					$this->_insert_new_venue_to_event($post_id, $new_venue_id);
275
+				}
276
+				$this->_add_post_metas($event_row, $post_id);
277
+			}
278
+			$items_migrated_this_step++;
279
+			if ($guid) {
280
+				// if we had to check for an image attachment
281
+				// then let's call it a day (avoid timing out, because this took a long time)
282
+				break;
283
+			}
284
+		}
285
+		if ($this->count_records_migrated() + $items_migrated_this_step >= $this->count_records_to_migrate()) {
286
+			$this->set_status(EE_Data_Migration_Manager::status_completed);
287
+		}
288
+		return $items_migrated_this_step;
289
+	}
290
+
291
+
292
+	/**
293
+	 * Stores any extra 3.1 "event_meta" column things as post meta
294
+	 *
295
+	 * @param array $old_event
296
+	 * @param int   $post_id
297
+	 * @return void
298
+	 */
299
+	private function _add_post_metas(array $old_event, int $post_id)
300
+	{
301
+		$event_meta = maybe_unserialize($old_event['event_meta']);
302
+		if (! $event_meta || ! is_array($event_meta)) {
303
+			return;
304
+		}
305
+		unset($event_meta['date_submitted']);              // factored into CPT
306
+		unset($event_meta['additional_attendee_reg_info']);// factored into event meta table
307
+		unset($event_meta['default_payment_status']);      // dido
308
+		unset($event_meta['event_thumbnail_url']);         // used to find post featured image
309
+		foreach ($event_meta as $meta_key => $meta_value) {
310
+			if ($meta_key) {// if the meta key is just an empty string, ignore it
311
+				$success = add_post_meta($post_id, $meta_key, $meta_value, true);
312
+				if (! $success) {
313
+					$this->add_error(
314
+						sprintf(
315
+							esc_html__(
316
+								"Could not add post meta for CPT with ID #%d. Meta key: '%s',meta value:'%d' for 3.1 event: %s",
317
+								"event_espresso"
318
+							),
319
+							$post_id,
320
+							$meta_key,
321
+							$meta_value,
322
+							implode(",", $old_event)
323
+						)
324
+					);
325
+				}
326
+			}
327
+		}
328
+		if ($old_event['alt_email']) {
329
+			add_post_meta($post_id, 'alt_email', $old_event['alt_email']);
330
+		}
331
+		if ($old_event['recurrence_id']) {
332
+			add_post_meta($post_id, 'recurrence_id', $old_event['recurrence_id']);
333
+		}
334
+	}
335
+
336
+
337
+	/**
338
+	 * Finds a unique slug for this event, given its name (we could have simply used
339
+	 * the old unique_identifier column, but it added a long string of seemingly random characters onto the end
340
+	 * and really wasn't that pretty for a slug, so we decided we'd make our own slug again)
341
+	 *
342
+	 * @param string $event_name      (the name of the event for reading by humans)
343
+	 * @param string $old_identifier  the old EE3 identifier (a long unique string)
344
+	 * @param string $new_post_status a post status
345
+	 * @return string
346
+	 */
347
+	private function _find_unique_slug(
348
+		string $event_name,
349
+		string $old_identifier = '',
350
+		string $new_post_status = 'publish'
351
+	): string {
352
+		$original_name = $event_name ? sanitize_title($event_name) : $old_identifier;
353
+		return wp_unique_post_slug($original_name, 0, $new_post_status, 'espresso_events', 0);
354
+	}
355
+
356
+
357
+	/**
358
+	 * returns whether there is a post that has this same slug (post_title)
359
+	 *
360
+	 * @param string $slug
361
+	 * @return boolean
362
+	 * @global wpdb  $wpdb
363
+	 */
364
+	private function _other_post_exists_with_that_slug(string $slug): bool
365
+	{
366
+		global $wpdb;
367
+		$query =
368
+			$wpdb->prepare(
369
+				"SELECT COUNT(ID) FROM $this->_new_table WHERE event_status != 'D' AND post_name = %s",
370
+				$slug
371
+			);
372
+		$count = $wpdb->get_var($query);
373
+		return (bool) intval($count);
374
+	}
375
+
376
+
377
+	/**
378
+	 * @param $old_event
379
+	 * @return int
380
+	 */
381
+	private function _insert_cpt($old_event): int
382
+	{
383
+		global $wpdb;
384
+		// convert 3.1 event status to 4.1 CPT status
385
+		// for reference, 3.1 event stati available for setting are:
386
+		//      $status = array(array('id' => 'A', 'text' => esc_html__('Public', 'event_espresso')), array('id' => 'S', 'text' => esc_html__('Waitlist', 'event_espresso')), array('id' => 'O', 'text' => esc_html__('Ongoing', 'event_espresso')), array('id' => 'R', 'text' => esc_html__('Draft', 'event_espresso')), array('id' => 'D', 'text' => esc_html__('Deleted', 'event_espresso')));
387
+		//      and the json api uses the following to convert from 3.1 to 4.0
388
+		//      'S'=>'secondary/waitlist',
389
+		//      'A'=>'active',
390
+		//      'X'=>'denied',
391
+		//      'IA'=>'inactive',
392
+		//      'O'=>'ongoing',
393
+		//      'P'=>'pending',
394
+		//      'R'=>'draft',
395
+		//      'D'=>'deleted');
396
+		//      4.1 Event Post stati are the normal post statis
397
+		//      (publish,future,draft,pending,private,trash,auto-draft,inherit)
398
+		//      and 3 custom ones: cancelled,postponed,sold_out
399
+		$status_conversions = [
400
+			'R'  => 'draft',
401
+			'X'  => 'draft',
402
+			// 4.1 doesn't have a "not approved for publishing" status. this is what posts are set to that aren't approved
403
+			'P'  => 'pending',
404
+			'IA' => 'draft',
405
+			// draft and in the past
406
+			// IA=inactive in 3.1: events were switched to this when they expired. in 4.1 that's just calculated
407
+			'O'  => 'publish',
408
+			// @todo: will be an event type later; if this is the status, set the end date WAAAY later; and add term for 'ongoing'
409
+			'A'  => 'publish',
410
+			'S'  => 'draft',
411
+			// @todo: is it ok to just mark secondary/waitlist events as DRAFTS?
412
+			'D'  => 'trash',
413
+		];
414
+		$post_status        = $status_conversions[ $old_event['event_status'] ];
415
+		// check if we've sold out
416
+		if (intval($old_event['reg_limit']) <= self::count_registrations($old_event['id'])) {
417
+			$post_status = 'sold_out';
418
+		}
419
+		//      FYI postponed and cancelled don't exist in 3.1
420
+		$cols_n_values                      = [
421
+			'post_title'        => stripslashes($old_event['event_name']),// EVT_name
422
+			'post_content'      => stripslashes($old_event['event_desc']),// EVT_desc
423
+			'post_name'         => $this->_find_unique_slug(
424
+				$old_event['event_name'],
425
+				$old_event['event_identifier'],
426
+				$post_status
427
+			),// EVT_slug
428
+			'post_date'         => $old_event['submitted'],// EVT_created NOT
429
+			'post_date_gmt'     => get_gmt_from_date($old_event['submitted']),
430
+			'post_excerpt'      => '',// EVT_short_desc
431
+			'post_modified'     => $old_event['submitted'],// EVT_modified
432
+			'post_modified_gmt' => get_gmt_from_date($old_event['submitted']),
433
+			'post_author'       => $old_event['wp_user'],// EVT_wp_user
434
+			'post_parent'       => 0,// parent maybe get this from some REM field?
435
+			'menu_order'        => 0,// EVT_order
436
+			'post_type'         => 'espresso_events',// post_type
437
+			'post_status'       => $post_status,// status
438
+		];
439
+		$cols_n_values_with_no_invalid_text = [];
440
+		foreach ($cols_n_values as $col => $value) {
441
+			$value_sans_invalid_chars = $wpdb->strip_invalid_text_for_column($this->_new_table, $col, $value);
442
+			if (! is_wp_error($value_sans_invalid_chars)) {
443
+				$cols_n_values_with_no_invalid_text[ $col ] = $value_sans_invalid_chars;
444
+			} else {
445
+				// otherwise leave it as-is. It will blow everything up and stop the migration
446
+				$cols_n_values_with_no_invalid_text[ $col ] = $value;
447
+			}
448
+		}
449
+		$cols_n_values = $cols_n_values_with_no_invalid_text;
450
+		$data_types    = [
451
+			'%s',// EVT_name
452
+			'%s',// EVT_desc
453
+			'%s',// EVT_slug
454
+			'%s',// EVT_created
455
+			'%s',
456
+			'%s',// EVT_short_desc
457
+			'%s',// EVT_modified
458
+			'%s',
459
+			'%s',// EVT_wp_user
460
+			'%d',// post_parent
461
+			'%d',// EVT_order
462
+			'%s',// post_type
463
+			'%s',// status
464
+		];
465
+		$success       = $wpdb->insert(
466
+			$this->_new_table,
467
+			$cols_n_values,
468
+			$data_types
469
+		);
470
+		if (! $success) {
471
+			$this->add_error(
472
+				$this->get_migration_script()->_create_error_message_for_db_insertion(
473
+					$this->_old_table,
474
+					$old_event,
475
+					$this->_new_table,
476
+					$cols_n_values,
477
+					$data_types
478
+				)
479
+			);
480
+			return 0;
481
+		}
482
+		return $wpdb->insert_id;
483
+	}
484
+
485
+
486
+	/**
487
+	 * Counts all the registrations for the event in the 3.1 DB. (takes into account attendee rows which represent
488
+	 * various registrations)
489
+	 *
490
+	 * @param int   $event_id
491
+	 * @return int
492
+	 * @global wpdb $wpdb
493
+	 */
494
+	public static function count_registrations(int $event_id): int
495
+	{
496
+		global $wpdb;
497
+		return (int) $wpdb->get_var(
498
+			$wpdb->prepare("SELECT sum(quantity) FROM {$wpdb->prefix}events_attendee WHERE event_id=%d", $event_id)
499
+		);
500
+	}
501
+
502
+
503
+	/**
504
+	 * @param $old_event
505
+	 * @param $new_cpt_id
506
+	 * @return int
507
+	 */
508
+	private function _insert_event_meta($old_event, $new_cpt_id): int
509
+	{
510
+		global $wpdb;
511
+		$event_meta = maybe_unserialize($old_event['event_meta']);
512
+		//      for reference, 3.1 'default_payment_status' are: $default_payment_status = array(
513
+		//  array('id' => "", 'text' => 'No Change'),
514
+		//  array('id' => 'Incomplete', 'text' => 'Incomplete'),
515
+		//  array('id' => 'Pending', 'text' => 'Pending'),
516
+		//  //array('id' => 'Completed', 'text' => 'Completed')
517
+		// );
518
+		$default_reg_status =
519
+			$this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID(
520
+				$event_meta['default_payment_status'] ?? '',
521
+				intval($old_event['require_pre_approval'])
522
+			);
523
+		$cols_n_values      = [
524
+			'EVT_ID'                          => $new_cpt_id,// EVT_ID_fk
525
+			'EVT_display_desc'                => 'Y' == $old_event['display_desc'],
526
+			'EVT_display_ticket_selector'     => 'Y' == $old_event['display_reg_form'],
527
+			'EVT_visible_on'                  => $this->get_migration_script()->convert_date_string_to_utc(
528
+				$this,
529
+				$old_event,
530
+				current_time(
531
+					'mysql'
532
+				),
533
+				$old_event['timezone_string']
534
+			),// don't use the old 'visible_on', as it wasn't ever used
535
+			'EVT_additional_limit'            => $old_event['allow_multiple'] == 'N' ? 1
536
+				: $old_event['additional_limit'],
537
+			'EVT_default_registration_status' => $default_reg_status,
538
+			'EVT_member_only'                 => $old_event['member_only'],
539
+			'EVT_phone'                       => $old_event['phone'],
540
+			'EVT_allow_overflow'              => 'Y' == $old_event['allow_overflow'],
541
+			'EVT_timezone_string'             => $old_event['timezone_string'],
542
+			'EVT_external_URL'                => $old_event['externalURL'],
543
+			'EVT_donations'                   => false,// doesn't exist in 3.1
544
+
545
+		];
546
+		$data_types         = [
547
+			'%s',// EVT_ID
548
+			'%d',// EVT_display_desc
549
+			'%d',// EVT_display_ticket_selector
550
+			'%s',// EVT_visible_on
551
+			'%d',// EVT_additional_limit
552
+			'%s',// EVT_default_registration_status
553
+			'%d',// EVT_member_only
554
+			'%s',// EVT_phone
555
+			'%d',// EVT_allow_overflow
556
+			'%s',// EVT_timezone_string
557
+			'%s',// EVT_external_URL
558
+			'%d',// EVT_donations
559
+		];
560
+		$success            = $wpdb->insert(
561
+			$this->_new_meta_table,
562
+			$cols_n_values,
563
+			$data_types
564
+		);
565
+		if (! $success) {
566
+			$this->add_error(
567
+				$this->get_migration_script()->_create_error_message_for_db_insertion(
568
+					$this->_old_table,
569
+					$old_event,
570
+					$this->_new_meta_table,
571
+					$cols_n_values,
572
+					$data_types
573
+				)
574
+			);
575
+			return 0;
576
+		}
577
+		return $wpdb->insert_id;
578
+	}
579
+
580
+
581
+	/**
582
+	 * @param $old_event
583
+	 * @return int
584
+	 */
585
+	private function _maybe_create_venue($old_event): int
586
+	{
587
+		if (
588
+			$old_event['address'] ||
589
+			$old_event['address2'] ||
590
+			$old_event['city'] ||
591
+			$old_event['state'] ||
592
+			$old_event['zip'] ||
593
+			$old_event['venue_title'] ||
594
+			$old_event['venue_url'] ||
595
+			$old_event['venue_image'] ||
596
+			$old_event['venue_phone'] ||
597
+			$old_event['virtual_url'] ||
598
+			$old_event['virtual_phone']
599
+		) {
600
+			$old_id = $this->_duplicate_venue_exists($old_event);
601
+			if ($old_id) {
602
+				return $old_id;
603
+			}
604
+			$new_id = $this->_insert_venue_into_posts($old_event);
605
+			if ($new_id) {
606
+				$this->_insert_venue_into_meta_table($new_id, $old_event);
607
+				$guid = $old_event['venue_image'] ?? null;
608
+				if($guid) {
609
+					$this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post(
610
+						$guid,
611
+						$new_id,
612
+						$this
613
+					);
614
+				}
615
+			}
616
+			// we don't bother recording the conversion from old events to venues as that
617
+			// will complicate finding the conversion from old venues to new events
618
+			return $new_id;
619
+		}
620
+		return 0;
621
+	}
622
+
623
+
624
+	/**
625
+	 * Assuming there is venue data on this event, check if there is a duplicate venue already in the system for it.
626
+	 * If so, return it. Otherwise, return NULL.
627
+	 *
628
+	 * @param array $old_event
629
+	 * @return int duplicate venue id
630
+	 */
631
+	private function _duplicate_venue_exists(array $old_event): int
632
+	{
633
+		global $wpdb;
634
+		$conditions     = [
635
+			'VNU_address'       => $old_event ['address'],
636
+			'VNU_address2'      => $old_event['address2'],
637
+			'VNU_city'          => $old_event['city'],
638
+			'VNU_zip'           => $old_event['zip'],
639
+			'post_title'        => $this->_get_venue_title_for_event($old_event),
640
+			'VNU_phone'         => $old_event['venue_phone'],// VNU_phone
641
+			'VNU_url'           => $old_event['venue_url'],// VNU_url
642
+			'VNU_virtual_phone' => $old_event['virtual_phone'],// VNU_virtual_phone
643
+			'VNU_virtual_url'   => $old_event['virtual_url'],// VNU_virtual_url
644
+		];
645
+		$sql_conditions = [];
646
+		foreach ($conditions as $column => $value) {
647
+			$sql_conditions [] = $wpdb->prepare("$column = %s", $value);
648
+		}
649
+		$query = "SELECT VNU_ID
650 650
 					FROM
651 651
 		$wpdb->posts as p INNER JOIN
652 652
 		{$wpdb->prefix}esp_venue_meta as v ON p.ID = v.VNU_ID
653 653
 			WHERE " . implode(" AND ", $sql_conditions) . " LIMIT 1";
654
-        return (int) $wpdb->get_var($query);
655
-    }
656
-
657
-
658
-    /**
659
-     * Gets teh venue's title or makes one up if there is none
660
-     *
661
-     * @param array $event_data_array keys are events_details columns and values are their values
662
-     * @return string
663
-     */
664
-    protected function _get_venue_title_for_event(array $event_data_array): string
665
-    {
666
-        return $event_data_array['venue_title']
667
-            ? stripslashes($event_data_array['venue_title'])
668
-            : stripslashes(
669
-                sprintf(
670
-                    esc_html__('Venue of %s', 'event_espresso'),
671
-                    $event_data_array['event_name']
672
-                )
673
-            );
674
-    }
675
-
676
-
677
-    /**
678
-     * Inserts the CPT
679
-     *
680
-     * @param array $old_event keys are cols, values are col values
681
-     * @return int
682
-     */
683
-    private function _insert_venue_into_posts(array $old_event): int
684
-    {
685
-        global $wpdb;
686
-        $insertion_array  = [
687
-            'post_title'        => $this->_get_venue_title_for_event($old_event),// VNU_name
688
-            'post_content'      => '',// VNU_desc
689
-            'post_name'         => $this->_find_unique_slug(
690
-                $old_event['venue_title'],
691
-                sanitize_title('venue-of-' . $old_event['event_name'])
692
-            ),// VNU_identifier
693
-            'post_date'         => current_time('mysql'),// VNU_created
694
-            'post_date_gmt'     => get_gmt_from_date(current_time('mysql')),
695
-            'post_excerpt'      => '',// VNU_short_desc arbitrary only 50 characters
696
-            'post_modified'     => current_time('mysql'),// VNU_modified
697
-            'post_modified_gmt' => get_gmt_from_date(current_time('mysql')),
698
-            'post_author'       => $old_event['wp_user'],// VNU_wp_user
699
-            'post_parent'       => 0,// parent
700
-            'menu_order'        => 0,// VNU_order
701
-            'post_type'         => 'espresso_venues',// post_type
702
-        ];
703
-        $data_types_array = [
704
-            '%s',// VNU_name
705
-            '%s',// VNU_desc
706
-            '%s',// VNU_identifier
707
-            '%s',// VNU_created
708
-            '%s',
709
-            '%s',// VNU_short_desc
710
-            '%s',// VNU_modified
711
-            '%s',
712
-            '%d',// VNU_wp_user
713
-            '%d',// parent
714
-            '%d',// VNU_order
715
-            '%s',// post_type
716
-        ];
717
-        $success          = $wpdb->insert(
718
-            $wpdb->posts,
719
-            $insertion_array,
720
-            $data_types_array
721
-        );
722
-        if (! $success) {
723
-            $this->add_error(
724
-                $this->get_migration_script()->_create_error_message_for_db_insertion(
725
-                    $this->_old_table,
726
-                    $old_event,
727
-                    $this->_new_table,
728
-                    $insertion_array,
729
-                    $data_types_array
730
-                )
731
-            );
732
-            return 0;
733
-        }
734
-        return $wpdb->insert_id;
735
-    }
736
-
737
-
738
-    /**
739
-     * Inserts into the venue_meta table
740
-     *
741
-     * @param int   $cpt_id
742
-     * @param array $old_event
743
-     * @return void
744
-     */
745
-    private function _insert_venue_into_meta_table(int $cpt_id, array $old_event): void
746
-    {
747
-        global $wpdb;
748
-
749
-        // assume the country is the same as the organization's old settings
750
-        $country_iso = $this->get_migration_script()->get_default_country_iso();
751
-        // find the state from the venue, or the organization, or just guess california
752
-        if (! $old_event['state']) {
753
-            $old_org_options = get_option('events_organization_settings');
754
-            $state_name      = stripslashes($old_org_options['organization_state']);
755
-        } else {
756
-            $state_name = $old_event['state'];
757
-        }
758
-        if (! $state_name) {
759
-            $state_name = 'CA';
760
-        }
761
-        // get a state ID with the same name, if possible
762
-        try {
763
-            $state    = $this->get_migration_script()->get_or_create_state($state_name, $country_iso);
764
-            $state_id = $state['STA_ID'];
765
-        } catch (EE_Error $e) {
766
-            $this->add_error($e->getMessage());
767
-            $state_id = 0;
768
-        }
769
-        // now insert into meta table
770
-        $insertion_array = [
771
-            'VNU_ID'              => $cpt_id,// VNU_ID_fk
772
-            'VNU_address'         => stripslashes($old_event['address']),// VNU_address
773
-            'VNU_address2'        => stripslashes($old_event['address2']),// VNU_address2
774
-            'VNU_city'            => stripslashes($old_event['city']),// VNU_city
775
-            'STA_ID'              => $state_id,// STA_ID
776
-            'CNT_ISO'             => $country_iso,// CNT_ISO
777
-            'VNU_zip'             => $old_event['zip'],// VNU_zip
778
-            'VNU_phone'           => $old_event['venue_phone'],// VNU_phone
779
-            'VNU_capacity'        => -1,// VNU_capacity
780
-            'VNU_url'             => $old_event['venue_url'],// VNU_url
781
-            'VNU_virtual_phone'   => $old_event['virtual_phone'],// VNU_virtual_phone
782
-            'VNU_virtual_url'     => $old_event['virtual_url'],// VNU_virtual_url
783
-            'VNU_google_map_link' => '',// VNU_google_map_link
784
-            'VNU_enable_for_gmap' => true, // VNU_enable_for_gmap
785
-        ];
786
-        $data_types      = [
787
-            '%d',// VNU_ID_fk
788
-            '%s',// VNU_address
789
-            '%s',// VNU_address2
790
-            '%s',// VNU_city
791
-            '%d',// STA_ID
792
-            '%s',// CNT_ISO
793
-            '%s',// VNU_zip
794
-            '%s',// VNU_phone
795
-            '%d',// VNU_capacity
796
-            '%s',// VNU_url
797
-            '%s',// VNU_virtual_phone
798
-            '%s',// VNU_virtual_url
799
-            '%s',// VNU_google_map_link
800
-            '%d',// VNU_enable_for_gmap
801
-        ];
802
-        $success         = $wpdb->insert($wpdb->prefix . "esp_venue_meta", $insertion_array, $data_types);
803
-        if (! $success) {
804
-            $this->add_error(
805
-                $this->get_migration_script()->_create_error_message_for_db_insertion(
806
-                    $this->_old_table,
807
-                    $old_event,
808
-                    $this->_new_meta_table,
809
-                    $insertion_array,
810
-                    $data_types
811
-                )
812
-            );
813
-        }
814
-    }
815
-
816
-
817
-    /**
818
-     * @param $new_event_id
819
-     * @param $new_venue_id
820
-     * @return void
821
-     */
822
-    private function _insert_new_venue_to_event($new_event_id, $new_venue_id): void
823
-    {
824
-        global $wpdb;
825
-        if (! $new_event_id) {
826
-            $this->add_error(
827
-                sprintf(esc_html__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $new_event_id)
828
-            );
829
-            return;
830
-        }
831
-        if (! $new_venue_id) {
832
-            $this->add_error(
833
-                sprintf(esc_html__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $new_venue_id)
834
-            );
835
-            return;
836
-        }
837
-        $cols_n_values = [
838
-            'EVT_ID'      => $new_event_id,
839
-            'VNU_ID'      => $new_venue_id,
840
-            'EVV_primary' => true,
841
-        ];
842
-        $data_types    = [
843
-            '%d',// EVT_ID
844
-            '%d',// VNU_ID
845
-            '%d',// EVT_primary
846
-        ];
847
-        $success       = $wpdb->insert($wpdb->prefix . "esp_event_venue", $cols_n_values, $data_types);
848
-        if (! $success) {
849
-            $this->add_error(
850
-                $this->get_migration_script()->_create_error_message_for_db_insertion(
851
-                    $this->_old_table,
852
-                    [],
853
-                    $this->_new_table,
854
-                    $cols_n_values,
855
-                    $data_types
856
-                )
857
-            );
858
-        }
859
-    }
860
-
861
-
862
-    /**
863
-     * Converts all the 3.1 start-end times for the event to 4.1 datetimes
864
-     *
865
-     * @param array $old_event  results of get_results(...,ARRAY_A)
866
-     * @param int   $new_cpt_id new post ID
867
-     * @return void (if there are errors though, adds them to the stage's error list
868
-     * @throws EE_Error
869
-     * @global wpdb $wpdb
870
-     */
871
-    private function _convert_start_end_times(array $old_event, int $new_cpt_id)
872
-    {
873
-        $start_end_times = $this->_get_old_start_end_times($old_event['id']);
874
-        foreach ($start_end_times as $start_end_time) {
875
-            $datetime_id = $this->_insert_new_datetime($start_end_time, $old_event, $new_cpt_id);
876
-            if ($datetime_id) {
877
-                $this->get_migration_script()->set_mapping(
878
-                    $this->_old_start_end_table,
879
-                    $start_end_time['id'],
880
-                    $this->_new_datetime_table,
881
-                    $datetime_id
882
-                );
883
-            }
884
-        }
885
-    }
886
-
887
-
888
-    /**
889
-     * Queries the 3.1 wp_events_start_end table to get all the start and end times for the event
890
-     *
891
-     * @param int   $old_event_id
892
-     * @return array
893
-     * @global wpdb $wpdb
894
-     */
895
-    private function _get_old_start_end_times(int $old_event_id): array
896
-    {
897
-        global $wpdb;
898
-        return $wpdb->get_results(
899
-            $wpdb->prepare("SELECT * FROM $this->_old_start_end_table WHERE event_id=%d", $old_event_id),
900
-            ARRAY_A
901
-        );
902
-    }
903
-
904
-
905
-    /**
906
-     * Inserts a 4.1 datetime given the 3.1 start_end db row and event_details row
907
-     *
908
-     * @param array $start_end_time_row
909
-     * @param array $old_event_row
910
-     * @param int   $new_cpt_id
911
-     * @return int ID of new datetime
912
-     */
913
-    private function _insert_new_datetime(array $start_end_time_row, array $old_event_row, int $new_cpt_id): int
914
-    {
915
-        global $wpdb;
916
-        $start_date         = $old_event_row['start_date'];
917
-        $start_time         = $this->get_migration_script()->convertTimeFromAMPM($start_end_time_row['start_time']);
918
-        $end_date           = $old_event_row['end_date'];
919
-        $end_time           = $this->get_migration_script()->convertTimeFromAMPM($start_end_time_row['end_time']);
920
-        $existing_datetimes = $this->_count_other_datetimes_exist_for_new_event($new_cpt_id);
921
-        $start_datetime_utc =
922
-            $this->get_migration_script()->convert_date_string_to_utc(
923
-                $this,
924
-                $start_end_time_row,
925
-                "$start_date $start_time:00",
926
-                $old_event_row['timezone_string']
927
-            );
928
-        $end_datetime_utc   =
929
-            $this->get_migration_script()->convert_date_string_to_utc(
930
-                $this,
931
-                $start_end_time_row,
932
-                "$end_date $end_time:00",
933
-                $old_event_row['timezone_string']
934
-            );
935
-        $cols_n_values      = [
936
-            'EVT_ID'        => $new_cpt_id,
937
-            // EVT_ID
938
-            'DTT_EVT_start' => $start_datetime_utc,
939
-            // DTT_EVT_start
940
-            'DTT_EVT_end'   => $end_datetime_utc,
941
-            // DTT_EVT_end
942
-            'DTT_reg_limit' => intval($start_end_time_row['reg_limit']) ? $start_end_time_row['reg_limit']
943
-                : $old_event_row['reg_limit'],
944
-            // DTT_reg_limit
945
-            'DTT_sold'      => 0,
946
-            // note: we will increment this as registrations are added during the migration
947
-            //          'DTT_is_primary'=> 0 == $existing_datetimes ,//DTT_is_primary... if count==0, then we'll call it the 'primary'
948
-            'DTT_order'     => $existing_datetimes,
949
-            // DTT_order, just give it the same order as the count of how many datetimes already exist
950
-            'DTT_parent'    => 0,
951
-            'DTT_deleted'   => false,
952
-        ];
953
-        $data_types         = [
954
-            '%d',// EVT_Id
955
-            '%s',// DTT_EVT_start
956
-            '%s',// DTT_EVT_end
957
-            '%d',// DTT_reg_limit
958
-            '%d',// DTT_sold
959
-            //          '%d',//DTT_is_primary
960
-            '%d',// DTT_order
961
-            '%d',// DTT_parent
962
-            '%d',// DTT_deleted
963
-        ];
964
-        $success            = $wpdb->insert($this->_new_datetime_table, $cols_n_values, $data_types);
965
-        if (! $success) {
966
-            $this->add_error(
967
-                $this->get_migration_script()->_create_error_message_for_db_insertion(
968
-                    $this->_old_start_end_table,
969
-                    array_merge($old_event_row, $start_end_time_row),
970
-                    $this->_new_datetime_table,
971
-                    $cols_n_values,
972
-                    $data_types
973
-                )
974
-            );
975
-            return 0;
976
-        }
977
-        return $wpdb->insert_id;
978
-    }
979
-
980
-
981
-    /**
982
-     * Checks if there's a 4.1 datetime for this event already. This is mostly only handy
983
-     * when deciding whether a datetime we're about ot insert should be the 'primary' or not
984
-     *
985
-     * @param int   $cpt_event_id
986
-     * @return int
987
-     * @global wpdb $wpdb
988
-     */
989
-    private function _count_other_datetimes_exist_for_new_event(int $cpt_event_id): int
990
-    {
991
-        global $wpdb;
992
-        return (int) $wpdb->get_var(
993
-            $wpdb->prepare(
994
-                "SELECT COUNT(*) FROM $this->_new_datetime_table WHERE EVT_ID=%d",
995
-                $cpt_event_id
996
-            )
997
-        );
998
-    }
654
+		return (int) $wpdb->get_var($query);
655
+	}
656
+
657
+
658
+	/**
659
+	 * Gets teh venue's title or makes one up if there is none
660
+	 *
661
+	 * @param array $event_data_array keys are events_details columns and values are their values
662
+	 * @return string
663
+	 */
664
+	protected function _get_venue_title_for_event(array $event_data_array): string
665
+	{
666
+		return $event_data_array['venue_title']
667
+			? stripslashes($event_data_array['venue_title'])
668
+			: stripslashes(
669
+				sprintf(
670
+					esc_html__('Venue of %s', 'event_espresso'),
671
+					$event_data_array['event_name']
672
+				)
673
+			);
674
+	}
675
+
676
+
677
+	/**
678
+	 * Inserts the CPT
679
+	 *
680
+	 * @param array $old_event keys are cols, values are col values
681
+	 * @return int
682
+	 */
683
+	private function _insert_venue_into_posts(array $old_event): int
684
+	{
685
+		global $wpdb;
686
+		$insertion_array  = [
687
+			'post_title'        => $this->_get_venue_title_for_event($old_event),// VNU_name
688
+			'post_content'      => '',// VNU_desc
689
+			'post_name'         => $this->_find_unique_slug(
690
+				$old_event['venue_title'],
691
+				sanitize_title('venue-of-' . $old_event['event_name'])
692
+			),// VNU_identifier
693
+			'post_date'         => current_time('mysql'),// VNU_created
694
+			'post_date_gmt'     => get_gmt_from_date(current_time('mysql')),
695
+			'post_excerpt'      => '',// VNU_short_desc arbitrary only 50 characters
696
+			'post_modified'     => current_time('mysql'),// VNU_modified
697
+			'post_modified_gmt' => get_gmt_from_date(current_time('mysql')),
698
+			'post_author'       => $old_event['wp_user'],// VNU_wp_user
699
+			'post_parent'       => 0,// parent
700
+			'menu_order'        => 0,// VNU_order
701
+			'post_type'         => 'espresso_venues',// post_type
702
+		];
703
+		$data_types_array = [
704
+			'%s',// VNU_name
705
+			'%s',// VNU_desc
706
+			'%s',// VNU_identifier
707
+			'%s',// VNU_created
708
+			'%s',
709
+			'%s',// VNU_short_desc
710
+			'%s',// VNU_modified
711
+			'%s',
712
+			'%d',// VNU_wp_user
713
+			'%d',// parent
714
+			'%d',// VNU_order
715
+			'%s',// post_type
716
+		];
717
+		$success          = $wpdb->insert(
718
+			$wpdb->posts,
719
+			$insertion_array,
720
+			$data_types_array
721
+		);
722
+		if (! $success) {
723
+			$this->add_error(
724
+				$this->get_migration_script()->_create_error_message_for_db_insertion(
725
+					$this->_old_table,
726
+					$old_event,
727
+					$this->_new_table,
728
+					$insertion_array,
729
+					$data_types_array
730
+				)
731
+			);
732
+			return 0;
733
+		}
734
+		return $wpdb->insert_id;
735
+	}
736
+
737
+
738
+	/**
739
+	 * Inserts into the venue_meta table
740
+	 *
741
+	 * @param int   $cpt_id
742
+	 * @param array $old_event
743
+	 * @return void
744
+	 */
745
+	private function _insert_venue_into_meta_table(int $cpt_id, array $old_event): void
746
+	{
747
+		global $wpdb;
748
+
749
+		// assume the country is the same as the organization's old settings
750
+		$country_iso = $this->get_migration_script()->get_default_country_iso();
751
+		// find the state from the venue, or the organization, or just guess california
752
+		if (! $old_event['state']) {
753
+			$old_org_options = get_option('events_organization_settings');
754
+			$state_name      = stripslashes($old_org_options['organization_state']);
755
+		} else {
756
+			$state_name = $old_event['state'];
757
+		}
758
+		if (! $state_name) {
759
+			$state_name = 'CA';
760
+		}
761
+		// get a state ID with the same name, if possible
762
+		try {
763
+			$state    = $this->get_migration_script()->get_or_create_state($state_name, $country_iso);
764
+			$state_id = $state['STA_ID'];
765
+		} catch (EE_Error $e) {
766
+			$this->add_error($e->getMessage());
767
+			$state_id = 0;
768
+		}
769
+		// now insert into meta table
770
+		$insertion_array = [
771
+			'VNU_ID'              => $cpt_id,// VNU_ID_fk
772
+			'VNU_address'         => stripslashes($old_event['address']),// VNU_address
773
+			'VNU_address2'        => stripslashes($old_event['address2']),// VNU_address2
774
+			'VNU_city'            => stripslashes($old_event['city']),// VNU_city
775
+			'STA_ID'              => $state_id,// STA_ID
776
+			'CNT_ISO'             => $country_iso,// CNT_ISO
777
+			'VNU_zip'             => $old_event['zip'],// VNU_zip
778
+			'VNU_phone'           => $old_event['venue_phone'],// VNU_phone
779
+			'VNU_capacity'        => -1,// VNU_capacity
780
+			'VNU_url'             => $old_event['venue_url'],// VNU_url
781
+			'VNU_virtual_phone'   => $old_event['virtual_phone'],// VNU_virtual_phone
782
+			'VNU_virtual_url'     => $old_event['virtual_url'],// VNU_virtual_url
783
+			'VNU_google_map_link' => '',// VNU_google_map_link
784
+			'VNU_enable_for_gmap' => true, // VNU_enable_for_gmap
785
+		];
786
+		$data_types      = [
787
+			'%d',// VNU_ID_fk
788
+			'%s',// VNU_address
789
+			'%s',// VNU_address2
790
+			'%s',// VNU_city
791
+			'%d',// STA_ID
792
+			'%s',// CNT_ISO
793
+			'%s',// VNU_zip
794
+			'%s',// VNU_phone
795
+			'%d',// VNU_capacity
796
+			'%s',// VNU_url
797
+			'%s',// VNU_virtual_phone
798
+			'%s',// VNU_virtual_url
799
+			'%s',// VNU_google_map_link
800
+			'%d',// VNU_enable_for_gmap
801
+		];
802
+		$success         = $wpdb->insert($wpdb->prefix . "esp_venue_meta", $insertion_array, $data_types);
803
+		if (! $success) {
804
+			$this->add_error(
805
+				$this->get_migration_script()->_create_error_message_for_db_insertion(
806
+					$this->_old_table,
807
+					$old_event,
808
+					$this->_new_meta_table,
809
+					$insertion_array,
810
+					$data_types
811
+				)
812
+			);
813
+		}
814
+	}
815
+
816
+
817
+	/**
818
+	 * @param $new_event_id
819
+	 * @param $new_venue_id
820
+	 * @return void
821
+	 */
822
+	private function _insert_new_venue_to_event($new_event_id, $new_venue_id): void
823
+	{
824
+		global $wpdb;
825
+		if (! $new_event_id) {
826
+			$this->add_error(
827
+				sprintf(esc_html__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $new_event_id)
828
+			);
829
+			return;
830
+		}
831
+		if (! $new_venue_id) {
832
+			$this->add_error(
833
+				sprintf(esc_html__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $new_venue_id)
834
+			);
835
+			return;
836
+		}
837
+		$cols_n_values = [
838
+			'EVT_ID'      => $new_event_id,
839
+			'VNU_ID'      => $new_venue_id,
840
+			'EVV_primary' => true,
841
+		];
842
+		$data_types    = [
843
+			'%d',// EVT_ID
844
+			'%d',// VNU_ID
845
+			'%d',// EVT_primary
846
+		];
847
+		$success       = $wpdb->insert($wpdb->prefix . "esp_event_venue", $cols_n_values, $data_types);
848
+		if (! $success) {
849
+			$this->add_error(
850
+				$this->get_migration_script()->_create_error_message_for_db_insertion(
851
+					$this->_old_table,
852
+					[],
853
+					$this->_new_table,
854
+					$cols_n_values,
855
+					$data_types
856
+				)
857
+			);
858
+		}
859
+	}
860
+
861
+
862
+	/**
863
+	 * Converts all the 3.1 start-end times for the event to 4.1 datetimes
864
+	 *
865
+	 * @param array $old_event  results of get_results(...,ARRAY_A)
866
+	 * @param int   $new_cpt_id new post ID
867
+	 * @return void (if there are errors though, adds them to the stage's error list
868
+	 * @throws EE_Error
869
+	 * @global wpdb $wpdb
870
+	 */
871
+	private function _convert_start_end_times(array $old_event, int $new_cpt_id)
872
+	{
873
+		$start_end_times = $this->_get_old_start_end_times($old_event['id']);
874
+		foreach ($start_end_times as $start_end_time) {
875
+			$datetime_id = $this->_insert_new_datetime($start_end_time, $old_event, $new_cpt_id);
876
+			if ($datetime_id) {
877
+				$this->get_migration_script()->set_mapping(
878
+					$this->_old_start_end_table,
879
+					$start_end_time['id'],
880
+					$this->_new_datetime_table,
881
+					$datetime_id
882
+				);
883
+			}
884
+		}
885
+	}
886
+
887
+
888
+	/**
889
+	 * Queries the 3.1 wp_events_start_end table to get all the start and end times for the event
890
+	 *
891
+	 * @param int   $old_event_id
892
+	 * @return array
893
+	 * @global wpdb $wpdb
894
+	 */
895
+	private function _get_old_start_end_times(int $old_event_id): array
896
+	{
897
+		global $wpdb;
898
+		return $wpdb->get_results(
899
+			$wpdb->prepare("SELECT * FROM $this->_old_start_end_table WHERE event_id=%d", $old_event_id),
900
+			ARRAY_A
901
+		);
902
+	}
903
+
904
+
905
+	/**
906
+	 * Inserts a 4.1 datetime given the 3.1 start_end db row and event_details row
907
+	 *
908
+	 * @param array $start_end_time_row
909
+	 * @param array $old_event_row
910
+	 * @param int   $new_cpt_id
911
+	 * @return int ID of new datetime
912
+	 */
913
+	private function _insert_new_datetime(array $start_end_time_row, array $old_event_row, int $new_cpt_id): int
914
+	{
915
+		global $wpdb;
916
+		$start_date         = $old_event_row['start_date'];
917
+		$start_time         = $this->get_migration_script()->convertTimeFromAMPM($start_end_time_row['start_time']);
918
+		$end_date           = $old_event_row['end_date'];
919
+		$end_time           = $this->get_migration_script()->convertTimeFromAMPM($start_end_time_row['end_time']);
920
+		$existing_datetimes = $this->_count_other_datetimes_exist_for_new_event($new_cpt_id);
921
+		$start_datetime_utc =
922
+			$this->get_migration_script()->convert_date_string_to_utc(
923
+				$this,
924
+				$start_end_time_row,
925
+				"$start_date $start_time:00",
926
+				$old_event_row['timezone_string']
927
+			);
928
+		$end_datetime_utc   =
929
+			$this->get_migration_script()->convert_date_string_to_utc(
930
+				$this,
931
+				$start_end_time_row,
932
+				"$end_date $end_time:00",
933
+				$old_event_row['timezone_string']
934
+			);
935
+		$cols_n_values      = [
936
+			'EVT_ID'        => $new_cpt_id,
937
+			// EVT_ID
938
+			'DTT_EVT_start' => $start_datetime_utc,
939
+			// DTT_EVT_start
940
+			'DTT_EVT_end'   => $end_datetime_utc,
941
+			// DTT_EVT_end
942
+			'DTT_reg_limit' => intval($start_end_time_row['reg_limit']) ? $start_end_time_row['reg_limit']
943
+				: $old_event_row['reg_limit'],
944
+			// DTT_reg_limit
945
+			'DTT_sold'      => 0,
946
+			// note: we will increment this as registrations are added during the migration
947
+			//          'DTT_is_primary'=> 0 == $existing_datetimes ,//DTT_is_primary... if count==0, then we'll call it the 'primary'
948
+			'DTT_order'     => $existing_datetimes,
949
+			// DTT_order, just give it the same order as the count of how many datetimes already exist
950
+			'DTT_parent'    => 0,
951
+			'DTT_deleted'   => false,
952
+		];
953
+		$data_types         = [
954
+			'%d',// EVT_Id
955
+			'%s',// DTT_EVT_start
956
+			'%s',// DTT_EVT_end
957
+			'%d',// DTT_reg_limit
958
+			'%d',// DTT_sold
959
+			//          '%d',//DTT_is_primary
960
+			'%d',// DTT_order
961
+			'%d',// DTT_parent
962
+			'%d',// DTT_deleted
963
+		];
964
+		$success            = $wpdb->insert($this->_new_datetime_table, $cols_n_values, $data_types);
965
+		if (! $success) {
966
+			$this->add_error(
967
+				$this->get_migration_script()->_create_error_message_for_db_insertion(
968
+					$this->_old_start_end_table,
969
+					array_merge($old_event_row, $start_end_time_row),
970
+					$this->_new_datetime_table,
971
+					$cols_n_values,
972
+					$data_types
973
+				)
974
+			);
975
+			return 0;
976
+		}
977
+		return $wpdb->insert_id;
978
+	}
979
+
980
+
981
+	/**
982
+	 * Checks if there's a 4.1 datetime for this event already. This is mostly only handy
983
+	 * when deciding whether a datetime we're about ot insert should be the 'primary' or not
984
+	 *
985
+	 * @param int   $cpt_event_id
986
+	 * @return int
987
+	 * @global wpdb $wpdb
988
+	 */
989
+	private function _count_other_datetimes_exist_for_new_event(int $cpt_event_id): int
990
+	{
991
+		global $wpdb;
992
+		return (int) $wpdb->get_var(
993
+			$wpdb->prepare(
994
+				"SELECT COUNT(*) FROM $this->_new_datetime_table WHERE EVT_ID=%d",
995
+				$cpt_event_id
996
+			)
997
+		);
998
+	}
999 999
 }
Please login to merge, or discard this patch.
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
     public function __construct()
189 189
     {
190 190
         global $wpdb;
191
-        $this->_old_table           = $wpdb->prefix . "events_detail";
192
-        $this->_old_start_end_table = $wpdb->prefix . "events_start_end";
193
-        $this->_new_table           = $wpdb->prefix . "posts";
194
-        $this->_new_meta_table      = $wpdb->prefix . "esp_event_meta";
195
-        $this->_new_datetime_table  = $wpdb->prefix . "esp_datetime";
191
+        $this->_old_table           = $wpdb->prefix."events_detail";
192
+        $this->_old_start_end_table = $wpdb->prefix."events_start_end";
193
+        $this->_new_table           = $wpdb->prefix."posts";
194
+        $this->_new_meta_table      = $wpdb->prefix."esp_event_meta";
195
+        $this->_new_datetime_table  = $wpdb->prefix."esp_datetime";
196 196
         $this->_pretty_name         = esc_html__("Events", "event_espresso");
197 197
         parent::__construct();
198 198
     }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     public function _count_records_to_migrate(): int
207 207
     {
208 208
         global $wpdb;
209
-        return (int) $wpdb->get_var("SELECT COUNT(*) FROM " . $this->_old_table . ' WHERE event_status !="D"');
209
+        return (int) $wpdb->get_var("SELECT COUNT(*) FROM ".$this->_old_table.' WHERE event_status !="D"');
210 210
     }
211 211
 
212 212
 
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
     private function _add_post_metas(array $old_event, int $post_id)
300 300
     {
301 301
         $event_meta = maybe_unserialize($old_event['event_meta']);
302
-        if (! $event_meta || ! is_array($event_meta)) {
302
+        if ( ! $event_meta || ! is_array($event_meta)) {
303 303
             return;
304 304
         }
305
-        unset($event_meta['date_submitted']);              // factored into CPT
306
-        unset($event_meta['additional_attendee_reg_info']);// factored into event meta table
307
-        unset($event_meta['default_payment_status']);      // dido
308
-        unset($event_meta['event_thumbnail_url']);         // used to find post featured image
305
+        unset($event_meta['date_submitted']); // factored into CPT
306
+        unset($event_meta['additional_attendee_reg_info']); // factored into event meta table
307
+        unset($event_meta['default_payment_status']); // dido
308
+        unset($event_meta['event_thumbnail_url']); // used to find post featured image
309 309
         foreach ($event_meta as $meta_key => $meta_value) {
310 310
             if ($meta_key) {// if the meta key is just an empty string, ignore it
311 311
                 $success = add_post_meta($post_id, $meta_key, $meta_value, true);
312
-                if (! $success) {
312
+                if ( ! $success) {
313 313
                     $this->add_error(
314 314
                         sprintf(
315 315
                             esc_html__(
@@ -411,63 +411,63 @@  discard block
 block discarded – undo
411 411
             // @todo: is it ok to just mark secondary/waitlist events as DRAFTS?
412 412
             'D'  => 'trash',
413 413
         ];
414
-        $post_status        = $status_conversions[ $old_event['event_status'] ];
414
+        $post_status = $status_conversions[$old_event['event_status']];
415 415
         // check if we've sold out
416 416
         if (intval($old_event['reg_limit']) <= self::count_registrations($old_event['id'])) {
417 417
             $post_status = 'sold_out';
418 418
         }
419 419
         //      FYI postponed and cancelled don't exist in 3.1
420
-        $cols_n_values                      = [
421
-            'post_title'        => stripslashes($old_event['event_name']),// EVT_name
422
-            'post_content'      => stripslashes($old_event['event_desc']),// EVT_desc
420
+        $cols_n_values = [
421
+            'post_title'        => stripslashes($old_event['event_name']), // EVT_name
422
+            'post_content'      => stripslashes($old_event['event_desc']), // EVT_desc
423 423
             'post_name'         => $this->_find_unique_slug(
424 424
                 $old_event['event_name'],
425 425
                 $old_event['event_identifier'],
426 426
                 $post_status
427
-            ),// EVT_slug
428
-            'post_date'         => $old_event['submitted'],// EVT_created NOT
427
+            ), // EVT_slug
428
+            'post_date'         => $old_event['submitted'], // EVT_created NOT
429 429
             'post_date_gmt'     => get_gmt_from_date($old_event['submitted']),
430
-            'post_excerpt'      => '',// EVT_short_desc
431
-            'post_modified'     => $old_event['submitted'],// EVT_modified
430
+            'post_excerpt'      => '', // EVT_short_desc
431
+            'post_modified'     => $old_event['submitted'], // EVT_modified
432 432
             'post_modified_gmt' => get_gmt_from_date($old_event['submitted']),
433
-            'post_author'       => $old_event['wp_user'],// EVT_wp_user
434
-            'post_parent'       => 0,// parent maybe get this from some REM field?
435
-            'menu_order'        => 0,// EVT_order
436
-            'post_type'         => 'espresso_events',// post_type
437
-            'post_status'       => $post_status,// status
433
+            'post_author'       => $old_event['wp_user'], // EVT_wp_user
434
+            'post_parent'       => 0, // parent maybe get this from some REM field?
435
+            'menu_order'        => 0, // EVT_order
436
+            'post_type'         => 'espresso_events', // post_type
437
+            'post_status'       => $post_status, // status
438 438
         ];
439 439
         $cols_n_values_with_no_invalid_text = [];
440 440
         foreach ($cols_n_values as $col => $value) {
441 441
             $value_sans_invalid_chars = $wpdb->strip_invalid_text_for_column($this->_new_table, $col, $value);
442
-            if (! is_wp_error($value_sans_invalid_chars)) {
443
-                $cols_n_values_with_no_invalid_text[ $col ] = $value_sans_invalid_chars;
442
+            if ( ! is_wp_error($value_sans_invalid_chars)) {
443
+                $cols_n_values_with_no_invalid_text[$col] = $value_sans_invalid_chars;
444 444
             } else {
445 445
                 // otherwise leave it as-is. It will blow everything up and stop the migration
446
-                $cols_n_values_with_no_invalid_text[ $col ] = $value;
446
+                $cols_n_values_with_no_invalid_text[$col] = $value;
447 447
             }
448 448
         }
449 449
         $cols_n_values = $cols_n_values_with_no_invalid_text;
450 450
         $data_types    = [
451
-            '%s',// EVT_name
452
-            '%s',// EVT_desc
453
-            '%s',// EVT_slug
454
-            '%s',// EVT_created
451
+            '%s', // EVT_name
452
+            '%s', // EVT_desc
453
+            '%s', // EVT_slug
454
+            '%s', // EVT_created
455 455
             '%s',
456
-            '%s',// EVT_short_desc
457
-            '%s',// EVT_modified
456
+            '%s', // EVT_short_desc
457
+            '%s', // EVT_modified
458 458
             '%s',
459
-            '%s',// EVT_wp_user
460
-            '%d',// post_parent
461
-            '%d',// EVT_order
462
-            '%s',// post_type
463
-            '%s',// status
459
+            '%s', // EVT_wp_user
460
+            '%d', // post_parent
461
+            '%d', // EVT_order
462
+            '%s', // post_type
463
+            '%s', // status
464 464
         ];
465
-        $success       = $wpdb->insert(
465
+        $success = $wpdb->insert(
466 466
             $this->_new_table,
467 467
             $cols_n_values,
468 468
             $data_types
469 469
         );
470
-        if (! $success) {
470
+        if ( ! $success) {
471 471
             $this->add_error(
472 472
                 $this->get_migration_script()->_create_error_message_for_db_insertion(
473 473
                     $this->_old_table,
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
                 $event_meta['default_payment_status'] ?? '',
521 521
                 intval($old_event['require_pre_approval'])
522 522
             );
523
-        $cols_n_values      = [
524
-            'EVT_ID'                          => $new_cpt_id,// EVT_ID_fk
523
+        $cols_n_values = [
524
+            'EVT_ID'                          => $new_cpt_id, // EVT_ID_fk
525 525
             'EVT_display_desc'                => 'Y' == $old_event['display_desc'],
526 526
             'EVT_display_ticket_selector'     => 'Y' == $old_event['display_reg_form'],
527 527
             'EVT_visible_on'                  => $this->get_migration_script()->convert_date_string_to_utc(
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                     'mysql'
532 532
                 ),
533 533
                 $old_event['timezone_string']
534
-            ),// don't use the old 'visible_on', as it wasn't ever used
534
+            ), // don't use the old 'visible_on', as it wasn't ever used
535 535
             'EVT_additional_limit'            => $old_event['allow_multiple'] == 'N' ? 1
536 536
                 : $old_event['additional_limit'],
537 537
             'EVT_default_registration_status' => $default_reg_status,
@@ -540,29 +540,29 @@  discard block
 block discarded – undo
540 540
             'EVT_allow_overflow'              => 'Y' == $old_event['allow_overflow'],
541 541
             'EVT_timezone_string'             => $old_event['timezone_string'],
542 542
             'EVT_external_URL'                => $old_event['externalURL'],
543
-            'EVT_donations'                   => false,// doesn't exist in 3.1
543
+            'EVT_donations'                   => false, // doesn't exist in 3.1
544 544
 
545 545
         ];
546
-        $data_types         = [
547
-            '%s',// EVT_ID
548
-            '%d',// EVT_display_desc
549
-            '%d',// EVT_display_ticket_selector
550
-            '%s',// EVT_visible_on
551
-            '%d',// EVT_additional_limit
552
-            '%s',// EVT_default_registration_status
553
-            '%d',// EVT_member_only
554
-            '%s',// EVT_phone
555
-            '%d',// EVT_allow_overflow
556
-            '%s',// EVT_timezone_string
557
-            '%s',// EVT_external_URL
558
-            '%d',// EVT_donations
546
+        $data_types = [
547
+            '%s', // EVT_ID
548
+            '%d', // EVT_display_desc
549
+            '%d', // EVT_display_ticket_selector
550
+            '%s', // EVT_visible_on
551
+            '%d', // EVT_additional_limit
552
+            '%s', // EVT_default_registration_status
553
+            '%d', // EVT_member_only
554
+            '%s', // EVT_phone
555
+            '%d', // EVT_allow_overflow
556
+            '%s', // EVT_timezone_string
557
+            '%s', // EVT_external_URL
558
+            '%d', // EVT_donations
559 559
         ];
560
-        $success            = $wpdb->insert(
560
+        $success = $wpdb->insert(
561 561
             $this->_new_meta_table,
562 562
             $cols_n_values,
563 563
             $data_types
564 564
         );
565
-        if (! $success) {
565
+        if ( ! $success) {
566 566
             $this->add_error(
567 567
                 $this->get_migration_script()->_create_error_message_for_db_insertion(
568 568
                     $this->_old_table,
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
             if ($new_id) {
606 606
                 $this->_insert_venue_into_meta_table($new_id, $old_event);
607 607
                 $guid = $old_event['venue_image'] ?? null;
608
-                if($guid) {
608
+                if ($guid) {
609 609
                     $this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post(
610 610
                         $guid,
611 611
                         $new_id,
@@ -631,16 +631,16 @@  discard block
 block discarded – undo
631 631
     private function _duplicate_venue_exists(array $old_event): int
632 632
     {
633 633
         global $wpdb;
634
-        $conditions     = [
634
+        $conditions = [
635 635
             'VNU_address'       => $old_event ['address'],
636 636
             'VNU_address2'      => $old_event['address2'],
637 637
             'VNU_city'          => $old_event['city'],
638 638
             'VNU_zip'           => $old_event['zip'],
639 639
             'post_title'        => $this->_get_venue_title_for_event($old_event),
640
-            'VNU_phone'         => $old_event['venue_phone'],// VNU_phone
641
-            'VNU_url'           => $old_event['venue_url'],// VNU_url
642
-            'VNU_virtual_phone' => $old_event['virtual_phone'],// VNU_virtual_phone
643
-            'VNU_virtual_url'   => $old_event['virtual_url'],// VNU_virtual_url
640
+            'VNU_phone'         => $old_event['venue_phone'], // VNU_phone
641
+            'VNU_url'           => $old_event['venue_url'], // VNU_url
642
+            'VNU_virtual_phone' => $old_event['virtual_phone'], // VNU_virtual_phone
643
+            'VNU_virtual_url'   => $old_event['virtual_url'], // VNU_virtual_url
644 644
         ];
645 645
         $sql_conditions = [];
646 646
         foreach ($conditions as $column => $value) {
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 					FROM
651 651
 		$wpdb->posts as p INNER JOIN
652 652
 		{$wpdb->prefix}esp_venue_meta as v ON p.ID = v.VNU_ID
653
-			WHERE " . implode(" AND ", $sql_conditions) . " LIMIT 1";
653
+			WHERE ".implode(" AND ", $sql_conditions)." LIMIT 1";
654 654
         return (int) $wpdb->get_var($query);
655 655
     }
656 656
 
@@ -683,43 +683,43 @@  discard block
 block discarded – undo
683 683
     private function _insert_venue_into_posts(array $old_event): int
684 684
     {
685 685
         global $wpdb;
686
-        $insertion_array  = [
687
-            'post_title'        => $this->_get_venue_title_for_event($old_event),// VNU_name
688
-            'post_content'      => '',// VNU_desc
686
+        $insertion_array = [
687
+            'post_title'        => $this->_get_venue_title_for_event($old_event), // VNU_name
688
+            'post_content'      => '', // VNU_desc
689 689
             'post_name'         => $this->_find_unique_slug(
690 690
                 $old_event['venue_title'],
691
-                sanitize_title('venue-of-' . $old_event['event_name'])
692
-            ),// VNU_identifier
693
-            'post_date'         => current_time('mysql'),// VNU_created
691
+                sanitize_title('venue-of-'.$old_event['event_name'])
692
+            ), // VNU_identifier
693
+            'post_date'         => current_time('mysql'), // VNU_created
694 694
             'post_date_gmt'     => get_gmt_from_date(current_time('mysql')),
695
-            'post_excerpt'      => '',// VNU_short_desc arbitrary only 50 characters
696
-            'post_modified'     => current_time('mysql'),// VNU_modified
695
+            'post_excerpt'      => '', // VNU_short_desc arbitrary only 50 characters
696
+            'post_modified'     => current_time('mysql'), // VNU_modified
697 697
             'post_modified_gmt' => get_gmt_from_date(current_time('mysql')),
698
-            'post_author'       => $old_event['wp_user'],// VNU_wp_user
699
-            'post_parent'       => 0,// parent
700
-            'menu_order'        => 0,// VNU_order
701
-            'post_type'         => 'espresso_venues',// post_type
698
+            'post_author'       => $old_event['wp_user'], // VNU_wp_user
699
+            'post_parent'       => 0, // parent
700
+            'menu_order'        => 0, // VNU_order
701
+            'post_type'         => 'espresso_venues', // post_type
702 702
         ];
703 703
         $data_types_array = [
704
-            '%s',// VNU_name
705
-            '%s',// VNU_desc
706
-            '%s',// VNU_identifier
707
-            '%s',// VNU_created
704
+            '%s', // VNU_name
705
+            '%s', // VNU_desc
706
+            '%s', // VNU_identifier
707
+            '%s', // VNU_created
708 708
             '%s',
709
-            '%s',// VNU_short_desc
710
-            '%s',// VNU_modified
709
+            '%s', // VNU_short_desc
710
+            '%s', // VNU_modified
711 711
             '%s',
712
-            '%d',// VNU_wp_user
713
-            '%d',// parent
714
-            '%d',// VNU_order
715
-            '%s',// post_type
712
+            '%d', // VNU_wp_user
713
+            '%d', // parent
714
+            '%d', // VNU_order
715
+            '%s', // post_type
716 716
         ];
717
-        $success          = $wpdb->insert(
717
+        $success = $wpdb->insert(
718 718
             $wpdb->posts,
719 719
             $insertion_array,
720 720
             $data_types_array
721 721
         );
722
-        if (! $success) {
722
+        if ( ! $success) {
723 723
             $this->add_error(
724 724
                 $this->get_migration_script()->_create_error_message_for_db_insertion(
725 725
                     $this->_old_table,
@@ -749,13 +749,13 @@  discard block
 block discarded – undo
749 749
         // assume the country is the same as the organization's old settings
750 750
         $country_iso = $this->get_migration_script()->get_default_country_iso();
751 751
         // find the state from the venue, or the organization, or just guess california
752
-        if (! $old_event['state']) {
752
+        if ( ! $old_event['state']) {
753 753
             $old_org_options = get_option('events_organization_settings');
754 754
             $state_name      = stripslashes($old_org_options['organization_state']);
755 755
         } else {
756 756
             $state_name = $old_event['state'];
757 757
         }
758
-        if (! $state_name) {
758
+        if ( ! $state_name) {
759 759
             $state_name = 'CA';
760 760
         }
761 761
         // get a state ID with the same name, if possible
@@ -768,39 +768,39 @@  discard block
 block discarded – undo
768 768
         }
769 769
         // now insert into meta table
770 770
         $insertion_array = [
771
-            'VNU_ID'              => $cpt_id,// VNU_ID_fk
772
-            'VNU_address'         => stripslashes($old_event['address']),// VNU_address
773
-            'VNU_address2'        => stripslashes($old_event['address2']),// VNU_address2
774
-            'VNU_city'            => stripslashes($old_event['city']),// VNU_city
775
-            'STA_ID'              => $state_id,// STA_ID
776
-            'CNT_ISO'             => $country_iso,// CNT_ISO
777
-            'VNU_zip'             => $old_event['zip'],// VNU_zip
778
-            'VNU_phone'           => $old_event['venue_phone'],// VNU_phone
779
-            'VNU_capacity'        => -1,// VNU_capacity
780
-            'VNU_url'             => $old_event['venue_url'],// VNU_url
781
-            'VNU_virtual_phone'   => $old_event['virtual_phone'],// VNU_virtual_phone
782
-            'VNU_virtual_url'     => $old_event['virtual_url'],// VNU_virtual_url
783
-            'VNU_google_map_link' => '',// VNU_google_map_link
771
+            'VNU_ID'              => $cpt_id, // VNU_ID_fk
772
+            'VNU_address'         => stripslashes($old_event['address']), // VNU_address
773
+            'VNU_address2'        => stripslashes($old_event['address2']), // VNU_address2
774
+            'VNU_city'            => stripslashes($old_event['city']), // VNU_city
775
+            'STA_ID'              => $state_id, // STA_ID
776
+            'CNT_ISO'             => $country_iso, // CNT_ISO
777
+            'VNU_zip'             => $old_event['zip'], // VNU_zip
778
+            'VNU_phone'           => $old_event['venue_phone'], // VNU_phone
779
+            'VNU_capacity'        => -1, // VNU_capacity
780
+            'VNU_url'             => $old_event['venue_url'], // VNU_url
781
+            'VNU_virtual_phone'   => $old_event['virtual_phone'], // VNU_virtual_phone
782
+            'VNU_virtual_url'     => $old_event['virtual_url'], // VNU_virtual_url
783
+            'VNU_google_map_link' => '', // VNU_google_map_link
784 784
             'VNU_enable_for_gmap' => true, // VNU_enable_for_gmap
785 785
         ];
786
-        $data_types      = [
787
-            '%d',// VNU_ID_fk
788
-            '%s',// VNU_address
789
-            '%s',// VNU_address2
790
-            '%s',// VNU_city
791
-            '%d',// STA_ID
792
-            '%s',// CNT_ISO
793
-            '%s',// VNU_zip
794
-            '%s',// VNU_phone
795
-            '%d',// VNU_capacity
796
-            '%s',// VNU_url
797
-            '%s',// VNU_virtual_phone
798
-            '%s',// VNU_virtual_url
799
-            '%s',// VNU_google_map_link
800
-            '%d',// VNU_enable_for_gmap
786
+        $data_types = [
787
+            '%d', // VNU_ID_fk
788
+            '%s', // VNU_address
789
+            '%s', // VNU_address2
790
+            '%s', // VNU_city
791
+            '%d', // STA_ID
792
+            '%s', // CNT_ISO
793
+            '%s', // VNU_zip
794
+            '%s', // VNU_phone
795
+            '%d', // VNU_capacity
796
+            '%s', // VNU_url
797
+            '%s', // VNU_virtual_phone
798
+            '%s', // VNU_virtual_url
799
+            '%s', // VNU_google_map_link
800
+            '%d', // VNU_enable_for_gmap
801 801
         ];
802
-        $success         = $wpdb->insert($wpdb->prefix . "esp_venue_meta", $insertion_array, $data_types);
803
-        if (! $success) {
802
+        $success = $wpdb->insert($wpdb->prefix."esp_venue_meta", $insertion_array, $data_types);
803
+        if ( ! $success) {
804 804
             $this->add_error(
805 805
                 $this->get_migration_script()->_create_error_message_for_db_insertion(
806 806
                     $this->_old_table,
@@ -822,13 +822,13 @@  discard block
 block discarded – undo
822 822
     private function _insert_new_venue_to_event($new_event_id, $new_venue_id): void
823 823
     {
824 824
         global $wpdb;
825
-        if (! $new_event_id) {
825
+        if ( ! $new_event_id) {
826 826
             $this->add_error(
827 827
                 sprintf(esc_html__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $new_event_id)
828 828
             );
829 829
             return;
830 830
         }
831
-        if (! $new_venue_id) {
831
+        if ( ! $new_venue_id) {
832 832
             $this->add_error(
833 833
                 sprintf(esc_html__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $new_venue_id)
834 834
             );
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
             'VNU_ID'      => $new_venue_id,
840 840
             'EVV_primary' => true,
841 841
         ];
842
-        $data_types    = [
843
-            '%d',// EVT_ID
844
-            '%d',// VNU_ID
845
-            '%d',// EVT_primary
842
+        $data_types = [
843
+            '%d', // EVT_ID
844
+            '%d', // VNU_ID
845
+            '%d', // EVT_primary
846 846
         ];
847
-        $success       = $wpdb->insert($wpdb->prefix . "esp_event_venue", $cols_n_values, $data_types);
848
-        if (! $success) {
847
+        $success = $wpdb->insert($wpdb->prefix."esp_event_venue", $cols_n_values, $data_types);
848
+        if ( ! $success) {
849 849
             $this->add_error(
850 850
                 $this->get_migration_script()->_create_error_message_for_db_insertion(
851 851
                     $this->_old_table,
@@ -925,14 +925,14 @@  discard block
 block discarded – undo
925 925
                 "$start_date $start_time:00",
926 926
                 $old_event_row['timezone_string']
927 927
             );
928
-        $end_datetime_utc   =
928
+        $end_datetime_utc =
929 929
             $this->get_migration_script()->convert_date_string_to_utc(
930 930
                 $this,
931 931
                 $start_end_time_row,
932 932
                 "$end_date $end_time:00",
933 933
                 $old_event_row['timezone_string']
934 934
             );
935
-        $cols_n_values      = [
935
+        $cols_n_values = [
936 936
             'EVT_ID'        => $new_cpt_id,
937 937
             // EVT_ID
938 938
             'DTT_EVT_start' => $start_datetime_utc,
@@ -950,19 +950,19 @@  discard block
 block discarded – undo
950 950
             'DTT_parent'    => 0,
951 951
             'DTT_deleted'   => false,
952 952
         ];
953
-        $data_types         = [
954
-            '%d',// EVT_Id
955
-            '%s',// DTT_EVT_start
956
-            '%s',// DTT_EVT_end
957
-            '%d',// DTT_reg_limit
958
-            '%d',// DTT_sold
953
+        $data_types = [
954
+            '%d', // EVT_Id
955
+            '%s', // DTT_EVT_start
956
+            '%s', // DTT_EVT_end
957
+            '%d', // DTT_reg_limit
958
+            '%d', // DTT_sold
959 959
             //          '%d',//DTT_is_primary
960
-            '%d',// DTT_order
961
-            '%d',// DTT_parent
962
-            '%d',// DTT_deleted
960
+            '%d', // DTT_order
961
+            '%d', // DTT_parent
962
+            '%d', // DTT_deleted
963 963
         ];
964
-        $success            = $wpdb->insert($this->_new_datetime_table, $cols_n_values, $data_types);
965
-        if (! $success) {
964
+        $success = $wpdb->insert($this->_new_datetime_table, $cols_n_values, $data_types);
965
+        if ( ! $success) {
966 966
             $this->add_error(
967 967
                 $this->get_migration_script()->_create_error_message_for_db_insertion(
968 968
                     $this->_old_start_end_table,
Please login to merge, or discard this patch.