@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | |
25 | 25 | |
26 | 26 | /** |
27 | - * @deprecated 4.9.27 |
|
28 | - * @return void |
|
27 | + * @deprecated 4.9.27 |
|
28 | + * @return void |
|
29 | 29 | */ |
30 | 30 | public static function set_hooks() { |
31 | 31 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | |
34 | 34 | |
35 | 35 | /** |
36 | - * @deprecated 4.9.27 |
|
37 | - * @return void |
|
36 | + * @deprecated 4.9.27 |
|
37 | + * @return void |
|
38 | 38 | */ |
39 | 39 | public static function set_hooks_admin() { |
40 | 40 | } |
@@ -42,353 +42,353 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | - * @deprecated 4.9.27 |
|
46 | - * @return void |
|
45 | + * @deprecated 4.9.27 |
|
46 | + * @return void |
|
47 | 47 | */ |
48 | 48 | public static function set_definitions() { |
49 | - \EE_Error::doing_it_wrong( |
|
50 | - __METHOD__, |
|
51 | - __( |
|
52 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
53 | - 'event_espresso' |
|
54 | - ), |
|
55 | - '4.9.27' |
|
56 | - ); |
|
57 | - } |
|
49 | + \EE_Error::doing_it_wrong( |
|
50 | + __METHOD__, |
|
51 | + __( |
|
52 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
53 | + 'event_espresso' |
|
54 | + ), |
|
55 | + '4.9.27' |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
62 | - * @deprecated 4.9.27 |
|
63 | - * @return EE_Transaction |
|
62 | + * @deprecated 4.9.27 |
|
63 | + * @return EE_Transaction |
|
64 | 64 | */ |
65 | 65 | public function get_txn() { |
66 | - \EE_Error::doing_it_wrong( |
|
67 | - __METHOD__, |
|
68 | - __( |
|
69 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
70 | - 'event_espresso' |
|
71 | - ), |
|
72 | - '4.9.27' |
|
73 | - ); |
|
74 | - } |
|
66 | + \EE_Error::doing_it_wrong( |
|
67 | + __METHOD__, |
|
68 | + __( |
|
69 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
70 | + 'event_espresso' |
|
71 | + ), |
|
72 | + '4.9.27' |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | |
78 | 78 | /** |
79 | - * @deprecated 4.9.27 |
|
80 | - * @param int $since |
|
79 | + * @deprecated 4.9.27 |
|
80 | + * @param int $since |
|
81 | 81 | * @return mixed array of EE_Payment || FALSE |
82 | 82 | */ |
83 | 83 | public function get_txn_payments( $since = 0 ) { |
84 | - \EE_Error::doing_it_wrong( |
|
85 | - __METHOD__, |
|
86 | - __( |
|
87 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
88 | - 'event_espresso' |
|
89 | - ), |
|
90 | - '4.9.27' |
|
91 | - ); |
|
92 | - } |
|
84 | + \EE_Error::doing_it_wrong( |
|
85 | + __METHOD__, |
|
86 | + __( |
|
87 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
88 | + 'event_espresso' |
|
89 | + ), |
|
90 | + '4.9.27' |
|
91 | + ); |
|
92 | + } |
|
93 | 93 | |
94 | 94 | |
95 | 95 | |
96 | 96 | /** |
97 | - * @deprecated 4.9.27 |
|
98 | - * @param string $reg_url_link |
|
97 | + * @deprecated 4.9.27 |
|
98 | + * @param string $reg_url_link |
|
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public function set_reg_url_link( $reg_url_link = null ) { |
102 | - \EE_Error::doing_it_wrong( |
|
103 | - __METHOD__, |
|
104 | - __( |
|
105 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
106 | - 'event_espresso' |
|
107 | - ), |
|
108 | - '4.9.27' |
|
109 | - ); |
|
110 | - } |
|
102 | + \EE_Error::doing_it_wrong( |
|
103 | + __METHOD__, |
|
104 | + __( |
|
105 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
106 | + 'event_espresso' |
|
107 | + ), |
|
108 | + '4.9.27' |
|
109 | + ); |
|
110 | + } |
|
111 | 111 | |
112 | 112 | |
113 | 113 | |
114 | 114 | /** |
115 | - * @deprecated 4.9.27 |
|
116 | - * @param WP $WP |
|
115 | + * @deprecated 4.9.27 |
|
116 | + * @param WP $WP |
|
117 | 117 | * @return void |
118 | 118 | */ |
119 | 119 | public function run( WP $WP ) { |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | 122 | |
123 | 123 | |
124 | 124 | /** |
125 | - * @deprecated 4.9.27 |
|
126 | - * @return void |
|
125 | + * @deprecated 4.9.27 |
|
126 | + * @return void |
|
127 | 127 | */ |
128 | 128 | protected function _translate_strings() { |
129 | - \EE_Error::doing_it_wrong( |
|
130 | - __METHOD__, |
|
131 | - __( |
|
132 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
133 | - 'event_espresso' |
|
134 | - ), |
|
135 | - '4.9.27' |
|
136 | - ); |
|
137 | - } |
|
129 | + \EE_Error::doing_it_wrong( |
|
130 | + __METHOD__, |
|
131 | + __( |
|
132 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
133 | + 'event_espresso' |
|
134 | + ), |
|
135 | + '4.9.27' |
|
136 | + ); |
|
137 | + } |
|
138 | 138 | |
139 | 139 | |
140 | 140 | |
141 | 141 | /** |
142 | - * @deprecated 4.9.27 |
|
143 | - * @return void |
|
142 | + * @deprecated 4.9.27 |
|
143 | + * @return void |
|
144 | 144 | */ |
145 | 145 | public function load_js() { |
146 | - \EE_Error::doing_it_wrong( |
|
147 | - __METHOD__, |
|
148 | - __( |
|
149 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
150 | - 'event_espresso' |
|
151 | - ), |
|
152 | - '4.9.27' |
|
153 | - ); |
|
154 | - } |
|
146 | + \EE_Error::doing_it_wrong( |
|
147 | + __METHOD__, |
|
148 | + __( |
|
149 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
150 | + 'event_espresso' |
|
151 | + ), |
|
152 | + '4.9.27' |
|
153 | + ); |
|
154 | + } |
|
155 | 155 | |
156 | 156 | |
157 | 157 | |
158 | 158 | /** |
159 | - * @deprecated 4.9.27 |
|
160 | - * @return void |
|
159 | + * @deprecated 4.9.27 |
|
160 | + * @return void |
|
161 | 161 | * @throws \EE_Error |
162 | 162 | */ |
163 | 163 | public function init() { |
164 | - \EE_Error::doing_it_wrong( |
|
165 | - __METHOD__, |
|
166 | - __( |
|
167 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
168 | - 'event_espresso' |
|
169 | - ), |
|
170 | - '4.9.27' |
|
171 | - ); |
|
172 | - } |
|
164 | + \EE_Error::doing_it_wrong( |
|
165 | + __METHOD__, |
|
166 | + __( |
|
167 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
168 | + 'event_espresso' |
|
169 | + ), |
|
170 | + '4.9.27' |
|
171 | + ); |
|
172 | + } |
|
173 | 173 | |
174 | 174 | |
175 | 175 | |
176 | 176 | /** |
177 | - * @deprecated 4.9.27 |
|
178 | - * @param array $attributes |
|
177 | + * @deprecated 4.9.27 |
|
178 | + * @param array $attributes |
|
179 | 179 | * @return string |
180 | 180 | * @throws \EE_Error |
181 | 181 | */ |
182 | 182 | public function process_shortcode( $attributes = array() ) { |
183 | - \EE_Error::doing_it_wrong( |
|
184 | - __METHOD__, |
|
185 | - __( |
|
186 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
187 | - 'event_espresso' |
|
188 | - ), |
|
189 | - '4.9.27' |
|
190 | - ); |
|
191 | - return ''; |
|
192 | - } |
|
183 | + \EE_Error::doing_it_wrong( |
|
184 | + __METHOD__, |
|
185 | + __( |
|
186 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
187 | + 'event_espresso' |
|
188 | + ), |
|
189 | + '4.9.27' |
|
190 | + ); |
|
191 | + return ''; |
|
192 | + } |
|
193 | 193 | |
194 | 194 | |
195 | 195 | |
196 | 196 | /** |
197 | - * @deprecated 4.9.27 |
|
198 | - * @param array $response |
|
197 | + * @deprecated 4.9.27 |
|
198 | + * @param array $response |
|
199 | 199 | * @param array $data |
200 | 200 | * @return array |
201 | 201 | * @throws \EE_Error |
202 | 202 | */ |
203 | 203 | public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) { |
204 | - \EE_Error::doing_it_wrong( |
|
205 | - __METHOD__, |
|
206 | - __( |
|
207 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
208 | - 'event_espresso' |
|
209 | - ), |
|
210 | - '4.9.27' |
|
211 | - ); |
|
212 | - } |
|
204 | + \EE_Error::doing_it_wrong( |
|
205 | + __METHOD__, |
|
206 | + __( |
|
207 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
208 | + 'event_espresso' |
|
209 | + ), |
|
210 | + '4.9.27' |
|
211 | + ); |
|
212 | + } |
|
213 | 213 | |
214 | 214 | |
215 | 215 | |
216 | 216 | |
217 | 217 | /** |
218 | - * @deprecated 4.9.27 |
|
219 | - * @return string |
|
218 | + * @deprecated 4.9.27 |
|
219 | + * @return string |
|
220 | 220 | * @throws \EE_Error |
221 | 221 | */ |
222 | 222 | public function get_registration_details() { |
223 | - \EE_Error::doing_it_wrong( |
|
224 | - __METHOD__, |
|
225 | - __( |
|
226 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
227 | - 'event_espresso' |
|
228 | - ), |
|
229 | - '4.9.27' |
|
230 | - ); |
|
231 | - } |
|
223 | + \EE_Error::doing_it_wrong( |
|
224 | + __METHOD__, |
|
225 | + __( |
|
226 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
227 | + 'event_espresso' |
|
228 | + ), |
|
229 | + '4.9.27' |
|
230 | + ); |
|
231 | + } |
|
232 | 232 | |
233 | 233 | |
234 | 234 | |
235 | 235 | /** |
236 | 236 | * resend_reg_confirmation_email |
237 | - * |
|
238 | - * @deprecated 4.9.27 |
|
239 | - */ |
|
237 | + * |
|
238 | + * @deprecated 4.9.27 |
|
239 | + */ |
|
240 | 240 | public static function resend_reg_confirmation_email() { |
241 | - \EE_Error::doing_it_wrong( |
|
242 | - __METHOD__, |
|
243 | - __( |
|
244 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
245 | - 'event_espresso' |
|
246 | - ), |
|
247 | - '4.9.27' |
|
248 | - ); |
|
249 | - } |
|
241 | + \EE_Error::doing_it_wrong( |
|
242 | + __METHOD__, |
|
243 | + __( |
|
244 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
245 | + 'event_espresso' |
|
246 | + ), |
|
247 | + '4.9.27' |
|
248 | + ); |
|
249 | + } |
|
250 | 250 | |
251 | 251 | |
252 | 252 | |
253 | 253 | /** |
254 | 254 | * get_ajax_content |
255 | - * |
|
256 | - * @deprecated 4.9.27 |
|
257 | - * @return void |
|
255 | + * |
|
256 | + * @deprecated 4.9.27 |
|
257 | + * @return void |
|
258 | 258 | */ |
259 | 259 | public function get_ajax_content() { |
260 | - \EE_Error::doing_it_wrong( |
|
261 | - __METHOD__, |
|
262 | - __( |
|
263 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
264 | - 'event_espresso' |
|
265 | - ), |
|
266 | - '4.9.27' |
|
267 | - ); |
|
268 | - } |
|
260 | + \EE_Error::doing_it_wrong( |
|
261 | + __METHOD__, |
|
262 | + __( |
|
263 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
264 | + 'event_espresso' |
|
265 | + ), |
|
266 | + '4.9.27' |
|
267 | + ); |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | 271 | |
272 | 272 | /** |
273 | 273 | * display_details_for_events |
274 | - * |
|
275 | - * @deprecated 4.9.27 |
|
276 | - * @param EE_Event[] $events |
|
274 | + * |
|
275 | + * @deprecated 4.9.27 |
|
276 | + * @param EE_Event[] $events |
|
277 | 277 | * @return void |
278 | 278 | */ |
279 | 279 | public function display_details_for_events( $events = array() ) { |
280 | - \EE_Error::doing_it_wrong( |
|
281 | - __METHOD__, |
|
282 | - __( |
|
283 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
284 | - 'event_espresso' |
|
285 | - ), |
|
286 | - '4.9.27' |
|
287 | - ); |
|
288 | - } |
|
280 | + \EE_Error::doing_it_wrong( |
|
281 | + __METHOD__, |
|
282 | + __( |
|
283 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
284 | + 'event_espresso' |
|
285 | + ), |
|
286 | + '4.9.27' |
|
287 | + ); |
|
288 | + } |
|
289 | 289 | |
290 | 290 | |
291 | 291 | |
292 | 292 | /** |
293 | 293 | * display_details_for_events_requiring_pre_approval |
294 | - * |
|
295 | - * @deprecated 4.9.27 |
|
296 | - * @param EE_Event[] $events |
|
294 | + * |
|
295 | + * @deprecated 4.9.27 |
|
296 | + * @param EE_Event[] $events |
|
297 | 297 | * @return void |
298 | 298 | */ |
299 | 299 | public function display_details_for_events_requiring_pre_approval( $events = array() ) { |
300 | - \EE_Error::doing_it_wrong( |
|
301 | - __METHOD__, |
|
302 | - __( |
|
303 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
304 | - 'event_espresso' |
|
305 | - ), |
|
306 | - '4.9.27' |
|
307 | - ); |
|
308 | - } |
|
300 | + \EE_Error::doing_it_wrong( |
|
301 | + __METHOD__, |
|
302 | + __( |
|
303 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
304 | + 'event_espresso' |
|
305 | + ), |
|
306 | + '4.9.27' |
|
307 | + ); |
|
308 | + } |
|
309 | 309 | |
310 | 310 | |
311 | 311 | |
312 | 312 | /** |
313 | 313 | * get_transaction_details |
314 | - * |
|
315 | - * @deprecated 4.9.27 |
|
316 | - * @return string |
|
314 | + * |
|
315 | + * @deprecated 4.9.27 |
|
316 | + * @return string |
|
317 | 317 | * @throws \EE_Error |
318 | 318 | */ |
319 | 319 | public function get_transaction_details() { |
320 | - \EE_Error::doing_it_wrong( |
|
321 | - __METHOD__, |
|
322 | - __( |
|
323 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
324 | - 'event_espresso' |
|
325 | - ), |
|
326 | - '4.9.27' |
|
327 | - ); |
|
328 | - } |
|
320 | + \EE_Error::doing_it_wrong( |
|
321 | + __METHOD__, |
|
322 | + __( |
|
323 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
324 | + 'event_espresso' |
|
325 | + ), |
|
326 | + '4.9.27' |
|
327 | + ); |
|
328 | + } |
|
329 | 329 | |
330 | 330 | |
331 | 331 | |
332 | 332 | /** |
333 | 333 | * get_payment_row_html |
334 | - * |
|
335 | - * @deprecated 4.9.27 |
|
336 | - * @param EE_Payment $payment |
|
334 | + * |
|
335 | + * @deprecated 4.9.27 |
|
336 | + * @param EE_Payment $payment |
|
337 | 337 | * @return string |
338 | 338 | * @throws \EE_Error |
339 | 339 | */ |
340 | 340 | public function get_payment_row_html( $payment = null ) { |
341 | - \EE_Error::doing_it_wrong( |
|
342 | - __METHOD__, |
|
343 | - __( |
|
344 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
345 | - 'event_espresso' |
|
346 | - ), |
|
347 | - '4.9.27' |
|
348 | - ); |
|
349 | - } |
|
341 | + \EE_Error::doing_it_wrong( |
|
342 | + __METHOD__, |
|
343 | + __( |
|
344 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
345 | + 'event_espresso' |
|
346 | + ), |
|
347 | + '4.9.27' |
|
348 | + ); |
|
349 | + } |
|
350 | 350 | |
351 | 351 | |
352 | 352 | |
353 | 353 | /** |
354 | 354 | * get_payment_details |
355 | - * |
|
356 | - * @deprecated 4.9.27 |
|
357 | - * @param array $payments |
|
355 | + * |
|
356 | + * @deprecated 4.9.27 |
|
357 | + * @param array $payments |
|
358 | 358 | * @return string |
359 | 359 | * @throws \EE_Error |
360 | 360 | */ |
361 | 361 | public function get_payment_details( $payments = array() ) { |
362 | - \EE_Error::doing_it_wrong( |
|
363 | - __METHOD__, |
|
364 | - __( |
|
365 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
366 | - 'event_espresso' |
|
367 | - ), |
|
368 | - '4.9.27' |
|
369 | - ); |
|
370 | - } |
|
362 | + \EE_Error::doing_it_wrong( |
|
363 | + __METHOD__, |
|
364 | + __( |
|
365 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
366 | + 'event_espresso' |
|
367 | + ), |
|
368 | + '4.9.27' |
|
369 | + ); |
|
370 | + } |
|
371 | 371 | |
372 | 372 | |
373 | 373 | |
374 | 374 | /** |
375 | 375 | * get_payment_details |
376 | - * |
|
377 | - * @deprecated 4.9.27 |
|
378 | - * @param array $payments |
|
376 | + * |
|
377 | + * @deprecated 4.9.27 |
|
378 | + * @param array $payments |
|
379 | 379 | * @return string |
380 | 380 | * @throws \EE_Error |
381 | 381 | */ |
382 | 382 | public function get_new_payments( $payments = array() ) { |
383 | - \EE_Error::doing_it_wrong( |
|
384 | - __METHOD__, |
|
385 | - __( |
|
386 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
387 | - 'event_espresso' |
|
388 | - ), |
|
389 | - '4.9.27' |
|
390 | - ); |
|
391 | - } |
|
383 | + \EE_Error::doing_it_wrong( |
|
384 | + __METHOD__, |
|
385 | + __( |
|
386 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
387 | + 'event_espresso' |
|
388 | + ), |
|
389 | + '4.9.27' |
|
390 | + ); |
|
391 | + } |
|
392 | 392 | |
393 | 393 | |
394 | 394 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param int $since |
81 | 81 | * @return mixed array of EE_Payment || FALSE |
82 | 82 | */ |
83 | - public function get_txn_payments( $since = 0 ) { |
|
83 | + public function get_txn_payments($since = 0) { |
|
84 | 84 | \EE_Error::doing_it_wrong( |
85 | 85 | __METHOD__, |
86 | 86 | __( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $reg_url_link |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - public function set_reg_url_link( $reg_url_link = null ) { |
|
101 | + public function set_reg_url_link($reg_url_link = null) { |
|
102 | 102 | \EE_Error::doing_it_wrong( |
103 | 103 | __METHOD__, |
104 | 104 | __( |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param WP $WP |
117 | 117 | * @return void |
118 | 118 | */ |
119 | - public function run( WP $WP ) { |
|
119 | + public function run(WP $WP) { |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return string |
180 | 180 | * @throws \EE_Error |
181 | 181 | */ |
182 | - public function process_shortcode( $attributes = array() ) { |
|
182 | + public function process_shortcode($attributes = array()) { |
|
183 | 183 | \EE_Error::doing_it_wrong( |
184 | 184 | __METHOD__, |
185 | 185 | __( |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @return array |
201 | 201 | * @throws \EE_Error |
202 | 202 | */ |
203 | - public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) { |
|
203 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) { |
|
204 | 204 | \EE_Error::doing_it_wrong( |
205 | 205 | __METHOD__, |
206 | 206 | __( |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @param EE_Event[] $events |
277 | 277 | * @return void |
278 | 278 | */ |
279 | - public function display_details_for_events( $events = array() ) { |
|
279 | + public function display_details_for_events($events = array()) { |
|
280 | 280 | \EE_Error::doing_it_wrong( |
281 | 281 | __METHOD__, |
282 | 282 | __( |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param EE_Event[] $events |
297 | 297 | * @return void |
298 | 298 | */ |
299 | - public function display_details_for_events_requiring_pre_approval( $events = array() ) { |
|
299 | + public function display_details_for_events_requiring_pre_approval($events = array()) { |
|
300 | 300 | \EE_Error::doing_it_wrong( |
301 | 301 | __METHOD__, |
302 | 302 | __( |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @return string |
338 | 338 | * @throws \EE_Error |
339 | 339 | */ |
340 | - public function get_payment_row_html( $payment = null ) { |
|
340 | + public function get_payment_row_html($payment = null) { |
|
341 | 341 | \EE_Error::doing_it_wrong( |
342 | 342 | __METHOD__, |
343 | 343 | __( |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @return string |
359 | 359 | * @throws \EE_Error |
360 | 360 | */ |
361 | - public function get_payment_details( $payments = array() ) { |
|
361 | + public function get_payment_details($payments = array()) { |
|
362 | 362 | \EE_Error::doing_it_wrong( |
363 | 363 | __METHOD__, |
364 | 364 | __( |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @return string |
380 | 380 | * @throws \EE_Error |
381 | 381 | */ |
382 | - public function get_new_payments( $payments = array() ) { |
|
382 | + public function get_new_payments($payments = array()) { |
|
383 | 383 | \EE_Error::doing_it_wrong( |
384 | 384 | __METHOD__, |
385 | 385 | __( |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <h2 class="section-heading display-box-heading"> |
2 | 2 | <?php _e('Payment Overview', 'event_espresso'); ?> |
3 | 3 | </h2> |
4 | -<?php do_action( 'AHEE__thank_you_page_payment_details_template__after_heading' ); ?> |
|
4 | +<?php do_action('AHEE__thank_you_page_payment_details_template__after_heading'); ?> |
|
5 | 5 | |
6 | 6 | <div id="espresso-thank-you-page-payment-details-dv"> |
7 | -<?php if ( ! empty( $payments )){ ?> |
|
7 | +<?php if ( ! empty($payments)) { ?> |
|
8 | 8 | <table class="ee-table"> |
9 | 9 | <thead> |
10 | 10 | <tr> |
11 | 11 | <th width="35%" class="jst-left"> |
12 | - <?php _e('Payment Date','event_espresso')?> |
|
12 | + <?php _e('Payment Date', 'event_espresso')?> |
|
13 | 13 | </th> |
14 | 14 | <th width="17.5%" class="jst-left"> |
15 | - <?php _e('Type','event_espresso');?> |
|
15 | + <?php _e('Type', 'event_espresso'); ?> |
|
16 | 16 | </th> |
17 | 17 | <th width="17.5%" class="jst-rght"> |
18 | - <?php _e('Amount','event_espresso');?> |
|
18 | + <?php _e('Amount', 'event_espresso'); ?> |
|
19 | 19 | </th> |
20 | 20 | <th width="30%" class="jst-rght"> |
21 | - <?php _e('Status','event_espresso');?> |
|
21 | + <?php _e('Status', 'event_espresso'); ?> |
|
22 | 22 | </th> |
23 | 23 | </tr> |
24 | 24 | </thead> |
25 | 25 | <tbody> |
26 | 26 | <?php |
27 | - foreach ( $payments as $payment ) { |
|
27 | + foreach ($payments as $payment) { |
|
28 | 28 | echo $payment; |
29 | 29 | } |
30 | 30 | ?> |
@@ -33,38 +33,38 @@ discard block |
||
33 | 33 | <?php |
34 | 34 | } else { |
35 | 35 | |
36 | - if ( $transaction->total() ){ |
|
36 | + if ($transaction->total()) { |
|
37 | 37 | |
38 | 38 | echo apply_filters( |
39 | 39 | 'FHEE__payment_overview_template__no_payments_made', |
40 | - sprintf ( |
|
41 | - __('%sNo payments towards this transaction have been received.%s', 'event_espresso' ), |
|
40 | + sprintf( |
|
41 | + __('%sNo payments towards this transaction have been received.%s', 'event_espresso'), |
|
42 | 42 | '<p class="important-notice">', |
43 | 43 | '</p>' |
44 | 44 | ) |
45 | 45 | ); |
46 | - do_action( 'AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction ); |
|
46 | + do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction); |
|
47 | 47 | |
48 | 48 | } else { |
49 | 49 | |
50 | 50 | echo apply_filters( |
51 | 51 | 'FHEE__payment_overview_template__no_payment_required', |
52 | - sprintf ( |
|
53 | - __('%sNo payment is required for this transaction.%s', 'event_espresso' ), |
|
52 | + sprintf( |
|
53 | + __('%sNo payment is required for this transaction.%s', 'event_espresso'), |
|
54 | 54 | '<p>', |
55 | 55 | '</p>' |
56 | 56 | ) |
57 | 57 | ); |
58 | - do_action( 'AHEE__thank_you_page_payment_details_template__no_payment_required' ); |
|
58 | + do_action('AHEE__thank_you_page_payment_details_template__no_payment_required'); |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | |
62 | 62 | } |
63 | 63 | echo $gateway_content; |
64 | - do_action( 'AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content ); |
|
64 | + do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content); |
|
65 | 65 | |
66 | 66 | ?> |
67 | 67 | |
68 | 68 | <br/> |
69 | - <?php do_action( 'AHEE__thank_you_page_payment_details_template__after_payment_details' ); ?> |
|
69 | + <?php do_action('AHEE__thank_you_page_payment_details_template__after_payment_details'); ?> |
|
70 | 70 |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | /** @var boolean $revisit */ |
4 | 4 | /** @var string $order_conf_desc */ |
5 | 5 | |
6 | -do_action( 'AHEE__thank_you_page_overview_template__top', $transaction ); |
|
6 | +do_action('AHEE__thank_you_page_overview_template__top', $transaction); |
|
7 | 7 | |
8 | 8 | ?> |
9 | 9 | |
10 | 10 | <div id="espresso-thank-you-page-overview-dv" class="width-100" > |
11 | 11 | |
12 | - <?php if ( ! $revisit ) : ?> |
|
12 | + <?php if ( ! $revisit) : ?> |
|
13 | 13 | <div class="ee-attention"> |
14 | 14 | <div class="extra-padding-sides"> |
15 | 15 | <?php echo apply_filters( |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | '<br />' |
22 | 22 | ) |
23 | 23 | ); |
24 | - if ( ! empty( $TXN_receipt_url )) : ?> |
|
24 | + if ( ! empty($TXN_receipt_url)) : ?> |
|
25 | 25 | <br/> |
26 | 26 | <div class="jst-rght"> |
27 | - <a class="ee-button ee-roundish indented-text big-text" href="<?php echo $TXN_receipt_url;?>"><span class="ee-icon ee-icon-PDF-file-type"></span><?php echo apply_filters( 'FHEE__thank_you_page_overview_template__order_conf_button_text', __( 'View Full Order Confirmation Receipt', 'event_espresso' )); ?></a> |
|
27 | + <a class="ee-button ee-roundish indented-text big-text" href="<?php echo $TXN_receipt_url; ?>"><span class="ee-icon ee-icon-PDF-file-type"></span><?php echo apply_filters('FHEE__thank_you_page_overview_template__order_conf_button_text', __('View Full Order Confirmation Receipt', 'event_espresso')); ?></a> |
|
28 | 28 | </div> |
29 | 29 | <?php endif; ?> |
30 | 30 | </div> |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | <?php endif; ?> |
34 | 34 | <br/> |
35 | 35 | |
36 | - <?php do_action( 'AHEE__thank_you_page_overview_template__content', $transaction ); ?> |
|
36 | + <?php do_action('AHEE__thank_you_page_overview_template__content', $transaction); ?> |
|
37 | 37 | |
38 | 38 | </div> |
39 | 39 | <!-- end of espresso-thank-you-page-overview-dv --> |
40 | 40 | |
41 | -<?php do_action( 'AHEE__thank_you_page_overview_template__bottom', $transaction ); ?> |
|
41 | +<?php do_action('AHEE__thank_you_page_overview_template__bottom', $transaction); ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <h3><?php _e('Transaction Details', 'event_espresso'); ?></h3> |
2 | -<?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_heading' ); ?> |
|
2 | +<?php do_action('AHEE__thank_you_page_transaction_details_template__after_heading'); ?> |
|
3 | 3 | |
4 | 4 | <div id="espresso-thank-you-page-transaction-details-dv"> |
5 | 5 | <table class='ee-table'> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <label><?php _e('Total Cost: ', 'event_espresso'); ?></label> |
10 | 10 | </td> |
11 | 11 | <td> |
12 | - <?php echo EEH_Template::format_currency( $transaction->total() ); ?> |
|
12 | + <?php echo EEH_Template::format_currency($transaction->total()); ?> |
|
13 | 13 | </td> |
14 | 14 | </tr> |
15 | 15 | <tr> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <label><?php _e('Amount Owing: ', 'event_espresso'); ?></label> |
18 | 18 | </td> |
19 | 19 | <td class="<?php echo ($transaction->paid() == $transaction->total()) ? 'ee-transaction-paid' : 'ee-transaction-unpaid' ?>"> |
20 | - <?php echo EEH_Template::format_currency( $transaction->remaining() ); ?> |
|
20 | + <?php echo EEH_Template::format_currency($transaction->remaining()); ?> |
|
21 | 21 | </td> |
22 | 22 | </tr> |
23 | 23 | <tr> |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | <label><?php _e('Transaction Status: ', 'event_espresso'); ?></label> |
26 | 26 | </td> |
27 | 27 | <td> |
28 | - <?php $transaction->e_pretty_status( TRUE ); |
|
29 | - if ( $show_try_pay_again_link && ! $transaction->is_completed() ) { ?> |
|
28 | + <?php $transaction->e_pretty_status(TRUE); |
|
29 | + if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
30 | 30 | <span class="small-text"><a href='<?php echo $SPCO_payment_options_url?>'><?php _e('View Payment Options', 'event_espresso'); ?></a></span> |
31 | 31 | <?php } ?> |
32 | 32 | </td> |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | <?php echo $primary_registrant_name; ?> |
40 | 40 | </td> |
41 | 41 | </tr> |
42 | - <?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', $transaction ); ?> |
|
42 | + <?php do_action('AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', $transaction); ?> |
|
43 | 43 | </tbody> |
44 | 44 | </table> |
45 | 45 | |
46 | -<?php if ( $show_try_pay_again_link && ! $transaction->is_completed() ) { ?> |
|
46 | +<?php if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
47 | 47 | <p class="small-text jst-rght"> |
48 | 48 | <a href='<?php echo $SPCO_payment_options_url?>'><?php _e("Click here to view Payment Options", 'event_espresso'); ?></a> |
49 | 49 | </p> |
@@ -52,6 +52,6 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php }?> |
54 | 54 | |
55 | - <?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_transaction_details' ); ?> |
|
55 | + <?php do_action('AHEE__thank_you_page_transaction_details_template__after_transaction_details'); ?> |
|
56 | 56 | |
57 | 57 | </div> |
@@ -5,81 +5,81 @@ discard block |
||
5 | 5 | /** @type string $SPCO_attendee_information_url */ |
6 | 6 | ?> |
7 | 7 | <h3 class="ee-registration-details-h3"><?php _e('Registration Details', 'event_espresso'); ?></h3> |
8 | -<?php do_action( 'AHEE__thank_you_page_registration_details_template__after_heading' ); ?> |
|
8 | +<?php do_action('AHEE__thank_you_page_registration_details_template__after_heading'); ?> |
|
9 | 9 | |
10 | 10 | <div class="ee-registration-details-dv"> |
11 | 11 | <?php |
12 | 12 | $registrations = $transaction->registrations(); |
13 | -$registrations = is_array( $registrations ) ? $registrations : array(); |
|
14 | -$reg_count = count( $registrations ); |
|
13 | +$registrations = is_array($registrations) ? $registrations : array(); |
|
14 | +$reg_count = count($registrations); |
|
15 | 15 | $reg_cntr = 0; |
16 | 16 | $event_name = ''; |
17 | 17 | $wait_list = false; |
18 | -foreach ( $registrations as $registration ) { |
|
19 | - if ( $registration instanceof EE_Registration ) { |
|
20 | - if ( $event_name != $registration->event_name() && ! empty( $event_name )) { ?> |
|
18 | +foreach ($registrations as $registration) { |
|
19 | + if ($registration instanceof EE_Registration) { |
|
20 | + if ($event_name != $registration->event_name() && ! empty($event_name)) { ?> |
|
21 | 21 | </tbody> |
22 | 22 | </table> |
23 | 23 | <?php |
24 | 24 | } |
25 | 25 | $reg_cntr++; |
26 | - if ( $event_name != $registration->event_name() ) { |
|
26 | + if ($event_name != $registration->event_name()) { |
|
27 | 27 | ?> |
28 | 28 | <h5> |
29 | - <span class="smaller-text grey-text"><?php _e('for','event_espresso');?>: </span> <?php echo htmlentities( $registration->event_name(), ENT_QUOTES, 'UTF-8' );?> |
|
29 | + <span class="smaller-text grey-text"><?php _e('for', 'event_espresso'); ?>: </span> <?php echo htmlentities($registration->event_name(), ENT_QUOTES, 'UTF-8'); ?> |
|
30 | 30 | </h5> |
31 | 31 | <table class='ee-table ee-registrations-list'> |
32 | 32 | <thead> |
33 | 33 | <tr> |
34 | 34 | <th width="40%"> |
35 | - <?php _e("Registrant Name",'event_espresso')?> |
|
35 | + <?php _e("Registrant Name", 'event_espresso')?> |
|
36 | 36 | </th> |
37 | 37 | <th width="25%" class="jst-left"> |
38 | - <?php _e("REG Code",'event_espresso');?> |
|
38 | + <?php _e("REG Code", 'event_espresso'); ?> |
|
39 | 39 | </th> |
40 | 40 | <th width="35%" class="jst-left"> |
41 | - <?php _e("REG Status",'event_espresso');?> |
|
41 | + <?php _e("REG Status", 'event_espresso'); ?> |
|
42 | 42 | </th> |
43 | 43 | </tr> |
44 | 44 | </thead> |
45 | 45 | <tbody> |
46 | 46 | <?php |
47 | 47 | } |
48 | - if ( $is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link() )) { ?> |
|
48 | + if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?> |
|
49 | 49 | <tr> |
50 | 50 | <td width="40%"> |
51 | 51 | <?php |
52 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
53 | - echo $registration->attendee()->full_name( TRUE ); |
|
52 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
53 | + echo $registration->attendee()->full_name(TRUE); |
|
54 | 54 | } |
55 | 55 | ?> |
56 | 56 | <p class="tiny-text" style="margin: .75em 0 0;"> |
57 | 57 | <?php |
58 | - if ( $registration->count_question_groups() ) { |
|
58 | + if ($registration->count_question_groups()) { |
|
59 | 59 | ?> |
60 | - <a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url();?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso');?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso');?></a> |
|
60 | + <a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url(); ?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso'); ?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso'); ?></a> |
|
61 | 61 | <?php } ?> |
62 | - <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg( array( 'token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true' ), EE_Registry::instance()->CFG->core->thank_you_page_url() );?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso');?>" rel="<?php echo $registration->reg_url_link();?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso');?></a> |
|
62 | + <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg(array('token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true'), EE_Registry::instance()->CFG->core->thank_you_page_url()); ?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso'); ?>" rel="<?php echo $registration->reg_url_link(); ?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso'); ?></a> |
|
63 | 63 | </p> |
64 | 64 | </td> |
65 | 65 | <td width="25%" class="jst-left"> |
66 | 66 | <?php $registration->e('REG_code') ?> |
67 | 67 | </td> |
68 | 68 | <td width="35%" class="jst-left"> |
69 | - <?php $registration->e_pretty_status( TRUE )?> |
|
69 | + <?php $registration->e_pretty_status(TRUE)?> |
|
70 | 70 | <?php |
71 | - if ( $registration->status_ID() === EEM_Registration::status_id_wait_list ) { |
|
71 | + if ($registration->status_ID() === EEM_Registration::status_id_wait_list) { |
|
72 | 72 | $wait_list = true; |
73 | 73 | } |
74 | 74 | ?> |
75 | 75 | </td> |
76 | 76 | </tr> |
77 | - <?php do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration ); ?> |
|
77 | + <?php do_action('AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration); ?> |
|
78 | 78 | <?php |
79 | 79 | $event_name = $registration->event_name(); |
80 | 80 | |
81 | 81 | } |
82 | - if ( $reg_cntr >= $reg_count ) { |
|
82 | + if ($reg_cntr >= $reg_count) { |
|
83 | 83 | ?> |
84 | 84 | </tbody> |
85 | 85 | </table> |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | ?> |
91 | -<?php if ( $is_primary && $SPCO_attendee_information_url ) { ?> |
|
91 | +<?php if ($is_primary && $SPCO_attendee_information_url) { ?> |
|
92 | 92 | <p class="small-text jst-rght"> |
93 | 93 | <a href='<?php echo $SPCO_attendee_information_url?>'><?php _e("Click here to edit All Attendee Information", 'event_espresso'); ?></a> |
94 | 94 | </p> |
95 | 95 | <?php } ?> |
96 | - <?php if ( $wait_list ) { ?> |
|
96 | + <?php if ($wait_list) { ?> |
|
97 | 97 | |
98 | 98 | <?php |
99 | 99 | echo apply_filters( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | <?php } ?> |
114 | 114 | |
115 | 115 | |
116 | - <?php do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_details' ); ?> |
|
116 | + <?php do_action('AHEE__thank_you_page_registration_details_template__after_registration_details'); ?> |
|
117 | 117 | |
118 | 118 | </div> |
119 | 119 | <!-- end of .registration-details --> |
@@ -14,756 +14,756 @@ discard block |
||
14 | 14 | class EED_Thank_You_Page extends EED_Module |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes ) |
|
19 | - */ |
|
20 | - const IPN_wait_time = 1200; |
|
21 | - |
|
22 | - /** |
|
23 | - * The transaction specified by the reg_url_link passed from the Request, or from the Session |
|
24 | - * |
|
25 | - * @var EE_Transaction $_current_txn |
|
26 | - */ |
|
27 | - private $_current_txn; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var EE_Registration $_primary_registrant |
|
31 | - */ |
|
32 | - private $_primary_registrant; |
|
33 | - |
|
34 | - /** |
|
35 | - * The reg_url_link passed from the Request, or from the Session |
|
36 | - * |
|
37 | - * @var string $_reg_url_link |
|
38 | - */ |
|
39 | - private $_reg_url_link; |
|
40 | - |
|
41 | - /** |
|
42 | - * whether the incoming reg_url_link is for the primary registrant or not |
|
43 | - * |
|
44 | - * @var boolean $_is_primary |
|
45 | - */ |
|
46 | - private $_is_primary; |
|
47 | - |
|
48 | - /** |
|
49 | - * The URL for revisiting the SPCO attendee information step |
|
50 | - * |
|
51 | - * @var string $_SPCO_attendee_information_url |
|
52 | - */ |
|
53 | - private $_SPCO_attendee_information_url; |
|
54 | - |
|
55 | - /** |
|
56 | - * The URL for revisiting the SPCO payment options step |
|
57 | - * |
|
58 | - * @var string $_SPCO_payment_options_url |
|
59 | - */ |
|
60 | - private $_SPCO_payment_options_url; |
|
61 | - |
|
62 | - /** |
|
63 | - * whether to display the Payment Options link |
|
64 | - * |
|
65 | - * @var boolean $_show_try_pay_again_link |
|
66 | - */ |
|
67 | - private $_show_try_pay_again_link = false; |
|
68 | - |
|
69 | - /** |
|
70 | - * whether payments are allowed at this time |
|
71 | - * |
|
72 | - * @var boolean $_payments_closed |
|
73 | - */ |
|
74 | - private $_payments_closed = false; |
|
75 | - |
|
76 | - /** |
|
77 | - * whether the selected payment method is Bank, Check , Invoice, etc |
|
78 | - * |
|
79 | - * @var boolean $_is_offline_payment_method |
|
80 | - */ |
|
81 | - private $_is_offline_payment_method = true; |
|
82 | - |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * @return EED_Module|EED_Thank_You_Page |
|
87 | - */ |
|
88 | - public static function instance() |
|
89 | - { |
|
90 | - return parent::get_instance(__CLASS__); |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * set_hooks - for hooking into EE Core, modules, etc |
|
96 | - * |
|
97 | - * @return void |
|
98 | - */ |
|
99 | - public static function set_hooks() |
|
100 | - { |
|
101 | - add_action('wp_loaded', array('EED_Thank_You_Page', 'set_definitions'), 2); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * set_hooks_admin - for hooking into EE Admin Core, modules, etc |
|
108 | - * |
|
109 | - * @return void |
|
110 | - */ |
|
111 | - public static function set_hooks_admin() |
|
112 | - { |
|
113 | - // AJAX for IPN monitoring |
|
114 | - add_filter('heartbeat_received', array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), 10, 3); |
|
115 | - add_filter( |
|
116 | - 'heartbeat_nopriv_received', |
|
117 | - array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), |
|
118 | - 10, |
|
119 | - 3 |
|
120 | - ); |
|
121 | - add_action( |
|
122 | - 'wp_ajax_espresso_resend_reg_confirmation_email', |
|
123 | - array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
124 | - 10, |
|
125 | - 2 |
|
126 | - ); |
|
127 | - add_action( |
|
128 | - 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', |
|
129 | - array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
130 | - 10, |
|
131 | - 2 |
|
132 | - ); |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * set_definitions |
|
139 | - * |
|
140 | - * @return void |
|
141 | - */ |
|
142 | - public static function set_definitions() |
|
143 | - { |
|
144 | - define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
145 | - define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * get_txn |
|
152 | - * |
|
153 | - * @return EE_Transaction |
|
154 | - */ |
|
155 | - public function get_txn() |
|
156 | - { |
|
157 | - if ($this->_current_txn instanceof EE_Transaction) { |
|
158 | - return $this->_current_txn; |
|
159 | - } |
|
160 | - $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
161 | - if ( ! $TXN_model instanceof EEM_Transaction) { |
|
162 | - EE_Error::add_error( |
|
163 | - __('The transaction model could not be established.', 'event_espresso'), |
|
164 | - __FILE__, |
|
165 | - __FUNCTION__, |
|
166 | - __LINE__ |
|
167 | - ); |
|
168 | - return null; |
|
169 | - } |
|
170 | - //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
|
171 | - $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
172 | - // verify TXN |
|
173 | - if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
174 | - EE_Error::add_error( |
|
175 | - __( |
|
176 | - 'No transaction information could be retrieved or the transaction data is not of the correct type.', |
|
177 | - 'event_espresso' |
|
178 | - ), |
|
179 | - __FILE__, |
|
180 | - __FUNCTION__, |
|
181 | - __LINE__ |
|
182 | - ); |
|
183 | - return null; |
|
184 | - } |
|
185 | - return $this->_current_txn; |
|
186 | - } |
|
187 | - |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * get_txn_payments |
|
192 | - * |
|
193 | - * @param int $since |
|
194 | - * @return mixed array of EE_Payment || FALSE |
|
195 | - * @throws \EE_Error |
|
196 | - */ |
|
197 | - public function get_txn_payments($since = 0) |
|
198 | - { |
|
199 | - if ( ! $this->get_txn()) { |
|
200 | - return false; |
|
201 | - } |
|
202 | - $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
203 | - if ($since > 0) { |
|
204 | - $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
205 | - } |
|
206 | - // get array of payments with most recent first |
|
207 | - return $this->_current_txn->payments($args); |
|
208 | - } |
|
209 | - |
|
210 | - |
|
211 | - |
|
212 | - /** |
|
213 | - * get_reg_url_link |
|
214 | - * |
|
215 | - * @return void |
|
216 | - */ |
|
217 | - private function _get_reg_url_link() |
|
218 | - { |
|
219 | - if ( ! empty($this->_reg_url_link)) { |
|
220 | - return; |
|
221 | - } |
|
222 | - // only do thank you page stuff if we have a REG_url_link in the url |
|
223 | - if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
224 | - EE_Error::add_error( |
|
225 | - __( |
|
226 | - 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
|
227 | - 'event_espresso' |
|
228 | - ), |
|
229 | - __FILE__, |
|
230 | - __FUNCTION__, |
|
231 | - __LINE__ |
|
232 | - ); |
|
233 | - return; |
|
234 | - } |
|
235 | - // check for reg_url_link |
|
236 | - $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - |
|
241 | - /** |
|
242 | - * set_reg_url_link |
|
243 | - * |
|
244 | - * @param string $reg_url_link |
|
245 | - */ |
|
246 | - public function set_reg_url_link($reg_url_link = null) |
|
247 | - { |
|
248 | - $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - |
|
253 | - /** |
|
254 | - * run - initial module setup |
|
255 | - * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
256 | - * |
|
257 | - * @param WP $WP |
|
258 | - * @return void |
|
259 | - * @throws \EE_Error |
|
260 | - */ |
|
261 | - public function run($WP) |
|
262 | - { |
|
263 | - |
|
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - |
|
268 | - /** |
|
269 | - * load_resources |
|
270 | - * |
|
271 | - * @return void |
|
272 | - * @throws \EE_Error |
|
273 | - */ |
|
274 | - public function load_resources() { |
|
275 | - $this->_get_reg_url_link(); |
|
276 | - // resend_reg_confirmation_email ? |
|
277 | - if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
278 | - EED_Thank_You_Page::resend_reg_confirmation_email(); |
|
279 | - } |
|
280 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
281 | - $this->_translate_strings(); |
|
282 | - // load assets |
|
283 | - add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
284 | - } |
|
285 | - |
|
286 | - |
|
287 | - |
|
288 | - /** |
|
289 | - * load_js |
|
290 | - * |
|
291 | - * @return void |
|
292 | - */ |
|
293 | - protected function _translate_strings() |
|
294 | - { |
|
295 | - EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
296 | - EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
297 | - EE_Registry::$i18n_js_strings['IPN_wait_time'] = EED_Thank_You_Page::IPN_wait_time; |
|
298 | - EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
299 | - EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
300 | - EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __( |
|
301 | - 'checking for new payments...', |
|
302 | - 'event_espresso' |
|
303 | - ); |
|
304 | - EE_Registry::$i18n_js_strings['loading_payment_info'] = __( |
|
305 | - 'loading payment information...', |
|
306 | - 'event_espresso' |
|
307 | - ); |
|
308 | - EE_Registry::$i18n_js_strings['server_error'] = __( |
|
309 | - 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', |
|
310 | - 'event_espresso' |
|
311 | - ); |
|
312 | - EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
313 | - 'EED_Thank_You_Page__load_js__slow_IPN', |
|
314 | - sprintf( |
|
315 | - __( |
|
316 | - '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', |
|
317 | - 'event_espresso' |
|
318 | - ), |
|
319 | - '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
|
320 | - '</div>' |
|
321 | - ) |
|
322 | - ); |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * load_js |
|
329 | - * |
|
330 | - * @return void |
|
331 | - */ |
|
332 | - public function load_js() |
|
333 | - { |
|
334 | - wp_register_script( |
|
335 | - 'thank_you_page', |
|
336 | - THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
337 | - array('espresso_core', 'heartbeat'), |
|
338 | - EVENT_ESPRESSO_VERSION, |
|
339 | - true |
|
340 | - ); |
|
341 | - wp_enqueue_script('thank_you_page'); |
|
342 | - } |
|
343 | - |
|
344 | - |
|
345 | - |
|
346 | - /** |
|
347 | - * init |
|
348 | - * |
|
349 | - * @return void |
|
350 | - * @throws \EE_Error |
|
351 | - */ |
|
352 | - public function init() |
|
353 | - { |
|
354 | - $this->_get_reg_url_link(); |
|
355 | - if ( ! $this->get_txn()) { |
|
356 | - echo EEH_HTML::div( |
|
357 | - EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') . |
|
358 | - sprintf( |
|
359 | - __( |
|
360 | - 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', |
|
361 | - 'event_espresso' |
|
362 | - ), |
|
363 | - '<br/>' |
|
364 | - ), |
|
365 | - '', |
|
366 | - 'ee-attention' |
|
367 | - ); |
|
368 | - return null; |
|
369 | - } |
|
370 | - // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
|
371 | - if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) { |
|
372 | - $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
373 | - $this->_current_txn->save(); |
|
374 | - } |
|
375 | - $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration |
|
376 | - ? $this->_current_txn->primary_registration() |
|
377 | - : null; |
|
378 | - $this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link ? true : false; |
|
379 | - $show_try_pay_again_link_default = apply_filters( |
|
380 | - 'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default', |
|
381 | - true |
|
382 | - ); |
|
383 | - $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
384 | - // txn status ? |
|
385 | - if ($this->_current_txn->is_completed()) { |
|
386 | - $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
387 | - } else if ( |
|
388 | - $this->_current_txn->is_incomplete() |
|
389 | - && ($this->_primary_registrant->is_approved() |
|
390 | - || $this->_primary_registrant->is_pending_payment()) |
|
391 | - ) { |
|
392 | - $this->_show_try_pay_again_link = true; |
|
393 | - } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
394 | - // its pending |
|
395 | - $this->_show_try_pay_again_link = isset( |
|
396 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
397 | - ) |
|
398 | - && EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
399 | - ? true |
|
400 | - : $show_try_pay_again_link_default; |
|
401 | - } |
|
402 | - $this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
403 | - ? true |
|
404 | - : false; |
|
405 | - $this->_is_offline_payment_method = false; |
|
406 | - if ( |
|
407 | - // if payment method is unknown |
|
408 | - ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
409 | - || ( |
|
410 | - // or is an offline payment method |
|
411 | - $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
412 | - && $this->_current_txn->payment_method()->is_off_line() |
|
413 | - ) |
|
414 | - ) { |
|
415 | - $this->_is_offline_payment_method = true; |
|
416 | - } |
|
417 | - // link to SPCO |
|
418 | - $revisit_spco_url = add_query_arg( |
|
419 | - array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link), |
|
420 | - EE_Registry::instance()->CFG->core->reg_page_url() |
|
421 | - ); |
|
422 | - // link to SPCO payment_options |
|
423 | - $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration |
|
424 | - ? $this->_primary_registrant->payment_overview_url() |
|
425 | - : add_query_arg( |
|
426 | - array('step' => 'payment_options'), |
|
427 | - $revisit_spco_url |
|
428 | - ); |
|
429 | - // link to SPCO attendee_information |
|
430 | - $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration |
|
431 | - ? $this->_primary_registrant->edit_attendee_information_url() |
|
432 | - : false; |
|
433 | - do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn); |
|
434 | - // set no cache headers and constants |
|
435 | - EE_System::do_not_cache(); |
|
436 | - } |
|
437 | - |
|
438 | - |
|
439 | - |
|
440 | - /** |
|
441 | - * display_thank_you_page_results |
|
442 | - * |
|
443 | - * @return string |
|
444 | - * @throws \EE_Error |
|
445 | - */ |
|
446 | - public function thank_you_page_results() |
|
447 | - { |
|
448 | - $this->init(); |
|
449 | - if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
450 | - return EE_Error::get_notices(); |
|
451 | - } |
|
452 | - // link to receipt |
|
453 | - $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
454 | - if ( ! empty($template_args['TXN_receipt_url'])) { |
|
455 | - $template_args['order_conf_desc'] = __( |
|
456 | - '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', |
|
457 | - 'event_espresso' |
|
458 | - ); |
|
459 | - } else { |
|
460 | - $template_args['order_conf_desc'] = __( |
|
461 | - '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', |
|
462 | - 'event_espresso' |
|
463 | - ); |
|
464 | - } |
|
465 | - $template_args['transaction'] = $this->_current_txn; |
|
466 | - $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false); |
|
467 | - add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
468 | - if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
469 | - add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
470 | - } |
|
471 | - return EEH_Template::locate_template( |
|
472 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
473 | - $template_args, |
|
474 | - true, |
|
475 | - true |
|
476 | - ); |
|
477 | - } |
|
478 | - |
|
479 | - |
|
480 | - |
|
481 | - /** |
|
482 | - * thank_you_page_IPN_monitor |
|
483 | - * this basically just pulls the TXN based on the reg_url_link sent from the server, |
|
484 | - * then checks that the TXN status is not failed, and that no other errors have been generated. |
|
485 | - * it also calculates the IPN wait time since the Thank You page was first loaded |
|
486 | - * |
|
487 | - * @param array $response |
|
488 | - * @param array $data |
|
489 | - * @return array |
|
490 | - * @throws \EE_Error |
|
491 | - */ |
|
492 | - public static function thank_you_page_IPN_monitor($response = array(), $data = array()) |
|
493 | - { |
|
494 | - // does this heartbeat contain our data ? |
|
495 | - if ( ! isset($data['espresso_thank_you_page'])) { |
|
496 | - return $response; |
|
497 | - } |
|
498 | - // check for reg_url_link in the incoming heartbeat data |
|
499 | - if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
500 | - $response['espresso_thank_you_page'] = array( |
|
501 | - 'errors' => ! empty($notices['errors']) |
|
502 | - ? $notices['errors'] |
|
503 | - : __( |
|
504 | - 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
|
505 | - 'event_espresso' |
|
506 | - ) |
|
507 | - ); |
|
508 | - return $response; |
|
509 | - } |
|
510 | - // kk heartbeat has our data |
|
511 | - $response['espresso_thank_you_page'] = array(); |
|
512 | - // set_definitions, instantiate the thank you page class, and get the ball rolling |
|
513 | - EED_Thank_You_Page::set_definitions(); |
|
514 | - /** @var $espresso_thank_you_page EED_Thank_You_Page */ |
|
515 | - $espresso_thank_you_page = EED_Thank_You_Page::instance(); |
|
516 | - $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
517 | - $espresso_thank_you_page->init(); |
|
518 | - //get TXN |
|
519 | - $TXN = $espresso_thank_you_page->get_txn(); |
|
520 | - // no TXN? then get out |
|
521 | - if ( ! $TXN instanceof EE_Transaction) { |
|
522 | - $notices = EE_Error::get_notices(); |
|
523 | - $response['espresso_thank_you_page'] = array( |
|
524 | - 'errors' => ! empty($notices['errors']) |
|
525 | - ? $notices['errors'] |
|
526 | - : sprintf( |
|
527 | - __( |
|
528 | - 'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', |
|
529 | - 'event_espresso' |
|
530 | - ), |
|
531 | - __LINE__ |
|
532 | - ) |
|
533 | - ); |
|
534 | - return $response; |
|
535 | - } |
|
536 | - // grab transient of TXN's status |
|
537 | - $txn_status = isset($data['espresso_thank_you_page']['txn_status']) |
|
538 | - ? $data['espresso_thank_you_page']['txn_status'] |
|
539 | - : null; |
|
540 | - // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
|
541 | - if ($txn_status !== $TXN->status_ID()) { |
|
542 | - // switch between two possible basic outcomes |
|
543 | - switch ($TXN->status_ID()) { |
|
544 | - // TXN has been updated in some way |
|
545 | - case EEM_Transaction::overpaid_status_code: |
|
546 | - case EEM_Transaction::complete_status_code: |
|
547 | - case EEM_Transaction::incomplete_status_code: |
|
548 | - // send updated TXN results back to client, |
|
549 | - $response['espresso_thank_you_page'] = array( |
|
550 | - 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
|
551 | - 'txn_status' => $TXN->status_ID() |
|
552 | - ); |
|
553 | - break; |
|
554 | - // or we have a bad TXN, or really slow IPN, so calculate the wait time and send that back... |
|
555 | - case EEM_Transaction::failed_status_code: |
|
556 | - default: |
|
557 | - // keep on waiting... |
|
558 | - return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
559 | - } |
|
560 | - // or is the TXN still failed (never been updated) ??? |
|
561 | - } else if ($TXN->failed()) { |
|
562 | - // keep on waiting... |
|
563 | - return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
564 | - } |
|
565 | - // TXN is happening so let's get the payments now |
|
566 | - // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
|
567 | - $since = isset($data['espresso_thank_you_page']['get_payments_since']) |
|
568 | - ? $data['espresso_thank_you_page']['get_payments_since'] |
|
569 | - : 0; |
|
570 | - // then check for payments |
|
571 | - $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
572 | - // has a payment been processed ? |
|
573 | - if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
574 | - if ($since) { |
|
575 | - $response['espresso_thank_you_page'] = array( |
|
576 | - 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
577 | - 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
|
578 | - 'txn_status' => $TXN->status_ID() |
|
579 | - ); |
|
580 | - } else { |
|
581 | - $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details( |
|
582 | - $payments |
|
583 | - ); |
|
584 | - } |
|
585 | - // reset time to check for payments |
|
586 | - $response['espresso_thank_you_page']['get_payments_since'] = time(); |
|
587 | - } else { |
|
588 | - $response['espresso_thank_you_page']['get_payments_since'] = $since; |
|
589 | - } |
|
590 | - return $response; |
|
591 | - } |
|
592 | - |
|
593 | - |
|
594 | - |
|
595 | - /** |
|
596 | - * _update_server_wait_time |
|
597 | - * |
|
598 | - * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
|
599 | - * @return array |
|
600 | - * @throws \EE_Error |
|
601 | - */ |
|
602 | - private function _update_server_wait_time($thank_you_page_data = array()) |
|
603 | - { |
|
604 | - $response['espresso_thank_you_page'] = array( |
|
605 | - 'still_waiting' => isset($thank_you_page_data['initial_access']) |
|
606 | - ? time() - $thank_you_page_data['initial_access'] |
|
607 | - : 0, |
|
608 | - 'txn_status' => $this->_current_txn->status_ID() |
|
609 | - ); |
|
610 | - return $response; |
|
611 | - } |
|
612 | - |
|
613 | - |
|
614 | - |
|
615 | - /** |
|
616 | - * get_registration_details |
|
617 | - * |
|
618 | - * @throws \EE_Error |
|
619 | - */ |
|
620 | - public function get_registration_details() |
|
621 | - { |
|
622 | - //prepare variables for displaying |
|
623 | - $template_args = array(); |
|
624 | - $template_args['transaction'] = $this->_current_txn; |
|
625 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
626 | - $template_args['is_primary'] = $this->_is_primary; |
|
627 | - $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
|
628 | - $template_args['resend_reg_confirmation_url'] = add_query_arg( |
|
629 | - array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
630 | - EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
631 | - ); |
|
632 | - // verify template arguments |
|
633 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
634 | - EEH_Template_Validator::verify_isnt_null( |
|
635 | - $template_args['SPCO_attendee_information_url'], |
|
636 | - '$SPCO_attendee_information_url' |
|
637 | - ); |
|
638 | - echo EEH_Template::locate_template( |
|
639 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
640 | - $template_args, |
|
641 | - true, |
|
642 | - true |
|
643 | - ); |
|
644 | - } |
|
645 | - |
|
646 | - |
|
647 | - |
|
648 | - /** |
|
649 | - * resend_reg_confirmation_email |
|
650 | - * |
|
651 | - * @throws \EE_Error |
|
652 | - */ |
|
653 | - public static function resend_reg_confirmation_email() |
|
654 | - { |
|
655 | - EE_Registry::instance()->load_core('Request_Handler'); |
|
656 | - $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
657 | - // was a REG_ID passed ? |
|
658 | - if ($reg_url_link) { |
|
659 | - $registration = EE_Registry::instance()->load_model('Registration')->get_one( |
|
660 | - array(array('REG_url_link' => $reg_url_link)) |
|
661 | - ); |
|
662 | - if ($registration instanceof EE_Registration) { |
|
663 | - // resend email |
|
664 | - EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
665 | - } else { |
|
666 | - EE_Error::add_error( |
|
667 | - __( |
|
668 | - 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', |
|
669 | - 'event_espresso' |
|
670 | - ), |
|
671 | - __FILE__, |
|
672 | - __FUNCTION__, |
|
673 | - __LINE__ |
|
674 | - ); |
|
675 | - } |
|
676 | - } else { |
|
677 | - EE_Error::add_error( |
|
678 | - __( |
|
679 | - 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', |
|
680 | - 'event_espresso' |
|
681 | - ), |
|
682 | - __FILE__, |
|
683 | - __FUNCTION__, |
|
684 | - __LINE__ |
|
685 | - ); |
|
686 | - } |
|
687 | - // request sent via AJAX ? |
|
688 | - if (EE_FRONT_AJAX) { |
|
689 | - echo wp_json_encode(EE_Error::get_notices(false)); |
|
690 | - die(); |
|
691 | - // or was JS disabled ? |
|
692 | - } else { |
|
693 | - // save errors so that they get picked up on the next request |
|
694 | - EE_Error::get_notices(true, true); |
|
695 | - wp_safe_redirect( |
|
696 | - add_query_arg( |
|
697 | - array('e_reg_url_link' => $reg_url_link), |
|
698 | - EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
699 | - ) |
|
700 | - ); |
|
701 | - } |
|
702 | - } |
|
703 | - |
|
704 | - |
|
705 | - |
|
706 | - /** |
|
707 | - * get_ajax_content |
|
708 | - * |
|
709 | - * @return void |
|
710 | - * @throws \EE_Error |
|
711 | - */ |
|
712 | - public function get_ajax_content() |
|
713 | - { |
|
714 | - if ( ! $this->get_txn()) { |
|
715 | - return; |
|
716 | - } |
|
717 | - // first determine which event(s) require pre-approval or not |
|
718 | - $events = array(); |
|
719 | - $events_requiring_pre_approval = array(); |
|
720 | - foreach ($this->_current_txn->registrations() as $registration) { |
|
721 | - if ($registration instanceof EE_Registration) { |
|
722 | - $event = $registration->event(); |
|
723 | - if ($event instanceof EE_Event) { |
|
724 | - if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
725 | - $events_requiring_pre_approval[$event->ID()] = $event; |
|
726 | - } else { |
|
727 | - $events[$event->ID()] = $event; |
|
728 | - } |
|
729 | - } |
|
730 | - } |
|
731 | - } |
|
732 | - $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
733 | - $this->display_details_for_events($events); |
|
734 | - } |
|
735 | - |
|
736 | - |
|
737 | - |
|
738 | - /** |
|
739 | - * display_details_for_events |
|
740 | - * |
|
741 | - * @param EE_Event[] $events |
|
742 | - * @return void |
|
743 | - */ |
|
744 | - public function display_details_for_events($events = array()) |
|
745 | - { |
|
746 | - if ( ! empty($events)) { |
|
747 | - ?> |
|
17 | + /** |
|
18 | + * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes ) |
|
19 | + */ |
|
20 | + const IPN_wait_time = 1200; |
|
21 | + |
|
22 | + /** |
|
23 | + * The transaction specified by the reg_url_link passed from the Request, or from the Session |
|
24 | + * |
|
25 | + * @var EE_Transaction $_current_txn |
|
26 | + */ |
|
27 | + private $_current_txn; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var EE_Registration $_primary_registrant |
|
31 | + */ |
|
32 | + private $_primary_registrant; |
|
33 | + |
|
34 | + /** |
|
35 | + * The reg_url_link passed from the Request, or from the Session |
|
36 | + * |
|
37 | + * @var string $_reg_url_link |
|
38 | + */ |
|
39 | + private $_reg_url_link; |
|
40 | + |
|
41 | + /** |
|
42 | + * whether the incoming reg_url_link is for the primary registrant or not |
|
43 | + * |
|
44 | + * @var boolean $_is_primary |
|
45 | + */ |
|
46 | + private $_is_primary; |
|
47 | + |
|
48 | + /** |
|
49 | + * The URL for revisiting the SPCO attendee information step |
|
50 | + * |
|
51 | + * @var string $_SPCO_attendee_information_url |
|
52 | + */ |
|
53 | + private $_SPCO_attendee_information_url; |
|
54 | + |
|
55 | + /** |
|
56 | + * The URL for revisiting the SPCO payment options step |
|
57 | + * |
|
58 | + * @var string $_SPCO_payment_options_url |
|
59 | + */ |
|
60 | + private $_SPCO_payment_options_url; |
|
61 | + |
|
62 | + /** |
|
63 | + * whether to display the Payment Options link |
|
64 | + * |
|
65 | + * @var boolean $_show_try_pay_again_link |
|
66 | + */ |
|
67 | + private $_show_try_pay_again_link = false; |
|
68 | + |
|
69 | + /** |
|
70 | + * whether payments are allowed at this time |
|
71 | + * |
|
72 | + * @var boolean $_payments_closed |
|
73 | + */ |
|
74 | + private $_payments_closed = false; |
|
75 | + |
|
76 | + /** |
|
77 | + * whether the selected payment method is Bank, Check , Invoice, etc |
|
78 | + * |
|
79 | + * @var boolean $_is_offline_payment_method |
|
80 | + */ |
|
81 | + private $_is_offline_payment_method = true; |
|
82 | + |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * @return EED_Module|EED_Thank_You_Page |
|
87 | + */ |
|
88 | + public static function instance() |
|
89 | + { |
|
90 | + return parent::get_instance(__CLASS__); |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * set_hooks - for hooking into EE Core, modules, etc |
|
96 | + * |
|
97 | + * @return void |
|
98 | + */ |
|
99 | + public static function set_hooks() |
|
100 | + { |
|
101 | + add_action('wp_loaded', array('EED_Thank_You_Page', 'set_definitions'), 2); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * set_hooks_admin - for hooking into EE Admin Core, modules, etc |
|
108 | + * |
|
109 | + * @return void |
|
110 | + */ |
|
111 | + public static function set_hooks_admin() |
|
112 | + { |
|
113 | + // AJAX for IPN monitoring |
|
114 | + add_filter('heartbeat_received', array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), 10, 3); |
|
115 | + add_filter( |
|
116 | + 'heartbeat_nopriv_received', |
|
117 | + array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), |
|
118 | + 10, |
|
119 | + 3 |
|
120 | + ); |
|
121 | + add_action( |
|
122 | + 'wp_ajax_espresso_resend_reg_confirmation_email', |
|
123 | + array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
124 | + 10, |
|
125 | + 2 |
|
126 | + ); |
|
127 | + add_action( |
|
128 | + 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', |
|
129 | + array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
130 | + 10, |
|
131 | + 2 |
|
132 | + ); |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * set_definitions |
|
139 | + * |
|
140 | + * @return void |
|
141 | + */ |
|
142 | + public static function set_definitions() |
|
143 | + { |
|
144 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
145 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * get_txn |
|
152 | + * |
|
153 | + * @return EE_Transaction |
|
154 | + */ |
|
155 | + public function get_txn() |
|
156 | + { |
|
157 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
158 | + return $this->_current_txn; |
|
159 | + } |
|
160 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
161 | + if ( ! $TXN_model instanceof EEM_Transaction) { |
|
162 | + EE_Error::add_error( |
|
163 | + __('The transaction model could not be established.', 'event_espresso'), |
|
164 | + __FILE__, |
|
165 | + __FUNCTION__, |
|
166 | + __LINE__ |
|
167 | + ); |
|
168 | + return null; |
|
169 | + } |
|
170 | + //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
|
171 | + $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
172 | + // verify TXN |
|
173 | + if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
174 | + EE_Error::add_error( |
|
175 | + __( |
|
176 | + 'No transaction information could be retrieved or the transaction data is not of the correct type.', |
|
177 | + 'event_espresso' |
|
178 | + ), |
|
179 | + __FILE__, |
|
180 | + __FUNCTION__, |
|
181 | + __LINE__ |
|
182 | + ); |
|
183 | + return null; |
|
184 | + } |
|
185 | + return $this->_current_txn; |
|
186 | + } |
|
187 | + |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * get_txn_payments |
|
192 | + * |
|
193 | + * @param int $since |
|
194 | + * @return mixed array of EE_Payment || FALSE |
|
195 | + * @throws \EE_Error |
|
196 | + */ |
|
197 | + public function get_txn_payments($since = 0) |
|
198 | + { |
|
199 | + if ( ! $this->get_txn()) { |
|
200 | + return false; |
|
201 | + } |
|
202 | + $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
203 | + if ($since > 0) { |
|
204 | + $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
205 | + } |
|
206 | + // get array of payments with most recent first |
|
207 | + return $this->_current_txn->payments($args); |
|
208 | + } |
|
209 | + |
|
210 | + |
|
211 | + |
|
212 | + /** |
|
213 | + * get_reg_url_link |
|
214 | + * |
|
215 | + * @return void |
|
216 | + */ |
|
217 | + private function _get_reg_url_link() |
|
218 | + { |
|
219 | + if ( ! empty($this->_reg_url_link)) { |
|
220 | + return; |
|
221 | + } |
|
222 | + // only do thank you page stuff if we have a REG_url_link in the url |
|
223 | + if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
224 | + EE_Error::add_error( |
|
225 | + __( |
|
226 | + 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
|
227 | + 'event_espresso' |
|
228 | + ), |
|
229 | + __FILE__, |
|
230 | + __FUNCTION__, |
|
231 | + __LINE__ |
|
232 | + ); |
|
233 | + return; |
|
234 | + } |
|
235 | + // check for reg_url_link |
|
236 | + $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + |
|
241 | + /** |
|
242 | + * set_reg_url_link |
|
243 | + * |
|
244 | + * @param string $reg_url_link |
|
245 | + */ |
|
246 | + public function set_reg_url_link($reg_url_link = null) |
|
247 | + { |
|
248 | + $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + |
|
253 | + /** |
|
254 | + * run - initial module setup |
|
255 | + * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
256 | + * |
|
257 | + * @param WP $WP |
|
258 | + * @return void |
|
259 | + * @throws \EE_Error |
|
260 | + */ |
|
261 | + public function run($WP) |
|
262 | + { |
|
263 | + |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + |
|
268 | + /** |
|
269 | + * load_resources |
|
270 | + * |
|
271 | + * @return void |
|
272 | + * @throws \EE_Error |
|
273 | + */ |
|
274 | + public function load_resources() { |
|
275 | + $this->_get_reg_url_link(); |
|
276 | + // resend_reg_confirmation_email ? |
|
277 | + if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
278 | + EED_Thank_You_Page::resend_reg_confirmation_email(); |
|
279 | + } |
|
280 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
281 | + $this->_translate_strings(); |
|
282 | + // load assets |
|
283 | + add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
284 | + } |
|
285 | + |
|
286 | + |
|
287 | + |
|
288 | + /** |
|
289 | + * load_js |
|
290 | + * |
|
291 | + * @return void |
|
292 | + */ |
|
293 | + protected function _translate_strings() |
|
294 | + { |
|
295 | + EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
296 | + EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
297 | + EE_Registry::$i18n_js_strings['IPN_wait_time'] = EED_Thank_You_Page::IPN_wait_time; |
|
298 | + EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
299 | + EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
300 | + EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __( |
|
301 | + 'checking for new payments...', |
|
302 | + 'event_espresso' |
|
303 | + ); |
|
304 | + EE_Registry::$i18n_js_strings['loading_payment_info'] = __( |
|
305 | + 'loading payment information...', |
|
306 | + 'event_espresso' |
|
307 | + ); |
|
308 | + EE_Registry::$i18n_js_strings['server_error'] = __( |
|
309 | + 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', |
|
310 | + 'event_espresso' |
|
311 | + ); |
|
312 | + EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
313 | + 'EED_Thank_You_Page__load_js__slow_IPN', |
|
314 | + sprintf( |
|
315 | + __( |
|
316 | + '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', |
|
317 | + 'event_espresso' |
|
318 | + ), |
|
319 | + '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
|
320 | + '</div>' |
|
321 | + ) |
|
322 | + ); |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * load_js |
|
329 | + * |
|
330 | + * @return void |
|
331 | + */ |
|
332 | + public function load_js() |
|
333 | + { |
|
334 | + wp_register_script( |
|
335 | + 'thank_you_page', |
|
336 | + THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
337 | + array('espresso_core', 'heartbeat'), |
|
338 | + EVENT_ESPRESSO_VERSION, |
|
339 | + true |
|
340 | + ); |
|
341 | + wp_enqueue_script('thank_you_page'); |
|
342 | + } |
|
343 | + |
|
344 | + |
|
345 | + |
|
346 | + /** |
|
347 | + * init |
|
348 | + * |
|
349 | + * @return void |
|
350 | + * @throws \EE_Error |
|
351 | + */ |
|
352 | + public function init() |
|
353 | + { |
|
354 | + $this->_get_reg_url_link(); |
|
355 | + if ( ! $this->get_txn()) { |
|
356 | + echo EEH_HTML::div( |
|
357 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') . |
|
358 | + sprintf( |
|
359 | + __( |
|
360 | + 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', |
|
361 | + 'event_espresso' |
|
362 | + ), |
|
363 | + '<br/>' |
|
364 | + ), |
|
365 | + '', |
|
366 | + 'ee-attention' |
|
367 | + ); |
|
368 | + return null; |
|
369 | + } |
|
370 | + // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
|
371 | + if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) { |
|
372 | + $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
373 | + $this->_current_txn->save(); |
|
374 | + } |
|
375 | + $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration |
|
376 | + ? $this->_current_txn->primary_registration() |
|
377 | + : null; |
|
378 | + $this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link ? true : false; |
|
379 | + $show_try_pay_again_link_default = apply_filters( |
|
380 | + 'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default', |
|
381 | + true |
|
382 | + ); |
|
383 | + $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
384 | + // txn status ? |
|
385 | + if ($this->_current_txn->is_completed()) { |
|
386 | + $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
387 | + } else if ( |
|
388 | + $this->_current_txn->is_incomplete() |
|
389 | + && ($this->_primary_registrant->is_approved() |
|
390 | + || $this->_primary_registrant->is_pending_payment()) |
|
391 | + ) { |
|
392 | + $this->_show_try_pay_again_link = true; |
|
393 | + } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
394 | + // its pending |
|
395 | + $this->_show_try_pay_again_link = isset( |
|
396 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
397 | + ) |
|
398 | + && EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
399 | + ? true |
|
400 | + : $show_try_pay_again_link_default; |
|
401 | + } |
|
402 | + $this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
403 | + ? true |
|
404 | + : false; |
|
405 | + $this->_is_offline_payment_method = false; |
|
406 | + if ( |
|
407 | + // if payment method is unknown |
|
408 | + ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
409 | + || ( |
|
410 | + // or is an offline payment method |
|
411 | + $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
412 | + && $this->_current_txn->payment_method()->is_off_line() |
|
413 | + ) |
|
414 | + ) { |
|
415 | + $this->_is_offline_payment_method = true; |
|
416 | + } |
|
417 | + // link to SPCO |
|
418 | + $revisit_spco_url = add_query_arg( |
|
419 | + array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link), |
|
420 | + EE_Registry::instance()->CFG->core->reg_page_url() |
|
421 | + ); |
|
422 | + // link to SPCO payment_options |
|
423 | + $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration |
|
424 | + ? $this->_primary_registrant->payment_overview_url() |
|
425 | + : add_query_arg( |
|
426 | + array('step' => 'payment_options'), |
|
427 | + $revisit_spco_url |
|
428 | + ); |
|
429 | + // link to SPCO attendee_information |
|
430 | + $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration |
|
431 | + ? $this->_primary_registrant->edit_attendee_information_url() |
|
432 | + : false; |
|
433 | + do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn); |
|
434 | + // set no cache headers and constants |
|
435 | + EE_System::do_not_cache(); |
|
436 | + } |
|
437 | + |
|
438 | + |
|
439 | + |
|
440 | + /** |
|
441 | + * display_thank_you_page_results |
|
442 | + * |
|
443 | + * @return string |
|
444 | + * @throws \EE_Error |
|
445 | + */ |
|
446 | + public function thank_you_page_results() |
|
447 | + { |
|
448 | + $this->init(); |
|
449 | + if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
450 | + return EE_Error::get_notices(); |
|
451 | + } |
|
452 | + // link to receipt |
|
453 | + $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
454 | + if ( ! empty($template_args['TXN_receipt_url'])) { |
|
455 | + $template_args['order_conf_desc'] = __( |
|
456 | + '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', |
|
457 | + 'event_espresso' |
|
458 | + ); |
|
459 | + } else { |
|
460 | + $template_args['order_conf_desc'] = __( |
|
461 | + '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', |
|
462 | + 'event_espresso' |
|
463 | + ); |
|
464 | + } |
|
465 | + $template_args['transaction'] = $this->_current_txn; |
|
466 | + $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false); |
|
467 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
468 | + if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
469 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
470 | + } |
|
471 | + return EEH_Template::locate_template( |
|
472 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
473 | + $template_args, |
|
474 | + true, |
|
475 | + true |
|
476 | + ); |
|
477 | + } |
|
478 | + |
|
479 | + |
|
480 | + |
|
481 | + /** |
|
482 | + * thank_you_page_IPN_monitor |
|
483 | + * this basically just pulls the TXN based on the reg_url_link sent from the server, |
|
484 | + * then checks that the TXN status is not failed, and that no other errors have been generated. |
|
485 | + * it also calculates the IPN wait time since the Thank You page was first loaded |
|
486 | + * |
|
487 | + * @param array $response |
|
488 | + * @param array $data |
|
489 | + * @return array |
|
490 | + * @throws \EE_Error |
|
491 | + */ |
|
492 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) |
|
493 | + { |
|
494 | + // does this heartbeat contain our data ? |
|
495 | + if ( ! isset($data['espresso_thank_you_page'])) { |
|
496 | + return $response; |
|
497 | + } |
|
498 | + // check for reg_url_link in the incoming heartbeat data |
|
499 | + if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
500 | + $response['espresso_thank_you_page'] = array( |
|
501 | + 'errors' => ! empty($notices['errors']) |
|
502 | + ? $notices['errors'] |
|
503 | + : __( |
|
504 | + 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
|
505 | + 'event_espresso' |
|
506 | + ) |
|
507 | + ); |
|
508 | + return $response; |
|
509 | + } |
|
510 | + // kk heartbeat has our data |
|
511 | + $response['espresso_thank_you_page'] = array(); |
|
512 | + // set_definitions, instantiate the thank you page class, and get the ball rolling |
|
513 | + EED_Thank_You_Page::set_definitions(); |
|
514 | + /** @var $espresso_thank_you_page EED_Thank_You_Page */ |
|
515 | + $espresso_thank_you_page = EED_Thank_You_Page::instance(); |
|
516 | + $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
517 | + $espresso_thank_you_page->init(); |
|
518 | + //get TXN |
|
519 | + $TXN = $espresso_thank_you_page->get_txn(); |
|
520 | + // no TXN? then get out |
|
521 | + if ( ! $TXN instanceof EE_Transaction) { |
|
522 | + $notices = EE_Error::get_notices(); |
|
523 | + $response['espresso_thank_you_page'] = array( |
|
524 | + 'errors' => ! empty($notices['errors']) |
|
525 | + ? $notices['errors'] |
|
526 | + : sprintf( |
|
527 | + __( |
|
528 | + 'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', |
|
529 | + 'event_espresso' |
|
530 | + ), |
|
531 | + __LINE__ |
|
532 | + ) |
|
533 | + ); |
|
534 | + return $response; |
|
535 | + } |
|
536 | + // grab transient of TXN's status |
|
537 | + $txn_status = isset($data['espresso_thank_you_page']['txn_status']) |
|
538 | + ? $data['espresso_thank_you_page']['txn_status'] |
|
539 | + : null; |
|
540 | + // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
|
541 | + if ($txn_status !== $TXN->status_ID()) { |
|
542 | + // switch between two possible basic outcomes |
|
543 | + switch ($TXN->status_ID()) { |
|
544 | + // TXN has been updated in some way |
|
545 | + case EEM_Transaction::overpaid_status_code: |
|
546 | + case EEM_Transaction::complete_status_code: |
|
547 | + case EEM_Transaction::incomplete_status_code: |
|
548 | + // send updated TXN results back to client, |
|
549 | + $response['espresso_thank_you_page'] = array( |
|
550 | + 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
|
551 | + 'txn_status' => $TXN->status_ID() |
|
552 | + ); |
|
553 | + break; |
|
554 | + // or we have a bad TXN, or really slow IPN, so calculate the wait time and send that back... |
|
555 | + case EEM_Transaction::failed_status_code: |
|
556 | + default: |
|
557 | + // keep on waiting... |
|
558 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
559 | + } |
|
560 | + // or is the TXN still failed (never been updated) ??? |
|
561 | + } else if ($TXN->failed()) { |
|
562 | + // keep on waiting... |
|
563 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
564 | + } |
|
565 | + // TXN is happening so let's get the payments now |
|
566 | + // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
|
567 | + $since = isset($data['espresso_thank_you_page']['get_payments_since']) |
|
568 | + ? $data['espresso_thank_you_page']['get_payments_since'] |
|
569 | + : 0; |
|
570 | + // then check for payments |
|
571 | + $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
572 | + // has a payment been processed ? |
|
573 | + if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
574 | + if ($since) { |
|
575 | + $response['espresso_thank_you_page'] = array( |
|
576 | + 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
577 | + 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
|
578 | + 'txn_status' => $TXN->status_ID() |
|
579 | + ); |
|
580 | + } else { |
|
581 | + $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details( |
|
582 | + $payments |
|
583 | + ); |
|
584 | + } |
|
585 | + // reset time to check for payments |
|
586 | + $response['espresso_thank_you_page']['get_payments_since'] = time(); |
|
587 | + } else { |
|
588 | + $response['espresso_thank_you_page']['get_payments_since'] = $since; |
|
589 | + } |
|
590 | + return $response; |
|
591 | + } |
|
592 | + |
|
593 | + |
|
594 | + |
|
595 | + /** |
|
596 | + * _update_server_wait_time |
|
597 | + * |
|
598 | + * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
|
599 | + * @return array |
|
600 | + * @throws \EE_Error |
|
601 | + */ |
|
602 | + private function _update_server_wait_time($thank_you_page_data = array()) |
|
603 | + { |
|
604 | + $response['espresso_thank_you_page'] = array( |
|
605 | + 'still_waiting' => isset($thank_you_page_data['initial_access']) |
|
606 | + ? time() - $thank_you_page_data['initial_access'] |
|
607 | + : 0, |
|
608 | + 'txn_status' => $this->_current_txn->status_ID() |
|
609 | + ); |
|
610 | + return $response; |
|
611 | + } |
|
612 | + |
|
613 | + |
|
614 | + |
|
615 | + /** |
|
616 | + * get_registration_details |
|
617 | + * |
|
618 | + * @throws \EE_Error |
|
619 | + */ |
|
620 | + public function get_registration_details() |
|
621 | + { |
|
622 | + //prepare variables for displaying |
|
623 | + $template_args = array(); |
|
624 | + $template_args['transaction'] = $this->_current_txn; |
|
625 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
626 | + $template_args['is_primary'] = $this->_is_primary; |
|
627 | + $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
|
628 | + $template_args['resend_reg_confirmation_url'] = add_query_arg( |
|
629 | + array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
630 | + EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
631 | + ); |
|
632 | + // verify template arguments |
|
633 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
634 | + EEH_Template_Validator::verify_isnt_null( |
|
635 | + $template_args['SPCO_attendee_information_url'], |
|
636 | + '$SPCO_attendee_information_url' |
|
637 | + ); |
|
638 | + echo EEH_Template::locate_template( |
|
639 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
640 | + $template_args, |
|
641 | + true, |
|
642 | + true |
|
643 | + ); |
|
644 | + } |
|
645 | + |
|
646 | + |
|
647 | + |
|
648 | + /** |
|
649 | + * resend_reg_confirmation_email |
|
650 | + * |
|
651 | + * @throws \EE_Error |
|
652 | + */ |
|
653 | + public static function resend_reg_confirmation_email() |
|
654 | + { |
|
655 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
656 | + $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
657 | + // was a REG_ID passed ? |
|
658 | + if ($reg_url_link) { |
|
659 | + $registration = EE_Registry::instance()->load_model('Registration')->get_one( |
|
660 | + array(array('REG_url_link' => $reg_url_link)) |
|
661 | + ); |
|
662 | + if ($registration instanceof EE_Registration) { |
|
663 | + // resend email |
|
664 | + EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
665 | + } else { |
|
666 | + EE_Error::add_error( |
|
667 | + __( |
|
668 | + 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', |
|
669 | + 'event_espresso' |
|
670 | + ), |
|
671 | + __FILE__, |
|
672 | + __FUNCTION__, |
|
673 | + __LINE__ |
|
674 | + ); |
|
675 | + } |
|
676 | + } else { |
|
677 | + EE_Error::add_error( |
|
678 | + __( |
|
679 | + 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', |
|
680 | + 'event_espresso' |
|
681 | + ), |
|
682 | + __FILE__, |
|
683 | + __FUNCTION__, |
|
684 | + __LINE__ |
|
685 | + ); |
|
686 | + } |
|
687 | + // request sent via AJAX ? |
|
688 | + if (EE_FRONT_AJAX) { |
|
689 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
690 | + die(); |
|
691 | + // or was JS disabled ? |
|
692 | + } else { |
|
693 | + // save errors so that they get picked up on the next request |
|
694 | + EE_Error::get_notices(true, true); |
|
695 | + wp_safe_redirect( |
|
696 | + add_query_arg( |
|
697 | + array('e_reg_url_link' => $reg_url_link), |
|
698 | + EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
699 | + ) |
|
700 | + ); |
|
701 | + } |
|
702 | + } |
|
703 | + |
|
704 | + |
|
705 | + |
|
706 | + /** |
|
707 | + * get_ajax_content |
|
708 | + * |
|
709 | + * @return void |
|
710 | + * @throws \EE_Error |
|
711 | + */ |
|
712 | + public function get_ajax_content() |
|
713 | + { |
|
714 | + if ( ! $this->get_txn()) { |
|
715 | + return; |
|
716 | + } |
|
717 | + // first determine which event(s) require pre-approval or not |
|
718 | + $events = array(); |
|
719 | + $events_requiring_pre_approval = array(); |
|
720 | + foreach ($this->_current_txn->registrations() as $registration) { |
|
721 | + if ($registration instanceof EE_Registration) { |
|
722 | + $event = $registration->event(); |
|
723 | + if ($event instanceof EE_Event) { |
|
724 | + if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
725 | + $events_requiring_pre_approval[$event->ID()] = $event; |
|
726 | + } else { |
|
727 | + $events[$event->ID()] = $event; |
|
728 | + } |
|
729 | + } |
|
730 | + } |
|
731 | + } |
|
732 | + $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
733 | + $this->display_details_for_events($events); |
|
734 | + } |
|
735 | + |
|
736 | + |
|
737 | + |
|
738 | + /** |
|
739 | + * display_details_for_events |
|
740 | + * |
|
741 | + * @param EE_Event[] $events |
|
742 | + * @return void |
|
743 | + */ |
|
744 | + public function display_details_for_events($events = array()) |
|
745 | + { |
|
746 | + if ( ! empty($events)) { |
|
747 | + ?> |
|
748 | 748 | <div id="espresso-thank-you-page-ajax-content-dv"> |
749 | 749 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
750 | 750 | <div id="espresso-thank-you-page-ajax-payment-dv"></div> |
751 | 751 | <div id="espresso-thank-you-page-ajax-loading-dv"> |
752 | 752 | <div id="ee-ajax-loading-dv" class="float-left lt-blue-text"> |
753 | 753 | <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e( |
754 | - 'loading transaction and payment information...', |
|
755 | - 'event_espresso' |
|
756 | - ); ?></span> |
|
754 | + 'loading transaction and payment information...', |
|
755 | + 'event_espresso' |
|
756 | + ); ?></span> |
|
757 | 757 | </div> |
758 | 758 | <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
759 | 759 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
760 | 760 | <?php echo apply_filters( |
761 | - 'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg', |
|
762 | - __( |
|
763 | - 'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', |
|
764 | - 'event_espresso' |
|
765 | - ) |
|
766 | - ); ?> |
|
761 | + 'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg', |
|
762 | + __( |
|
763 | + 'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', |
|
764 | + 'event_espresso' |
|
765 | + ) |
|
766 | + ); ?> |
|
767 | 767 | <br/> |
768 | 768 | <span class="jst-rght ee-block small-text lt-grey-text"> |
769 | 769 | <?php _e('current wait time ', 'event_espresso'); ?> |
@@ -774,120 +774,120 @@ discard block |
||
774 | 774 | <div class="clear"></div> |
775 | 775 | </div> |
776 | 776 | <?php |
777 | - } |
|
778 | - } |
|
777 | + } |
|
778 | + } |
|
779 | 779 | |
780 | 780 | |
781 | 781 | |
782 | - /** |
|
783 | - * display_details_for_events_requiring_pre_approval |
|
784 | - * |
|
785 | - * @param EE_Event[] $events |
|
786 | - * @return void |
|
787 | - */ |
|
788 | - public function display_details_for_events_requiring_pre_approval($events = array()) |
|
789 | - { |
|
790 | - if ( ! empty($events)) { |
|
791 | - ?> |
|
782 | + /** |
|
783 | + * display_details_for_events_requiring_pre_approval |
|
784 | + * |
|
785 | + * @param EE_Event[] $events |
|
786 | + * @return void |
|
787 | + */ |
|
788 | + public function display_details_for_events_requiring_pre_approval($events = array()) |
|
789 | + { |
|
790 | + if ( ! empty($events)) { |
|
791 | + ?> |
|
792 | 792 | <div id="espresso-thank-you-page-not-approved-message-dv"> |
793 | 793 | <h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4> |
794 | 794 | <p id="events-requiring-pre-approval-pg" class="small-text"> |
795 | 795 | <?php echo apply_filters( |
796 | - 'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message', |
|
797 | - __( |
|
798 | - 'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', |
|
799 | - 'event_espresso' |
|
800 | - ) |
|
801 | - ); ?> |
|
796 | + 'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message', |
|
797 | + __( |
|
798 | + 'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', |
|
799 | + 'event_espresso' |
|
800 | + ) |
|
801 | + ); ?> |
|
802 | 802 | </p> |
803 | 803 | <ul class="events-requiring-pre-approval-ul"> |
804 | 804 | <?php foreach ($events as $event) { |
805 | - if ($event instanceof EE_Event) { |
|
806 | - echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', |
|
807 | - $event->name(), |
|
808 | - '</li>'; |
|
809 | - } |
|
810 | - } ?> |
|
805 | + if ($event instanceof EE_Event) { |
|
806 | + echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', |
|
807 | + $event->name(), |
|
808 | + '</li>'; |
|
809 | + } |
|
810 | + } ?> |
|
811 | 811 | </ul> |
812 | 812 | <div class="clear"></div> |
813 | 813 | </div> |
814 | 814 | <?php |
815 | - } |
|
816 | - } |
|
817 | - |
|
818 | - |
|
819 | - |
|
820 | - /** |
|
821 | - * get_transaction_details |
|
822 | - * |
|
823 | - * @return string |
|
824 | - * @throws \EE_Error |
|
825 | - */ |
|
826 | - public function get_transaction_details() |
|
827 | - { |
|
828 | - //prepare variables for displaying |
|
829 | - $template_args = array(); |
|
830 | - $template_args['transaction'] = $this->_current_txn; |
|
831 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
832 | - $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true); |
|
833 | - // link to SPCO payment_options |
|
834 | - $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
835 | - $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
836 | - // verify template arguments |
|
837 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
838 | - EEH_Template_Validator::verify_isnt_null( |
|
839 | - $template_args['show_try_pay_again_link'], |
|
840 | - '$show_try_pay_again_link' |
|
841 | - ); |
|
842 | - EEH_Template_Validator::verify_isnt_null( |
|
843 | - $template_args['SPCO_payment_options_url'], |
|
844 | - '$SPCO_payment_options_url' |
|
845 | - ); |
|
846 | - return EEH_Template::locate_template( |
|
847 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
848 | - $template_args, |
|
849 | - true, |
|
850 | - true |
|
851 | - ); |
|
852 | - } |
|
853 | - |
|
854 | - |
|
855 | - |
|
856 | - /** |
|
857 | - * get_payment_row_html |
|
858 | - * |
|
859 | - * @param EE_Payment $payment |
|
860 | - * @return string |
|
861 | - * @throws \EE_Error |
|
862 | - */ |
|
863 | - public function get_payment_row_html($payment = null) |
|
864 | - { |
|
865 | - $html = ''; |
|
866 | - if ($payment instanceof EE_Payment) { |
|
867 | - if ( |
|
868 | - $payment->payment_method() instanceof EE_Payment_Method |
|
869 | - && $payment->status() === EEM_Payment::status_id_failed |
|
870 | - && $payment->payment_method()->is_off_site() |
|
871 | - ) { |
|
872 | - // considering the registrant has made it to the Thank You page, |
|
873 | - // any failed payments may actually be pending and the IPN is just slow |
|
874 | - // so let's |
|
875 | - $payment->set_status(EEM_Payment::status_id_pending); |
|
876 | - } |
|
877 | - $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
|
878 | - ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' |
|
879 | - : ''; |
|
880 | - $html .= ' |
|
815 | + } |
|
816 | + } |
|
817 | + |
|
818 | + |
|
819 | + |
|
820 | + /** |
|
821 | + * get_transaction_details |
|
822 | + * |
|
823 | + * @return string |
|
824 | + * @throws \EE_Error |
|
825 | + */ |
|
826 | + public function get_transaction_details() |
|
827 | + { |
|
828 | + //prepare variables for displaying |
|
829 | + $template_args = array(); |
|
830 | + $template_args['transaction'] = $this->_current_txn; |
|
831 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
832 | + $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true); |
|
833 | + // link to SPCO payment_options |
|
834 | + $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
835 | + $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
836 | + // verify template arguments |
|
837 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
838 | + EEH_Template_Validator::verify_isnt_null( |
|
839 | + $template_args['show_try_pay_again_link'], |
|
840 | + '$show_try_pay_again_link' |
|
841 | + ); |
|
842 | + EEH_Template_Validator::verify_isnt_null( |
|
843 | + $template_args['SPCO_payment_options_url'], |
|
844 | + '$SPCO_payment_options_url' |
|
845 | + ); |
|
846 | + return EEH_Template::locate_template( |
|
847 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
848 | + $template_args, |
|
849 | + true, |
|
850 | + true |
|
851 | + ); |
|
852 | + } |
|
853 | + |
|
854 | + |
|
855 | + |
|
856 | + /** |
|
857 | + * get_payment_row_html |
|
858 | + * |
|
859 | + * @param EE_Payment $payment |
|
860 | + * @return string |
|
861 | + * @throws \EE_Error |
|
862 | + */ |
|
863 | + public function get_payment_row_html($payment = null) |
|
864 | + { |
|
865 | + $html = ''; |
|
866 | + if ($payment instanceof EE_Payment) { |
|
867 | + if ( |
|
868 | + $payment->payment_method() instanceof EE_Payment_Method |
|
869 | + && $payment->status() === EEM_Payment::status_id_failed |
|
870 | + && $payment->payment_method()->is_off_site() |
|
871 | + ) { |
|
872 | + // considering the registrant has made it to the Thank You page, |
|
873 | + // any failed payments may actually be pending and the IPN is just slow |
|
874 | + // so let's |
|
875 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
876 | + } |
|
877 | + $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
|
878 | + ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' |
|
879 | + : ''; |
|
880 | + $html .= ' |
|
881 | 881 | <tr> |
882 | 882 | <td> |
883 | 883 | ' . $payment->timestamp() . ' |
884 | 884 | </td> |
885 | 885 | <td> |
886 | 886 | ' . ( |
887 | - $payment->payment_method() instanceof EE_Payment_Method |
|
888 | - ? $payment->payment_method()->name() |
|
889 | - : __('Unknown', 'event_espresso') |
|
890 | - ) . ' |
|
887 | + $payment->payment_method() instanceof EE_Payment_Method |
|
888 | + ? $payment->payment_method()->name() |
|
889 | + : __('Unknown', 'event_espresso') |
|
890 | + ) . ' |
|
891 | 891 | </td> |
892 | 892 | <td class="jst-rght"> |
893 | 893 | ' . EEH_Template::format_currency($payment->amount()) . ' |
@@ -896,87 +896,87 @@ discard block |
||
896 | 896 | ' . $payment->pretty_status(true) . $payment_declined_msg . ' |
897 | 897 | </td> |
898 | 898 | </tr>'; |
899 | - do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
900 | - } |
|
901 | - return $html; |
|
902 | - } |
|
903 | - |
|
904 | - |
|
905 | - |
|
906 | - /** |
|
907 | - * get_payment_details |
|
908 | - * |
|
909 | - * @param array $payments |
|
910 | - * @return string |
|
911 | - * @throws \EE_Error |
|
912 | - */ |
|
913 | - public function get_payment_details($payments = array()) |
|
914 | - { |
|
915 | - //prepare variables for displaying |
|
916 | - $template_args = array(); |
|
917 | - $template_args['transaction'] = $this->_current_txn; |
|
918 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
919 | - $template_args['payments'] = array(); |
|
920 | - foreach ($payments as $payment) { |
|
921 | - $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
922 | - } |
|
923 | - //create a hacky payment object, but dont save it |
|
924 | - $payment = EE_Payment::new_instance( |
|
925 | - array( |
|
926 | - 'TXN_ID' => $this->_current_txn->ID(), |
|
927 | - 'STS_ID' => EEM_Payment::status_id_pending, |
|
928 | - 'PAY_timestamp' => time(), |
|
929 | - 'PAY_amount' => $this->_current_txn->total(), |
|
930 | - 'PMD_ID' => $this->_current_txn->payment_method_ID() |
|
931 | - ) |
|
932 | - ); |
|
933 | - $payment_method = $this->_current_txn->payment_method(); |
|
934 | - if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
935 | - $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
936 | - } else { |
|
937 | - $template_args['gateway_content'] = ''; |
|
938 | - } |
|
939 | - // link to SPCO payment_options |
|
940 | - $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
941 | - $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
942 | - // verify template arguments |
|
943 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
944 | - EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
945 | - EEH_Template_Validator::verify_isnt_null( |
|
946 | - $template_args['show_try_pay_again_link'], |
|
947 | - '$show_try_pay_again_link' |
|
948 | - ); |
|
949 | - EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
950 | - EEH_Template_Validator::verify_isnt_null( |
|
951 | - $template_args['SPCO_payment_options_url'], |
|
952 | - '$SPCO_payment_options_url' |
|
953 | - ); |
|
954 | - return EEH_Template::locate_template( |
|
955 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
956 | - $template_args, |
|
957 | - true, |
|
958 | - true |
|
959 | - ); |
|
960 | - } |
|
961 | - |
|
962 | - |
|
963 | - |
|
964 | - /** |
|
965 | - * get_payment_details |
|
966 | - * |
|
967 | - * @param array $payments |
|
968 | - * @return string |
|
969 | - * @throws \EE_Error |
|
970 | - */ |
|
971 | - public function get_new_payments($payments = array()) |
|
972 | - { |
|
973 | - $payments_html = ''; |
|
974 | - //prepare variables for displaying |
|
975 | - foreach ($payments as $payment) { |
|
976 | - $payments_html .= $this->get_payment_row_html($payment); |
|
977 | - } |
|
978 | - return $payments_html; |
|
979 | - } |
|
899 | + do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
900 | + } |
|
901 | + return $html; |
|
902 | + } |
|
903 | + |
|
904 | + |
|
905 | + |
|
906 | + /** |
|
907 | + * get_payment_details |
|
908 | + * |
|
909 | + * @param array $payments |
|
910 | + * @return string |
|
911 | + * @throws \EE_Error |
|
912 | + */ |
|
913 | + public function get_payment_details($payments = array()) |
|
914 | + { |
|
915 | + //prepare variables for displaying |
|
916 | + $template_args = array(); |
|
917 | + $template_args['transaction'] = $this->_current_txn; |
|
918 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
919 | + $template_args['payments'] = array(); |
|
920 | + foreach ($payments as $payment) { |
|
921 | + $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
922 | + } |
|
923 | + //create a hacky payment object, but dont save it |
|
924 | + $payment = EE_Payment::new_instance( |
|
925 | + array( |
|
926 | + 'TXN_ID' => $this->_current_txn->ID(), |
|
927 | + 'STS_ID' => EEM_Payment::status_id_pending, |
|
928 | + 'PAY_timestamp' => time(), |
|
929 | + 'PAY_amount' => $this->_current_txn->total(), |
|
930 | + 'PMD_ID' => $this->_current_txn->payment_method_ID() |
|
931 | + ) |
|
932 | + ); |
|
933 | + $payment_method = $this->_current_txn->payment_method(); |
|
934 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
935 | + $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
936 | + } else { |
|
937 | + $template_args['gateway_content'] = ''; |
|
938 | + } |
|
939 | + // link to SPCO payment_options |
|
940 | + $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
941 | + $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
942 | + // verify template arguments |
|
943 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
944 | + EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
945 | + EEH_Template_Validator::verify_isnt_null( |
|
946 | + $template_args['show_try_pay_again_link'], |
|
947 | + '$show_try_pay_again_link' |
|
948 | + ); |
|
949 | + EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
950 | + EEH_Template_Validator::verify_isnt_null( |
|
951 | + $template_args['SPCO_payment_options_url'], |
|
952 | + '$SPCO_payment_options_url' |
|
953 | + ); |
|
954 | + return EEH_Template::locate_template( |
|
955 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
956 | + $template_args, |
|
957 | + true, |
|
958 | + true |
|
959 | + ); |
|
960 | + } |
|
961 | + |
|
962 | + |
|
963 | + |
|
964 | + /** |
|
965 | + * get_payment_details |
|
966 | + * |
|
967 | + * @param array $payments |
|
968 | + * @return string |
|
969 | + * @throws \EE_Error |
|
970 | + */ |
|
971 | + public function get_new_payments($payments = array()) |
|
972 | + { |
|
973 | + $payments_html = ''; |
|
974 | + //prepare variables for displaying |
|
975 | + foreach ($payments as $payment) { |
|
976 | + $payments_html .= $this->get_payment_row_html($payment); |
|
977 | + } |
|
978 | + return $payments_html; |
|
979 | + } |
|
980 | 980 | |
981 | 981 | |
982 | 982 | } |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public static function set_definitions() |
143 | 143 | { |
144 | - define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
145 | - define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
144 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
145 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | { |
334 | 334 | wp_register_script( |
335 | 335 | 'thank_you_page', |
336 | - THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
336 | + THANK_YOU_ASSETS_URL.'thank_you_page.js', |
|
337 | 337 | array('espresso_core', 'heartbeat'), |
338 | 338 | EVENT_ESPRESSO_VERSION, |
339 | 339 | true |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $this->_get_reg_url_link(); |
355 | 355 | if ( ! $this->get_txn()) { |
356 | 356 | echo EEH_HTML::div( |
357 | - EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') . |
|
357 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', ''). |
|
358 | 358 | sprintf( |
359 | 359 | __( |
360 | 360 | 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
470 | 470 | } |
471 | 471 | return EEH_Template::locate_template( |
472 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
472 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', |
|
473 | 473 | $template_args, |
474 | 474 | true, |
475 | 475 | true |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | '$SPCO_attendee_information_url' |
637 | 637 | ); |
638 | 638 | echo EEH_Template::locate_template( |
639 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
639 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', |
|
640 | 640 | $template_args, |
641 | 641 | true, |
642 | 642 | true |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | '$SPCO_payment_options_url' |
845 | 845 | ); |
846 | 846 | return EEH_Template::locate_template( |
847 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
847 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', |
|
848 | 848 | $template_args, |
849 | 849 | true, |
850 | 850 | true |
@@ -875,25 +875,25 @@ discard block |
||
875 | 875 | $payment->set_status(EEM_Payment::status_id_pending); |
876 | 876 | } |
877 | 877 | $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
878 | - ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' |
|
878 | + ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>' |
|
879 | 879 | : ''; |
880 | 880 | $html .= ' |
881 | 881 | <tr> |
882 | 882 | <td> |
883 | - ' . $payment->timestamp() . ' |
|
883 | + ' . $payment->timestamp().' |
|
884 | 884 | </td> |
885 | 885 | <td> |
886 | 886 | ' . ( |
887 | 887 | $payment->payment_method() instanceof EE_Payment_Method |
888 | 888 | ? $payment->payment_method()->name() |
889 | 889 | : __('Unknown', 'event_espresso') |
890 | - ) . ' |
|
890 | + ).' |
|
891 | 891 | </td> |
892 | 892 | <td class="jst-rght"> |
893 | - ' . EEH_Template::format_currency($payment->amount()) . ' |
|
893 | + ' . EEH_Template::format_currency($payment->amount()).' |
|
894 | 894 | </td> |
895 | 895 | <td class="jst-rght" style="line-height:1;"> |
896 | - ' . $payment->pretty_status(true) . $payment_declined_msg . ' |
|
896 | + ' . $payment->pretty_status(true).$payment_declined_msg.' |
|
897 | 897 | </td> |
898 | 898 | </tr>'; |
899 | 899 | do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | '$SPCO_payment_options_url' |
953 | 953 | ); |
954 | 954 | return EEH_Template::locate_template( |
955 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
955 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', |
|
956 | 956 | $template_args, |
957 | 957 | true, |
958 | 958 | true |
@@ -52,7 +52,7 @@ |
||
52 | 52 | return; |
53 | 53 | } |
54 | 54 | $post = reset($wp_query->posts); |
55 | - if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
55 | + if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | $this->is_thank_you_page = true; |
@@ -20,74 +20,74 @@ |
||
20 | 20 | class EspressoThankYou extends EspressoShortcode |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var boolean $is_thank_you_page |
|
25 | - */ |
|
26 | - private $is_thank_you_page = false; |
|
27 | - |
|
28 | - /** |
|
29 | - * the actual shortcode tag that gets registered with WordPress |
|
30 | - * |
|
31 | - * @return string |
|
32 | - */ |
|
33 | - public function getTag() |
|
34 | - { |
|
35 | - return 'ESPRESSO_THANK_YOU'; |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * the time in seconds to cache the results of the processShortcode() method |
|
42 | - * 0 means the processShortcode() results will NOT be cached at all |
|
43 | - * |
|
44 | - * @return int |
|
45 | - */ |
|
46 | - public function cacheExpiration() |
|
47 | - { |
|
48 | - return 0; |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
54 | - * this may be required for shortcodes that utilize a corresponding module, |
|
55 | - * and need to enqueue assets for that module |
|
56 | - * |
|
57 | - * @return void |
|
58 | - * @throws \EE_Error |
|
59 | - */ |
|
60 | - public function initializeShortcode() |
|
61 | - { |
|
62 | - global $wp_query; |
|
63 | - if (empty($wp_query->posts) || count($wp_query->posts) > 1) { |
|
64 | - return; |
|
65 | - } |
|
66 | - $post = reset($wp_query->posts); |
|
67 | - if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
68 | - return; |
|
69 | - } |
|
70 | - $this->is_thank_you_page = true; |
|
71 | - \EED_Thank_You_Page::instance()->load_resources(); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * callback that runs when the shortcode is encountered in post content. |
|
78 | - * IMPORTANT !!! |
|
79 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
80 | - * |
|
81 | - * @param array $attributes |
|
82 | - * @return string |
|
83 | - * @throws \EE_Error |
|
84 | - */ |
|
85 | - public function processShortcode($attributes = array()) |
|
86 | - { |
|
87 | - return $this->is_thank_you_page |
|
88 | - ? \EED_Thank_You_Page::instance()->thank_you_page_results() |
|
89 | - : ''; |
|
90 | - } |
|
23 | + /** |
|
24 | + * @var boolean $is_thank_you_page |
|
25 | + */ |
|
26 | + private $is_thank_you_page = false; |
|
27 | + |
|
28 | + /** |
|
29 | + * the actual shortcode tag that gets registered with WordPress |
|
30 | + * |
|
31 | + * @return string |
|
32 | + */ |
|
33 | + public function getTag() |
|
34 | + { |
|
35 | + return 'ESPRESSO_THANK_YOU'; |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * the time in seconds to cache the results of the processShortcode() method |
|
42 | + * 0 means the processShortcode() results will NOT be cached at all |
|
43 | + * |
|
44 | + * @return int |
|
45 | + */ |
|
46 | + public function cacheExpiration() |
|
47 | + { |
|
48 | + return 0; |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
54 | + * this may be required for shortcodes that utilize a corresponding module, |
|
55 | + * and need to enqueue assets for that module |
|
56 | + * |
|
57 | + * @return void |
|
58 | + * @throws \EE_Error |
|
59 | + */ |
|
60 | + public function initializeShortcode() |
|
61 | + { |
|
62 | + global $wp_query; |
|
63 | + if (empty($wp_query->posts) || count($wp_query->posts) > 1) { |
|
64 | + return; |
|
65 | + } |
|
66 | + $post = reset($wp_query->posts); |
|
67 | + if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
68 | + return; |
|
69 | + } |
|
70 | + $this->is_thank_you_page = true; |
|
71 | + \EED_Thank_You_Page::instance()->load_resources(); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * callback that runs when the shortcode is encountered in post content. |
|
78 | + * IMPORTANT !!! |
|
79 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
80 | + * |
|
81 | + * @param array $attributes |
|
82 | + * @return string |
|
83 | + * @throws \EE_Error |
|
84 | + */ |
|
85 | + public function processShortcode($attributes = array()) |
|
86 | + { |
|
87 | + return $this->is_thank_you_page |
|
88 | + ? \EED_Thank_You_Page::instance()->thank_you_page_results() |
|
89 | + : ''; |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | 93 |
@@ -221,37 +221,37 @@ |
||
221 | 221 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
222 | 222 | */ |
223 | 223 | protected function setIdentifier( $entity, $identifier ) { |
224 | - switch($this->collection_details->identifierType()) { |
|
225 | - // every unique object gets added to the collection, but not duplicates of the exact same object |
|
226 | - case CollectionDetails::ID_OBJECT_HASH : |
|
227 | - $identifier = spl_object_hash($entity); |
|
228 | - break; |
|
229 | - // only one entity per class can be added to collection, like a singleton |
|
230 | - case CollectionDetails::ID_CLASS_NAME : |
|
231 | - $identifier = get_class($entity); |
|
232 | - break; |
|
233 | - // objects added to the collection based on entity callback, so the entity itself decides |
|
234 | - case CollectionDetails::ID_CALLBACK_METHOD : |
|
235 | - $identifier_callback = $this->collection_details->identifierCallback(); |
|
236 | - if ( ! method_exists($entity, $identifier_callback)) { |
|
237 | - throw new InvalidEntityException( |
|
238 | - $entity, |
|
239 | - $this->collection_details->getCollectionInterface(), |
|
240 | - sprintf( |
|
241 | - __( |
|
242 | - 'The current collection is configured to use a method named "%1$s" when setting or retrieving objects. The supplied entity is an instance |
|
224 | + switch($this->collection_details->identifierType()) { |
|
225 | + // every unique object gets added to the collection, but not duplicates of the exact same object |
|
226 | + case CollectionDetails::ID_OBJECT_HASH : |
|
227 | + $identifier = spl_object_hash($entity); |
|
228 | + break; |
|
229 | + // only one entity per class can be added to collection, like a singleton |
|
230 | + case CollectionDetails::ID_CLASS_NAME : |
|
231 | + $identifier = get_class($entity); |
|
232 | + break; |
|
233 | + // objects added to the collection based on entity callback, so the entity itself decides |
|
234 | + case CollectionDetails::ID_CALLBACK_METHOD : |
|
235 | + $identifier_callback = $this->collection_details->identifierCallback(); |
|
236 | + if ( ! method_exists($entity, $identifier_callback)) { |
|
237 | + throw new InvalidEntityException( |
|
238 | + $entity, |
|
239 | + $this->collection_details->getCollectionInterface(), |
|
240 | + sprintf( |
|
241 | + __( |
|
242 | + 'The current collection is configured to use a method named "%1$s" when setting or retrieving objects. The supplied entity is an instance |
|
243 | 243 | of "%2$s", but does not contain this method.', |
244 | - 'event_espresso' |
|
245 | - ), |
|
246 | - $identifier_callback, |
|
247 | - get_class($entity) |
|
248 | - ) |
|
249 | - ); |
|
250 | - } |
|
251 | - $identifier = $entity->{$identifier_callback}(); |
|
252 | - break; |
|
253 | - |
|
254 | - } |
|
244 | + 'event_espresso' |
|
245 | + ), |
|
246 | + $identifier_callback, |
|
247 | + get_class($entity) |
|
248 | + ) |
|
249 | + ); |
|
250 | + } |
|
251 | + $identifier = $entity->{$identifier_callback}(); |
|
252 | + break; |
|
253 | + |
|
254 | + } |
|
255 | 255 | return apply_filters( |
256 | 256 | 'FHEE__CollectionLoader__addEntityToCollection__identifier', |
257 | 257 | $identifier, |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\locators\LocatorInterface; |
9 | 9 | use EventEspresso\core\services\locators\FileLocator; |
10 | 10 | |
11 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
12 | - exit( 'No direct script access allowed' ); |
|
11 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
12 | + exit('No direct script access allowed'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | LocatorInterface $file_locator = null |
82 | 82 | ) { |
83 | 83 | $this->collection_details = $collection_details; |
84 | - if ( ! $collection instanceof CollectionInterface ) { |
|
85 | - $collection = new Collection( $this->collection_details->getCollectionInterface() ); |
|
84 | + if ( ! $collection instanceof CollectionInterface) { |
|
85 | + $collection = new Collection($this->collection_details->getCollectionInterface()); |
|
86 | 86 | } |
87 | 87 | $this->collection = $collection; |
88 | 88 | $this->file_locator = $file_locator; |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
111 | 111 | */ |
112 | 112 | protected function loadAllFromFilepaths() { |
113 | - if ( ! $this->file_locator instanceof FileLocator ) { |
|
113 | + if ( ! $this->file_locator instanceof FileLocator) { |
|
114 | 114 | $this->file_locator = new FileLocator(); |
115 | 115 | } |
116 | - $this->file_locator->setFileMask( $this->collection_details->getFileMask() ); |
|
116 | + $this->file_locator->setFileMask($this->collection_details->getFileMask()); |
|
117 | 117 | // find all of the files that match the file mask in the specified folder |
118 | - $this->file_locator->locate( $this->collection_details->getCollectionPaths() ); |
|
118 | + $this->file_locator->locate($this->collection_details->getCollectionPaths()); |
|
119 | 119 | // filter the results |
120 | 120 | $filepaths = (array) apply_filters( |
121 | 121 | 'FHEE__CollectionLoader__loadAllFromFilepath__filepaths', |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | $this->collection_details->collectionName(), |
124 | 124 | $this->collection_details |
125 | 125 | ); |
126 | - if ( empty( $filepaths ) ) { |
|
126 | + if (empty($filepaths)) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | - foreach ( $filepaths as $filepath ) { |
|
130 | - $this->loadClassFromFilepath( $filepath ); |
|
129 | + foreach ($filepaths as $filepath) { |
|
130 | + $this->loadClassFromFilepath($filepath); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -144,22 +144,22 @@ discard block |
||
144 | 144 | * @throws \EventEspresso\core\exceptions\InvalidFilePathException |
145 | 145 | * @throws \EventEspresso\core\exceptions\InvalidClassException |
146 | 146 | */ |
147 | - protected function loadClassFromFilepath( $filepath ) { |
|
148 | - if ( ! is_string( $filepath ) ) { |
|
149 | - throw new InvalidDataTypeException( '$filepath', $filepath, 'string' ); |
|
147 | + protected function loadClassFromFilepath($filepath) { |
|
148 | + if ( ! is_string($filepath)) { |
|
149 | + throw new InvalidDataTypeException('$filepath', $filepath, 'string'); |
|
150 | 150 | } |
151 | - if ( ! is_readable( $filepath ) ) { |
|
152 | - throw new InvalidFilePathException( $filepath ); |
|
151 | + if ( ! is_readable($filepath)) { |
|
152 | + throw new InvalidFilePathException($filepath); |
|
153 | 153 | } |
154 | - require_once( $filepath ); |
|
154 | + require_once($filepath); |
|
155 | 155 | // extract filename from path |
156 | - $file_name = basename( $filepath ); |
|
156 | + $file_name = basename($filepath); |
|
157 | 157 | // now remove any file extensions |
158 | - $class_name = \EEH_File::get_classname_from_filepath_with_standard_filename( $file_name ); |
|
159 | - if ( ! class_exists( $class_name ) ) { |
|
160 | - throw new InvalidClassException( $class_name ); |
|
158 | + $class_name = \EEH_File::get_classname_from_filepath_with_standard_filename($file_name); |
|
159 | + if ( ! class_exists($class_name)) { |
|
160 | + throw new InvalidClassException($class_name); |
|
161 | 161 | } |
162 | - return $this->addEntityToCollection( new $class_name(), $file_name ); |
|
162 | + return $this->addEntityToCollection(new $class_name(), $file_name); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | * @return string |
174 | 174 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
175 | 175 | */ |
176 | - protected function addEntityToCollection( $entity, $identifier ) { |
|
176 | + protected function addEntityToCollection($entity, $identifier) { |
|
177 | 177 | do_action( |
178 | 178 | 'FHEE__CollectionLoader__addEntityToCollection__entity', |
179 | 179 | $entity, |
180 | 180 | $this->collection_details->collectionName(), |
181 | 181 | $this->collection_details |
182 | 182 | ); |
183 | - $identifier = $this->setIdentifier( $entity, $identifier ); |
|
184 | - if ( $this->collection->has( $identifier ) ) { |
|
183 | + $identifier = $this->setIdentifier($entity, $identifier); |
|
184 | + if ($this->collection->has($identifier)) { |
|
185 | 185 | do_action( |
186 | 186 | 'FHEE__CollectionLoader__addEntityToCollection__entity_already_added', |
187 | 187 | $this, |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | ); |
191 | 191 | return CollectionLoader::ENTITY_EXISTS; |
192 | 192 | } |
193 | - if( $this->collection->add( $entity, $identifier ) ) { |
|
193 | + if ($this->collection->add($entity, $identifier)) { |
|
194 | 194 | do_action( |
195 | 195 | 'FHEE__CollectionLoader__addEntityToCollection__entity_added', |
196 | 196 | $this, |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | * @return string |
221 | 221 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
222 | 222 | */ |
223 | - protected function setIdentifier( $entity, $identifier ) { |
|
224 | - switch($this->collection_details->identifierType()) { |
|
223 | + protected function setIdentifier($entity, $identifier) { |
|
224 | + switch ($this->collection_details->identifierType()) { |
|
225 | 225 | // every unique object gets added to the collection, but not duplicates of the exact same object |
226 | 226 | case CollectionDetails::ID_OBJECT_HASH : |
227 | 227 | $identifier = spl_object_hash($entity); |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | $this->collection_details->collectionName(), |
279 | 279 | $this->collection_details |
280 | 280 | ); |
281 | - foreach ( $FQCNs as $FQCN ) { |
|
282 | - $this->loadClassFromFQCN( $FQCN ); |
|
281 | + foreach ($FQCNs as $FQCN) { |
|
282 | + $this->loadClassFromFQCN($FQCN); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
@@ -295,15 +295,15 @@ discard block |
||
295 | 295 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
296 | 296 | * @throws \EventEspresso\core\exceptions\InvalidClassException |
297 | 297 | */ |
298 | - protected function loadClassFromFQCN( $FQCN ) { |
|
299 | - if ( ! is_string( $FQCN ) ) { |
|
300 | - throw new InvalidDataTypeException( '$FQCN', $FQCN, 'string' ); |
|
298 | + protected function loadClassFromFQCN($FQCN) { |
|
299 | + if ( ! is_string($FQCN)) { |
|
300 | + throw new InvalidDataTypeException('$FQCN', $FQCN, 'string'); |
|
301 | 301 | } |
302 | - if ( ! class_exists( $FQCN ) ) { |
|
303 | - throw new InvalidClassException( $FQCN ); |
|
302 | + if ( ! class_exists($FQCN)) { |
|
303 | + throw new InvalidClassException($FQCN); |
|
304 | 304 | } |
305 | 305 | return $this->addEntityToCollection( |
306 | - \EE_Registry::instance()->create( $FQCN ), |
|
306 | + \EE_Registry::instance()->create($FQCN), |
|
307 | 307 | $FQCN |
308 | 308 | ); |
309 | 309 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * get_event |
37 | 37 | * attempts to retrieve an EE_Event object any way it can |
38 | 38 | * |
39 | - * @param int|WP_Post $EVT_ID |
|
39 | + * @param integer $EVT_ID |
|
40 | 40 | * @return EE_Event|null |
41 | 41 | * @throws \EE_Error |
42 | 42 | */ |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @access public |
115 | 115 | * @param int $EVT_ID |
116 | - * @return string |
|
116 | + * @return boolean |
|
117 | 117 | */ |
118 | 118 | public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
119 | 119 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * event_active_status |
134 | 134 | * |
135 | 135 | * @access public |
136 | - * @param null $num_words |
|
136 | + * @param integer $num_words |
|
137 | 137 | * @param null $more |
138 | 138 | * @return string |
139 | 139 | */ |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @access public |
446 | 446 | * @param int $EVT_ID |
447 | - * @param null $include_expired |
|
447 | + * @param false|null $include_expired |
|
448 | 448 | * @param bool $include_deleted |
449 | 449 | * @param null $limit |
450 | 450 | * @return EE_Datetime[] |
@@ -32,47 +32,47 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * get_event |
|
37 | - * attempts to retrieve an EE_Event object any way it can |
|
38 | - * |
|
39 | - * @param int|WP_Post $EVT_ID |
|
40 | - * @return EE_Event|null |
|
41 | - * @throws \EE_Error |
|
42 | - */ |
|
35 | + /** |
|
36 | + * get_event |
|
37 | + * attempts to retrieve an EE_Event object any way it can |
|
38 | + * |
|
39 | + * @param int|WP_Post $EVT_ID |
|
40 | + * @return EE_Event|null |
|
41 | + * @throws \EE_Error |
|
42 | + */ |
|
43 | 43 | public static function get_event( $EVT_ID = 0 ) { |
44 | - // international newspaper? |
|
45 | - global $post; |
|
46 | - $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events' |
|
47 | - ? $EVT_ID->ID |
|
48 | - : absint($EVT_ID); |
|
49 | - // do we already have the Event you are looking for? |
|
50 | - if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
51 | - return EEH_Event_View::$_event; |
|
52 | - } |
|
53 | - //reset property so that the new event is cached. |
|
54 | - EEH_Event_View::$_event = null; |
|
55 | - |
|
56 | - if ($EVT_ID || $post instanceof WP_Post) { |
|
57 | - //if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID |
|
58 | - //then let's just use that cached event on the $post object. |
|
59 | - if ($post->post_type === 'espresso_events' |
|
60 | - && isset($post->EE_Event) |
|
61 | - && ($EVT_ID === 0 |
|
62 | - || $EVT_ID === $post->ID |
|
63 | - ) |
|
64 | - ) { |
|
65 | - EEH_Event_View::$_event = $post->EE_Event; |
|
66 | - } |
|
67 | - |
|
68 | - //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
|
69 | - if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
70 | - EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
71 | - } |
|
72 | - } |
|
73 | - |
|
74 | - return EEH_Event_View::$_event; |
|
75 | - } |
|
44 | + // international newspaper? |
|
45 | + global $post; |
|
46 | + $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events' |
|
47 | + ? $EVT_ID->ID |
|
48 | + : absint($EVT_ID); |
|
49 | + // do we already have the Event you are looking for? |
|
50 | + if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
51 | + return EEH_Event_View::$_event; |
|
52 | + } |
|
53 | + //reset property so that the new event is cached. |
|
54 | + EEH_Event_View::$_event = null; |
|
55 | + |
|
56 | + if ($EVT_ID || $post instanceof WP_Post) { |
|
57 | + //if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID |
|
58 | + //then let's just use that cached event on the $post object. |
|
59 | + if ($post->post_type === 'espresso_events' |
|
60 | + && isset($post->EE_Event) |
|
61 | + && ($EVT_ID === 0 |
|
62 | + || $EVT_ID === $post->ID |
|
63 | + ) |
|
64 | + ) { |
|
65 | + EEH_Event_View::$_event = $post->EE_Event; |
|
66 | + } |
|
67 | + |
|
68 | + //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
|
69 | + if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
70 | + EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
71 | + } |
|
72 | + } |
|
73 | + |
|
74 | + return EEH_Event_View::$_event; |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | 78 | |
@@ -148,58 +148,58 @@ discard block |
||
148 | 148 | * @return string |
149 | 149 | */ |
150 | 150 | public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
151 | - global $post; |
|
151 | + global $post; |
|
152 | 152 | ob_start(); |
153 | 153 | if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
154 | 154 | // admin has chosen "full description" |
155 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
155 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
156 | 156 | the_content(); |
157 | 157 | } else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) { |
158 | - if ( has_excerpt( $post->ID )) { |
|
159 | - // admin has chosen "excerpt (short desc)" |
|
160 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
161 | - // AND an excerpt actually exists |
|
162 | - the_excerpt(); |
|
163 | - } else { |
|
164 | - // admin has chosen "excerpt (short desc)" |
|
165 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
166 | - // but NO excerpt actually exists, so we need to create one |
|
167 | - if ( ! empty( $num_words )) { |
|
168 | - if ( empty( $more )) { |
|
169 | - $more_link_text = __( '(more…)' ); |
|
170 | - $more = ' <a href="' . get_permalink() . '"'; |
|
171 | - $more .= ' class="more-link"'; |
|
172 | - $more .= \EED_Events_Archive::link_target(); |
|
173 | - $more .= '>' . $more_link_text . '</a>'; |
|
174 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
175 | - } |
|
176 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
177 | - |
|
178 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
179 | - } else { |
|
180 | - $content = get_the_content(); |
|
181 | - } |
|
182 | - global $allowedtags; |
|
183 | - // make sure links are allowed |
|
184 | - $allowedtags['a'] = isset($allowedtags['a']) |
|
185 | - ? $allowedtags['a'] |
|
186 | - : array(); |
|
187 | - // as well as target attribute |
|
188 | - $allowedtags['a']['target'] = isset($allowedtags['a']['target']) |
|
189 | - ? $allowedtags['a']['target'] |
|
190 | - : false; |
|
191 | - // but get previous value so we can reset it |
|
192 | - $prev_value = $allowedtags['a']['target']; |
|
193 | - $allowedtags['a']['target'] = true; |
|
194 | - $content = wp_kses( $content, $allowedtags ); |
|
195 | - $content = strip_shortcodes( $content ); |
|
196 | - echo apply_filters( 'the_content', $content ); |
|
197 | - $allowedtags['a']['target'] = $prev_value; |
|
198 | - } |
|
199 | - } else { |
|
200 | - // admin has chosen "none" |
|
201 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
202 | - echo apply_filters( 'the_content', '' ); |
|
158 | + if ( has_excerpt( $post->ID )) { |
|
159 | + // admin has chosen "excerpt (short desc)" |
|
160 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
161 | + // AND an excerpt actually exists |
|
162 | + the_excerpt(); |
|
163 | + } else { |
|
164 | + // admin has chosen "excerpt (short desc)" |
|
165 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
166 | + // but NO excerpt actually exists, so we need to create one |
|
167 | + if ( ! empty( $num_words )) { |
|
168 | + if ( empty( $more )) { |
|
169 | + $more_link_text = __( '(more…)' ); |
|
170 | + $more = ' <a href="' . get_permalink() . '"'; |
|
171 | + $more .= ' class="more-link"'; |
|
172 | + $more .= \EED_Events_Archive::link_target(); |
|
173 | + $more .= '>' . $more_link_text . '</a>'; |
|
174 | + $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
175 | + } |
|
176 | + $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
177 | + |
|
178 | + $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
179 | + } else { |
|
180 | + $content = get_the_content(); |
|
181 | + } |
|
182 | + global $allowedtags; |
|
183 | + // make sure links are allowed |
|
184 | + $allowedtags['a'] = isset($allowedtags['a']) |
|
185 | + ? $allowedtags['a'] |
|
186 | + : array(); |
|
187 | + // as well as target attribute |
|
188 | + $allowedtags['a']['target'] = isset($allowedtags['a']['target']) |
|
189 | + ? $allowedtags['a']['target'] |
|
190 | + : false; |
|
191 | + // but get previous value so we can reset it |
|
192 | + $prev_value = $allowedtags['a']['target']; |
|
193 | + $allowedtags['a']['target'] = true; |
|
194 | + $content = wp_kses( $content, $allowedtags ); |
|
195 | + $content = strip_shortcodes( $content ); |
|
196 | + echo apply_filters( 'the_content', $content ); |
|
197 | + $allowedtags['a']['target'] = $prev_value; |
|
198 | + } |
|
199 | + } else { |
|
200 | + // admin has chosen "none" |
|
201 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
202 | + echo apply_filters( 'the_content', '' ); |
|
203 | 203 | } |
204 | 204 | return ob_get_clean(); |
205 | 205 | } |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | $url = get_term_link( $term, 'espresso_venue_categories' ); |
247 | 247 | if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
248 | 248 | $category_links[] = '<a href="' . esc_url( $url ) |
249 | - . '" rel="tag"' |
|
250 | - . \EED_Events_Archive::link_target() |
|
251 | - .'>' |
|
252 | - . $term->name |
|
253 | - . '</a>'; |
|
249 | + . '" rel="tag"' |
|
250 | + . \EED_Events_Archive::link_target() |
|
251 | + .'>' |
|
252 | + . $term->name |
|
253 | + . '</a>'; |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return EE_Event|null |
41 | 41 | * @throws \EE_Error |
42 | 42 | */ |
43 | - public static function get_event( $EVT_ID = 0 ) { |
|
43 | + public static function get_event($EVT_ID = 0) { |
|
44 | 44 | // international newspaper? |
45 | 45 | global $post; |
46 | 46 | $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events' |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
69 | - if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
69 | + if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
70 | 70 | EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
71 | 71 | } |
72 | 72 | } |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | * @param int $EVT_ID |
84 | 84 | * @return boolean |
85 | 85 | */ |
86 | - public static function display_ticket_selector( $EVT_ID = 0 ) { |
|
87 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
86 | + public static function display_ticket_selector($EVT_ID = 0) { |
|
87 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
88 | 88 | return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE; |
89 | 89 | } |
90 | 90 | |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | * @param int $EVT_ID |
98 | 98 | * @return string |
99 | 99 | */ |
100 | - public static function event_status( $EVT_ID = 0 ) { |
|
101 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
102 | - return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : ''; |
|
100 | + public static function event_status($EVT_ID = 0) { |
|
101 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
102 | + return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : ''; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * @param int $EVT_ID |
112 | 112 | * @return string |
113 | 113 | */ |
114 | - public static function event_active_status( $EVT_ID = 0 ) { |
|
115 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
114 | + public static function event_active_status($EVT_ID = 0) { |
|
115 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
116 | 116 | return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive'; |
117 | 117 | } |
118 | 118 | |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | * @param int $EVT_ID |
126 | 126 | * @return string |
127 | 127 | */ |
128 | - public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
|
129 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
128 | + public static function event_has_content_or_excerpt($EVT_ID = 0) { |
|
129 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
130 | 130 | $has_content_or_excerpt = FALSE; |
131 | - if ( $event instanceof EE_Event ) { |
|
132 | - $has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE; |
|
131 | + if ($event instanceof EE_Event) { |
|
132 | + $has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE; |
|
133 | 133 | } |
134 | - if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) { |
|
134 | + if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) { |
|
135 | 135 | $has_content_or_excerpt = FALSE; |
136 | 136 | } |
137 | 137 | return $has_content_or_excerpt; |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | * @param null $more |
148 | 148 | * @return string |
149 | 149 | */ |
150 | - public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
|
150 | + public static function event_content_or_excerpt($num_words = NULL, $more = NULL) { |
|
151 | 151 | global $post; |
152 | 152 | ob_start(); |
153 | - if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
|
153 | + if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) { |
|
154 | 154 | // admin has chosen "full description" |
155 | 155 | // for the "Event Espresso - Events > Templates > Display Description" option |
156 | 156 | the_content(); |
157 | - } else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) { |
|
158 | - if ( has_excerpt( $post->ID )) { |
|
157 | + } else if ((is_archive() && espresso_display_excerpt_in_event_list())) { |
|
158 | + if (has_excerpt($post->ID)) { |
|
159 | 159 | // admin has chosen "excerpt (short desc)" |
160 | 160 | // for the "Event Espresso - Events > Templates > Display Description" option |
161 | 161 | // AND an excerpt actually exists |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | // admin has chosen "excerpt (short desc)" |
165 | 165 | // for the "Event Espresso - Events > Templates > Display Description" option |
166 | 166 | // but NO excerpt actually exists, so we need to create one |
167 | - if ( ! empty( $num_words )) { |
|
168 | - if ( empty( $more )) { |
|
169 | - $more_link_text = __( '(more…)' ); |
|
170 | - $more = ' <a href="' . get_permalink() . '"'; |
|
167 | + if ( ! empty($num_words)) { |
|
168 | + if (empty($more)) { |
|
169 | + $more_link_text = __('(more…)'); |
|
170 | + $more = ' <a href="'.get_permalink().'"'; |
|
171 | 171 | $more .= ' class="more-link"'; |
172 | 172 | $more .= \EED_Events_Archive::link_target(); |
173 | - $more .= '>' . $more_link_text . '</a>'; |
|
174 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
173 | + $more .= '>'.$more_link_text.'</a>'; |
|
174 | + $more = apply_filters('the_content_more_link', $more, $more_link_text); |
|
175 | 175 | } |
176 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
176 | + $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK')); |
|
177 | 177 | |
178 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
178 | + $content = wp_trim_words($content, $num_words, ' ').$more; |
|
179 | 179 | } else { |
180 | - $content = get_the_content(); |
|
180 | + $content = get_the_content(); |
|
181 | 181 | } |
182 | 182 | global $allowedtags; |
183 | 183 | // make sure links are allowed |
@@ -191,15 +191,15 @@ discard block |
||
191 | 191 | // but get previous value so we can reset it |
192 | 192 | $prev_value = $allowedtags['a']['target']; |
193 | 193 | $allowedtags['a']['target'] = true; |
194 | - $content = wp_kses( $content, $allowedtags ); |
|
195 | - $content = strip_shortcodes( $content ); |
|
196 | - echo apply_filters( 'the_content', $content ); |
|
194 | + $content = wp_kses($content, $allowedtags); |
|
195 | + $content = strip_shortcodes($content); |
|
196 | + echo apply_filters('the_content', $content); |
|
197 | 197 | $allowedtags['a']['target'] = $prev_value; |
198 | 198 | } |
199 | 199 | } else { |
200 | 200 | // admin has chosen "none" |
201 | 201 | // for the "Event Espresso - Events > Templates > Display Description" option |
202 | - echo apply_filters( 'the_content', '' ); |
|
202 | + echo apply_filters('the_content', ''); |
|
203 | 203 | } |
204 | 204 | return ob_get_clean(); |
205 | 205 | } |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | * @param int $EVT_ID |
214 | 214 | * @return EE_Ticket[] |
215 | 215 | */ |
216 | - public static function event_tickets_available( $EVT_ID = 0 ) { |
|
217 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
216 | + public static function event_tickets_available($EVT_ID = 0) { |
|
217 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
218 | 218 | $tickets_available_for_purchase = array(); |
219 | - if( $event instanceof EE_Event ) { |
|
220 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE ); |
|
221 | - foreach( $datetimes as $datetime ) { |
|
222 | - $tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() ); |
|
219 | + if ($event instanceof EE_Event) { |
|
220 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE); |
|
221 | + foreach ($datetimes as $datetime) { |
|
222 | + $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase()); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | return $tickets_available_for_purchase; |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | * @param bool $hide_uncategorized |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) { |
|
238 | + public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) { |
|
239 | 239 | $category_links = array(); |
240 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
241 | - if ( $event instanceof EE_Event ) { |
|
242 | - $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' ); |
|
243 | - if ( $event_categories ) { |
|
240 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
241 | + if ($event instanceof EE_Event) { |
|
242 | + $event_categories = get_the_terms($event->ID(), 'espresso_event_categories'); |
|
243 | + if ($event_categories) { |
|
244 | 244 | // loop thru terms and create links |
245 | - foreach ( $event_categories as $term ) { |
|
246 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
247 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
248 | - $category_links[] = '<a href="' . esc_url( $url ) |
|
245 | + foreach ($event_categories as $term) { |
|
246 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
247 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
248 | + $category_links[] = '<a href="'.esc_url($url) |
|
249 | 249 | . '" rel="tag"' |
250 | 250 | . \EED_Events_Archive::link_target() |
251 | 251 | .'>' |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | - return implode( ', ', $category_links ); |
|
258 | + return implode(', ', $category_links); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | * @param int $EVT_ID |
270 | 270 | * @return string |
271 | 271 | */ |
272 | - public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
273 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
274 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
275 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
272 | + public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
273 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
274 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
275 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | * @param int $EVT_ID |
287 | 287 | * @return string |
288 | 288 | */ |
289 | - public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
290 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
291 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
292 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
289 | + public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
290 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
291 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
292 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | * @param int $EVT_ID |
304 | 304 | * @return string |
305 | 305 | */ |
306 | - public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
307 | - $datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID ); |
|
308 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
309 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
306 | + public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
307 | + $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID); |
|
308 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
309 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | * @param int $EVT_ID |
321 | 321 | * @return string |
322 | 322 | */ |
323 | - public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
324 | - $datetime = EEH_Event_View::get_latest_date_obj( $EVT_ID ); |
|
325 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
326 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
323 | + public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
324 | + $datetime = EEH_Event_View::get_latest_date_obj($EVT_ID); |
|
325 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
326 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -335,13 +335,13 @@ discard block |
||
335 | 335 | * @param int $EVT_ID |
336 | 336 | * @return string |
337 | 337 | */ |
338 | - public static function event_date_as_calendar_page( $EVT_ID = 0 ) { |
|
339 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
340 | - if ( $datetime instanceof EE_Datetime ) { |
|
338 | + public static function event_date_as_calendar_page($EVT_ID = 0) { |
|
339 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
340 | + if ($datetime instanceof EE_Datetime) { |
|
341 | 341 | ?> |
342 | 342 | <div class="event-date-calendar-page-dv"> |
343 | - <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div> |
|
344 | - <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div> |
|
343 | + <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div> |
|
344 | + <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div> |
|
345 | 345 | </div> |
346 | 346 | <?php |
347 | 347 | } |
@@ -356,17 +356,17 @@ discard block |
||
356 | 356 | * @param int $EVT_ID |
357 | 357 | * @return string |
358 | 358 | */ |
359 | - public static function get_primary_date_obj( $EVT_ID = 0 ) { |
|
360 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
361 | - if ( $event instanceof EE_Event ) { |
|
359 | + public static function get_primary_date_obj($EVT_ID = 0) { |
|
360 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
361 | + if ($event instanceof EE_Event) { |
|
362 | 362 | $datetimes = $event->get_many_related( |
363 | 363 | 'Datetime', |
364 | 364 | array( |
365 | 365 | 'limit' => 1, |
366 | - 'order_by' => array( 'DTT_order' => 'ASC' ) |
|
366 | + 'order_by' => array('DTT_order' => 'ASC') |
|
367 | 367 | ) |
368 | 368 | ); |
369 | - return reset( $datetimes ); |
|
369 | + return reset($datetimes); |
|
370 | 370 | } else { |
371 | 371 | return FALSE; |
372 | 372 | } |
@@ -381,17 +381,17 @@ discard block |
||
381 | 381 | * @param int $EVT_ID |
382 | 382 | * @return string |
383 | 383 | */ |
384 | - public static function get_last_date_obj( $EVT_ID = 0 ) { |
|
385 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
386 | - if ( $event instanceof EE_Event ) { |
|
384 | + public static function get_last_date_obj($EVT_ID = 0) { |
|
385 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
386 | + if ($event instanceof EE_Event) { |
|
387 | 387 | $datetimes = $event->get_many_related( |
388 | 388 | 'Datetime', |
389 | 389 | array( |
390 | 390 | 'limit' => 1, |
391 | - 'order_by' => array( 'DTT_order' => 'DESC' ) |
|
391 | + 'order_by' => array('DTT_order' => 'DESC') |
|
392 | 392 | ) |
393 | 393 | ); |
394 | - return end( $datetimes ); |
|
394 | + return end($datetimes); |
|
395 | 395 | } else { |
396 | 396 | return FALSE; |
397 | 397 | } |
@@ -406,17 +406,17 @@ discard block |
||
406 | 406 | * @param int $EVT_ID |
407 | 407 | * @return string |
408 | 408 | */ |
409 | - public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
|
410 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
411 | - if ( $event instanceof EE_Event ) { |
|
409 | + public static function get_earliest_date_obj($EVT_ID = 0) { |
|
410 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
411 | + if ($event instanceof EE_Event) { |
|
412 | 412 | $datetimes = $event->get_many_related( |
413 | 413 | 'Datetime', |
414 | 414 | array( |
415 | 415 | 'limit' => 1, |
416 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) |
|
416 | + 'order_by' => array('DTT_EVT_start' => 'ASC') |
|
417 | 417 | ) |
418 | 418 | ); |
419 | - return reset( $datetimes ); |
|
419 | + return reset($datetimes); |
|
420 | 420 | } else { |
421 | 421 | return FALSE; |
422 | 422 | } |
@@ -431,17 +431,17 @@ discard block |
||
431 | 431 | * @param int $EVT_ID |
432 | 432 | * @return string |
433 | 433 | */ |
434 | - public static function get_latest_date_obj( $EVT_ID = 0 ) { |
|
435 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
436 | - if ( $event instanceof EE_Event ) { |
|
434 | + public static function get_latest_date_obj($EVT_ID = 0) { |
|
435 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
436 | + if ($event instanceof EE_Event) { |
|
437 | 437 | $datetimes = $event->get_many_related( |
438 | 438 | 'Datetime', |
439 | 439 | array( |
440 | 440 | 'limit' => 1, |
441 | - 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) |
|
441 | + 'order_by' => array('DTT_EVT_start' => 'DESC') |
|
442 | 442 | ) |
443 | 443 | ); |
444 | - return end( $datetimes ); |
|
444 | + return end($datetimes); |
|
445 | 445 | } else { |
446 | 446 | return FALSE; |
447 | 447 | } |
@@ -459,17 +459,17 @@ discard block |
||
459 | 459 | * @param null $limit |
460 | 460 | * @return EE_Datetime[] |
461 | 461 | */ |
462 | - public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) { |
|
463 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
464 | - if($include_expired === null){ |
|
465 | - if($event instanceof EE_Event && $event->is_expired()){ |
|
462 | + public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) { |
|
463 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
464 | + if ($include_expired === null) { |
|
465 | + if ($event instanceof EE_Event && $event->is_expired()) { |
|
466 | 466 | $include_expired = true; |
467 | - }else{ |
|
467 | + } else { |
|
468 | 468 | $include_expired = false; |
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
472 | - if ( $event instanceof EE_Event ) { |
|
472 | + if ($event instanceof EE_Event) { |
|
473 | 473 | return $event->datetimes_ordered($include_expired, $include_deleted, $limit); |
474 | 474 | } else { |
475 | 475 | return array(); |
@@ -485,11 +485,11 @@ discard block |
||
485 | 485 | * @param int $EVT_ID |
486 | 486 | * @return string |
487 | 487 | */ |
488 | - public static function event_link_url( $EVT_ID = 0 ) { |
|
489 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
490 | - if ( $event instanceof EE_Event ) { |
|
491 | - $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() ); |
|
492 | - return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url; |
|
488 | + public static function event_link_url($EVT_ID = 0) { |
|
489 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
490 | + if ($event instanceof EE_Event) { |
|
491 | + $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID()); |
|
492 | + return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url; |
|
493 | 493 | } |
494 | 494 | return NULL; |
495 | 495 | } |
@@ -503,10 +503,10 @@ discard block |
||
503 | 503 | * @param int $EVT_ID |
504 | 504 | * @return string |
505 | 505 | */ |
506 | - public static function event_phone( $EVT_ID = 0 ) { |
|
507 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
508 | - if ( $event instanceof EE_Event ) { |
|
509 | - return EEH_Schema::telephone( $event->phone() ); |
|
506 | + public static function event_phone($EVT_ID = 0) { |
|
507 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
508 | + if ($event instanceof EE_Event) { |
|
509 | + return EEH_Schema::telephone($event->phone()); |
|
510 | 510 | } |
511 | 511 | return NULL; |
512 | 512 | } |
@@ -523,26 +523,26 @@ discard block |
||
523 | 523 | * @param string $after |
524 | 524 | * @return string |
525 | 525 | */ |
526 | - public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) { |
|
527 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
528 | - if ( $event instanceof EE_Event ) { |
|
526 | + public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { |
|
527 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
528 | + if ($event instanceof EE_Event) { |
|
529 | 529 | // can the user edit this post ? |
530 | - if ( current_user_can( 'edit_post', $event->ID() )) { |
|
530 | + if (current_user_can('edit_post', $event->ID())) { |
|
531 | 531 | // set link text |
532 | - $link_text = ! empty( $link ) ? $link : __('edit this event'); |
|
532 | + $link_text = ! empty($link) ? $link : __('edit this event'); |
|
533 | 533 | // generate nonce |
534 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
534 | + $nonce = wp_create_nonce('edit_nonce'); |
|
535 | 535 | // generate url to event editor for this event |
536 | - $url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() ); |
|
536 | + $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); |
|
537 | 537 | // get edit CPT text |
538 | - $post_type_obj = get_post_type_object( 'espresso_events' ); |
|
538 | + $post_type_obj = get_post_type_object('espresso_events'); |
|
539 | 539 | // build final link html |
540 | - $link = '<a class="post-edit-link" href="' . $url . '" '; |
|
541 | - $link .= ' title="' . esc_attr( $post_type_obj->labels->edit_item ) . '"'; |
|
540 | + $link = '<a class="post-edit-link" href="'.$url.'" '; |
|
541 | + $link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"'; |
|
542 | 542 | $link .= \EED_Events_Archive::link_target(); |
543 | - $link .='>' . $link_text . '</a>'; |
|
543 | + $link .= '>'.$link_text.'</a>'; |
|
544 | 544 | // put it all together |
545 | - return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after; |
|
545 | + return $before.apply_filters('edit_post_link', $link, $event->ID()).$after; |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | return ''; |