Completed
Branch FET-10416-autoload-b4-bootstra... (42a01c)
by
unknown
13:17
created
shortcodes/espresso_thank_you/EES_Espresso_Thank_You.shortcode.php 2 patches
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             __(
Please login to merge, or discard this patch.
thank_you_page/templates/thank-you-page-payment-details.template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
modules/thank_you_page/templates/thank-you-page-overview.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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); ?>
Please login to merge, or discard this patch.
thank_you_page/templates/thank-you-page-transaction-details.template.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 					 &nbsp; <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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
thank_you_page/templates/thank-you-page-registration-details.template.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,81 +5,81 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 -->
Please login to merge, or discard this patch.
modules/thank_you_page/EED_Thank_You_Page.module.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Indentation   +916 added lines, -916 removed lines patch added patch discarded remove patch
@@ -14,757 +14,757 @@  discard block
 block discarded – undo
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
-        wp_enqueue_style('espresso_default');
343
-    }
344
-
345
-
346
-
347
-    /**
348
-     * init
349
-     *
350
-     * @return void
351
-     * @throws \EE_Error
352
-     */
353
-    public function init()
354
-    {
355
-        $this->_get_reg_url_link();
356
-        if ( ! $this->get_txn()) {
357
-            echo EEH_HTML::div(
358
-                EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') .
359
-                sprintf(
360
-                    __(
361
-                        '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',
362
-                        'event_espresso'
363
-                    ),
364
-                    '<br/>'
365
-                ),
366
-                '',
367
-                'ee-attention'
368
-            );
369
-            return null;
370
-        }
371
-        // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
372
-        if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) {
373
-            $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
374
-            $this->_current_txn->save();
375
-        }
376
-        $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration
377
-            ? $this->_current_txn->primary_registration()
378
-            : null;
379
-        $this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link ? true : false;
380
-        $show_try_pay_again_link_default = apply_filters(
381
-            'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default',
382
-            true
383
-        );
384
-        $this->_show_try_pay_again_link = $show_try_pay_again_link_default;
385
-        // txn status ?
386
-        if ($this->_current_txn->is_completed()) {
387
-            $this->_show_try_pay_again_link = $show_try_pay_again_link_default;
388
-        } else if (
389
-            $this->_current_txn->is_incomplete()
390
-            && ($this->_primary_registrant->is_approved()
391
-                || $this->_primary_registrant->is_pending_payment())
392
-        ) {
393
-            $this->_show_try_pay_again_link = true;
394
-        } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
395
-            // its pending
396
-            $this->_show_try_pay_again_link = isset(
397
-                                                  EE_Registry::instance()->CFG->registration->show_pending_payment_options
398
-                                              )
399
-                                              && EE_Registry::instance()->CFG->registration->show_pending_payment_options
400
-                ? true
401
-                : $show_try_pay_again_link_default;
402
-        }
403
-        $this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method
404
-            ? true
405
-            : false;
406
-        $this->_is_offline_payment_method = false;
407
-        if (
408
-            // if payment method is unknown
409
-            ! $this->_current_txn->payment_method() instanceof EE_Payment_Method
410
-            || (
411
-                // or is an offline payment method
412
-                $this->_current_txn->payment_method() instanceof EE_Payment_Method
413
-                && $this->_current_txn->payment_method()->is_off_line()
414
-            )
415
-        ) {
416
-            $this->_is_offline_payment_method = true;
417
-        }
418
-        // link to SPCO
419
-        $revisit_spco_url = add_query_arg(
420
-            array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link),
421
-            EE_Registry::instance()->CFG->core->reg_page_url()
422
-        );
423
-        // link to SPCO payment_options
424
-        $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration
425
-            ? $this->_primary_registrant->payment_overview_url()
426
-            : add_query_arg(
427
-                array('step' => 'payment_options'),
428
-                $revisit_spco_url
429
-            );
430
-        // link to SPCO attendee_information
431
-        $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration
432
-            ? $this->_primary_registrant->edit_attendee_information_url()
433
-            : false;
434
-        do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn);
435
-        // set no cache headers and constants
436
-        EE_System::do_not_cache();
437
-    }
438
-
439
-
440
-
441
-    /**
442
-     * display_thank_you_page_results
443
-     *
444
-     * @return string
445
-     * @throws \EE_Error
446
-     */
447
-    public function thank_you_page_results()
448
-    {
449
-        $this->init();
450
-        if ( ! $this->_current_txn instanceof EE_Transaction) {
451
-            return EE_Error::get_notices();
452
-        }
453
-        // link to receipt
454
-        $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
455
-        if ( ! empty($template_args['TXN_receipt_url'])) {
456
-            $template_args['order_conf_desc'] = __(
457
-                '%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.',
458
-                'event_espresso'
459
-            );
460
-        } else {
461
-            $template_args['order_conf_desc'] = __(
462
-                '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.',
463
-                'event_espresso'
464
-            );
465
-        }
466
-        $template_args['transaction'] = $this->_current_txn;
467
-        $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false);
468
-        add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details'));
469
-        if ($this->_is_primary && ! $this->_current_txn->is_free()) {
470
-            add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
471
-        }
472
-        return EEH_Template::locate_template(
473
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php',
474
-            $template_args,
475
-            true,
476
-            true
477
-        );
478
-    }
479
-
480
-
481
-
482
-    /**
483
-     * thank_you_page_IPN_monitor
484
-     * this basically just pulls the TXN based on the reg_url_link sent from the server,
485
-     * then checks that the TXN status is not failed, and that no other errors have been generated.
486
-     * it also calculates the IPN wait time since the Thank You page was first loaded
487
-     *
488
-     * @param array $response
489
-     * @param array $data
490
-     * @return array
491
-     * @throws \EE_Error
492
-     */
493
-    public static function thank_you_page_IPN_monitor($response = array(), $data = array())
494
-    {
495
-        // does this heartbeat contain our data ?
496
-        if ( ! isset($data['espresso_thank_you_page'])) {
497
-            return $response;
498
-        }
499
-        // check for reg_url_link in the incoming heartbeat data
500
-        if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
501
-            $response['espresso_thank_you_page'] = array(
502
-                'errors' => ! empty($notices['errors'])
503
-                    ? $notices['errors']
504
-                    : __(
505
-                        'No transaction information could be retrieved because the registration URL link is missing or invalid.',
506
-                        'event_espresso'
507
-                    )
508
-            );
509
-            return $response;
510
-        }
511
-        // kk heartbeat has our data
512
-        $response['espresso_thank_you_page'] = array();
513
-        // set_definitions, instantiate the thank you page class, and get the ball rolling
514
-        EED_Thank_You_Page::set_definitions();
515
-        /** @var $espresso_thank_you_page EED_Thank_You_Page */
516
-        $espresso_thank_you_page = EED_Thank_You_Page::instance();
517
-        $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']);
518
-        $espresso_thank_you_page->init();
519
-        //get TXN
520
-        $TXN = $espresso_thank_you_page->get_txn();
521
-        // no TXN? then get out
522
-        if ( ! $TXN instanceof EE_Transaction) {
523
-            $notices = EE_Error::get_notices();
524
-            $response['espresso_thank_you_page'] = array(
525
-                'errors' => ! empty($notices['errors'])
526
-                    ? $notices['errors']
527
-                    : sprintf(
528
-                        __(
529
-                            '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)',
530
-                            'event_espresso'
531
-                        ),
532
-                        __LINE__
533
-                    )
534
-            );
535
-            return $response;
536
-        }
537
-        // grab transient of TXN's status
538
-        $txn_status = isset($data['espresso_thank_you_page']['txn_status'])
539
-            ? $data['espresso_thank_you_page']['txn_status']
540
-            : null;
541
-        // has the TXN status changed since we last checked (or empty because this is the first time running through this code)?
542
-        if ($txn_status !== $TXN->status_ID()) {
543
-            // switch between two possible basic outcomes
544
-            switch ($TXN->status_ID()) {
545
-                // TXN has been updated in some way
546
-                case EEM_Transaction::overpaid_status_code:
547
-                case EEM_Transaction::complete_status_code:
548
-                case EEM_Transaction::incomplete_status_code:
549
-                    // send updated TXN results back to client,
550
-                    $response['espresso_thank_you_page'] = array(
551
-                        'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
552
-                        'txn_status'          => $TXN->status_ID()
553
-                    );
554
-                    break;
555
-                // or we have a bad TXN, or really slow IPN, so calculate the wait time and send that back...
556
-                case EEM_Transaction::failed_status_code:
557
-                default:
558
-                    // keep on waiting...
559
-                    return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
560
-            }
561
-            // or is the TXN still failed (never been updated) ???
562
-        } else if ($TXN->failed()) {
563
-            // keep on waiting...
564
-            return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
565
-        }
566
-        // TXN is happening so let's get the payments now
567
-        // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked
568
-        $since = isset($data['espresso_thank_you_page']['get_payments_since'])
569
-            ? $data['espresso_thank_you_page']['get_payments_since']
570
-            : 0;
571
-        // then check for payments
572
-        $payments = $espresso_thank_you_page->get_txn_payments($since);
573
-        // has a payment been processed ?
574
-        if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
575
-            if ($since) {
576
-                $response['espresso_thank_you_page'] = array(
577
-                    'new_payments'        => $espresso_thank_you_page->get_new_payments($payments),
578
-                    'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
579
-                    'txn_status'          => $TXN->status_ID()
580
-                );
581
-            } else {
582
-                $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details(
583
-                    $payments
584
-                );
585
-            }
586
-            // reset time to check for payments
587
-            $response['espresso_thank_you_page']['get_payments_since'] = time();
588
-        } else {
589
-            $response['espresso_thank_you_page']['get_payments_since'] = $since;
590
-        }
591
-        return $response;
592
-    }
593
-
594
-
595
-
596
-    /**
597
-     * _update_server_wait_time
598
-     *
599
-     * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data
600
-     * @return array
601
-     * @throws \EE_Error
602
-     */
603
-    private function _update_server_wait_time($thank_you_page_data = array())
604
-    {
605
-        $response['espresso_thank_you_page'] = array(
606
-            'still_waiting' => isset($thank_you_page_data['initial_access'])
607
-                ? time() - $thank_you_page_data['initial_access']
608
-                : 0,
609
-            'txn_status'    => $this->_current_txn->status_ID()
610
-        );
611
-        return $response;
612
-    }
613
-
614
-
615
-
616
-    /**
617
-     * get_registration_details
618
-     *
619
-     * @throws \EE_Error
620
-     */
621
-    public function get_registration_details()
622
-    {
623
-        //prepare variables for displaying
624
-        $template_args = array();
625
-        $template_args['transaction'] = $this->_current_txn;
626
-        $template_args['reg_url_link'] = $this->_reg_url_link;
627
-        $template_args['is_primary'] = $this->_is_primary;
628
-        $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url;
629
-        $template_args['resend_reg_confirmation_url'] = add_query_arg(
630
-            array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'),
631
-            EE_Registry::instance()->CFG->core->thank_you_page_url()
632
-        );
633
-        // verify template arguments
634
-        EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
635
-        EEH_Template_Validator::verify_isnt_null(
636
-            $template_args['SPCO_attendee_information_url'],
637
-            '$SPCO_attendee_information_url'
638
-        );
639
-        echo EEH_Template::locate_template(
640
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php',
641
-            $template_args,
642
-            true,
643
-            true
644
-        );
645
-    }
646
-
647
-
648
-
649
-    /**
650
-     * resend_reg_confirmation_email
651
-     *
652
-     * @throws \EE_Error
653
-     */
654
-    public static function resend_reg_confirmation_email()
655
-    {
656
-        EE_Registry::instance()->load_core('Request_Handler');
657
-        $reg_url_link = EE_Registry::instance()->REQ->get('token');
658
-        // was a REG_ID passed ?
659
-        if ($reg_url_link) {
660
-            $registration = EE_Registry::instance()->load_model('Registration')->get_one(
661
-                array(array('REG_url_link' => $reg_url_link))
662
-            );
663
-            if ($registration instanceof EE_Registration) {
664
-                // resend email
665
-                EED_Messages::process_resend(array('_REG_ID' => $registration->ID()));
666
-            } else {
667
-                EE_Error::add_error(
668
-                    __(
669
-                        'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.',
670
-                        'event_espresso'
671
-                    ),
672
-                    __FILE__,
673
-                    __FUNCTION__,
674
-                    __LINE__
675
-                );
676
-            }
677
-        } else {
678
-            EE_Error::add_error(
679
-                __(
680
-                    'The Registration Confirmation email could not be sent because a registration token is missing or invalid.',
681
-                    'event_espresso'
682
-                ),
683
-                __FILE__,
684
-                __FUNCTION__,
685
-                __LINE__
686
-            );
687
-        }
688
-        // request sent via AJAX ?
689
-        if (EE_FRONT_AJAX) {
690
-            echo wp_json_encode(EE_Error::get_notices(false));
691
-            die();
692
-            // or was JS disabled ?
693
-        } else {
694
-            // save errors so that they get picked up on the next request
695
-            EE_Error::get_notices(true, true);
696
-            wp_safe_redirect(
697
-                add_query_arg(
698
-                    array('e_reg_url_link' => $reg_url_link),
699
-                    EE_Registry::instance()->CFG->core->thank_you_page_url()
700
-                )
701
-            );
702
-        }
703
-    }
704
-
705
-
706
-
707
-    /**
708
-     * get_ajax_content
709
-     *
710
-     * @return void
711
-     * @throws \EE_Error
712
-     */
713
-    public function get_ajax_content()
714
-    {
715
-        if ( ! $this->get_txn()) {
716
-            return;
717
-        }
718
-        // first determine which event(s) require pre-approval or not
719
-        $events = array();
720
-        $events_requiring_pre_approval = array();
721
-        foreach ($this->_current_txn->registrations() as $registration) {
722
-            if ($registration instanceof EE_Registration) {
723
-                $event = $registration->event();
724
-                if ($event instanceof EE_Event) {
725
-                    if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
726
-                        $events_requiring_pre_approval[$event->ID()] = $event;
727
-                    } else {
728
-                        $events[$event->ID()] = $event;
729
-                    }
730
-                }
731
-            }
732
-        }
733
-        $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
734
-        $this->display_details_for_events($events);
735
-    }
736
-
737
-
738
-
739
-    /**
740
-     * display_details_for_events
741
-     *
742
-     * @param EE_Event[] $events
743
-     * @return void
744
-     */
745
-    public function display_details_for_events($events = array())
746
-    {
747
-        if ( ! empty($events)) {
748
-            ?>
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
+		wp_enqueue_style('espresso_default');
343
+	}
344
+
345
+
346
+
347
+	/**
348
+	 * init
349
+	 *
350
+	 * @return void
351
+	 * @throws \EE_Error
352
+	 */
353
+	public function init()
354
+	{
355
+		$this->_get_reg_url_link();
356
+		if ( ! $this->get_txn()) {
357
+			echo EEH_HTML::div(
358
+				EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') .
359
+				sprintf(
360
+					__(
361
+						'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',
362
+						'event_espresso'
363
+					),
364
+					'<br/>'
365
+				),
366
+				'',
367
+				'ee-attention'
368
+			);
369
+			return null;
370
+		}
371
+		// if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
372
+		if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) {
373
+			$this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
374
+			$this->_current_txn->save();
375
+		}
376
+		$this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration
377
+			? $this->_current_txn->primary_registration()
378
+			: null;
379
+		$this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link ? true : false;
380
+		$show_try_pay_again_link_default = apply_filters(
381
+			'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default',
382
+			true
383
+		);
384
+		$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
385
+		// txn status ?
386
+		if ($this->_current_txn->is_completed()) {
387
+			$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
388
+		} else if (
389
+			$this->_current_txn->is_incomplete()
390
+			&& ($this->_primary_registrant->is_approved()
391
+				|| $this->_primary_registrant->is_pending_payment())
392
+		) {
393
+			$this->_show_try_pay_again_link = true;
394
+		} else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
395
+			// its pending
396
+			$this->_show_try_pay_again_link = isset(
397
+												  EE_Registry::instance()->CFG->registration->show_pending_payment_options
398
+											  )
399
+											  && EE_Registry::instance()->CFG->registration->show_pending_payment_options
400
+				? true
401
+				: $show_try_pay_again_link_default;
402
+		}
403
+		$this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method
404
+			? true
405
+			: false;
406
+		$this->_is_offline_payment_method = false;
407
+		if (
408
+			// if payment method is unknown
409
+			! $this->_current_txn->payment_method() instanceof EE_Payment_Method
410
+			|| (
411
+				// or is an offline payment method
412
+				$this->_current_txn->payment_method() instanceof EE_Payment_Method
413
+				&& $this->_current_txn->payment_method()->is_off_line()
414
+			)
415
+		) {
416
+			$this->_is_offline_payment_method = true;
417
+		}
418
+		// link to SPCO
419
+		$revisit_spco_url = add_query_arg(
420
+			array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link),
421
+			EE_Registry::instance()->CFG->core->reg_page_url()
422
+		);
423
+		// link to SPCO payment_options
424
+		$this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration
425
+			? $this->_primary_registrant->payment_overview_url()
426
+			: add_query_arg(
427
+				array('step' => 'payment_options'),
428
+				$revisit_spco_url
429
+			);
430
+		// link to SPCO attendee_information
431
+		$this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration
432
+			? $this->_primary_registrant->edit_attendee_information_url()
433
+			: false;
434
+		do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn);
435
+		// set no cache headers and constants
436
+		EE_System::do_not_cache();
437
+	}
438
+
439
+
440
+
441
+	/**
442
+	 * display_thank_you_page_results
443
+	 *
444
+	 * @return string
445
+	 * @throws \EE_Error
446
+	 */
447
+	public function thank_you_page_results()
448
+	{
449
+		$this->init();
450
+		if ( ! $this->_current_txn instanceof EE_Transaction) {
451
+			return EE_Error::get_notices();
452
+		}
453
+		// link to receipt
454
+		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
455
+		if ( ! empty($template_args['TXN_receipt_url'])) {
456
+			$template_args['order_conf_desc'] = __(
457
+				'%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.',
458
+				'event_espresso'
459
+			);
460
+		} else {
461
+			$template_args['order_conf_desc'] = __(
462
+				'%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.',
463
+				'event_espresso'
464
+			);
465
+		}
466
+		$template_args['transaction'] = $this->_current_txn;
467
+		$template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false);
468
+		add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details'));
469
+		if ($this->_is_primary && ! $this->_current_txn->is_free()) {
470
+			add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
471
+		}
472
+		return EEH_Template::locate_template(
473
+			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php',
474
+			$template_args,
475
+			true,
476
+			true
477
+		);
478
+	}
479
+
480
+
481
+
482
+	/**
483
+	 * thank_you_page_IPN_monitor
484
+	 * this basically just pulls the TXN based on the reg_url_link sent from the server,
485
+	 * then checks that the TXN status is not failed, and that no other errors have been generated.
486
+	 * it also calculates the IPN wait time since the Thank You page was first loaded
487
+	 *
488
+	 * @param array $response
489
+	 * @param array $data
490
+	 * @return array
491
+	 * @throws \EE_Error
492
+	 */
493
+	public static function thank_you_page_IPN_monitor($response = array(), $data = array())
494
+	{
495
+		// does this heartbeat contain our data ?
496
+		if ( ! isset($data['espresso_thank_you_page'])) {
497
+			return $response;
498
+		}
499
+		// check for reg_url_link in the incoming heartbeat data
500
+		if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
501
+			$response['espresso_thank_you_page'] = array(
502
+				'errors' => ! empty($notices['errors'])
503
+					? $notices['errors']
504
+					: __(
505
+						'No transaction information could be retrieved because the registration URL link is missing or invalid.',
506
+						'event_espresso'
507
+					)
508
+			);
509
+			return $response;
510
+		}
511
+		// kk heartbeat has our data
512
+		$response['espresso_thank_you_page'] = array();
513
+		// set_definitions, instantiate the thank you page class, and get the ball rolling
514
+		EED_Thank_You_Page::set_definitions();
515
+		/** @var $espresso_thank_you_page EED_Thank_You_Page */
516
+		$espresso_thank_you_page = EED_Thank_You_Page::instance();
517
+		$espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']);
518
+		$espresso_thank_you_page->init();
519
+		//get TXN
520
+		$TXN = $espresso_thank_you_page->get_txn();
521
+		// no TXN? then get out
522
+		if ( ! $TXN instanceof EE_Transaction) {
523
+			$notices = EE_Error::get_notices();
524
+			$response['espresso_thank_you_page'] = array(
525
+				'errors' => ! empty($notices['errors'])
526
+					? $notices['errors']
527
+					: sprintf(
528
+						__(
529
+							'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)',
530
+							'event_espresso'
531
+						),
532
+						__LINE__
533
+					)
534
+			);
535
+			return $response;
536
+		}
537
+		// grab transient of TXN's status
538
+		$txn_status = isset($data['espresso_thank_you_page']['txn_status'])
539
+			? $data['espresso_thank_you_page']['txn_status']
540
+			: null;
541
+		// has the TXN status changed since we last checked (or empty because this is the first time running through this code)?
542
+		if ($txn_status !== $TXN->status_ID()) {
543
+			// switch between two possible basic outcomes
544
+			switch ($TXN->status_ID()) {
545
+				// TXN has been updated in some way
546
+				case EEM_Transaction::overpaid_status_code:
547
+				case EEM_Transaction::complete_status_code:
548
+				case EEM_Transaction::incomplete_status_code:
549
+					// send updated TXN results back to client,
550
+					$response['espresso_thank_you_page'] = array(
551
+						'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
552
+						'txn_status'          => $TXN->status_ID()
553
+					);
554
+					break;
555
+				// or we have a bad TXN, or really slow IPN, so calculate the wait time and send that back...
556
+				case EEM_Transaction::failed_status_code:
557
+				default:
558
+					// keep on waiting...
559
+					return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
560
+			}
561
+			// or is the TXN still failed (never been updated) ???
562
+		} else if ($TXN->failed()) {
563
+			// keep on waiting...
564
+			return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
565
+		}
566
+		// TXN is happening so let's get the payments now
567
+		// if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked
568
+		$since = isset($data['espresso_thank_you_page']['get_payments_since'])
569
+			? $data['espresso_thank_you_page']['get_payments_since']
570
+			: 0;
571
+		// then check for payments
572
+		$payments = $espresso_thank_you_page->get_txn_payments($since);
573
+		// has a payment been processed ?
574
+		if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
575
+			if ($since) {
576
+				$response['espresso_thank_you_page'] = array(
577
+					'new_payments'        => $espresso_thank_you_page->get_new_payments($payments),
578
+					'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
579
+					'txn_status'          => $TXN->status_ID()
580
+				);
581
+			} else {
582
+				$response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details(
583
+					$payments
584
+				);
585
+			}
586
+			// reset time to check for payments
587
+			$response['espresso_thank_you_page']['get_payments_since'] = time();
588
+		} else {
589
+			$response['espresso_thank_you_page']['get_payments_since'] = $since;
590
+		}
591
+		return $response;
592
+	}
593
+
594
+
595
+
596
+	/**
597
+	 * _update_server_wait_time
598
+	 *
599
+	 * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data
600
+	 * @return array
601
+	 * @throws \EE_Error
602
+	 */
603
+	private function _update_server_wait_time($thank_you_page_data = array())
604
+	{
605
+		$response['espresso_thank_you_page'] = array(
606
+			'still_waiting' => isset($thank_you_page_data['initial_access'])
607
+				? time() - $thank_you_page_data['initial_access']
608
+				: 0,
609
+			'txn_status'    => $this->_current_txn->status_ID()
610
+		);
611
+		return $response;
612
+	}
613
+
614
+
615
+
616
+	/**
617
+	 * get_registration_details
618
+	 *
619
+	 * @throws \EE_Error
620
+	 */
621
+	public function get_registration_details()
622
+	{
623
+		//prepare variables for displaying
624
+		$template_args = array();
625
+		$template_args['transaction'] = $this->_current_txn;
626
+		$template_args['reg_url_link'] = $this->_reg_url_link;
627
+		$template_args['is_primary'] = $this->_is_primary;
628
+		$template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url;
629
+		$template_args['resend_reg_confirmation_url'] = add_query_arg(
630
+			array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'),
631
+			EE_Registry::instance()->CFG->core->thank_you_page_url()
632
+		);
633
+		// verify template arguments
634
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
635
+		EEH_Template_Validator::verify_isnt_null(
636
+			$template_args['SPCO_attendee_information_url'],
637
+			'$SPCO_attendee_information_url'
638
+		);
639
+		echo EEH_Template::locate_template(
640
+			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php',
641
+			$template_args,
642
+			true,
643
+			true
644
+		);
645
+	}
646
+
647
+
648
+
649
+	/**
650
+	 * resend_reg_confirmation_email
651
+	 *
652
+	 * @throws \EE_Error
653
+	 */
654
+	public static function resend_reg_confirmation_email()
655
+	{
656
+		EE_Registry::instance()->load_core('Request_Handler');
657
+		$reg_url_link = EE_Registry::instance()->REQ->get('token');
658
+		// was a REG_ID passed ?
659
+		if ($reg_url_link) {
660
+			$registration = EE_Registry::instance()->load_model('Registration')->get_one(
661
+				array(array('REG_url_link' => $reg_url_link))
662
+			);
663
+			if ($registration instanceof EE_Registration) {
664
+				// resend email
665
+				EED_Messages::process_resend(array('_REG_ID' => $registration->ID()));
666
+			} else {
667
+				EE_Error::add_error(
668
+					__(
669
+						'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.',
670
+						'event_espresso'
671
+					),
672
+					__FILE__,
673
+					__FUNCTION__,
674
+					__LINE__
675
+				);
676
+			}
677
+		} else {
678
+			EE_Error::add_error(
679
+				__(
680
+					'The Registration Confirmation email could not be sent because a registration token is missing or invalid.',
681
+					'event_espresso'
682
+				),
683
+				__FILE__,
684
+				__FUNCTION__,
685
+				__LINE__
686
+			);
687
+		}
688
+		// request sent via AJAX ?
689
+		if (EE_FRONT_AJAX) {
690
+			echo wp_json_encode(EE_Error::get_notices(false));
691
+			die();
692
+			// or was JS disabled ?
693
+		} else {
694
+			// save errors so that they get picked up on the next request
695
+			EE_Error::get_notices(true, true);
696
+			wp_safe_redirect(
697
+				add_query_arg(
698
+					array('e_reg_url_link' => $reg_url_link),
699
+					EE_Registry::instance()->CFG->core->thank_you_page_url()
700
+				)
701
+			);
702
+		}
703
+	}
704
+
705
+
706
+
707
+	/**
708
+	 * get_ajax_content
709
+	 *
710
+	 * @return void
711
+	 * @throws \EE_Error
712
+	 */
713
+	public function get_ajax_content()
714
+	{
715
+		if ( ! $this->get_txn()) {
716
+			return;
717
+		}
718
+		// first determine which event(s) require pre-approval or not
719
+		$events = array();
720
+		$events_requiring_pre_approval = array();
721
+		foreach ($this->_current_txn->registrations() as $registration) {
722
+			if ($registration instanceof EE_Registration) {
723
+				$event = $registration->event();
724
+				if ($event instanceof EE_Event) {
725
+					if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
726
+						$events_requiring_pre_approval[$event->ID()] = $event;
727
+					} else {
728
+						$events[$event->ID()] = $event;
729
+					}
730
+				}
731
+			}
732
+		}
733
+		$this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
734
+		$this->display_details_for_events($events);
735
+	}
736
+
737
+
738
+
739
+	/**
740
+	 * display_details_for_events
741
+	 *
742
+	 * @param EE_Event[] $events
743
+	 * @return void
744
+	 */
745
+	public function display_details_for_events($events = array())
746
+	{
747
+		if ( ! empty($events)) {
748
+			?>
749 749
             <div id="espresso-thank-you-page-ajax-content-dv">
750 750
                 <div id="espresso-thank-you-page-ajax-transaction-dv"></div>
751 751
                 <div id="espresso-thank-you-page-ajax-payment-dv"></div>
752 752
                 <div id="espresso-thank-you-page-ajax-loading-dv">
753 753
                     <div id="ee-ajax-loading-dv" class="float-left lt-blue-text">
754 754
                         <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e(
755
-                                'loading transaction and payment information...',
756
-                                'event_espresso'
757
-                            ); ?></span>
755
+								'loading transaction and payment information...',
756
+								'event_espresso'
757
+							); ?></span>
758 758
                     </div>
759 759
                     <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?>
760 760
                         <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear">
761 761
                             <?php echo apply_filters(
762
-                                'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg',
763
-                                __(
764
-                                    '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.',
765
-                                    'event_espresso'
766
-                                )
767
-                            ); ?>
762
+								'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg',
763
+								__(
764
+									'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.',
765
+									'event_espresso'
766
+								)
767
+							); ?>
768 768
                             <br/>
769 769
                             <span class="jst-rght ee-block small-text lt-grey-text">
770 770
 								<?php _e('current wait time ', 'event_espresso'); ?>
@@ -775,120 +775,120 @@  discard block
 block discarded – undo
775 775
                 <div class="clear"></div>
776 776
             </div>
777 777
             <?php
778
-        }
779
-    }
778
+		}
779
+	}
780 780
 
781 781
 
782 782
 
783
-    /**
784
-     * display_details_for_events_requiring_pre_approval
785
-     *
786
-     * @param EE_Event[] $events
787
-     * @return void
788
-     */
789
-    public function display_details_for_events_requiring_pre_approval($events = array())
790
-    {
791
-        if ( ! empty($events)) {
792
-            ?>
783
+	/**
784
+	 * display_details_for_events_requiring_pre_approval
785
+	 *
786
+	 * @param EE_Event[] $events
787
+	 * @return void
788
+	 */
789
+	public function display_details_for_events_requiring_pre_approval($events = array())
790
+	{
791
+		if ( ! empty($events)) {
792
+			?>
793 793
             <div id="espresso-thank-you-page-not-approved-message-dv">
794 794
                 <h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4>
795 795
                 <p id="events-requiring-pre-approval-pg" class="small-text">
796 796
                     <?php echo apply_filters(
797
-                        'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message',
798
-                        __(
799
-                            '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.',
800
-                            'event_espresso'
801
-                        )
802
-                    ); ?>
797
+						'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message',
798
+						__(
799
+							'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.',
800
+							'event_espresso'
801
+						)
802
+					); ?>
803 803
                 </p>
804 804
                 <ul class="events-requiring-pre-approval-ul">
805 805
                     <?php foreach ($events as $event) {
806
-                        if ($event instanceof EE_Event) {
807
-                            echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>',
808
-                            $event->name(),
809
-                            '</li>';
810
-                        }
811
-                    } ?>
806
+						if ($event instanceof EE_Event) {
807
+							echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>',
808
+							$event->name(),
809
+							'</li>';
810
+						}
811
+					} ?>
812 812
                 </ul>
813 813
                 <div class="clear"></div>
814 814
             </div>
815 815
             <?php
816
-        }
817
-    }
818
-
819
-
820
-
821
-    /**
822
-     * get_transaction_details
823
-     *
824
-     * @return string
825
-     * @throws \EE_Error
826
-     */
827
-    public function get_transaction_details()
828
-    {
829
-        //prepare variables for displaying
830
-        $template_args = array();
831
-        $template_args['transaction'] = $this->_current_txn;
832
-        $template_args['reg_url_link'] = $this->_reg_url_link;
833
-        $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true);
834
-        // link to SPCO payment_options
835
-        $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
836
-        $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
837
-        // verify template arguments
838
-        EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
839
-        EEH_Template_Validator::verify_isnt_null(
840
-            $template_args['show_try_pay_again_link'],
841
-            '$show_try_pay_again_link'
842
-        );
843
-        EEH_Template_Validator::verify_isnt_null(
844
-            $template_args['SPCO_payment_options_url'],
845
-            '$SPCO_payment_options_url'
846
-        );
847
-        return EEH_Template::locate_template(
848
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php',
849
-            $template_args,
850
-            true,
851
-            true
852
-        );
853
-    }
854
-
855
-
856
-
857
-    /**
858
-     * get_payment_row_html
859
-     *
860
-     * @param EE_Payment $payment
861
-     * @return string
862
-     * @throws \EE_Error
863
-     */
864
-    public function get_payment_row_html($payment = null)
865
-    {
866
-        $html = '';
867
-        if ($payment instanceof EE_Payment) {
868
-            if (
869
-                $payment->payment_method() instanceof EE_Payment_Method
870
-                && $payment->status() === EEM_Payment::status_id_failed
871
-                && $payment->payment_method()->is_off_site()
872
-            ) {
873
-                // considering the registrant has made it to the Thank You page,
874
-                // any failed payments may actually be pending and the IPN is just slow
875
-                // so let's
876
-                $payment->set_status(EEM_Payment::status_id_pending);
877
-            }
878
-            $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined
879
-                ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>'
880
-                : '';
881
-            $html .= '
816
+		}
817
+	}
818
+
819
+
820
+
821
+	/**
822
+	 * get_transaction_details
823
+	 *
824
+	 * @return string
825
+	 * @throws \EE_Error
826
+	 */
827
+	public function get_transaction_details()
828
+	{
829
+		//prepare variables for displaying
830
+		$template_args = array();
831
+		$template_args['transaction'] = $this->_current_txn;
832
+		$template_args['reg_url_link'] = $this->_reg_url_link;
833
+		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true);
834
+		// link to SPCO payment_options
835
+		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
836
+		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
837
+		// verify template arguments
838
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
839
+		EEH_Template_Validator::verify_isnt_null(
840
+			$template_args['show_try_pay_again_link'],
841
+			'$show_try_pay_again_link'
842
+		);
843
+		EEH_Template_Validator::verify_isnt_null(
844
+			$template_args['SPCO_payment_options_url'],
845
+			'$SPCO_payment_options_url'
846
+		);
847
+		return EEH_Template::locate_template(
848
+			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php',
849
+			$template_args,
850
+			true,
851
+			true
852
+		);
853
+	}
854
+
855
+
856
+
857
+	/**
858
+	 * get_payment_row_html
859
+	 *
860
+	 * @param EE_Payment $payment
861
+	 * @return string
862
+	 * @throws \EE_Error
863
+	 */
864
+	public function get_payment_row_html($payment = null)
865
+	{
866
+		$html = '';
867
+		if ($payment instanceof EE_Payment) {
868
+			if (
869
+				$payment->payment_method() instanceof EE_Payment_Method
870
+				&& $payment->status() === EEM_Payment::status_id_failed
871
+				&& $payment->payment_method()->is_off_site()
872
+			) {
873
+				// considering the registrant has made it to the Thank You page,
874
+				// any failed payments may actually be pending and the IPN is just slow
875
+				// so let's
876
+				$payment->set_status(EEM_Payment::status_id_pending);
877
+			}
878
+			$payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined
879
+				? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>'
880
+				: '';
881
+			$html .= '
882 882
 				<tr>
883 883
 					<td>
884 884
 						' . $payment->timestamp() . '
885 885
 					</td>
886 886
 					<td>
887 887
 						' . (
888
-                $payment->payment_method() instanceof EE_Payment_Method
889
-                    ? $payment->payment_method()->name()
890
-                    : __('Unknown', 'event_espresso')
891
-                ) . '
888
+				$payment->payment_method() instanceof EE_Payment_Method
889
+					? $payment->payment_method()->name()
890
+					: __('Unknown', 'event_espresso')
891
+				) . '
892 892
 					</td>
893 893
 					<td class="jst-rght">
894 894
 						' . EEH_Template::format_currency($payment->amount()) . '
@@ -897,87 +897,87 @@  discard block
 block discarded – undo
897 897
 						' . $payment->pretty_status(true) . $payment_declined_msg . '
898 898
 					</td>
899 899
 				</tr>';
900
-            do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
901
-        }
902
-        return $html;
903
-    }
904
-
905
-
906
-
907
-    /**
908
-     * get_payment_details
909
-     *
910
-     * @param array $payments
911
-     * @return string
912
-     * @throws \EE_Error
913
-     */
914
-    public function get_payment_details($payments = array())
915
-    {
916
-        //prepare variables for displaying
917
-        $template_args = array();
918
-        $template_args['transaction'] = $this->_current_txn;
919
-        $template_args['reg_url_link'] = $this->_reg_url_link;
920
-        $template_args['payments'] = array();
921
-        foreach ($payments as $payment) {
922
-            $template_args['payments'][] = $this->get_payment_row_html($payment);
923
-        }
924
-        //create a hacky payment object, but dont save it
925
-        $payment = EE_Payment::new_instance(
926
-            array(
927
-                'TXN_ID'        => $this->_current_txn->ID(),
928
-                'STS_ID'        => EEM_Payment::status_id_pending,
929
-                'PAY_timestamp' => time(),
930
-                'PAY_amount'    => $this->_current_txn->total(),
931
-                'PMD_ID'        => $this->_current_txn->payment_method_ID()
932
-            )
933
-        );
934
-        $payment_method = $this->_current_txn->payment_method();
935
-        if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
936
-            $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
937
-        } else {
938
-            $template_args['gateway_content'] = '';
939
-        }
940
-        // link to SPCO payment_options
941
-        $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
942
-        $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
943
-        // verify template arguments
944
-        EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
945
-        EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
946
-        EEH_Template_Validator::verify_isnt_null(
947
-            $template_args['show_try_pay_again_link'],
948
-            '$show_try_pay_again_link'
949
-        );
950
-        EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
951
-        EEH_Template_Validator::verify_isnt_null(
952
-            $template_args['SPCO_payment_options_url'],
953
-            '$SPCO_payment_options_url'
954
-        );
955
-        return EEH_Template::locate_template(
956
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php',
957
-            $template_args,
958
-            true,
959
-            true
960
-        );
961
-    }
962
-
963
-
964
-
965
-    /**
966
-     * get_payment_details
967
-     *
968
-     * @param array $payments
969
-     * @return string
970
-     * @throws \EE_Error
971
-     */
972
-    public function get_new_payments($payments = array())
973
-    {
974
-        $payments_html = '';
975
-        //prepare variables for displaying
976
-        foreach ($payments as $payment) {
977
-            $payments_html .= $this->get_payment_row_html($payment);
978
-        }
979
-        return $payments_html;
980
-    }
900
+			do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
901
+		}
902
+		return $html;
903
+	}
904
+
905
+
906
+
907
+	/**
908
+	 * get_payment_details
909
+	 *
910
+	 * @param array $payments
911
+	 * @return string
912
+	 * @throws \EE_Error
913
+	 */
914
+	public function get_payment_details($payments = array())
915
+	{
916
+		//prepare variables for displaying
917
+		$template_args = array();
918
+		$template_args['transaction'] = $this->_current_txn;
919
+		$template_args['reg_url_link'] = $this->_reg_url_link;
920
+		$template_args['payments'] = array();
921
+		foreach ($payments as $payment) {
922
+			$template_args['payments'][] = $this->get_payment_row_html($payment);
923
+		}
924
+		//create a hacky payment object, but dont save it
925
+		$payment = EE_Payment::new_instance(
926
+			array(
927
+				'TXN_ID'        => $this->_current_txn->ID(),
928
+				'STS_ID'        => EEM_Payment::status_id_pending,
929
+				'PAY_timestamp' => time(),
930
+				'PAY_amount'    => $this->_current_txn->total(),
931
+				'PMD_ID'        => $this->_current_txn->payment_method_ID()
932
+			)
933
+		);
934
+		$payment_method = $this->_current_txn->payment_method();
935
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
936
+			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
937
+		} else {
938
+			$template_args['gateway_content'] = '';
939
+		}
940
+		// link to SPCO payment_options
941
+		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
942
+		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
943
+		// verify template arguments
944
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
945
+		EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
946
+		EEH_Template_Validator::verify_isnt_null(
947
+			$template_args['show_try_pay_again_link'],
948
+			'$show_try_pay_again_link'
949
+		);
950
+		EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
951
+		EEH_Template_Validator::verify_isnt_null(
952
+			$template_args['SPCO_payment_options_url'],
953
+			'$SPCO_payment_options_url'
954
+		);
955
+		return EEH_Template::locate_template(
956
+			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php',
957
+			$template_args,
958
+			true,
959
+			true
960
+		);
961
+	}
962
+
963
+
964
+
965
+	/**
966
+	 * get_payment_details
967
+	 *
968
+	 * @param array $payments
969
+	 * @return string
970
+	 * @throws \EE_Error
971
+	 */
972
+	public function get_new_payments($payments = array())
973
+	{
974
+		$payments_html = '';
975
+		//prepare variables for displaying
976
+		foreach ($payments as $payment) {
977
+			$payments_html .= $this->get_payment_row_html($payment);
978
+		}
979
+		return $payments_html;
980
+	}
981 981
 
982 982
 
983 983
 }
Please login to merge, or discard this patch.
core/domain/entities/shortcodes/EspressoThankYou.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -20,75 +20,75 @@
 block discarded – undo
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
-        $this->shortcodeHasBeenInitialized();
73
-    }
74
-
75
-
76
-
77
-    /**
78
-     * callback that runs when the shortcode is encountered in post content.
79
-     * IMPORTANT !!!
80
-     * remember that shortcode content should be RETURNED and NOT echoed out
81
-     *
82
-     * @param array $attributes
83
-     * @return string
84
-     * @throws \EE_Error
85
-     */
86
-    public function processShortcode($attributes = array())
87
-    {
88
-        return $this->is_thank_you_page
89
-            ? \EED_Thank_You_Page::instance()->thank_you_page_results()
90
-            : '';
91
-    }
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
+		$this->shortcodeHasBeenInitialized();
73
+	}
74
+
75
+
76
+
77
+	/**
78
+	 * callback that runs when the shortcode is encountered in post content.
79
+	 * IMPORTANT !!!
80
+	 * remember that shortcode content should be RETURNED and NOT echoed out
81
+	 *
82
+	 * @param array $attributes
83
+	 * @return string
84
+	 * @throws \EE_Error
85
+	 */
86
+	public function processShortcode($attributes = array())
87
+	{
88
+		return $this->is_thank_you_page
89
+			? \EED_Thank_You_Page::instance()->thank_you_page_results()
90
+			: '';
91
+	}
92 92
 
93 93
 
94 94
 
Please login to merge, or discard this patch.
core/domain/services/capabilities/CapCheck.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
 
40 40
     /**
41
-     * @param string|array $capability   - the capability to be checked, like: 'ee_edit_registrations',
41
+     * @param string $capability   - the capability to be checked, like: 'ee_edit_registrations',
42 42
      *                                   or an array of capability strings
43 43
      * @param string       $context      - what the user is attempting to do, like: 'Edit Registration'
44 44
      * @param int          $ID           - (optional) ID for item where current_user_can is being called from
Please login to merge, or discard this patch.
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\exceptions\InvalidDataTypeException;
5 5
 
6 6
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
-    exit('No direct script access allowed');
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -20,72 +20,72 @@  discard block
 block discarded – undo
20 20
 class CapCheck implements CapCheckInterface
21 21
 {
22 22
 
23
-    /**
24
-     * @var string|array $capability
25
-     */
26
-    private $capability;
27
-
28
-    /**
29
-     * @var string $context
30
-     */
31
-    private $context;
32
-
33
-    /**
34
-     * @var int|string $ID
35
-     */
36
-    private $ID;
37
-
38
-
39
-
40
-    /**
41
-     * @param string|array $capability   - the capability to be checked, like: 'ee_edit_registrations',
42
-     *                                   or an array of capability strings
43
-     * @param string       $context      - what the user is attempting to do, like: 'Edit Registration'
44
-     * @param int          $ID           - (optional) ID for item where current_user_can is being called from
45
-     * @throws InvalidDataTypeException
46
-     */
47
-    public function __construct($capability, $context, $ID = 0)
48
-    {
49
-        if ( ! is_string($capability)) {
50
-            throw new InvalidDataTypeException('$capability', $capability, 'string');
51
-        }
52
-        if ( ! is_string($context)) {
53
-            throw new InvalidDataTypeException('$context', $context, 'string');
54
-        }
55
-        $this->capability = $capability;
56
-        $this->context = strtolower(str_replace(' ', '_', $context));
57
-        $this->ID = $ID;
58
-    }
59
-
60
-
61
-
62
-    /**
63
-     * @return string|array
64
-     */
65
-    public function capability()
66
-    {
67
-        return $this->capability;
68
-    }
69
-
70
-
71
-
72
-    /**
73
-     * @return string
74
-     */
75
-    public function context()
76
-    {
77
-        return $this->context;
78
-    }
79
-
80
-
81
-
82
-    /**
83
-     * @return int|string
84
-     */
85
-    public function ID()
86
-    {
87
-        return $this->ID;
88
-    }
23
+	/**
24
+	 * @var string|array $capability
25
+	 */
26
+	private $capability;
27
+
28
+	/**
29
+	 * @var string $context
30
+	 */
31
+	private $context;
32
+
33
+	/**
34
+	 * @var int|string $ID
35
+	 */
36
+	private $ID;
37
+
38
+
39
+
40
+	/**
41
+	 * @param string|array $capability   - the capability to be checked, like: 'ee_edit_registrations',
42
+	 *                                   or an array of capability strings
43
+	 * @param string       $context      - what the user is attempting to do, like: 'Edit Registration'
44
+	 * @param int          $ID           - (optional) ID for item where current_user_can is being called from
45
+	 * @throws InvalidDataTypeException
46
+	 */
47
+	public function __construct($capability, $context, $ID = 0)
48
+	{
49
+		if ( ! is_string($capability)) {
50
+			throw new InvalidDataTypeException('$capability', $capability, 'string');
51
+		}
52
+		if ( ! is_string($context)) {
53
+			throw new InvalidDataTypeException('$context', $context, 'string');
54
+		}
55
+		$this->capability = $capability;
56
+		$this->context = strtolower(str_replace(' ', '_', $context));
57
+		$this->ID = $ID;
58
+	}
59
+
60
+
61
+
62
+	/**
63
+	 * @return string|array
64
+	 */
65
+	public function capability()
66
+	{
67
+		return $this->capability;
68
+	}
69
+
70
+
71
+
72
+	/**
73
+	 * @return string
74
+	 */
75
+	public function context()
76
+	{
77
+		return $this->context;
78
+	}
79
+
80
+
81
+
82
+	/**
83
+	 * @return int|string
84
+	 */
85
+	public function ID()
86
+	{
87
+		return $this->ID;
88
+	}
89 89
 
90 90
 
91 91
 }
Please login to merge, or discard this patch.
core/services/collections/CollectionLoader.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 			);
200 200
 			return CollectionLoader::ENTITY_ADDED;
201 201
 		}
202
-        do_action(
203
-            'FHEE__CollectionLoader__addEntityToCollection__entity_not_added',
204
-            $this,
205
-            $this->collection_details->collectionName(),
206
-            $this->collection_details
207
-        );
208
-        return CollectionLoader::ENTITY_NOT_ADDED;
202
+		do_action(
203
+			'FHEE__CollectionLoader__addEntityToCollection__entity_not_added',
204
+			$this,
205
+			$this->collection_details->collectionName(),
206
+			$this->collection_details
207
+		);
208
+		return CollectionLoader::ENTITY_NOT_ADDED;
209 209
 	}
210 210
 
211 211
 
@@ -220,37 +220,37 @@  discard block
 block discarded – undo
220 220
 	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
221 221
 	 */
222 222
 	protected function setIdentifier( $entity, $identifier ) {
223
-	    switch($this->collection_details->identifierType()) {
224
-	        // every unique object gets added to the collection, but not duplicates of the exact same object
225
-            case CollectionDetails::ID_OBJECT_HASH :
226
-                $identifier = spl_object_hash($entity);
227
-                break;
228
-            // only one entity per class can be added to collection, like a singleton
229
-            case CollectionDetails::ID_CLASS_NAME :
230
-                $identifier = get_class($entity);
231
-                break;
232
-            // objects added to the collection based on entity callback, so the entity itself decides
233
-            case CollectionDetails::ID_CALLBACK_METHOD :
234
-                $identifier_callback = $this->collection_details->identifierCallback();
235
-                if ( ! method_exists($entity, $identifier_callback)) {
236
-                    throw new InvalidEntityException(
237
-                        $entity,
238
-                        $this->collection_details->getCollectionInterface(),
239
-                        sprintf(
240
-                            __(
241
-                                'The current collection is configured to use a method named "%1$s" when setting or retrieving objects. The supplied entity is an instance
223
+		switch($this->collection_details->identifierType()) {
224
+			// every unique object gets added to the collection, but not duplicates of the exact same object
225
+			case CollectionDetails::ID_OBJECT_HASH :
226
+				$identifier = spl_object_hash($entity);
227
+				break;
228
+			// only one entity per class can be added to collection, like a singleton
229
+			case CollectionDetails::ID_CLASS_NAME :
230
+				$identifier = get_class($entity);
231
+				break;
232
+			// objects added to the collection based on entity callback, so the entity itself decides
233
+			case CollectionDetails::ID_CALLBACK_METHOD :
234
+				$identifier_callback = $this->collection_details->identifierCallback();
235
+				if ( ! method_exists($entity, $identifier_callback)) {
236
+					throw new InvalidEntityException(
237
+						$entity,
238
+						$this->collection_details->getCollectionInterface(),
239
+						sprintf(
240
+							__(
241
+								'The current collection is configured to use a method named "%1$s" when setting or retrieving objects. The supplied entity is an instance
242 242
                                 of "%2$s", but does not contain this method.',
243
-                                'event_espresso'
244
-                            ),
245
-                            $identifier_callback,
246
-                            get_class($entity)
247
-                        )
248
-                    );
249
-                }
250
-                $identifier = $entity->{$identifier_callback}();
251
-                break;
252
-
253
-        }
243
+								'event_espresso'
244
+							),
245
+							$identifier_callback,
246
+							get_class($entity)
247
+						)
248
+					);
249
+				}
250
+				$identifier = $entity->{$identifier_callback}();
251
+				break;
252
+
253
+		}
254 254
 		return apply_filters(
255 255
 			'FHEE__CollectionLoader__addEntityToCollection__identifier',
256 256
 			$identifier,
Please login to merge, or discard this patch.