@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | <div class="ticket-time-and-place-details"> |
25 | 25 | <div class="ticket-time-details"> |
26 | 26 | <h4 class="sub-section-title no-bottom-margin"> |
27 | - <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'clock-16x16.png'); ?>"> |
|
27 | + <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'clock-16x16.png'); ?>"> |
|
28 | 28 | <?php esc_html_e('Date/Time:', 'event_espresso'); ?> |
29 | 29 | </h4> |
30 | 30 | <ul class="event-dates">[DATETIME_LIST]</ul> |
31 | 31 | </div> |
32 | 32 | <div class="ticket-place-details"> |
33 | 33 | <h4 class="sub-section-title no-bottom-margin"> |
34 | - <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'location-pin-16x16.png'); ?>"> |
|
34 | + <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'location-pin-16x16.png'); ?>"> |
|
35 | 35 | <?php esc_html_e('Venue', 'event_espresso'); ?> |
36 | 36 | </h4> |
37 | 37 | <ul class="event-venues"> |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | </div> |
46 | 46 | <div class="ticket-registrations-area"> |
47 | 47 | <h4 class="sub-section-title"> |
48 | - <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'users-16x16.png'); ?>"> |
|
48 | + <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'users-16x16.png'); ?>"> |
|
49 | 49 | <?php esc_html_e("Registration Details", "event_espresso"); ?> |
50 | 50 | <span class="small-text link"> |
51 | 51 | ( <a class="print_button noPrint" href="[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]"> |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | ?> |
8 | 8 | <h3 class="section-title event-name"> |
9 | - <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'calendar_year-24x24.png'); ?>"> |
|
9 | + <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'calendar_year-24x24.png'); ?>"> |
|
10 | 10 | <?php esc_html_e("Event Name:", "event_espresso") ?> |
11 | 11 | <span class="plain-text">[EVENT_NAME]</span> |
12 | 12 | <span class="small-text link"> |
@@ -8,11 +8,11 @@ |
||
8 | 8 | <li class="ticket-registration"> |
9 | 9 | <table class="registration-details"> |
10 | 10 | <tr class="odd"> |
11 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
11 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
12 | 12 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
13 | 13 | </tr> |
14 | 14 | <tr> |
15 | - <th><?php esc_html_e("Registration Code:", "event_espresso");?></th> |
|
15 | + <th><?php esc_html_e("Registration Code:", "event_espresso"); ?></th> |
|
16 | 16 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
17 | 17 | </tr> |
18 | 18 | </table> |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public static function instance() |
60 | 60 | { |
61 | 61 | // check if class object is instantiated |
62 | - if (! self::$_instance instanceof EE_Maintenance_Mode) { |
|
62 | + if ( ! self::$_instance instanceof EE_Maintenance_Mode) { |
|
63 | 63 | self::$_instance = new self(); |
64 | 64 | } |
65 | 65 | return self::$_instance; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public static function disable_frontend_for_maintenance() |
186 | 186 | { |
187 | - return (! is_admin() && EE_Maintenance_Mode::instance()->level()); |
|
187 | + return ( ! is_admin() && EE_Maintenance_Mode::instance()->level()); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | ) { |
200 | 200 | wp_register_style( |
201 | 201 | 'espresso_default', |
202 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
202 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', |
|
203 | 203 | ['dashicons'], |
204 | 204 | EVENT_ESPRESSO_VERSION |
205 | 205 | ); |
206 | 206 | wp_enqueue_style('espresso_default'); |
207 | 207 | wp_register_script( |
208 | 208 | 'espresso_core', |
209 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', |
|
209 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', |
|
210 | 210 | ['jquery'], |
211 | 211 | EVENT_ESPRESSO_VERSION, |
212 | 212 | true |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | public static function template_include() |
227 | 227 | { |
228 | 228 | // shut 'er down for maintenance ? then don't use any of our templates for our endpoints |
229 | - return get_template_directory() . '/index.php'; |
|
229 | + return get_template_directory().'/index.php'; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | ), |
279 | 279 | '<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="', |
280 | 280 | '"><span class="dashicons dashicons-no"></span></a><p>', |
281 | - ' » <a href="' . add_query_arg( |
|
281 | + ' » <a href="'.add_query_arg( |
|
282 | 282 | ['page' => 'espresso_maintenance_settings'], |
283 | 283 | admin_url('admin.php') |
284 | - ) . '">', |
|
284 | + ).'">', |
|
285 | 285 | '</a></p></div>' |
286 | 286 | ); |
287 | 287 | } |
@@ -15,340 +15,340 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_Maintenance_Mode implements ResettableInterface |
17 | 17 | { |
18 | - /** |
|
19 | - * constants available to client code for interpreting the values of EE_Maintenance_Mode::level(). |
|
20 | - * level_0_not_in_maintenance means the site is NOT in maintenance mode (so everything's normal) |
|
21 | - */ |
|
22 | - const level_0_not_in_maintenance = 0; |
|
23 | - |
|
24 | - /** |
|
25 | - * level_1_frontend_only_maintenance means that the site's frontend EE code should be completely disabled |
|
26 | - * but the admin backend should be running as normal. Maybe an admin can view the frontend though |
|
27 | - */ |
|
28 | - const level_1_frontend_only_maintenance = 1; |
|
29 | - |
|
30 | - /** |
|
31 | - * level_2_complete_maintenance means the frontend AND EE backend code are disabled. The only system running |
|
32 | - * is the maintenance mode stuff, which will require users to update all addons, and then finish running all |
|
33 | - * migration scripts before taking the site out of maintenance mode |
|
34 | - */ |
|
35 | - const level_2_complete_maintenance = 2; |
|
36 | - |
|
37 | - /** |
|
38 | - * the name of the option which stores the current level of maintenance mode |
|
39 | - */ |
|
40 | - const option_name_maintenance_mode = 'ee_maintenance_mode'; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @var EE_Maintenance_Mode $_instance |
|
45 | - */ |
|
46 | - private static $_instance; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var EE_Registry $EE |
|
50 | - */ |
|
51 | - protected $EE; |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @singleton method used to instantiate class object |
|
56 | - * @return EE_Maintenance_Mode |
|
57 | - */ |
|
58 | - public static function instance() |
|
59 | - { |
|
60 | - // check if class object is instantiated |
|
61 | - if (! self::$_instance instanceof EE_Maintenance_Mode) { |
|
62 | - self::$_instance = new self(); |
|
63 | - } |
|
64 | - return self::$_instance; |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * Resets maintenance mode (mostly just re-checks whether we should be in maintenance mode) |
|
70 | - * |
|
71 | - * @return EE_Maintenance_Mode |
|
72 | - * @throws EE_Error |
|
73 | - */ |
|
74 | - public static function reset() |
|
75 | - { |
|
76 | - self::instance()->set_maintenance_mode_if_db_old(); |
|
77 | - return self::instance(); |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - *private constructor to prevent direct creation |
|
83 | - */ |
|
84 | - private function __construct() |
|
85 | - { |
|
86 | - // if M-Mode level 2 is engaged, we still need basic assets loaded |
|
87 | - add_action('wp_enqueue_scripts', [$this, 'load_assets_required_for_m_mode']); |
|
88 | - // shut 'er down for maintenance ? |
|
89 | - add_filter('the_content', [$this, 'the_content'], 2); |
|
90 | - // add powered by EE msg |
|
91 | - add_action('shutdown', [$this, 'display_maintenance_mode_notice'], 10); |
|
92 | - } |
|
93 | - |
|
94 | - |
|
95 | - /** |
|
96 | - * retrieves the maintenance mode option value from the db |
|
97 | - * |
|
98 | - * @return int |
|
99 | - */ |
|
100 | - public function real_level() |
|
101 | - { |
|
102 | - return (int) get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * Returns whether the models reportedly are able to run queries or not |
|
108 | - * (ie, if the system thinks their tables are present and up-to-date). |
|
109 | - * |
|
110 | - * @return boolean |
|
111 | - */ |
|
112 | - public function models_can_query() |
|
113 | - { |
|
114 | - return $this->real_level() !== EE_Maintenance_Mode::level_2_complete_maintenance; |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * Determines whether we're in maintenance mode and what level. However, while the site |
|
120 | - * is in level 1 maintenance, and an admin visits the frontend, this function makes it appear |
|
121 | - * to them as if teh site isn't in maintenance mode. |
|
122 | - * EE_Maintenance_Mode::level_0_not_in_maintenance => not in maintenance mode (in normal mode) |
|
123 | - * EE_Maintenance_Mode::level_1_frontend_only_maintenance=> frontend-only maintenance mode |
|
124 | - * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode |
|
125 | - * |
|
126 | - * @return int |
|
127 | - */ |
|
128 | - public function level() |
|
129 | - { |
|
130 | - $maintenance_mode_level = $this->real_level(); |
|
131 | - // if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend |
|
132 | - if ( |
|
133 | - $maintenance_mode_level === EE_Maintenance_Mode::level_1_frontend_only_maintenance// we're in level 1 |
|
134 | - && ((defined('DOING_AJAX') && DOING_AJAX) || ! is_admin()) // on non-ajax frontend requests |
|
135 | - && current_user_can('administrator') // when the user is an admin |
|
136 | - ) { |
|
137 | - $maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance; |
|
138 | - } |
|
139 | - return $maintenance_mode_level; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * Determines if we need to put EE in maintenance mode because the database needs updating |
|
145 | - * |
|
146 | - * @return boolean true if DB is old and maintenance mode was triggered; false otherwise |
|
147 | - * @throws EE_Error |
|
148 | - */ |
|
149 | - public function set_maintenance_mode_if_db_old() |
|
150 | - { |
|
151 | - LoaderFactory::getLoader()->getShared('Data_Migration_Manager'); |
|
152 | - if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
153 | - update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance); |
|
154 | - return true; |
|
155 | - } |
|
156 | - if ($this->level() === self::level_2_complete_maintenance) { |
|
157 | - // we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run |
|
158 | - // then we shouldn't be in mm2. (Maybe an addon got deactivated?) |
|
159 | - update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance); |
|
160 | - return false; |
|
161 | - } |
|
162 | - return false; |
|
163 | - } |
|
164 | - |
|
165 | - |
|
166 | - /** |
|
167 | - * Updates the maintenance level on the site |
|
168 | - * |
|
169 | - * @param int $level |
|
170 | - * @return void |
|
171 | - */ |
|
172 | - public function set_maintenance_level($level) |
|
173 | - { |
|
174 | - do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level); |
|
175 | - update_option(self::option_name_maintenance_mode, (int) $level); |
|
176 | - } |
|
177 | - |
|
178 | - |
|
179 | - /** |
|
180 | - * returns TRUE if M-Mode is engaged and the current request is not for the admin |
|
181 | - * |
|
182 | - * @return bool |
|
183 | - */ |
|
184 | - public static function disable_frontend_for_maintenance() |
|
185 | - { |
|
186 | - return (! is_admin() && EE_Maintenance_Mode::instance()->level()); |
|
187 | - } |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * @return void |
|
192 | - */ |
|
193 | - public function load_assets_required_for_m_mode() |
|
194 | - { |
|
195 | - if ( |
|
196 | - $this->real_level() === EE_Maintenance_Mode::level_2_complete_maintenance |
|
197 | - && ! wp_script_is('espresso_core') |
|
198 | - ) { |
|
199 | - wp_register_style( |
|
200 | - 'espresso_default', |
|
201 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
202 | - ['dashicons'], |
|
203 | - EVENT_ESPRESSO_VERSION |
|
204 | - ); |
|
205 | - wp_enqueue_style('espresso_default'); |
|
206 | - wp_register_script( |
|
207 | - 'espresso_core', |
|
208 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', |
|
209 | - ['jquery'], |
|
210 | - EVENT_ESPRESSO_VERSION, |
|
211 | - true |
|
212 | - ); |
|
213 | - wp_enqueue_script('espresso_core'); |
|
214 | - } |
|
215 | - } |
|
216 | - |
|
217 | - |
|
218 | - /** |
|
219 | - * replacement EE CPT template that displays message notifying site visitors |
|
220 | - * that EE has been temporarily placed into maintenance mode |
|
221 | - * does NOT get called on non-EE-CPT requests |
|
222 | - * |
|
223 | - * @return string |
|
224 | - */ |
|
225 | - public static function template_include() |
|
226 | - { |
|
227 | - // shut 'er down for maintenance ? then don't use any of our templates for our endpoints |
|
228 | - return get_template_directory() . '/index.php'; |
|
229 | - } |
|
230 | - |
|
231 | - |
|
232 | - /** |
|
233 | - * displays message notifying site visitors that EE has been temporarily |
|
234 | - * placed into maintenance mode when post_type != EE CPT |
|
235 | - * |
|
236 | - * @param string $the_content |
|
237 | - * @return string |
|
238 | - */ |
|
239 | - public function the_content($the_content) |
|
240 | - { |
|
241 | - // check if M-mode is engaged and for EE shortcode |
|
242 | - if ($this->level() && strpos($the_content, '[ESPRESSO_') !== false) { |
|
243 | - // this can eventually be moved to a template, or edited via admin. But for now... |
|
244 | - $the_content = sprintf( |
|
245 | - esc_html__( |
|
246 | - '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', |
|
247 | - 'event_espresso' |
|
248 | - ), |
|
249 | - '<h3>', |
|
250 | - '</h3><p>', |
|
251 | - '</p>' |
|
252 | - ); |
|
253 | - } |
|
254 | - return $the_content; |
|
255 | - } |
|
256 | - |
|
257 | - |
|
258 | - /** |
|
259 | - * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode |
|
260 | - */ |
|
261 | - public function display_maintenance_mode_notice() |
|
262 | - { |
|
263 | - /** @var CurrentPage $current_page */ |
|
264 | - $current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class); |
|
265 | - // check if M-mode is engaged and for EE shortcode |
|
266 | - if ( |
|
267 | - ! (defined('DOING_AJAX') && DOING_AJAX) |
|
268 | - && $this->real_level() |
|
269 | - && ! is_admin() |
|
270 | - && current_user_can('administrator') |
|
271 | - && $current_page->isEspressoPage() |
|
272 | - ) { |
|
273 | - printf( |
|
274 | - esc_html__( |
|
275 | - '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', |
|
276 | - 'event_espresso' |
|
277 | - ), |
|
278 | - '<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="', |
|
279 | - '"><span class="dashicons dashicons-no"></span></a><p>', |
|
280 | - ' » <a href="' . add_query_arg( |
|
281 | - ['page' => 'espresso_maintenance_settings'], |
|
282 | - admin_url('admin.php') |
|
283 | - ) . '">', |
|
284 | - '</a></p></div>' |
|
285 | - ); |
|
286 | - } |
|
287 | - } |
|
288 | - // espresso-notices important-notice ee-attention |
|
289 | - |
|
290 | - |
|
291 | - /** |
|
292 | - * override magic methods |
|
293 | - */ |
|
294 | - final public function __destruct() |
|
295 | - { |
|
296 | - } |
|
297 | - |
|
298 | - |
|
299 | - final public function __call($a, $b) |
|
300 | - { |
|
301 | - } |
|
302 | - |
|
303 | - |
|
304 | - final public function __get($a) |
|
305 | - { |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - final public function __set($a, $b) |
|
310 | - { |
|
311 | - } |
|
312 | - |
|
313 | - |
|
314 | - final public function __isset($a) |
|
315 | - { |
|
316 | - } |
|
317 | - |
|
318 | - |
|
319 | - final public function __unset($a) |
|
320 | - { |
|
321 | - } |
|
322 | - |
|
323 | - |
|
324 | - final public function __sleep() |
|
325 | - { |
|
326 | - return []; |
|
327 | - } |
|
328 | - |
|
329 | - |
|
330 | - final public function __wakeup() |
|
331 | - { |
|
332 | - } |
|
333 | - |
|
334 | - |
|
335 | - final public function __invoke() |
|
336 | - { |
|
337 | - } |
|
338 | - |
|
339 | - |
|
340 | - final public static function __set_state($a = null) |
|
341 | - { |
|
342 | - return EE_Maintenance_Mode::instance(); |
|
343 | - } |
|
344 | - |
|
345 | - |
|
346 | - final public function __clone() |
|
347 | - { |
|
348 | - } |
|
18 | + /** |
|
19 | + * constants available to client code for interpreting the values of EE_Maintenance_Mode::level(). |
|
20 | + * level_0_not_in_maintenance means the site is NOT in maintenance mode (so everything's normal) |
|
21 | + */ |
|
22 | + const level_0_not_in_maintenance = 0; |
|
23 | + |
|
24 | + /** |
|
25 | + * level_1_frontend_only_maintenance means that the site's frontend EE code should be completely disabled |
|
26 | + * but the admin backend should be running as normal. Maybe an admin can view the frontend though |
|
27 | + */ |
|
28 | + const level_1_frontend_only_maintenance = 1; |
|
29 | + |
|
30 | + /** |
|
31 | + * level_2_complete_maintenance means the frontend AND EE backend code are disabled. The only system running |
|
32 | + * is the maintenance mode stuff, which will require users to update all addons, and then finish running all |
|
33 | + * migration scripts before taking the site out of maintenance mode |
|
34 | + */ |
|
35 | + const level_2_complete_maintenance = 2; |
|
36 | + |
|
37 | + /** |
|
38 | + * the name of the option which stores the current level of maintenance mode |
|
39 | + */ |
|
40 | + const option_name_maintenance_mode = 'ee_maintenance_mode'; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @var EE_Maintenance_Mode $_instance |
|
45 | + */ |
|
46 | + private static $_instance; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var EE_Registry $EE |
|
50 | + */ |
|
51 | + protected $EE; |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @singleton method used to instantiate class object |
|
56 | + * @return EE_Maintenance_Mode |
|
57 | + */ |
|
58 | + public static function instance() |
|
59 | + { |
|
60 | + // check if class object is instantiated |
|
61 | + if (! self::$_instance instanceof EE_Maintenance_Mode) { |
|
62 | + self::$_instance = new self(); |
|
63 | + } |
|
64 | + return self::$_instance; |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * Resets maintenance mode (mostly just re-checks whether we should be in maintenance mode) |
|
70 | + * |
|
71 | + * @return EE_Maintenance_Mode |
|
72 | + * @throws EE_Error |
|
73 | + */ |
|
74 | + public static function reset() |
|
75 | + { |
|
76 | + self::instance()->set_maintenance_mode_if_db_old(); |
|
77 | + return self::instance(); |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + *private constructor to prevent direct creation |
|
83 | + */ |
|
84 | + private function __construct() |
|
85 | + { |
|
86 | + // if M-Mode level 2 is engaged, we still need basic assets loaded |
|
87 | + add_action('wp_enqueue_scripts', [$this, 'load_assets_required_for_m_mode']); |
|
88 | + // shut 'er down for maintenance ? |
|
89 | + add_filter('the_content', [$this, 'the_content'], 2); |
|
90 | + // add powered by EE msg |
|
91 | + add_action('shutdown', [$this, 'display_maintenance_mode_notice'], 10); |
|
92 | + } |
|
93 | + |
|
94 | + |
|
95 | + /** |
|
96 | + * retrieves the maintenance mode option value from the db |
|
97 | + * |
|
98 | + * @return int |
|
99 | + */ |
|
100 | + public function real_level() |
|
101 | + { |
|
102 | + return (int) get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * Returns whether the models reportedly are able to run queries or not |
|
108 | + * (ie, if the system thinks their tables are present and up-to-date). |
|
109 | + * |
|
110 | + * @return boolean |
|
111 | + */ |
|
112 | + public function models_can_query() |
|
113 | + { |
|
114 | + return $this->real_level() !== EE_Maintenance_Mode::level_2_complete_maintenance; |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * Determines whether we're in maintenance mode and what level. However, while the site |
|
120 | + * is in level 1 maintenance, and an admin visits the frontend, this function makes it appear |
|
121 | + * to them as if teh site isn't in maintenance mode. |
|
122 | + * EE_Maintenance_Mode::level_0_not_in_maintenance => not in maintenance mode (in normal mode) |
|
123 | + * EE_Maintenance_Mode::level_1_frontend_only_maintenance=> frontend-only maintenance mode |
|
124 | + * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode |
|
125 | + * |
|
126 | + * @return int |
|
127 | + */ |
|
128 | + public function level() |
|
129 | + { |
|
130 | + $maintenance_mode_level = $this->real_level(); |
|
131 | + // if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend |
|
132 | + if ( |
|
133 | + $maintenance_mode_level === EE_Maintenance_Mode::level_1_frontend_only_maintenance// we're in level 1 |
|
134 | + && ((defined('DOING_AJAX') && DOING_AJAX) || ! is_admin()) // on non-ajax frontend requests |
|
135 | + && current_user_can('administrator') // when the user is an admin |
|
136 | + ) { |
|
137 | + $maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance; |
|
138 | + } |
|
139 | + return $maintenance_mode_level; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * Determines if we need to put EE in maintenance mode because the database needs updating |
|
145 | + * |
|
146 | + * @return boolean true if DB is old and maintenance mode was triggered; false otherwise |
|
147 | + * @throws EE_Error |
|
148 | + */ |
|
149 | + public function set_maintenance_mode_if_db_old() |
|
150 | + { |
|
151 | + LoaderFactory::getLoader()->getShared('Data_Migration_Manager'); |
|
152 | + if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
153 | + update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance); |
|
154 | + return true; |
|
155 | + } |
|
156 | + if ($this->level() === self::level_2_complete_maintenance) { |
|
157 | + // we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run |
|
158 | + // then we shouldn't be in mm2. (Maybe an addon got deactivated?) |
|
159 | + update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance); |
|
160 | + return false; |
|
161 | + } |
|
162 | + return false; |
|
163 | + } |
|
164 | + |
|
165 | + |
|
166 | + /** |
|
167 | + * Updates the maintenance level on the site |
|
168 | + * |
|
169 | + * @param int $level |
|
170 | + * @return void |
|
171 | + */ |
|
172 | + public function set_maintenance_level($level) |
|
173 | + { |
|
174 | + do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level); |
|
175 | + update_option(self::option_name_maintenance_mode, (int) $level); |
|
176 | + } |
|
177 | + |
|
178 | + |
|
179 | + /** |
|
180 | + * returns TRUE if M-Mode is engaged and the current request is not for the admin |
|
181 | + * |
|
182 | + * @return bool |
|
183 | + */ |
|
184 | + public static function disable_frontend_for_maintenance() |
|
185 | + { |
|
186 | + return (! is_admin() && EE_Maintenance_Mode::instance()->level()); |
|
187 | + } |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * @return void |
|
192 | + */ |
|
193 | + public function load_assets_required_for_m_mode() |
|
194 | + { |
|
195 | + if ( |
|
196 | + $this->real_level() === EE_Maintenance_Mode::level_2_complete_maintenance |
|
197 | + && ! wp_script_is('espresso_core') |
|
198 | + ) { |
|
199 | + wp_register_style( |
|
200 | + 'espresso_default', |
|
201 | + EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
202 | + ['dashicons'], |
|
203 | + EVENT_ESPRESSO_VERSION |
|
204 | + ); |
|
205 | + wp_enqueue_style('espresso_default'); |
|
206 | + wp_register_script( |
|
207 | + 'espresso_core', |
|
208 | + EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', |
|
209 | + ['jquery'], |
|
210 | + EVENT_ESPRESSO_VERSION, |
|
211 | + true |
|
212 | + ); |
|
213 | + wp_enqueue_script('espresso_core'); |
|
214 | + } |
|
215 | + } |
|
216 | + |
|
217 | + |
|
218 | + /** |
|
219 | + * replacement EE CPT template that displays message notifying site visitors |
|
220 | + * that EE has been temporarily placed into maintenance mode |
|
221 | + * does NOT get called on non-EE-CPT requests |
|
222 | + * |
|
223 | + * @return string |
|
224 | + */ |
|
225 | + public static function template_include() |
|
226 | + { |
|
227 | + // shut 'er down for maintenance ? then don't use any of our templates for our endpoints |
|
228 | + return get_template_directory() . '/index.php'; |
|
229 | + } |
|
230 | + |
|
231 | + |
|
232 | + /** |
|
233 | + * displays message notifying site visitors that EE has been temporarily |
|
234 | + * placed into maintenance mode when post_type != EE CPT |
|
235 | + * |
|
236 | + * @param string $the_content |
|
237 | + * @return string |
|
238 | + */ |
|
239 | + public function the_content($the_content) |
|
240 | + { |
|
241 | + // check if M-mode is engaged and for EE shortcode |
|
242 | + if ($this->level() && strpos($the_content, '[ESPRESSO_') !== false) { |
|
243 | + // this can eventually be moved to a template, or edited via admin. But for now... |
|
244 | + $the_content = sprintf( |
|
245 | + esc_html__( |
|
246 | + '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', |
|
247 | + 'event_espresso' |
|
248 | + ), |
|
249 | + '<h3>', |
|
250 | + '</h3><p>', |
|
251 | + '</p>' |
|
252 | + ); |
|
253 | + } |
|
254 | + return $the_content; |
|
255 | + } |
|
256 | + |
|
257 | + |
|
258 | + /** |
|
259 | + * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode |
|
260 | + */ |
|
261 | + public function display_maintenance_mode_notice() |
|
262 | + { |
|
263 | + /** @var CurrentPage $current_page */ |
|
264 | + $current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class); |
|
265 | + // check if M-mode is engaged and for EE shortcode |
|
266 | + if ( |
|
267 | + ! (defined('DOING_AJAX') && DOING_AJAX) |
|
268 | + && $this->real_level() |
|
269 | + && ! is_admin() |
|
270 | + && current_user_can('administrator') |
|
271 | + && $current_page->isEspressoPage() |
|
272 | + ) { |
|
273 | + printf( |
|
274 | + esc_html__( |
|
275 | + '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', |
|
276 | + 'event_espresso' |
|
277 | + ), |
|
278 | + '<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="', |
|
279 | + '"><span class="dashicons dashicons-no"></span></a><p>', |
|
280 | + ' » <a href="' . add_query_arg( |
|
281 | + ['page' => 'espresso_maintenance_settings'], |
|
282 | + admin_url('admin.php') |
|
283 | + ) . '">', |
|
284 | + '</a></p></div>' |
|
285 | + ); |
|
286 | + } |
|
287 | + } |
|
288 | + // espresso-notices important-notice ee-attention |
|
289 | + |
|
290 | + |
|
291 | + /** |
|
292 | + * override magic methods |
|
293 | + */ |
|
294 | + final public function __destruct() |
|
295 | + { |
|
296 | + } |
|
297 | + |
|
298 | + |
|
299 | + final public function __call($a, $b) |
|
300 | + { |
|
301 | + } |
|
302 | + |
|
303 | + |
|
304 | + final public function __get($a) |
|
305 | + { |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + final public function __set($a, $b) |
|
310 | + { |
|
311 | + } |
|
312 | + |
|
313 | + |
|
314 | + final public function __isset($a) |
|
315 | + { |
|
316 | + } |
|
317 | + |
|
318 | + |
|
319 | + final public function __unset($a) |
|
320 | + { |
|
321 | + } |
|
322 | + |
|
323 | + |
|
324 | + final public function __sleep() |
|
325 | + { |
|
326 | + return []; |
|
327 | + } |
|
328 | + |
|
329 | + |
|
330 | + final public function __wakeup() |
|
331 | + { |
|
332 | + } |
|
333 | + |
|
334 | + |
|
335 | + final public function __invoke() |
|
336 | + { |
|
337 | + } |
|
338 | + |
|
339 | + |
|
340 | + final public static function __set_state($a = null) |
|
341 | + { |
|
342 | + return EE_Maintenance_Mode::instance(); |
|
343 | + } |
|
344 | + |
|
345 | + |
|
346 | + final public function __clone() |
|
347 | + { |
|
348 | + } |
|
349 | 349 | |
350 | 350 | |
351 | - final public static function __callStatic($a, $b) |
|
352 | - { |
|
353 | - } |
|
351 | + final public static function __callStatic($a, $b) |
|
352 | + { |
|
353 | + } |
|
354 | 354 | } |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | $active_plugins = array_map('strtolower', $active_plugins); |
98 | 98 | $plugin_info = array(); |
99 | 99 | foreach ($active_plugins as $plugin) { |
100 | - $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin); |
|
100 | + $plugin_data = @get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin); |
|
101 | 101 | |
102 | - $plugin_info[ $plugin ] = $plugin_data; |
|
102 | + $plugin_info[$plugin] = $plugin_data; |
|
103 | 103 | } |
104 | 104 | return $plugin_info; |
105 | 105 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ); |
125 | 125 | $wp_memory_to_display .= '</mark>'; |
126 | 126 | } else { |
127 | - $wp_memory_to_display = '<mark class="yes">' . size_format($wp_memory_int) . '</mark>'; |
|
127 | + $wp_memory_to_display = '<mark class="yes">'.size_format($wp_memory_int).'</mark>'; |
|
128 | 128 | } |
129 | 129 | return array( |
130 | 130 | 'name' => get_bloginfo('name', 'display'), |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $options = EE_Data_Migration_Manager::instance()->get_all_migration_script_options(); |
164 | 164 | $presentable_migration_scripts = array(); |
165 | 165 | foreach ($options as $option_array) { |
166 | - $presentable_migration_scripts[ str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name']) ] = maybe_unserialize($option_array['option_value']); |
|
166 | + $presentable_migration_scripts[str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name'])] = maybe_unserialize($option_array['option_value']); |
|
167 | 167 | } |
168 | 168 | return $presentable_migration_scripts; |
169 | 169 | // return get_option(EE_Data_Migration_Manager::data_migrations_option_name);//EE_Data_Migration_Manager::instance()->get_data_migrations_ran(); |
@@ -189,18 +189,18 @@ discard block |
||
189 | 189 | |
190 | 190 | $pi = preg_replace( |
191 | 191 | array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms', |
192 | - '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', |
|
192 | + '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', |
|
193 | 193 | "#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%', |
194 | 194 | '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>' |
195 | 195 | . '<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#', |
196 | 196 | '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#', |
197 | 197 | '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#', |
198 | 198 | "# +#", '#<tr>#', '#</tr>#'), |
199 | - array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ', |
|
200 | - '<h2>PHP Configuration</h2>' . "\n" . '<tr><td>PHP Version</td><td>$2</td></tr>' . |
|
201 | - "\n" . '<tr><td>PHP Egg</td><td>$1</td></tr>', |
|
199 | + array('$1', '', '', '', '</$1>'."\n", '<', ' ', ' ', ' ', '', ' ', |
|
200 | + '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'. |
|
201 | + "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>', |
|
202 | 202 | '<tr><td>PHP Credits Egg</td><td>$1</td></tr>', |
203 | - '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" . |
|
203 | + '<tr><td>Zend Engine</td><td>$2</td></tr>'."\n". |
|
204 | 204 | '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'), |
205 | 205 | ob_get_clean() |
206 | 206 | ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | foreach ($askapache as $m) { |
221 | 221 | $m2 = isset($m[2]) ? $m[2] : null; |
222 | 222 | } |
223 | - $pi[ $n ][ $m[1] ] = (!isset($m[3]) || $m2 == $m[3]) ? $m2 : array_slice($m, 2); |
|
223 | + $pi[$n][$m[1]] = ( ! isset($m[3]) || $m2 == $m[3]) ? $m2 : array_slice($m, 2); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return $pi; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | if ($response instanceof WP_Error) { |
238 | 238 | $error_string = ''; |
239 | 239 | foreach ($response->errors as $short_name => $description_array) { |
240 | - $error_string .= "<b>$short_name</b>: " . implode(", ", $description_array); |
|
240 | + $error_string .= "<b>$short_name</b>: ".implode(", ", $description_array); |
|
241 | 241 | } |
242 | 242 | return $error_string; |
243 | 243 | } |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function get_wp_maintenance_mode() |
251 | 251 | { |
252 | - $opened = file_exists(ABSPATH . '.maintenance'); |
|
253 | - return $opened ? sprintf(esc_html__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : esc_html__('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso') ; |
|
252 | + $opened = file_exists(ABSPATH.'.maintenance'); |
|
253 | + return $opened ? sprintf(esc_html__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : esc_html__('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso'); |
|
254 | 254 | } |
255 | 255 | /** |
256 | 256 | * Whether or not logging is enabled |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function get_logging_enabled() |
260 | 260 | { |
261 | - $opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a'); |
|
262 | - return $opened ? esc_html__('Log Directory is writable', 'event_espresso') : sprintf(esc_html__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>') ; |
|
261 | + $opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR.'/logs/espresso_log.txt', 'a'); |
|
262 | + return $opened ? esc_html__('Log Directory is writable', 'event_espresso') : sprintf(esc_html__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>'); |
|
263 | 263 | } |
264 | 264 | /** |
265 | 265 | * Whether curl ro fsock works |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } elseif ($curl_works) { |
277 | 277 | $status = esc_html__('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso'); |
278 | 278 | } else { |
279 | - $status = esc_html__('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso') . '</mark>'; |
|
279 | + $status = esc_html__('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso').'</mark>'; |
|
280 | 280 | } |
281 | 281 | return $status; |
282 | 282 | } |
@@ -5,79 +5,79 @@ discard block |
||
5 | 5 | */ |
6 | 6 | class EEM_System_Status |
7 | 7 | { |
8 | - // private instance of the EEM_System_Status object |
|
9 | - protected static $_instance = null; |
|
8 | + // private instance of the EEM_System_Status object |
|
9 | + protected static $_instance = null; |
|
10 | 10 | |
11 | 11 | |
12 | 12 | |
13 | - /** |
|
14 | - * This function is a singleton method used to instantiate the EEM_Attendee object |
|
15 | - * |
|
16 | - * @access public |
|
17 | - * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
18 | - * @return EEM_System_Status |
|
19 | - */ |
|
20 | - public static function instance() |
|
21 | - { |
|
13 | + /** |
|
14 | + * This function is a singleton method used to instantiate the EEM_Attendee object |
|
15 | + * |
|
16 | + * @access public |
|
17 | + * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
18 | + * @return EEM_System_Status |
|
19 | + */ |
|
20 | + public static function instance() |
|
21 | + { |
|
22 | 22 | |
23 | - // check if instance of EEM_System_Status already exists |
|
24 | - if (self::$_instance === null) { |
|
25 | - // instantiate EEM_System_Status |
|
26 | - self::$_instance = new self(); |
|
27 | - } |
|
28 | - return self::$_instance; |
|
29 | - } |
|
30 | - private function __construct() |
|
31 | - { |
|
32 | - } |
|
33 | - /** |
|
34 | - * |
|
35 | - * @return array where each key is a function name on this class, and each value is SOMETHING-- |
|
36 | - * it might be a value, an array, or an object |
|
37 | - */ |
|
38 | - public function get_system_stati() |
|
39 | - { |
|
40 | - return apply_filters( |
|
41 | - 'FHEE__EEM_System_Status__get_system_stati', |
|
42 | - array( |
|
43 | - 'ee_version' => $this->get_ee_version(), |
|
44 | - 'ee_activation_history' => $this->get_ee_activation_history(), |
|
45 | - 'ee_config' => $this->get_ee_config(), |
|
46 | - 'ee_migration_history' => $this->get_ee_migration_history(), |
|
47 | - 'active_plugins' => $this->get_active_plugins(), |
|
48 | - 'wp_settings' => $this->get_wp_settings(), |
|
49 | - 'wp_maintenance_mode' => $this->get_wp_maintenance_mode(), |
|
50 | - 'https_enabled' => $this->get_https_enabled(), |
|
51 | - 'logging_enabled' => $this->get_logging_enabled(), |
|
52 | - 'remote_posting' => $this->get_remote_posting(), |
|
53 | - 'php_version' => $this->php_version(), |
|
54 | - 'php.ini_settings' => $this->get_php_ini_all(), |
|
55 | - 'php_info' => $this->get_php_info(), |
|
56 | - ), |
|
57 | - $this |
|
58 | - ); |
|
59 | - } |
|
60 | - /** |
|
61 | - * |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - public function get_ee_version() |
|
65 | - { |
|
66 | - return espresso_version(); |
|
67 | - } |
|
68 | - /** |
|
69 | - * |
|
70 | - * @return string |
|
71 | - */ |
|
72 | - public function php_version() |
|
73 | - { |
|
74 | - return phpversion(); |
|
75 | - } |
|
76 | - /** |
|
77 | - * |
|
78 | - * @return array, where each key is a plugin name (lower-cased), values are sub-arrays. |
|
79 | - * Sub-arrays like described in wp function get_plugin_data. Ie, * |
|
80 | - * 'Name' => 'Plugin Name', |
|
23 | + // check if instance of EEM_System_Status already exists |
|
24 | + if (self::$_instance === null) { |
|
25 | + // instantiate EEM_System_Status |
|
26 | + self::$_instance = new self(); |
|
27 | + } |
|
28 | + return self::$_instance; |
|
29 | + } |
|
30 | + private function __construct() |
|
31 | + { |
|
32 | + } |
|
33 | + /** |
|
34 | + * |
|
35 | + * @return array where each key is a function name on this class, and each value is SOMETHING-- |
|
36 | + * it might be a value, an array, or an object |
|
37 | + */ |
|
38 | + public function get_system_stati() |
|
39 | + { |
|
40 | + return apply_filters( |
|
41 | + 'FHEE__EEM_System_Status__get_system_stati', |
|
42 | + array( |
|
43 | + 'ee_version' => $this->get_ee_version(), |
|
44 | + 'ee_activation_history' => $this->get_ee_activation_history(), |
|
45 | + 'ee_config' => $this->get_ee_config(), |
|
46 | + 'ee_migration_history' => $this->get_ee_migration_history(), |
|
47 | + 'active_plugins' => $this->get_active_plugins(), |
|
48 | + 'wp_settings' => $this->get_wp_settings(), |
|
49 | + 'wp_maintenance_mode' => $this->get_wp_maintenance_mode(), |
|
50 | + 'https_enabled' => $this->get_https_enabled(), |
|
51 | + 'logging_enabled' => $this->get_logging_enabled(), |
|
52 | + 'remote_posting' => $this->get_remote_posting(), |
|
53 | + 'php_version' => $this->php_version(), |
|
54 | + 'php.ini_settings' => $this->get_php_ini_all(), |
|
55 | + 'php_info' => $this->get_php_info(), |
|
56 | + ), |
|
57 | + $this |
|
58 | + ); |
|
59 | + } |
|
60 | + /** |
|
61 | + * |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + public function get_ee_version() |
|
65 | + { |
|
66 | + return espresso_version(); |
|
67 | + } |
|
68 | + /** |
|
69 | + * |
|
70 | + * @return string |
|
71 | + */ |
|
72 | + public function php_version() |
|
73 | + { |
|
74 | + return phpversion(); |
|
75 | + } |
|
76 | + /** |
|
77 | + * |
|
78 | + * @return array, where each key is a plugin name (lower-cased), values are sub-arrays. |
|
79 | + * Sub-arrays like described in wp function get_plugin_data. Ie, * |
|
80 | + * 'Name' => 'Plugin Name', |
|
81 | 81 | 'PluginURI' => 'Plugin URI', |
82 | 82 | 'Version' => 'Version', |
83 | 83 | 'Description' => 'Description', |
@@ -86,231 +86,231 @@ discard block |
||
86 | 86 | 'TextDomain' => 'Text Domain', |
87 | 87 | 'DomainPath' => 'Domain Path', |
88 | 88 | 'Network' => 'Network', |
89 | - */ |
|
90 | - public function get_active_plugins() |
|
91 | - { |
|
92 | - $active_plugins = (array) get_option('active_plugins', array()); |
|
93 | - if (is_multisite()) { |
|
94 | - $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); |
|
95 | - } |
|
96 | - $active_plugins = array_map('strtolower', $active_plugins); |
|
97 | - $plugin_info = array(); |
|
98 | - foreach ($active_plugins as $plugin) { |
|
99 | - $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin); |
|
89 | + */ |
|
90 | + public function get_active_plugins() |
|
91 | + { |
|
92 | + $active_plugins = (array) get_option('active_plugins', array()); |
|
93 | + if (is_multisite()) { |
|
94 | + $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); |
|
95 | + } |
|
96 | + $active_plugins = array_map('strtolower', $active_plugins); |
|
97 | + $plugin_info = array(); |
|
98 | + foreach ($active_plugins as $plugin) { |
|
99 | + $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin); |
|
100 | 100 | |
101 | - $plugin_info[ $plugin ] = $plugin_data; |
|
102 | - } |
|
103 | - return $plugin_info; |
|
104 | - } |
|
101 | + $plugin_info[ $plugin ] = $plugin_data; |
|
102 | + } |
|
103 | + return $plugin_info; |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * |
|
108 | - * @return array with keys 'home_url' and 'site_url' |
|
109 | - */ |
|
110 | - public function get_wp_settings() |
|
111 | - { |
|
112 | - $wp_memory_int = $this->let_to_num(WP_MEMORY_LIMIT); |
|
113 | - if ($wp_memory_int < 67108864) { |
|
114 | - $wp_memory_to_display = '<mark class="error">'; |
|
115 | - $wp_memory_to_display .= sprintf( |
|
116 | - esc_html__( |
|
117 | - '%s - We recommend setting memory to at least 64MB. See: %s Increasing memory allocated to PHP %s', |
|
118 | - 'event_espresso' |
|
119 | - ), |
|
120 | - WP_MEMORY_LIMIT, |
|
121 | - '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">', |
|
122 | - '</a>"' |
|
123 | - ); |
|
124 | - $wp_memory_to_display .= '</mark>'; |
|
125 | - } else { |
|
126 | - $wp_memory_to_display = '<mark class="yes">' . size_format($wp_memory_int) . '</mark>'; |
|
127 | - } |
|
128 | - return array( |
|
129 | - 'name' => get_bloginfo('name', 'display'), |
|
130 | - 'is_multisite' => is_multisite(), |
|
131 | - 'version' => get_bloginfo('version', 'display'), |
|
132 | - 'home_url' => home_url(), |
|
133 | - 'site_url' => site_url(), |
|
134 | - 'WP_DEBUG' => WP_DEBUG, |
|
135 | - 'permalink_structure' => get_option('permalink_structure'), |
|
136 | - 'theme' => wp_get_theme(), |
|
137 | - 'gmt_offset' => get_option('gmt_offset'), |
|
138 | - 'timezone_string' => get_option('timezone_string'), |
|
139 | - 'admin_email' => get_bloginfo('admin_email', 'display'), |
|
140 | - 'language' => get_bloginfo('language', 'display'), |
|
141 | - 'wp_max_upload_size' => size_format(wp_max_upload_size()), |
|
142 | - 'wp_memory' => $wp_memory_to_display |
|
143 | - ); |
|
144 | - } |
|
106 | + /** |
|
107 | + * |
|
108 | + * @return array with keys 'home_url' and 'site_url' |
|
109 | + */ |
|
110 | + public function get_wp_settings() |
|
111 | + { |
|
112 | + $wp_memory_int = $this->let_to_num(WP_MEMORY_LIMIT); |
|
113 | + if ($wp_memory_int < 67108864) { |
|
114 | + $wp_memory_to_display = '<mark class="error">'; |
|
115 | + $wp_memory_to_display .= sprintf( |
|
116 | + esc_html__( |
|
117 | + '%s - We recommend setting memory to at least 64MB. See: %s Increasing memory allocated to PHP %s', |
|
118 | + 'event_espresso' |
|
119 | + ), |
|
120 | + WP_MEMORY_LIMIT, |
|
121 | + '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">', |
|
122 | + '</a>"' |
|
123 | + ); |
|
124 | + $wp_memory_to_display .= '</mark>'; |
|
125 | + } else { |
|
126 | + $wp_memory_to_display = '<mark class="yes">' . size_format($wp_memory_int) . '</mark>'; |
|
127 | + } |
|
128 | + return array( |
|
129 | + 'name' => get_bloginfo('name', 'display'), |
|
130 | + 'is_multisite' => is_multisite(), |
|
131 | + 'version' => get_bloginfo('version', 'display'), |
|
132 | + 'home_url' => home_url(), |
|
133 | + 'site_url' => site_url(), |
|
134 | + 'WP_DEBUG' => WP_DEBUG, |
|
135 | + 'permalink_structure' => get_option('permalink_structure'), |
|
136 | + 'theme' => wp_get_theme(), |
|
137 | + 'gmt_offset' => get_option('gmt_offset'), |
|
138 | + 'timezone_string' => get_option('timezone_string'), |
|
139 | + 'admin_email' => get_bloginfo('admin_email', 'display'), |
|
140 | + 'language' => get_bloginfo('language', 'display'), |
|
141 | + 'wp_max_upload_size' => size_format(wp_max_upload_size()), |
|
142 | + 'wp_memory' => $wp_memory_to_display |
|
143 | + ); |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * Gets an array of information about the history of ee versions installed |
|
148 | - * @return array |
|
149 | - */ |
|
150 | - public function get_ee_activation_history() |
|
151 | - { |
|
152 | - return get_option('espresso_db_update'); |
|
153 | - } |
|
146 | + /** |
|
147 | + * Gets an array of information about the history of ee versions installed |
|
148 | + * @return array |
|
149 | + */ |
|
150 | + public function get_ee_activation_history() |
|
151 | + { |
|
152 | + return get_option('espresso_db_update'); |
|
153 | + } |
|
154 | 154 | |
155 | 155 | |
156 | - /** |
|
157 | - * Gets an array where keys are ee versions, and their values are arrays indicating all the different times that version was installed |
|
158 | - * @return EE_Data_Migration_Script_Base[] |
|
159 | - */ |
|
160 | - public function get_ee_migration_history() |
|
161 | - { |
|
162 | - $options = EE_Data_Migration_Manager::instance()->get_all_migration_script_options(); |
|
163 | - $presentable_migration_scripts = array(); |
|
164 | - foreach ($options as $option_array) { |
|
165 | - $presentable_migration_scripts[ str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name']) ] = maybe_unserialize($option_array['option_value']); |
|
166 | - } |
|
167 | - return $presentable_migration_scripts; |
|
156 | + /** |
|
157 | + * Gets an array where keys are ee versions, and their values are arrays indicating all the different times that version was installed |
|
158 | + * @return EE_Data_Migration_Script_Base[] |
|
159 | + */ |
|
160 | + public function get_ee_migration_history() |
|
161 | + { |
|
162 | + $options = EE_Data_Migration_Manager::instance()->get_all_migration_script_options(); |
|
163 | + $presentable_migration_scripts = array(); |
|
164 | + foreach ($options as $option_array) { |
|
165 | + $presentable_migration_scripts[ str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name']) ] = maybe_unserialize($option_array['option_value']); |
|
166 | + } |
|
167 | + return $presentable_migration_scripts; |
|
168 | 168 | // return get_option(EE_Data_Migration_Manager::data_migrations_option_name);//EE_Data_Migration_Manager::instance()->get_data_migrations_ran(); |
169 | - } |
|
169 | + } |
|
170 | 170 | |
171 | - /** |
|
172 | - * |
|
173 | - * @return array like EE_Config class |
|
174 | - */ |
|
175 | - public function get_ee_config() |
|
176 | - { |
|
177 | - return EE_Config::instance(); |
|
178 | - } |
|
171 | + /** |
|
172 | + * |
|
173 | + * @return array like EE_Config class |
|
174 | + */ |
|
175 | + public function get_ee_config() |
|
176 | + { |
|
177 | + return EE_Config::instance(); |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
181 | - * Gets an array of php setup info, pilfered from http://www.php.net/manual/en/function.phpinfo.php#87463 |
|
182 | - * @return array like the output of phpinfo(), but in an array |
|
183 | - */ |
|
184 | - public function get_php_info() |
|
185 | - { |
|
186 | - ob_start(); |
|
187 | - phpinfo(-1); |
|
180 | + /** |
|
181 | + * Gets an array of php setup info, pilfered from http://www.php.net/manual/en/function.phpinfo.php#87463 |
|
182 | + * @return array like the output of phpinfo(), but in an array |
|
183 | + */ |
|
184 | + public function get_php_info() |
|
185 | + { |
|
186 | + ob_start(); |
|
187 | + phpinfo(-1); |
|
188 | 188 | |
189 | - $pi = preg_replace( |
|
190 | - array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms', |
|
191 | - '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', |
|
192 | - "#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%', |
|
193 | - '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>' |
|
194 | - . '<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#', |
|
195 | - '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#', |
|
196 | - '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#', |
|
197 | - "# +#", '#<tr>#', '#</tr>#'), |
|
198 | - array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ', |
|
199 | - '<h2>PHP Configuration</h2>' . "\n" . '<tr><td>PHP Version</td><td>$2</td></tr>' . |
|
200 | - "\n" . '<tr><td>PHP Egg</td><td>$1</td></tr>', |
|
201 | - '<tr><td>PHP Credits Egg</td><td>$1</td></tr>', |
|
202 | - '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" . |
|
203 | - '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'), |
|
204 | - ob_get_clean() |
|
205 | - ); |
|
189 | + $pi = preg_replace( |
|
190 | + array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms', |
|
191 | + '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', |
|
192 | + "#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%', |
|
193 | + '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>' |
|
194 | + . '<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#', |
|
195 | + '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#', |
|
196 | + '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#', |
|
197 | + "# +#", '#<tr>#', '#</tr>#'), |
|
198 | + array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ', |
|
199 | + '<h2>PHP Configuration</h2>' . "\n" . '<tr><td>PHP Version</td><td>$2</td></tr>' . |
|
200 | + "\n" . '<tr><td>PHP Egg</td><td>$1</td></tr>', |
|
201 | + '<tr><td>PHP Credits Egg</td><td>$1</td></tr>', |
|
202 | + '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" . |
|
203 | + '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'), |
|
204 | + ob_get_clean() |
|
205 | + ); |
|
206 | 206 | |
207 | - $sections = explode('<h2>', strip_tags((string) $pi, '<h2><th><td>')); |
|
208 | - unset($sections[0]); |
|
207 | + $sections = explode('<h2>', strip_tags((string) $pi, '<h2><th><td>')); |
|
208 | + unset($sections[0]); |
|
209 | 209 | |
210 | - $pi = array(); |
|
211 | - foreach ($sections as $section) { |
|
212 | - $n = substr($section, 0, strpos($section, '</h2>')); |
|
213 | - preg_match_all( |
|
214 | - '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#', |
|
215 | - $section, |
|
216 | - $askapache, |
|
217 | - PREG_SET_ORDER |
|
218 | - ); |
|
219 | - foreach ($askapache as $m) { |
|
220 | - $m2 = isset($m[2]) ? $m[2] : null; |
|
221 | - } |
|
222 | - $pi[ $n ][ $m[1] ] = (!isset($m[3]) || $m2 == $m[3]) ? $m2 : array_slice($m, 2); |
|
223 | - } |
|
210 | + $pi = array(); |
|
211 | + foreach ($sections as $section) { |
|
212 | + $n = substr($section, 0, strpos($section, '</h2>')); |
|
213 | + preg_match_all( |
|
214 | + '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#', |
|
215 | + $section, |
|
216 | + $askapache, |
|
217 | + PREG_SET_ORDER |
|
218 | + ); |
|
219 | + foreach ($askapache as $m) { |
|
220 | + $m2 = isset($m[2]) ? $m[2] : null; |
|
221 | + } |
|
222 | + $pi[ $n ][ $m[1] ] = (!isset($m[3]) || $m2 == $m[3]) ? $m2 : array_slice($m, 2); |
|
223 | + } |
|
224 | 224 | |
225 | - return $pi; |
|
226 | - } |
|
225 | + return $pi; |
|
226 | + } |
|
227 | 227 | |
228 | - /** |
|
229 | - * Checks if site responds ot HTTPS |
|
230 | - * @return boolean |
|
231 | - */ |
|
232 | - public function get_https_enabled() |
|
233 | - { |
|
234 | - $home = str_replace("http://", "https://", home_url()); |
|
235 | - $response = wp_remote_get($home); |
|
236 | - if ($response instanceof WP_Error) { |
|
237 | - $error_string = ''; |
|
238 | - foreach ($response->errors as $short_name => $description_array) { |
|
239 | - $error_string .= "<b>$short_name</b>: " . implode(", ", $description_array); |
|
240 | - } |
|
241 | - return $error_string; |
|
242 | - } |
|
243 | - return "ok!"; |
|
244 | - } |
|
245 | - /** |
|
246 | - * Whether or not a .maintenance file is detected |
|
247 | - * @return string descripting wp_maintenance_mode status |
|
248 | - */ |
|
249 | - public function get_wp_maintenance_mode() |
|
250 | - { |
|
251 | - $opened = file_exists(ABSPATH . '.maintenance'); |
|
252 | - return $opened ? sprintf(esc_html__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : esc_html__('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso') ; |
|
253 | - } |
|
254 | - /** |
|
255 | - * Whether or not logging is enabled |
|
256 | - * @return string descripting logging's status |
|
257 | - */ |
|
258 | - public function get_logging_enabled() |
|
259 | - { |
|
260 | - $opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a'); |
|
261 | - return $opened ? esc_html__('Log Directory is writable', 'event_espresso') : sprintf(esc_html__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>') ; |
|
262 | - } |
|
263 | - /** |
|
264 | - * Whether curl ro fsock works |
|
265 | - * @return string describing posting's status |
|
266 | - */ |
|
267 | - public function get_remote_posting() |
|
268 | - { |
|
269 | - $fsock_works = function_exists('fsockopen'); |
|
270 | - $curl_works = function_exists('curl_init'); |
|
271 | - if ($fsock_works && $curl_works) { |
|
272 | - $status = esc_html__('Your server has fsockopen and cURL enabled.', 'event_espresso'); |
|
273 | - } elseif ($fsock_works) { |
|
274 | - $status = esc_html__('Your server has fsockopen enabled, cURL is disabled.', 'event_espresso'); |
|
275 | - } elseif ($curl_works) { |
|
276 | - $status = esc_html__('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso'); |
|
277 | - } else { |
|
278 | - $status = esc_html__('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso') . '</mark>'; |
|
279 | - } |
|
280 | - return $status; |
|
281 | - } |
|
282 | - /** |
|
283 | - * Gets all the php.ini settings |
|
284 | - * @return array |
|
285 | - */ |
|
286 | - public function get_php_ini_all() |
|
287 | - { |
|
288 | - return ini_get_all(); |
|
289 | - } |
|
290 | - /** |
|
291 | - * Transforms the php.ini notation for numbers (like '2M') to an integer. |
|
292 | - * |
|
293 | - * @param type $size |
|
294 | - * @return int |
|
295 | - */ |
|
296 | - public function let_to_num($size) |
|
297 | - { |
|
298 | - $l = substr($size, -1); |
|
299 | - $ret = substr($size, 0, -1); |
|
300 | - // phpcs:disable PSR2.ControlStructures.SwitchDeclaration.TerminatingComment |
|
301 | - switch (strtoupper($l)) { |
|
302 | - case 'P': |
|
303 | - $ret *= 1024; |
|
304 | - case 'T': |
|
305 | - $ret *= 1024; |
|
306 | - case 'G': |
|
307 | - $ret *= 1024; |
|
308 | - case 'M': |
|
309 | - $ret *= 1024; |
|
310 | - case 'K': |
|
311 | - $ret *= 1024; |
|
312 | - } |
|
313 | - // phpcs:enable |
|
314 | - return $ret; |
|
315 | - } |
|
228 | + /** |
|
229 | + * Checks if site responds ot HTTPS |
|
230 | + * @return boolean |
|
231 | + */ |
|
232 | + public function get_https_enabled() |
|
233 | + { |
|
234 | + $home = str_replace("http://", "https://", home_url()); |
|
235 | + $response = wp_remote_get($home); |
|
236 | + if ($response instanceof WP_Error) { |
|
237 | + $error_string = ''; |
|
238 | + foreach ($response->errors as $short_name => $description_array) { |
|
239 | + $error_string .= "<b>$short_name</b>: " . implode(", ", $description_array); |
|
240 | + } |
|
241 | + return $error_string; |
|
242 | + } |
|
243 | + return "ok!"; |
|
244 | + } |
|
245 | + /** |
|
246 | + * Whether or not a .maintenance file is detected |
|
247 | + * @return string descripting wp_maintenance_mode status |
|
248 | + */ |
|
249 | + public function get_wp_maintenance_mode() |
|
250 | + { |
|
251 | + $opened = file_exists(ABSPATH . '.maintenance'); |
|
252 | + return $opened ? sprintf(esc_html__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : esc_html__('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso') ; |
|
253 | + } |
|
254 | + /** |
|
255 | + * Whether or not logging is enabled |
|
256 | + * @return string descripting logging's status |
|
257 | + */ |
|
258 | + public function get_logging_enabled() |
|
259 | + { |
|
260 | + $opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a'); |
|
261 | + return $opened ? esc_html__('Log Directory is writable', 'event_espresso') : sprintf(esc_html__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>') ; |
|
262 | + } |
|
263 | + /** |
|
264 | + * Whether curl ro fsock works |
|
265 | + * @return string describing posting's status |
|
266 | + */ |
|
267 | + public function get_remote_posting() |
|
268 | + { |
|
269 | + $fsock_works = function_exists('fsockopen'); |
|
270 | + $curl_works = function_exists('curl_init'); |
|
271 | + if ($fsock_works && $curl_works) { |
|
272 | + $status = esc_html__('Your server has fsockopen and cURL enabled.', 'event_espresso'); |
|
273 | + } elseif ($fsock_works) { |
|
274 | + $status = esc_html__('Your server has fsockopen enabled, cURL is disabled.', 'event_espresso'); |
|
275 | + } elseif ($curl_works) { |
|
276 | + $status = esc_html__('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso'); |
|
277 | + } else { |
|
278 | + $status = esc_html__('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso') . '</mark>'; |
|
279 | + } |
|
280 | + return $status; |
|
281 | + } |
|
282 | + /** |
|
283 | + * Gets all the php.ini settings |
|
284 | + * @return array |
|
285 | + */ |
|
286 | + public function get_php_ini_all() |
|
287 | + { |
|
288 | + return ini_get_all(); |
|
289 | + } |
|
290 | + /** |
|
291 | + * Transforms the php.ini notation for numbers (like '2M') to an integer. |
|
292 | + * |
|
293 | + * @param type $size |
|
294 | + * @return int |
|
295 | + */ |
|
296 | + public function let_to_num($size) |
|
297 | + { |
|
298 | + $l = substr($size, -1); |
|
299 | + $ret = substr($size, 0, -1); |
|
300 | + // phpcs:disable PSR2.ControlStructures.SwitchDeclaration.TerminatingComment |
|
301 | + switch (strtoupper($l)) { |
|
302 | + case 'P': |
|
303 | + $ret *= 1024; |
|
304 | + case 'T': |
|
305 | + $ret *= 1024; |
|
306 | + case 'G': |
|
307 | + $ret *= 1024; |
|
308 | + case 'M': |
|
309 | + $ret *= 1024; |
|
310 | + case 'K': |
|
311 | + $ret *= 1024; |
|
312 | + } |
|
313 | + // phpcs:enable |
|
314 | + return $ret; |
|
315 | + } |
|
316 | 316 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $event_name = ''; |
22 | 22 | $wait_list = false; |
23 | 23 | foreach ($registrations as $registration) { |
24 | - if (! $registration instanceof EE_Registration) { |
|
24 | + if ( ! $registration instanceof EE_Registration) { |
|
25 | 25 | continue; |
26 | 26 | } |
27 | 27 | if ($event_name != $registration->event_name() && ! empty($event_name)) { ?> |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | <tbody> |
56 | 56 | <?php |
57 | 57 | } |
58 | - if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?> |
|
58 | + if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?> |
|
59 | 59 | <tr> |
60 | 60 | <td width="40%"> |
61 | 61 | <?php |
@@ -14,24 +14,24 @@ discard block |
||
14 | 14 | |
15 | 15 | <div class="ee-registration-details-dv"> |
16 | 16 | <?php |
17 | - $registrations = $transaction->registrations(); |
|
18 | - $registrations = is_array($registrations) ? $registrations : []; |
|
19 | - $reg_count = count($registrations); |
|
20 | - $reg_cntr = 0; |
|
21 | - $event_name = ''; |
|
22 | - $wait_list = false; |
|
23 | - foreach ($registrations as $registration) { |
|
24 | - if (! $registration instanceof EE_Registration) { |
|
25 | - continue; |
|
26 | - } |
|
27 | - if ($event_name != $registration->event_name() && ! empty($event_name)) { ?> |
|
17 | + $registrations = $transaction->registrations(); |
|
18 | + $registrations = is_array($registrations) ? $registrations : []; |
|
19 | + $reg_count = count($registrations); |
|
20 | + $reg_cntr = 0; |
|
21 | + $event_name = ''; |
|
22 | + $wait_list = false; |
|
23 | + foreach ($registrations as $registration) { |
|
24 | + if (! $registration instanceof EE_Registration) { |
|
25 | + continue; |
|
26 | + } |
|
27 | + if ($event_name != $registration->event_name() && ! empty($event_name)) { ?> |
|
28 | 28 | </tbody> |
29 | 29 | </table> |
30 | 30 | <?php |
31 | - } |
|
32 | - $reg_cntr++; |
|
33 | - if ($event_name != $registration->event_name()) { |
|
34 | - ?> |
|
31 | + } |
|
32 | + $reg_cntr++; |
|
33 | + if ($event_name != $registration->event_name()) { |
|
34 | + ?> |
|
35 | 35 | <h5> |
36 | 36 | <span class="smaller-text grey-text"> |
37 | 37 | <?php esc_html_e('for', 'event_espresso'); ?> : |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | </thead> |
55 | 55 | <tbody> |
56 | 56 | <?php |
57 | - } |
|
58 | - if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?> |
|
57 | + } |
|
58 | + if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?> |
|
59 | 59 | <tr> |
60 | 60 | <td width="40%"> |
61 | 61 | <?php |
62 | - if ($registration->attendee() instanceof EE_Attendee) { |
|
63 | - echo esc_html($registration->attendee()->full_name(true)); |
|
64 | - } |
|
65 | - ?> |
|
62 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
63 | + echo esc_html($registration->attendee()->full_name(true)); |
|
64 | + } |
|
65 | + ?> |
|
66 | 66 | <p class="tiny-text" style="margin: .75em 0 0;"> |
67 | 67 | <?php if ($registration->count_question_groups()) { ?> |
68 | 68 | <a class="ee-icon-only-lnk" |
69 | 69 | href="<?php echo esc_url_raw($registration->edit_attendee_information_url()); ?>" |
70 | 70 | title="<?php esc_attr_e( |
71 | - 'Click here to edit Attendee Information', |
|
72 | - 'event_espresso' |
|
73 | - ); ?>" |
|
71 | + 'Click here to edit Attendee Information', |
|
72 | + 'event_espresso' |
|
73 | + ); ?>" |
|
74 | 74 | > |
75 | 75 | <span class="dashicons dashicons-groups"></span> |
76 | 76 | <?php esc_html_e('edit info', 'event_espresso'); ?> |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | <?php } ?> |
79 | 79 | <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" |
80 | 80 | href="<?php echo esc_url_raw( |
81 | - add_query_arg( |
|
82 | - ['token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'], |
|
83 | - EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
84 | - ) |
|
85 | - ); ?>" |
|
81 | + add_query_arg( |
|
82 | + ['token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'], |
|
83 | + EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
84 | + ) |
|
85 | + ); ?>" |
|
86 | 86 | title="<?php esc_attr_e( |
87 | - 'Click here to resend the Registration Confirmation email', |
|
88 | - 'event_espresso' |
|
89 | - ); ?>" |
|
87 | + 'Click here to resend the Registration Confirmation email', |
|
88 | + 'event_espresso' |
|
89 | + ); ?>" |
|
90 | 90 | rel="<?php echo esc_attr($registration->reg_url_link()); ?>" |
91 | 91 | > |
92 | 92 | <span class="dashicons dashicons-email-alt"></span> |
@@ -100,27 +100,27 @@ discard block |
||
100 | 100 | <td width="35%" class="jst-left"> |
101 | 101 | <?php $registration->e_pretty_status(true) ?> |
102 | 102 | <?php |
103 | - if ($registration->status_ID() === EEM_Registration::status_id_wait_list) { |
|
104 | - $wait_list = true; |
|
105 | - } |
|
106 | - ?> |
|
103 | + if ($registration->status_ID() === EEM_Registration::status_id_wait_list) { |
|
104 | + $wait_list = true; |
|
105 | + } |
|
106 | + ?> |
|
107 | 107 | </td> |
108 | 108 | </tr> |
109 | 109 | <?php do_action( |
110 | - 'AHEE__thank_you_page_registration_details_template__after_registration_table_row', |
|
111 | - $registration |
|
112 | - ); ?> |
|
110 | + 'AHEE__thank_you_page_registration_details_template__after_registration_table_row', |
|
111 | + $registration |
|
112 | + ); ?> |
|
113 | 113 | <?php |
114 | - $event_name = $registration->event_name(); |
|
115 | - } |
|
116 | - if ($reg_cntr >= $reg_count) { |
|
117 | - ?> |
|
114 | + $event_name = $registration->event_name(); |
|
115 | + } |
|
116 | + if ($reg_cntr >= $reg_count) { |
|
117 | + ?> |
|
118 | 118 | </tbody> |
119 | 119 | </table> |
120 | 120 | <?php |
121 | - } |
|
122 | - } |
|
123 | - ?> |
|
121 | + } |
|
122 | + } |
|
123 | + ?> |
|
124 | 124 | <?php if ($is_primary && $SPCO_attendee_information_url) { ?> |
125 | 125 | <p class="small-text jst-rght"> |
126 | 126 | <a href='<?php echo esc_url_raw($SPCO_attendee_information_url) ?>'> |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | </p> |
130 | 130 | <?php } ?> |
131 | 131 | <?php |
132 | - if ($wait_list) { |
|
133 | - echo apply_filters( |
|
134 | - 'AFEE__thank_you_page_registration_details_template__wait_list_notice', |
|
135 | - sprintf( |
|
136 | - esc_html__( |
|
137 | - '%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s', |
|
138 | - 'event_espresso' |
|
139 | - ), |
|
140 | - '<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>', |
|
141 | - '</h6 ><p class="ee-wait-list-notice">', |
|
142 | - '</p ><br />' |
|
143 | - ) |
|
144 | - ); |
|
145 | - } |
|
146 | - do_action('AHEE__thank_you_page_registration_details_template__after_registration_details'); |
|
147 | - ?> |
|
132 | + if ($wait_list) { |
|
133 | + echo apply_filters( |
|
134 | + 'AFEE__thank_you_page_registration_details_template__wait_list_notice', |
|
135 | + sprintf( |
|
136 | + esc_html__( |
|
137 | + '%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s', |
|
138 | + 'event_espresso' |
|
139 | + ), |
|
140 | + '<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>', |
|
141 | + '</h6 ><p class="ee-wait-list-notice">', |
|
142 | + '</p ><br />' |
|
143 | + ) |
|
144 | + ); |
|
145 | + } |
|
146 | + do_action('AHEE__thank_you_page_registration_details_template__after_registration_details'); |
|
147 | + ?> |
|
148 | 148 | |
149 | 149 | </div> |
150 | 150 | <!-- end of .registration-details --> |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public static function set_definitions() |
131 | 131 | { |
132 | - define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); |
|
133 | - define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/'); |
|
132 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets/'); |
|
133 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)).'templates/'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | return $this->_current_txn; |
148 | 148 | } |
149 | 149 | $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
150 | - if (! $TXN_model instanceof EEM_Transaction) { |
|
150 | + if ( ! $TXN_model instanceof EEM_Transaction) { |
|
151 | 151 | EE_Error::add_error( |
152 | 152 | esc_html__('The transaction model could not be established.', 'event_espresso'), |
153 | 153 | __FILE__, |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function get_txn_payments($since = 0) |
187 | 187 | { |
188 | - if (! $this->get_txn()) { |
|
188 | + if ( ! $this->get_txn()) { |
|
189 | 189 | return []; |
190 | 190 | } |
191 | 191 | $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | { |
328 | 328 | wp_register_script( |
329 | 329 | 'thank_you_page', |
330 | - THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
330 | + THANK_YOU_ASSETS_URL.'thank_you_page.js', |
|
331 | 331 | array('espresso_core', 'heartbeat'), |
332 | 332 | EVENT_ESPRESSO_VERSION, |
333 | 333 | true |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | public function init() |
348 | 348 | { |
349 | 349 | $this->_get_reg_url_link(); |
350 | - if (! $this->get_txn()) { |
|
350 | + if ( ! $this->get_txn()) { |
|
351 | 351 | echo EEH_HTML::div( |
352 | - EEH_HTML::h4(esc_html__('We\'re sorry...', 'event_espresso')) . |
|
352 | + EEH_HTML::h4(esc_html__('We\'re sorry...', 'event_espresso')). |
|
353 | 353 | sprintf( |
354 | 354 | esc_html__( |
355 | 355 | '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', |
@@ -440,12 +440,12 @@ discard block |
||
440 | 440 | public function thank_you_page_results() |
441 | 441 | { |
442 | 442 | $this->init(); |
443 | - if (! $this->_current_txn instanceof EE_Transaction) { |
|
443 | + if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
444 | 444 | return EE_Error::get_notices(); |
445 | 445 | } |
446 | 446 | // link to receipt |
447 | 447 | $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url(); |
448 | - if (! empty($template_args['TXN_receipt_url'])) { |
|
448 | + if ( ! empty($template_args['TXN_receipt_url'])) { |
|
449 | 449 | $template_args['order_conf_desc'] = esc_html__( |
450 | 450 | '%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.', |
451 | 451 | 'event_espresso' |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
464 | 464 | } |
465 | 465 | return EEH_Template::locate_template( |
466 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
466 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', |
|
467 | 467 | $template_args |
468 | 468 | ); |
469 | 469 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | '$SPCO_attendee_information_url' |
514 | 514 | ); |
515 | 515 | echo EEH_Template::locate_template( |
516 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
516 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', |
|
517 | 517 | $template_args |
518 | 518 | ); |
519 | 519 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function get_ajax_content() |
587 | 587 | { |
588 | - if (! $this->get_txn()) { |
|
588 | + if ( ! $this->get_txn()) { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | // first determine which event(s) require pre-approval or not |
@@ -596,9 +596,9 @@ discard block |
||
596 | 596 | $event = $registration->event(); |
597 | 597 | if ($event instanceof EE_Event) { |
598 | 598 | if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
599 | - $events_requiring_pre_approval[ $event->ID() ] = $event; |
|
599 | + $events_requiring_pre_approval[$event->ID()] = $event; |
|
600 | 600 | } else { |
601 | - $events[ $event->ID() ] = $event; |
|
601 | + $events[$event->ID()] = $event; |
|
602 | 602 | } |
603 | 603 | } |
604 | 604 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | */ |
617 | 617 | public function display_details_for_events($events = array()) |
618 | 618 | { |
619 | - if (! empty($events)) { |
|
619 | + if ( ! empty($events)) { |
|
620 | 620 | ?> |
621 | 621 | <div id="espresso-thank-you-page-ajax-content-dv"> |
622 | 622 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | 'event_espresso' |
630 | 630 | ); ?></span> |
631 | 631 | </div> |
632 | - <?php if (! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
|
632 | + <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
|
633 | 633 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
634 | 634 | <?php echo apply_filters( |
635 | 635 | 'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg', |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | */ |
663 | 663 | public function display_details_for_events_requiring_pre_approval($events = array()) |
664 | 664 | { |
665 | - if (! empty($events)) { |
|
665 | + if ( ! empty($events)) { |
|
666 | 666 | ?> |
667 | 667 | <div id="espresso-thank-you-page-not-approved-message-dv"> |
668 | 668 | <h4 class="orange-text"><?php esc_html_e('Important Notice:', 'event_espresso'); ?></h4> |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | '$SPCO_payment_options_url' |
720 | 720 | ); |
721 | 721 | return EEH_Template::locate_template( |
722 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
722 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', |
|
723 | 723 | $template_args |
724 | 724 | ); |
725 | 725 | } |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | public function get_payment_row_html(EE_Payment $payment = null) |
736 | 736 | { |
737 | 737 | $html = ''; |
738 | - if (! $payment instanceof EE_Payment) { |
|
738 | + if ( ! $payment instanceof EE_Payment) { |
|
739 | 739 | return ''; |
740 | 740 | } |
741 | 741 | if ( |
@@ -749,25 +749,25 @@ discard block |
||
749 | 749 | $payment->set_status(EEM_Payment::status_id_pending); |
750 | 750 | } |
751 | 751 | $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
752 | - ? '<br /><span class="small-text">' . esc_html($payment->gateway_response()) . '</span>' |
|
752 | + ? '<br /><span class="small-text">'.esc_html($payment->gateway_response()).'</span>' |
|
753 | 753 | : ''; |
754 | 754 | $html .= ' |
755 | 755 | <tr> |
756 | 756 | <td> |
757 | - ' . esc_html($payment->timestamp()) . ' |
|
757 | + ' . esc_html($payment->timestamp()).' |
|
758 | 758 | </td> |
759 | 759 | <td> |
760 | 760 | ' . ( |
761 | 761 | $payment->payment_method() instanceof EE_Payment_Method |
762 | 762 | ? esc_html($payment->payment_method()->name()) |
763 | 763 | : esc_html__('Unknown', 'event_espresso') |
764 | - ) . ' |
|
764 | + ).' |
|
765 | 765 | </td> |
766 | 766 | <td class="jst-rght"> |
767 | - ' . EEH_Template::format_currency($payment->amount()) . ' |
|
767 | + ' . EEH_Template::format_currency($payment->amount()).' |
|
768 | 768 | </td> |
769 | 769 | <td class="jst-rght" style="line-height:1;"> |
770 | - ' . $payment->pretty_status(true) . $payment_declined_msg . ' |
|
770 | + ' . $payment->pretty_status(true).$payment_declined_msg.' |
|
771 | 771 | </td> |
772 | 772 | </tr>'; |
773 | 773 | do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | '$SPCO_payment_options_url' |
826 | 826 | ); |
827 | 827 | return EEH_Template::locate_template( |
828 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
828 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', |
|
829 | 829 | $template_args |
830 | 830 | ); |
831 | 831 | } |
@@ -10,613 +10,613 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class EED_Thank_You_Page extends EED_Module |
12 | 12 | { |
13 | - /** |
|
14 | - * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes ) |
|
15 | - */ |
|
16 | - const IPN_wait_time = 1200; |
|
17 | - |
|
18 | - /** |
|
19 | - * The transaction specified by the reg_url_link passed from the Request, or from the Session |
|
20 | - * |
|
21 | - * @var EE_Transaction $_current_txn |
|
22 | - */ |
|
23 | - private $_current_txn; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var EE_Registration $_primary_registrant |
|
27 | - */ |
|
28 | - private $_primary_registrant; |
|
29 | - |
|
30 | - /** |
|
31 | - * The reg_url_link passed from the Request, or from the Session |
|
32 | - * |
|
33 | - * @var string $_reg_url_link |
|
34 | - */ |
|
35 | - private $_reg_url_link; |
|
36 | - |
|
37 | - /** |
|
38 | - * whether the incoming reg_url_link is for the primary registrant or not |
|
39 | - * |
|
40 | - * @var boolean $_is_primary |
|
41 | - */ |
|
42 | - private $_is_primary; |
|
43 | - |
|
44 | - /** |
|
45 | - * The URL for revisiting the SPCO attendee information step |
|
46 | - * |
|
47 | - * @var string $_SPCO_attendee_information_url |
|
48 | - */ |
|
49 | - private $_SPCO_attendee_information_url; |
|
50 | - |
|
51 | - /** |
|
52 | - * The URL for revisiting the SPCO payment options step |
|
53 | - * |
|
54 | - * @var string $_SPCO_payment_options_url |
|
55 | - */ |
|
56 | - private $_SPCO_payment_options_url; |
|
57 | - |
|
58 | - /** |
|
59 | - * whether to display the Payment Options link |
|
60 | - * |
|
61 | - * @var boolean $_show_try_pay_again_link |
|
62 | - */ |
|
63 | - private $_show_try_pay_again_link = false; |
|
64 | - |
|
65 | - /** |
|
66 | - * whether payments are allowed at this time |
|
67 | - * |
|
68 | - * @var boolean $_payments_closed |
|
69 | - */ |
|
70 | - private $_payments_closed = false; |
|
71 | - |
|
72 | - /** |
|
73 | - * whether the selected payment method is Bank, Check , Invoice, etc |
|
74 | - * |
|
75 | - * @var boolean $_is_offline_payment_method |
|
76 | - */ |
|
77 | - private $_is_offline_payment_method = true; |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * @return EED_Module|EED_Thank_You_Page |
|
82 | - * @throws EE_Error |
|
83 | - * @throws ReflectionException |
|
84 | - */ |
|
85 | - public static function instance() |
|
86 | - { |
|
87 | - return parent::get_instance(__CLASS__); |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * set_hooks - for hooking into EE Core, modules, etc |
|
93 | - * |
|
94 | - * @return void |
|
95 | - */ |
|
96 | - public static function set_hooks() |
|
97 | - { |
|
98 | - add_action('wp_loaded', array('EED_Thank_You_Page', 'set_definitions'), 2); |
|
99 | - } |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * set_hooks_admin - for hooking into EE Admin Core, modules, etc |
|
104 | - * |
|
105 | - * @return void |
|
106 | - */ |
|
107 | - public static function set_hooks_admin() |
|
108 | - { |
|
109 | - add_action( |
|
110 | - 'wp_ajax_espresso_resend_reg_confirmation_email', |
|
111 | - array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
112 | - 10, |
|
113 | - 2 |
|
114 | - ); |
|
115 | - add_action( |
|
116 | - 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', |
|
117 | - array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
118 | - 10, |
|
119 | - 2 |
|
120 | - ); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * set_definitions |
|
126 | - * |
|
127 | - * @return void |
|
128 | - */ |
|
129 | - public static function set_definitions() |
|
130 | - { |
|
131 | - define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); |
|
132 | - define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/'); |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * get_txn |
|
138 | - * |
|
139 | - * @return EE_Transaction |
|
140 | - * @throws EE_Error |
|
141 | - * @throws ReflectionException |
|
142 | - */ |
|
143 | - public function get_txn() |
|
144 | - { |
|
145 | - if ($this->_current_txn instanceof EE_Transaction) { |
|
146 | - return $this->_current_txn; |
|
147 | - } |
|
148 | - $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
149 | - if (! $TXN_model instanceof EEM_Transaction) { |
|
150 | - EE_Error::add_error( |
|
151 | - esc_html__('The transaction model could not be established.', 'event_espresso'), |
|
152 | - __FILE__, |
|
153 | - __FUNCTION__, |
|
154 | - __LINE__ |
|
155 | - ); |
|
156 | - return null; |
|
157 | - } |
|
158 | - // get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
|
159 | - $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
160 | - // verify TXN |
|
161 | - if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
162 | - EE_Error::add_error( |
|
163 | - esc_html__( |
|
164 | - 'No transaction information could be retrieved or the transaction data is not of the correct type.', |
|
165 | - 'event_espresso' |
|
166 | - ), |
|
167 | - __FILE__, |
|
168 | - __FUNCTION__, |
|
169 | - __LINE__ |
|
170 | - ); |
|
171 | - return null; |
|
172 | - } |
|
173 | - return $this->_current_txn; |
|
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * get_txn_payments |
|
179 | - * |
|
180 | - * @param int $since |
|
181 | - * @return EE_Payment[] |
|
182 | - * @throws EE_Error |
|
183 | - * @throws ReflectionException |
|
184 | - */ |
|
185 | - public function get_txn_payments($since = 0) |
|
186 | - { |
|
187 | - if (! $this->get_txn()) { |
|
188 | - return []; |
|
189 | - } |
|
190 | - $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
191 | - if ($since > 0) { |
|
192 | - $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
193 | - } |
|
194 | - // get array of payments with most recent first |
|
195 | - return $this->_current_txn->payments($args); |
|
196 | - } |
|
197 | - |
|
198 | - |
|
199 | - /** |
|
200 | - * @return bool |
|
201 | - */ |
|
202 | - public function isOfflinePaymentMethod() |
|
203 | - { |
|
204 | - return $this->_is_offline_payment_method; |
|
205 | - } |
|
206 | - |
|
207 | - |
|
208 | - |
|
209 | - |
|
210 | - /** |
|
211 | - * get_reg_url_link |
|
212 | - * |
|
213 | - * @return void |
|
214 | - */ |
|
215 | - private function _get_reg_url_link() |
|
216 | - { |
|
217 | - if ($this->_reg_url_link) { |
|
218 | - return; |
|
219 | - } |
|
220 | - // check for reg_url_link |
|
221 | - $reg_url_link = self::getRequest()->getRequestParam('e_reg_url_link'); |
|
222 | - // only do thank you page stuff if we have a REG_url_link in the url |
|
223 | - if (WP_DEBUG && ! $reg_url_link) { |
|
224 | - EE_Error::add_error( |
|
225 | - esc_html__( |
|
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 | - } |
|
234 | - $this->set_reg_url_link($reg_url_link); |
|
235 | - } |
|
236 | - |
|
237 | - |
|
238 | - /** |
|
239 | - * set_reg_url_link |
|
240 | - * |
|
241 | - * @param string $reg_url_link |
|
242 | - */ |
|
243 | - public function set_reg_url_link($reg_url_link = null) |
|
244 | - { |
|
245 | - $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
246 | - } |
|
247 | - |
|
248 | - |
|
249 | - /** |
|
250 | - * run - initial module setup |
|
251 | - * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
252 | - * |
|
253 | - * @param WP $WP |
|
254 | - * @return void |
|
255 | - */ |
|
256 | - public function run($WP) |
|
257 | - { |
|
258 | - } |
|
259 | - |
|
260 | - |
|
261 | - /** |
|
262 | - * load_resources |
|
263 | - * |
|
264 | - * @return void |
|
265 | - * @throws EE_Error |
|
266 | - * @throws ReflectionException |
|
267 | - */ |
|
268 | - public function load_resources() |
|
269 | - { |
|
270 | - $this->_get_reg_url_link(); |
|
271 | - // resend_reg_confirmation_email ? |
|
272 | - if (self::getRequest()->requestParamIsSet('resend')) { |
|
273 | - EED_Thank_You_Page::resend_reg_confirmation_email(); |
|
274 | - } |
|
275 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
276 | - $this->_translate_strings(); |
|
277 | - // load assets |
|
278 | - add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
279 | - } |
|
280 | - |
|
281 | - |
|
282 | - /** |
|
283 | - * load_js |
|
284 | - * |
|
285 | - * @return void |
|
286 | - */ |
|
287 | - protected function _translate_strings() |
|
288 | - { |
|
289 | - EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
290 | - EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
291 | - EE_Registry::$i18n_js_strings['IPN_wait_time'] = EED_Thank_You_Page::IPN_wait_time; |
|
292 | - EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
293 | - EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
294 | - EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __( |
|
295 | - 'checking for new payments...', |
|
296 | - 'event_espresso' |
|
297 | - ); |
|
298 | - EE_Registry::$i18n_js_strings['loading_payment_info'] = __( |
|
299 | - 'loading payment information...', |
|
300 | - 'event_espresso' |
|
301 | - ); |
|
302 | - EE_Registry::$i18n_js_strings['server_error'] = __( |
|
303 | - 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', |
|
304 | - 'event_espresso' |
|
305 | - ); |
|
306 | - EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
307 | - 'EED_Thank_You_Page__load_js__slow_IPN', |
|
308 | - sprintf( |
|
309 | - __( |
|
310 | - '%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', |
|
311 | - 'event_espresso' |
|
312 | - ), |
|
313 | - '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
|
314 | - '</div>' |
|
315 | - ) |
|
316 | - ); |
|
317 | - } |
|
318 | - |
|
319 | - |
|
320 | - /** |
|
321 | - * load_js |
|
322 | - * |
|
323 | - * @return void |
|
324 | - */ |
|
325 | - public function load_js() |
|
326 | - { |
|
327 | - wp_register_script( |
|
328 | - 'thank_you_page', |
|
329 | - THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
330 | - array('espresso_core', 'heartbeat'), |
|
331 | - EVENT_ESPRESSO_VERSION, |
|
332 | - true |
|
333 | - ); |
|
334 | - wp_enqueue_script('thank_you_page'); |
|
335 | - wp_enqueue_style('espresso_default'); |
|
336 | - } |
|
337 | - |
|
338 | - |
|
339 | - /** |
|
340 | - * init |
|
341 | - * |
|
342 | - * @return void |
|
343 | - * @throws EE_Error |
|
344 | - * @throws ReflectionException |
|
345 | - */ |
|
346 | - public function init() |
|
347 | - { |
|
348 | - $this->_get_reg_url_link(); |
|
349 | - if (! $this->get_txn()) { |
|
350 | - echo EEH_HTML::div( |
|
351 | - EEH_HTML::h4(esc_html__('We\'re sorry...', 'event_espresso')) . |
|
352 | - sprintf( |
|
353 | - esc_html__( |
|
354 | - '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', |
|
355 | - 'event_espresso' |
|
356 | - ), |
|
357 | - '<br/>' |
|
358 | - ), |
|
359 | - '', |
|
360 | - 'ee-attention' |
|
361 | - ); |
|
362 | - return; |
|
363 | - } |
|
364 | - // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
|
365 | - if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) { |
|
366 | - $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
367 | - $this->_current_txn->save(); |
|
368 | - } |
|
369 | - $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration |
|
370 | - ? $this->_current_txn->primary_registration() |
|
371 | - : null; |
|
372 | - $this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link; |
|
373 | - $show_try_pay_again_link_default = apply_filters( |
|
374 | - 'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default', |
|
375 | - true |
|
376 | - ); |
|
377 | - $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
378 | - // txn status ? |
|
379 | - if ($this->_current_txn->is_completed()) { |
|
380 | - $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
381 | - } elseif ( |
|
382 | - $this->_current_txn->is_incomplete() |
|
383 | - && ($this->_primary_registrant->is_approved() |
|
384 | - || $this->_primary_registrant->is_pending_payment()) |
|
385 | - ) { |
|
386 | - $this->_show_try_pay_again_link = true; |
|
387 | - } elseif ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
388 | - // its pending |
|
389 | - $this->_show_try_pay_again_link = isset( |
|
390 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
391 | - ) |
|
392 | - && EE_Registry::instance()->CFG |
|
393 | - ->registration->show_pending_payment_options |
|
394 | - ? true |
|
395 | - : $show_try_pay_again_link_default; |
|
396 | - } |
|
397 | - $this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method; |
|
398 | - $this->_is_offline_payment_method = false; |
|
399 | - if ( |
|
13 | + /** |
|
14 | + * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes ) |
|
15 | + */ |
|
16 | + const IPN_wait_time = 1200; |
|
17 | + |
|
18 | + /** |
|
19 | + * The transaction specified by the reg_url_link passed from the Request, or from the Session |
|
20 | + * |
|
21 | + * @var EE_Transaction $_current_txn |
|
22 | + */ |
|
23 | + private $_current_txn; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var EE_Registration $_primary_registrant |
|
27 | + */ |
|
28 | + private $_primary_registrant; |
|
29 | + |
|
30 | + /** |
|
31 | + * The reg_url_link passed from the Request, or from the Session |
|
32 | + * |
|
33 | + * @var string $_reg_url_link |
|
34 | + */ |
|
35 | + private $_reg_url_link; |
|
36 | + |
|
37 | + /** |
|
38 | + * whether the incoming reg_url_link is for the primary registrant or not |
|
39 | + * |
|
40 | + * @var boolean $_is_primary |
|
41 | + */ |
|
42 | + private $_is_primary; |
|
43 | + |
|
44 | + /** |
|
45 | + * The URL for revisiting the SPCO attendee information step |
|
46 | + * |
|
47 | + * @var string $_SPCO_attendee_information_url |
|
48 | + */ |
|
49 | + private $_SPCO_attendee_information_url; |
|
50 | + |
|
51 | + /** |
|
52 | + * The URL for revisiting the SPCO payment options step |
|
53 | + * |
|
54 | + * @var string $_SPCO_payment_options_url |
|
55 | + */ |
|
56 | + private $_SPCO_payment_options_url; |
|
57 | + |
|
58 | + /** |
|
59 | + * whether to display the Payment Options link |
|
60 | + * |
|
61 | + * @var boolean $_show_try_pay_again_link |
|
62 | + */ |
|
63 | + private $_show_try_pay_again_link = false; |
|
64 | + |
|
65 | + /** |
|
66 | + * whether payments are allowed at this time |
|
67 | + * |
|
68 | + * @var boolean $_payments_closed |
|
69 | + */ |
|
70 | + private $_payments_closed = false; |
|
71 | + |
|
72 | + /** |
|
73 | + * whether the selected payment method is Bank, Check , Invoice, etc |
|
74 | + * |
|
75 | + * @var boolean $_is_offline_payment_method |
|
76 | + */ |
|
77 | + private $_is_offline_payment_method = true; |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * @return EED_Module|EED_Thank_You_Page |
|
82 | + * @throws EE_Error |
|
83 | + * @throws ReflectionException |
|
84 | + */ |
|
85 | + public static function instance() |
|
86 | + { |
|
87 | + return parent::get_instance(__CLASS__); |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * set_hooks - for hooking into EE Core, modules, etc |
|
93 | + * |
|
94 | + * @return void |
|
95 | + */ |
|
96 | + public static function set_hooks() |
|
97 | + { |
|
98 | + add_action('wp_loaded', array('EED_Thank_You_Page', 'set_definitions'), 2); |
|
99 | + } |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * set_hooks_admin - for hooking into EE Admin Core, modules, etc |
|
104 | + * |
|
105 | + * @return void |
|
106 | + */ |
|
107 | + public static function set_hooks_admin() |
|
108 | + { |
|
109 | + add_action( |
|
110 | + 'wp_ajax_espresso_resend_reg_confirmation_email', |
|
111 | + array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
112 | + 10, |
|
113 | + 2 |
|
114 | + ); |
|
115 | + add_action( |
|
116 | + 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', |
|
117 | + array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
118 | + 10, |
|
119 | + 2 |
|
120 | + ); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * set_definitions |
|
126 | + * |
|
127 | + * @return void |
|
128 | + */ |
|
129 | + public static function set_definitions() |
|
130 | + { |
|
131 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); |
|
132 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/'); |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * get_txn |
|
138 | + * |
|
139 | + * @return EE_Transaction |
|
140 | + * @throws EE_Error |
|
141 | + * @throws ReflectionException |
|
142 | + */ |
|
143 | + public function get_txn() |
|
144 | + { |
|
145 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
146 | + return $this->_current_txn; |
|
147 | + } |
|
148 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
149 | + if (! $TXN_model instanceof EEM_Transaction) { |
|
150 | + EE_Error::add_error( |
|
151 | + esc_html__('The transaction model could not be established.', 'event_espresso'), |
|
152 | + __FILE__, |
|
153 | + __FUNCTION__, |
|
154 | + __LINE__ |
|
155 | + ); |
|
156 | + return null; |
|
157 | + } |
|
158 | + // get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
|
159 | + $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
160 | + // verify TXN |
|
161 | + if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
162 | + EE_Error::add_error( |
|
163 | + esc_html__( |
|
164 | + 'No transaction information could be retrieved or the transaction data is not of the correct type.', |
|
165 | + 'event_espresso' |
|
166 | + ), |
|
167 | + __FILE__, |
|
168 | + __FUNCTION__, |
|
169 | + __LINE__ |
|
170 | + ); |
|
171 | + return null; |
|
172 | + } |
|
173 | + return $this->_current_txn; |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * get_txn_payments |
|
179 | + * |
|
180 | + * @param int $since |
|
181 | + * @return EE_Payment[] |
|
182 | + * @throws EE_Error |
|
183 | + * @throws ReflectionException |
|
184 | + */ |
|
185 | + public function get_txn_payments($since = 0) |
|
186 | + { |
|
187 | + if (! $this->get_txn()) { |
|
188 | + return []; |
|
189 | + } |
|
190 | + $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
191 | + if ($since > 0) { |
|
192 | + $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
193 | + } |
|
194 | + // get array of payments with most recent first |
|
195 | + return $this->_current_txn->payments($args); |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + /** |
|
200 | + * @return bool |
|
201 | + */ |
|
202 | + public function isOfflinePaymentMethod() |
|
203 | + { |
|
204 | + return $this->_is_offline_payment_method; |
|
205 | + } |
|
206 | + |
|
207 | + |
|
208 | + |
|
209 | + |
|
210 | + /** |
|
211 | + * get_reg_url_link |
|
212 | + * |
|
213 | + * @return void |
|
214 | + */ |
|
215 | + private function _get_reg_url_link() |
|
216 | + { |
|
217 | + if ($this->_reg_url_link) { |
|
218 | + return; |
|
219 | + } |
|
220 | + // check for reg_url_link |
|
221 | + $reg_url_link = self::getRequest()->getRequestParam('e_reg_url_link'); |
|
222 | + // only do thank you page stuff if we have a REG_url_link in the url |
|
223 | + if (WP_DEBUG && ! $reg_url_link) { |
|
224 | + EE_Error::add_error( |
|
225 | + esc_html__( |
|
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 | + } |
|
234 | + $this->set_reg_url_link($reg_url_link); |
|
235 | + } |
|
236 | + |
|
237 | + |
|
238 | + /** |
|
239 | + * set_reg_url_link |
|
240 | + * |
|
241 | + * @param string $reg_url_link |
|
242 | + */ |
|
243 | + public function set_reg_url_link($reg_url_link = null) |
|
244 | + { |
|
245 | + $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
246 | + } |
|
247 | + |
|
248 | + |
|
249 | + /** |
|
250 | + * run - initial module setup |
|
251 | + * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
252 | + * |
|
253 | + * @param WP $WP |
|
254 | + * @return void |
|
255 | + */ |
|
256 | + public function run($WP) |
|
257 | + { |
|
258 | + } |
|
259 | + |
|
260 | + |
|
261 | + /** |
|
262 | + * load_resources |
|
263 | + * |
|
264 | + * @return void |
|
265 | + * @throws EE_Error |
|
266 | + * @throws ReflectionException |
|
267 | + */ |
|
268 | + public function load_resources() |
|
269 | + { |
|
270 | + $this->_get_reg_url_link(); |
|
271 | + // resend_reg_confirmation_email ? |
|
272 | + if (self::getRequest()->requestParamIsSet('resend')) { |
|
273 | + EED_Thank_You_Page::resend_reg_confirmation_email(); |
|
274 | + } |
|
275 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
276 | + $this->_translate_strings(); |
|
277 | + // load assets |
|
278 | + add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
279 | + } |
|
280 | + |
|
281 | + |
|
282 | + /** |
|
283 | + * load_js |
|
284 | + * |
|
285 | + * @return void |
|
286 | + */ |
|
287 | + protected function _translate_strings() |
|
288 | + { |
|
289 | + EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
290 | + EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
291 | + EE_Registry::$i18n_js_strings['IPN_wait_time'] = EED_Thank_You_Page::IPN_wait_time; |
|
292 | + EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
293 | + EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
294 | + EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __( |
|
295 | + 'checking for new payments...', |
|
296 | + 'event_espresso' |
|
297 | + ); |
|
298 | + EE_Registry::$i18n_js_strings['loading_payment_info'] = __( |
|
299 | + 'loading payment information...', |
|
300 | + 'event_espresso' |
|
301 | + ); |
|
302 | + EE_Registry::$i18n_js_strings['server_error'] = __( |
|
303 | + 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', |
|
304 | + 'event_espresso' |
|
305 | + ); |
|
306 | + EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
307 | + 'EED_Thank_You_Page__load_js__slow_IPN', |
|
308 | + sprintf( |
|
309 | + __( |
|
310 | + '%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', |
|
311 | + 'event_espresso' |
|
312 | + ), |
|
313 | + '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
|
314 | + '</div>' |
|
315 | + ) |
|
316 | + ); |
|
317 | + } |
|
318 | + |
|
319 | + |
|
320 | + /** |
|
321 | + * load_js |
|
322 | + * |
|
323 | + * @return void |
|
324 | + */ |
|
325 | + public function load_js() |
|
326 | + { |
|
327 | + wp_register_script( |
|
328 | + 'thank_you_page', |
|
329 | + THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
330 | + array('espresso_core', 'heartbeat'), |
|
331 | + EVENT_ESPRESSO_VERSION, |
|
332 | + true |
|
333 | + ); |
|
334 | + wp_enqueue_script('thank_you_page'); |
|
335 | + wp_enqueue_style('espresso_default'); |
|
336 | + } |
|
337 | + |
|
338 | + |
|
339 | + /** |
|
340 | + * init |
|
341 | + * |
|
342 | + * @return void |
|
343 | + * @throws EE_Error |
|
344 | + * @throws ReflectionException |
|
345 | + */ |
|
346 | + public function init() |
|
347 | + { |
|
348 | + $this->_get_reg_url_link(); |
|
349 | + if (! $this->get_txn()) { |
|
350 | + echo EEH_HTML::div( |
|
351 | + EEH_HTML::h4(esc_html__('We\'re sorry...', 'event_espresso')) . |
|
352 | + sprintf( |
|
353 | + esc_html__( |
|
354 | + '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', |
|
355 | + 'event_espresso' |
|
356 | + ), |
|
357 | + '<br/>' |
|
358 | + ), |
|
359 | + '', |
|
360 | + 'ee-attention' |
|
361 | + ); |
|
362 | + return; |
|
363 | + } |
|
364 | + // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
|
365 | + if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) { |
|
366 | + $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
367 | + $this->_current_txn->save(); |
|
368 | + } |
|
369 | + $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration |
|
370 | + ? $this->_current_txn->primary_registration() |
|
371 | + : null; |
|
372 | + $this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link; |
|
373 | + $show_try_pay_again_link_default = apply_filters( |
|
374 | + 'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default', |
|
375 | + true |
|
376 | + ); |
|
377 | + $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
378 | + // txn status ? |
|
379 | + if ($this->_current_txn->is_completed()) { |
|
380 | + $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
381 | + } elseif ( |
|
382 | + $this->_current_txn->is_incomplete() |
|
383 | + && ($this->_primary_registrant->is_approved() |
|
384 | + || $this->_primary_registrant->is_pending_payment()) |
|
385 | + ) { |
|
386 | + $this->_show_try_pay_again_link = true; |
|
387 | + } elseif ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
388 | + // its pending |
|
389 | + $this->_show_try_pay_again_link = isset( |
|
390 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
391 | + ) |
|
392 | + && EE_Registry::instance()->CFG |
|
393 | + ->registration->show_pending_payment_options |
|
394 | + ? true |
|
395 | + : $show_try_pay_again_link_default; |
|
396 | + } |
|
397 | + $this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method; |
|
398 | + $this->_is_offline_payment_method = false; |
|
399 | + if ( |
|
400 | 400 | // if payment method is unknown |
401 | - ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
402 | - || ( |
|
403 | - // or is an offline payment method |
|
404 | - $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
405 | - && $this->_current_txn->payment_method()->is_off_line() |
|
406 | - ) |
|
407 | - ) { |
|
408 | - $this->_is_offline_payment_method = true; |
|
409 | - } |
|
410 | - // link to SPCO |
|
411 | - $revisit_spco_url = add_query_arg( |
|
412 | - array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link), |
|
413 | - EE_Registry::instance()->CFG->core->reg_page_url() |
|
414 | - ); |
|
415 | - // link to SPCO payment_options |
|
416 | - $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration |
|
417 | - ? $this->_primary_registrant->payment_overview_url() |
|
418 | - : add_query_arg( |
|
419 | - array('step' => 'payment_options'), |
|
420 | - $revisit_spco_url |
|
421 | - ); |
|
422 | - // link to SPCO attendee_information |
|
423 | - $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration |
|
424 | - ? $this->_primary_registrant->edit_attendee_information_url() |
|
425 | - : false; |
|
426 | - do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn); |
|
427 | - // set no cache headers and constants |
|
428 | - EE_System::do_not_cache(); |
|
429 | - } |
|
430 | - |
|
431 | - |
|
432 | - /** |
|
433 | - * display_thank_you_page_results |
|
434 | - * |
|
435 | - * @return string |
|
436 | - * @throws EE_Error |
|
437 | - * @throws ReflectionException |
|
438 | - */ |
|
439 | - public function thank_you_page_results() |
|
440 | - { |
|
441 | - $this->init(); |
|
442 | - if (! $this->_current_txn instanceof EE_Transaction) { |
|
443 | - return EE_Error::get_notices(); |
|
444 | - } |
|
445 | - // link to receipt |
|
446 | - $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url(); |
|
447 | - if (! empty($template_args['TXN_receipt_url'])) { |
|
448 | - $template_args['order_conf_desc'] = esc_html__( |
|
449 | - '%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.', |
|
450 | - 'event_espresso' |
|
451 | - ); |
|
452 | - } else { |
|
453 | - $template_args['order_conf_desc'] = esc_html__( |
|
454 | - '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', |
|
455 | - 'event_espresso' |
|
456 | - ); |
|
457 | - } |
|
458 | - $template_args['transaction'] = $this->_current_txn; |
|
459 | - $template_args['revisit'] = self::getRequest()->getRequestParam('revisit', false, 'bool'); |
|
460 | - add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
461 | - if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
462 | - add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
463 | - } |
|
464 | - return EEH_Template::locate_template( |
|
465 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
466 | - $template_args |
|
467 | - ); |
|
468 | - } |
|
469 | - |
|
470 | - |
|
471 | - /** |
|
472 | - * _update_server_wait_time |
|
473 | - * |
|
474 | - * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
|
475 | - * @return array |
|
476 | - * @throws EE_Error |
|
477 | - * @throws ReflectionException |
|
478 | - */ |
|
479 | - private function _update_server_wait_time($thank_you_page_data = array()) |
|
480 | - { |
|
481 | - $response['espresso_thank_you_page'] = array( |
|
482 | - 'still_waiting' => isset($thank_you_page_data['initial_access']) |
|
483 | - ? time() - $thank_you_page_data['initial_access'] |
|
484 | - : 0, |
|
485 | - 'txn_status' => $this->_current_txn->status_ID(), |
|
486 | - ); |
|
487 | - return $response; |
|
488 | - } |
|
489 | - |
|
490 | - |
|
491 | - /** |
|
492 | - * get_registration_details |
|
493 | - * |
|
494 | - * @throws EE_Error |
|
495 | - */ |
|
496 | - public function get_registration_details() |
|
497 | - { |
|
498 | - // prepare variables for displaying |
|
499 | - $template_args = array(); |
|
500 | - $template_args['transaction'] = $this->_current_txn; |
|
501 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
502 | - $template_args['is_primary'] = $this->_is_primary; |
|
503 | - $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
|
504 | - $template_args['resend_reg_confirmation_url'] = add_query_arg( |
|
505 | - array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
506 | - EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
507 | - ); |
|
508 | - // verify template arguments |
|
509 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
510 | - EEH_Template_Validator::verify_isnt_null( |
|
511 | - $template_args['SPCO_attendee_information_url'], |
|
512 | - '$SPCO_attendee_information_url' |
|
513 | - ); |
|
514 | - echo EEH_Template::locate_template( |
|
515 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
516 | - $template_args |
|
517 | - ); |
|
518 | - } |
|
519 | - |
|
520 | - |
|
521 | - /** |
|
522 | - * resend_reg_confirmation_email |
|
523 | - * |
|
524 | - * @throws EE_Error |
|
525 | - * @throws ReflectionException |
|
526 | - */ |
|
527 | - public static function resend_reg_confirmation_email() |
|
528 | - { |
|
529 | - $reg_url_link = self::getRequest()->getRequestParam('token'); |
|
530 | - // was a REG_ID passed ? |
|
531 | - if ($reg_url_link) { |
|
532 | - $registration = EEM_Registration::instance()->get_one( |
|
533 | - array(array('REG_url_link' => $reg_url_link)) |
|
534 | - ); |
|
535 | - if ($registration instanceof EE_Registration) { |
|
536 | - // resend email |
|
537 | - EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
538 | - } else { |
|
539 | - EE_Error::add_error( |
|
540 | - esc_html__( |
|
541 | - 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', |
|
542 | - 'event_espresso' |
|
543 | - ), |
|
544 | - __FILE__, |
|
545 | - __FUNCTION__, |
|
546 | - __LINE__ |
|
547 | - ); |
|
548 | - } |
|
549 | - } else { |
|
550 | - EE_Error::add_error( |
|
551 | - esc_html__( |
|
552 | - 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', |
|
553 | - 'event_espresso' |
|
554 | - ), |
|
555 | - __FILE__, |
|
556 | - __FUNCTION__, |
|
557 | - __LINE__ |
|
558 | - ); |
|
559 | - } |
|
560 | - // request sent via AJAX ? |
|
561 | - if (EE_FRONT_AJAX) { |
|
562 | - echo wp_json_encode(EE_Error::get_notices(false)); |
|
563 | - die(); |
|
564 | - // or was JS disabled ? |
|
565 | - } else { |
|
566 | - // save errors so that they get picked up on the next request |
|
567 | - EE_Error::get_notices(true, true); |
|
568 | - wp_safe_redirect( |
|
569 | - add_query_arg( |
|
570 | - array('e_reg_url_link' => $reg_url_link), |
|
571 | - EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
572 | - ) |
|
573 | - ); |
|
574 | - } |
|
575 | - } |
|
576 | - |
|
577 | - |
|
578 | - /** |
|
579 | - * get_ajax_content |
|
580 | - * |
|
581 | - * @return void |
|
582 | - * @throws EE_Error |
|
583 | - * @throws ReflectionException |
|
584 | - */ |
|
585 | - public function get_ajax_content() |
|
586 | - { |
|
587 | - if (! $this->get_txn()) { |
|
588 | - return; |
|
589 | - } |
|
590 | - // first determine which event(s) require pre-approval or not |
|
591 | - $events = array(); |
|
592 | - $events_requiring_pre_approval = array(); |
|
593 | - foreach ($this->_current_txn->registrations() as $registration) { |
|
594 | - if ($registration instanceof EE_Registration) { |
|
595 | - $event = $registration->event(); |
|
596 | - if ($event instanceof EE_Event) { |
|
597 | - if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
598 | - $events_requiring_pre_approval[ $event->ID() ] = $event; |
|
599 | - } else { |
|
600 | - $events[ $event->ID() ] = $event; |
|
601 | - } |
|
602 | - } |
|
603 | - } |
|
604 | - } |
|
605 | - $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
606 | - $this->display_details_for_events($events); |
|
607 | - } |
|
608 | - |
|
609 | - |
|
610 | - /** |
|
611 | - * display_details_for_events |
|
612 | - * |
|
613 | - * @param EE_Event[] $events |
|
614 | - * @return void |
|
615 | - */ |
|
616 | - public function display_details_for_events($events = array()) |
|
617 | - { |
|
618 | - if (! empty($events)) { |
|
619 | - ?> |
|
401 | + ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
402 | + || ( |
|
403 | + // or is an offline payment method |
|
404 | + $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
405 | + && $this->_current_txn->payment_method()->is_off_line() |
|
406 | + ) |
|
407 | + ) { |
|
408 | + $this->_is_offline_payment_method = true; |
|
409 | + } |
|
410 | + // link to SPCO |
|
411 | + $revisit_spco_url = add_query_arg( |
|
412 | + array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link), |
|
413 | + EE_Registry::instance()->CFG->core->reg_page_url() |
|
414 | + ); |
|
415 | + // link to SPCO payment_options |
|
416 | + $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration |
|
417 | + ? $this->_primary_registrant->payment_overview_url() |
|
418 | + : add_query_arg( |
|
419 | + array('step' => 'payment_options'), |
|
420 | + $revisit_spco_url |
|
421 | + ); |
|
422 | + // link to SPCO attendee_information |
|
423 | + $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration |
|
424 | + ? $this->_primary_registrant->edit_attendee_information_url() |
|
425 | + : false; |
|
426 | + do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn); |
|
427 | + // set no cache headers and constants |
|
428 | + EE_System::do_not_cache(); |
|
429 | + } |
|
430 | + |
|
431 | + |
|
432 | + /** |
|
433 | + * display_thank_you_page_results |
|
434 | + * |
|
435 | + * @return string |
|
436 | + * @throws EE_Error |
|
437 | + * @throws ReflectionException |
|
438 | + */ |
|
439 | + public function thank_you_page_results() |
|
440 | + { |
|
441 | + $this->init(); |
|
442 | + if (! $this->_current_txn instanceof EE_Transaction) { |
|
443 | + return EE_Error::get_notices(); |
|
444 | + } |
|
445 | + // link to receipt |
|
446 | + $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url(); |
|
447 | + if (! empty($template_args['TXN_receipt_url'])) { |
|
448 | + $template_args['order_conf_desc'] = esc_html__( |
|
449 | + '%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.', |
|
450 | + 'event_espresso' |
|
451 | + ); |
|
452 | + } else { |
|
453 | + $template_args['order_conf_desc'] = esc_html__( |
|
454 | + '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', |
|
455 | + 'event_espresso' |
|
456 | + ); |
|
457 | + } |
|
458 | + $template_args['transaction'] = $this->_current_txn; |
|
459 | + $template_args['revisit'] = self::getRequest()->getRequestParam('revisit', false, 'bool'); |
|
460 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
461 | + if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
462 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
463 | + } |
|
464 | + return EEH_Template::locate_template( |
|
465 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
466 | + $template_args |
|
467 | + ); |
|
468 | + } |
|
469 | + |
|
470 | + |
|
471 | + /** |
|
472 | + * _update_server_wait_time |
|
473 | + * |
|
474 | + * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
|
475 | + * @return array |
|
476 | + * @throws EE_Error |
|
477 | + * @throws ReflectionException |
|
478 | + */ |
|
479 | + private function _update_server_wait_time($thank_you_page_data = array()) |
|
480 | + { |
|
481 | + $response['espresso_thank_you_page'] = array( |
|
482 | + 'still_waiting' => isset($thank_you_page_data['initial_access']) |
|
483 | + ? time() - $thank_you_page_data['initial_access'] |
|
484 | + : 0, |
|
485 | + 'txn_status' => $this->_current_txn->status_ID(), |
|
486 | + ); |
|
487 | + return $response; |
|
488 | + } |
|
489 | + |
|
490 | + |
|
491 | + /** |
|
492 | + * get_registration_details |
|
493 | + * |
|
494 | + * @throws EE_Error |
|
495 | + */ |
|
496 | + public function get_registration_details() |
|
497 | + { |
|
498 | + // prepare variables for displaying |
|
499 | + $template_args = array(); |
|
500 | + $template_args['transaction'] = $this->_current_txn; |
|
501 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
502 | + $template_args['is_primary'] = $this->_is_primary; |
|
503 | + $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
|
504 | + $template_args['resend_reg_confirmation_url'] = add_query_arg( |
|
505 | + array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
506 | + EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
507 | + ); |
|
508 | + // verify template arguments |
|
509 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
510 | + EEH_Template_Validator::verify_isnt_null( |
|
511 | + $template_args['SPCO_attendee_information_url'], |
|
512 | + '$SPCO_attendee_information_url' |
|
513 | + ); |
|
514 | + echo EEH_Template::locate_template( |
|
515 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
516 | + $template_args |
|
517 | + ); |
|
518 | + } |
|
519 | + |
|
520 | + |
|
521 | + /** |
|
522 | + * resend_reg_confirmation_email |
|
523 | + * |
|
524 | + * @throws EE_Error |
|
525 | + * @throws ReflectionException |
|
526 | + */ |
|
527 | + public static function resend_reg_confirmation_email() |
|
528 | + { |
|
529 | + $reg_url_link = self::getRequest()->getRequestParam('token'); |
|
530 | + // was a REG_ID passed ? |
|
531 | + if ($reg_url_link) { |
|
532 | + $registration = EEM_Registration::instance()->get_one( |
|
533 | + array(array('REG_url_link' => $reg_url_link)) |
|
534 | + ); |
|
535 | + if ($registration instanceof EE_Registration) { |
|
536 | + // resend email |
|
537 | + EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
538 | + } else { |
|
539 | + EE_Error::add_error( |
|
540 | + esc_html__( |
|
541 | + 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', |
|
542 | + 'event_espresso' |
|
543 | + ), |
|
544 | + __FILE__, |
|
545 | + __FUNCTION__, |
|
546 | + __LINE__ |
|
547 | + ); |
|
548 | + } |
|
549 | + } else { |
|
550 | + EE_Error::add_error( |
|
551 | + esc_html__( |
|
552 | + 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', |
|
553 | + 'event_espresso' |
|
554 | + ), |
|
555 | + __FILE__, |
|
556 | + __FUNCTION__, |
|
557 | + __LINE__ |
|
558 | + ); |
|
559 | + } |
|
560 | + // request sent via AJAX ? |
|
561 | + if (EE_FRONT_AJAX) { |
|
562 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
563 | + die(); |
|
564 | + // or was JS disabled ? |
|
565 | + } else { |
|
566 | + // save errors so that they get picked up on the next request |
|
567 | + EE_Error::get_notices(true, true); |
|
568 | + wp_safe_redirect( |
|
569 | + add_query_arg( |
|
570 | + array('e_reg_url_link' => $reg_url_link), |
|
571 | + EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
572 | + ) |
|
573 | + ); |
|
574 | + } |
|
575 | + } |
|
576 | + |
|
577 | + |
|
578 | + /** |
|
579 | + * get_ajax_content |
|
580 | + * |
|
581 | + * @return void |
|
582 | + * @throws EE_Error |
|
583 | + * @throws ReflectionException |
|
584 | + */ |
|
585 | + public function get_ajax_content() |
|
586 | + { |
|
587 | + if (! $this->get_txn()) { |
|
588 | + return; |
|
589 | + } |
|
590 | + // first determine which event(s) require pre-approval or not |
|
591 | + $events = array(); |
|
592 | + $events_requiring_pre_approval = array(); |
|
593 | + foreach ($this->_current_txn->registrations() as $registration) { |
|
594 | + if ($registration instanceof EE_Registration) { |
|
595 | + $event = $registration->event(); |
|
596 | + if ($event instanceof EE_Event) { |
|
597 | + if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
598 | + $events_requiring_pre_approval[ $event->ID() ] = $event; |
|
599 | + } else { |
|
600 | + $events[ $event->ID() ] = $event; |
|
601 | + } |
|
602 | + } |
|
603 | + } |
|
604 | + } |
|
605 | + $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
606 | + $this->display_details_for_events($events); |
|
607 | + } |
|
608 | + |
|
609 | + |
|
610 | + /** |
|
611 | + * display_details_for_events |
|
612 | + * |
|
613 | + * @param EE_Event[] $events |
|
614 | + * @return void |
|
615 | + */ |
|
616 | + public function display_details_for_events($events = array()) |
|
617 | + { |
|
618 | + if (! empty($events)) { |
|
619 | + ?> |
|
620 | 620 | <div id="espresso-thank-you-page-ajax-content-dv"> |
621 | 621 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
622 | 622 | <div id="espresso-thank-you-page-ajax-payment-dv"></div> |
@@ -624,19 +624,19 @@ discard block |
||
624 | 624 | <div id="ee-ajax-loading-dv" class="float-left lt-blue-text"> |
625 | 625 | <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"> |
626 | 626 | <?php esc_html_e( |
627 | - 'loading transaction and payment information...', |
|
628 | - 'event_espresso' |
|
629 | - ); ?></span> |
|
627 | + 'loading transaction and payment information...', |
|
628 | + 'event_espresso' |
|
629 | + ); ?></span> |
|
630 | 630 | </div> |
631 | 631 | <?php if (! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
632 | 632 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
633 | 633 | <?php echo apply_filters( |
634 | - 'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg', |
|
635 | - esc_html__( |
|
636 | - '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.', |
|
637 | - 'event_espresso' |
|
638 | - ) |
|
639 | - ); ?> |
|
634 | + 'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg', |
|
635 | + esc_html__( |
|
636 | + '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.', |
|
637 | + 'event_espresso' |
|
638 | + ) |
|
639 | + ); ?> |
|
640 | 640 | <br/> |
641 | 641 | <span class="jst-rght ee-block small-text lt-grey-text"> |
642 | 642 | <?php esc_html_e('current wait time ', 'event_espresso'); ?> |
@@ -647,120 +647,120 @@ discard block |
||
647 | 647 | <div class="clear"></div> |
648 | 648 | </div> |
649 | 649 | <?php |
650 | - } |
|
651 | - } |
|
652 | - |
|
653 | - |
|
654 | - /** |
|
655 | - * display_details_for_events_requiring_pre_approval |
|
656 | - * |
|
657 | - * @param EE_Event[] $events |
|
658 | - * @return void |
|
659 | - * @throws EE_Error |
|
660 | - * @throws EE_Error |
|
661 | - */ |
|
662 | - public function display_details_for_events_requiring_pre_approval($events = array()) |
|
663 | - { |
|
664 | - if (! empty($events)) { |
|
665 | - ?> |
|
650 | + } |
|
651 | + } |
|
652 | + |
|
653 | + |
|
654 | + /** |
|
655 | + * display_details_for_events_requiring_pre_approval |
|
656 | + * |
|
657 | + * @param EE_Event[] $events |
|
658 | + * @return void |
|
659 | + * @throws EE_Error |
|
660 | + * @throws EE_Error |
|
661 | + */ |
|
662 | + public function display_details_for_events_requiring_pre_approval($events = array()) |
|
663 | + { |
|
664 | + if (! empty($events)) { |
|
665 | + ?> |
|
666 | 666 | <div id="espresso-thank-you-page-not-approved-message-dv"> |
667 | 667 | <h4 class="orange-text"><?php esc_html_e('Important Notice:', 'event_espresso'); ?></h4> |
668 | 668 | <p id="events-requiring-pre-approval-pg" class="small-text"> |
669 | 669 | <?php echo apply_filters( |
670 | - 'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message', |
|
671 | - esc_html__( |
|
672 | - '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.', |
|
673 | - 'event_espresso' |
|
674 | - ) |
|
675 | - ); ?> |
|
670 | + 'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message', |
|
671 | + esc_html__( |
|
672 | + '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.', |
|
673 | + 'event_espresso' |
|
674 | + ) |
|
675 | + ); ?> |
|
676 | 676 | </p> |
677 | 677 | <ul class="events-requiring-pre-approval-ul"> |
678 | 678 | <?php |
679 | - foreach ($events as $event) { |
|
680 | - if ($event instanceof EE_Event) { |
|
681 | - echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', |
|
682 | - esc_html($event->name()), |
|
683 | - '</li>'; |
|
684 | - } |
|
685 | - } ?> |
|
679 | + foreach ($events as $event) { |
|
680 | + if ($event instanceof EE_Event) { |
|
681 | + echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', |
|
682 | + esc_html($event->name()), |
|
683 | + '</li>'; |
|
684 | + } |
|
685 | + } ?> |
|
686 | 686 | </ul> |
687 | 687 | <div class="clear"></div> |
688 | 688 | </div> |
689 | 689 | <?php |
690 | - } |
|
691 | - } |
|
692 | - |
|
693 | - |
|
694 | - /** |
|
695 | - * get_transaction_details |
|
696 | - * |
|
697 | - * @return string |
|
698 | - * @throws EE_Error |
|
699 | - */ |
|
700 | - public function get_transaction_details() |
|
701 | - { |
|
702 | - // prepare variables for displaying |
|
703 | - $template_args = array(); |
|
704 | - $template_args['transaction'] = $this->_current_txn; |
|
705 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
706 | - $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true); |
|
707 | - // link to SPCO payment_options |
|
708 | - $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
709 | - $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
710 | - // verify template arguments |
|
711 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
712 | - EEH_Template_Validator::verify_isnt_null( |
|
713 | - $template_args['show_try_pay_again_link'], |
|
714 | - '$show_try_pay_again_link' |
|
715 | - ); |
|
716 | - EEH_Template_Validator::verify_isnt_null( |
|
717 | - $template_args['SPCO_payment_options_url'], |
|
718 | - '$SPCO_payment_options_url' |
|
719 | - ); |
|
720 | - return EEH_Template::locate_template( |
|
721 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
722 | - $template_args |
|
723 | - ); |
|
724 | - } |
|
725 | - |
|
726 | - |
|
727 | - /** |
|
728 | - * get_payment_row_html |
|
729 | - * |
|
730 | - * @param EE_Payment $payment |
|
731 | - * @return string |
|
732 | - * @throws EE_Error |
|
733 | - */ |
|
734 | - public function get_payment_row_html(EE_Payment $payment = null) |
|
735 | - { |
|
736 | - $html = ''; |
|
737 | - if (! $payment instanceof EE_Payment) { |
|
738 | - return ''; |
|
739 | - } |
|
740 | - if ( |
|
741 | - $payment->payment_method() instanceof EE_Payment_Method |
|
742 | - && $payment->status() === EEM_Payment::status_id_failed |
|
743 | - && $payment->payment_method()->is_off_site() |
|
744 | - ) { |
|
745 | - // considering the registrant has made it to the Thank You page, |
|
746 | - // any failed payments may actually be pending and the IPN is just slow |
|
747 | - // so let's |
|
748 | - $payment->set_status(EEM_Payment::status_id_pending); |
|
749 | - } |
|
750 | - $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
|
751 | - ? '<br /><span class="small-text">' . esc_html($payment->gateway_response()) . '</span>' |
|
752 | - : ''; |
|
753 | - $html .= ' |
|
690 | + } |
|
691 | + } |
|
692 | + |
|
693 | + |
|
694 | + /** |
|
695 | + * get_transaction_details |
|
696 | + * |
|
697 | + * @return string |
|
698 | + * @throws EE_Error |
|
699 | + */ |
|
700 | + public function get_transaction_details() |
|
701 | + { |
|
702 | + // prepare variables for displaying |
|
703 | + $template_args = array(); |
|
704 | + $template_args['transaction'] = $this->_current_txn; |
|
705 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
706 | + $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true); |
|
707 | + // link to SPCO payment_options |
|
708 | + $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
709 | + $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
710 | + // verify template arguments |
|
711 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
712 | + EEH_Template_Validator::verify_isnt_null( |
|
713 | + $template_args['show_try_pay_again_link'], |
|
714 | + '$show_try_pay_again_link' |
|
715 | + ); |
|
716 | + EEH_Template_Validator::verify_isnt_null( |
|
717 | + $template_args['SPCO_payment_options_url'], |
|
718 | + '$SPCO_payment_options_url' |
|
719 | + ); |
|
720 | + return EEH_Template::locate_template( |
|
721 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
722 | + $template_args |
|
723 | + ); |
|
724 | + } |
|
725 | + |
|
726 | + |
|
727 | + /** |
|
728 | + * get_payment_row_html |
|
729 | + * |
|
730 | + * @param EE_Payment $payment |
|
731 | + * @return string |
|
732 | + * @throws EE_Error |
|
733 | + */ |
|
734 | + public function get_payment_row_html(EE_Payment $payment = null) |
|
735 | + { |
|
736 | + $html = ''; |
|
737 | + if (! $payment instanceof EE_Payment) { |
|
738 | + return ''; |
|
739 | + } |
|
740 | + if ( |
|
741 | + $payment->payment_method() instanceof EE_Payment_Method |
|
742 | + && $payment->status() === EEM_Payment::status_id_failed |
|
743 | + && $payment->payment_method()->is_off_site() |
|
744 | + ) { |
|
745 | + // considering the registrant has made it to the Thank You page, |
|
746 | + // any failed payments may actually be pending and the IPN is just slow |
|
747 | + // so let's |
|
748 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
749 | + } |
|
750 | + $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
|
751 | + ? '<br /><span class="small-text">' . esc_html($payment->gateway_response()) . '</span>' |
|
752 | + : ''; |
|
753 | + $html .= ' |
|
754 | 754 | <tr> |
755 | 755 | <td> |
756 | 756 | ' . esc_html($payment->timestamp()) . ' |
757 | 757 | </td> |
758 | 758 | <td> |
759 | 759 | ' . ( |
760 | - $payment->payment_method() instanceof EE_Payment_Method |
|
761 | - ? esc_html($payment->payment_method()->name()) |
|
762 | - : esc_html__('Unknown', 'event_espresso') |
|
763 | - ) . ' |
|
760 | + $payment->payment_method() instanceof EE_Payment_Method |
|
761 | + ? esc_html($payment->payment_method()->name()) |
|
762 | + : esc_html__('Unknown', 'event_espresso') |
|
763 | + ) . ' |
|
764 | 764 | </td> |
765 | 765 | <td class="jst-rght"> |
766 | 766 | ' . EEH_Template::format_currency($payment->amount()) . ' |
@@ -769,81 +769,81 @@ discard block |
||
769 | 769 | ' . $payment->pretty_status(true) . $payment_declined_msg . ' |
770 | 770 | </td> |
771 | 771 | </tr>'; |
772 | - do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
773 | - return $html; |
|
774 | - } |
|
775 | - |
|
776 | - |
|
777 | - /** |
|
778 | - * get_payment_details |
|
779 | - * |
|
780 | - * @param EE_Payment[] $payments |
|
781 | - * @return string |
|
782 | - * @throws EE_Error |
|
783 | - * @throws ReflectionException |
|
784 | - */ |
|
785 | - public function get_payment_details($payments = array()) |
|
786 | - { |
|
787 | - // prepare variables for displaying |
|
788 | - $template_args = array(); |
|
789 | - $template_args['transaction'] = $this->_current_txn; |
|
790 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
791 | - $template_args['payments'] = array(); |
|
792 | - foreach ($payments as $payment) { |
|
793 | - $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
794 | - } |
|
795 | - // create a hacky payment object, but dont save it |
|
796 | - $payment = EE_Payment::new_instance( |
|
797 | - array( |
|
798 | - 'TXN_ID' => $this->_current_txn->ID(), |
|
799 | - 'STS_ID' => EEM_Payment::status_id_pending, |
|
800 | - 'PAY_timestamp' => time(), |
|
801 | - 'PAY_amount' => $this->_current_txn->total(), |
|
802 | - 'PMD_ID' => $this->_current_txn->payment_method_ID(), |
|
803 | - ) |
|
804 | - ); |
|
805 | - $payment_method = $this->_current_txn->payment_method(); |
|
806 | - if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
807 | - $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
808 | - } else { |
|
809 | - $template_args['gateway_content'] = ''; |
|
810 | - } |
|
811 | - // link to SPCO payment_options |
|
812 | - $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
813 | - $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
814 | - // verify template arguments |
|
815 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
816 | - EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
817 | - EEH_Template_Validator::verify_isnt_null( |
|
818 | - $template_args['show_try_pay_again_link'], |
|
819 | - '$show_try_pay_again_link' |
|
820 | - ); |
|
821 | - EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
822 | - EEH_Template_Validator::verify_isnt_null( |
|
823 | - $template_args['SPCO_payment_options_url'], |
|
824 | - '$SPCO_payment_options_url' |
|
825 | - ); |
|
826 | - return EEH_Template::locate_template( |
|
827 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
828 | - $template_args |
|
829 | - ); |
|
830 | - } |
|
831 | - |
|
832 | - |
|
833 | - /** |
|
834 | - * get_payment_details |
|
835 | - * |
|
836 | - * @param array $payments |
|
837 | - * @return string |
|
838 | - * @throws EE_Error |
|
839 | - */ |
|
840 | - public function get_new_payments($payments = array()) |
|
841 | - { |
|
842 | - $payments_html = ''; |
|
843 | - // prepare variables for displaying |
|
844 | - foreach ($payments as $payment) { |
|
845 | - $payments_html .= $this->get_payment_row_html($payment); |
|
846 | - } |
|
847 | - return $payments_html; |
|
848 | - } |
|
772 | + do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
773 | + return $html; |
|
774 | + } |
|
775 | + |
|
776 | + |
|
777 | + /** |
|
778 | + * get_payment_details |
|
779 | + * |
|
780 | + * @param EE_Payment[] $payments |
|
781 | + * @return string |
|
782 | + * @throws EE_Error |
|
783 | + * @throws ReflectionException |
|
784 | + */ |
|
785 | + public function get_payment_details($payments = array()) |
|
786 | + { |
|
787 | + // prepare variables for displaying |
|
788 | + $template_args = array(); |
|
789 | + $template_args['transaction'] = $this->_current_txn; |
|
790 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
791 | + $template_args['payments'] = array(); |
|
792 | + foreach ($payments as $payment) { |
|
793 | + $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
794 | + } |
|
795 | + // create a hacky payment object, but dont save it |
|
796 | + $payment = EE_Payment::new_instance( |
|
797 | + array( |
|
798 | + 'TXN_ID' => $this->_current_txn->ID(), |
|
799 | + 'STS_ID' => EEM_Payment::status_id_pending, |
|
800 | + 'PAY_timestamp' => time(), |
|
801 | + 'PAY_amount' => $this->_current_txn->total(), |
|
802 | + 'PMD_ID' => $this->_current_txn->payment_method_ID(), |
|
803 | + ) |
|
804 | + ); |
|
805 | + $payment_method = $this->_current_txn->payment_method(); |
|
806 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
807 | + $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
808 | + } else { |
|
809 | + $template_args['gateway_content'] = ''; |
|
810 | + } |
|
811 | + // link to SPCO payment_options |
|
812 | + $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
813 | + $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
814 | + // verify template arguments |
|
815 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
816 | + EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
817 | + EEH_Template_Validator::verify_isnt_null( |
|
818 | + $template_args['show_try_pay_again_link'], |
|
819 | + '$show_try_pay_again_link' |
|
820 | + ); |
|
821 | + EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
822 | + EEH_Template_Validator::verify_isnt_null( |
|
823 | + $template_args['SPCO_payment_options_url'], |
|
824 | + '$SPCO_payment_options_url' |
|
825 | + ); |
|
826 | + return EEH_Template::locate_template( |
|
827 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
828 | + $template_args |
|
829 | + ); |
|
830 | + } |
|
831 | + |
|
832 | + |
|
833 | + /** |
|
834 | + * get_payment_details |
|
835 | + * |
|
836 | + * @param array $payments |
|
837 | + * @return string |
|
838 | + * @throws EE_Error |
|
839 | + */ |
|
840 | + public function get_new_payments($payments = array()) |
|
841 | + { |
|
842 | + $payments_html = ''; |
|
843 | + // prepare variables for displaying |
|
844 | + foreach ($payments as $payment) { |
|
845 | + $payments_html .= $this->get_payment_row_html($payment); |
|
846 | + } |
|
847 | + return $payments_html; |
|
848 | + } |
|
849 | 849 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | <div id="ee-single-page-checkout-dv" class=""> |
16 | 16 | <?php |
17 | - if (! $empty_cart) { |
|
17 | + if ( ! $empty_cart) { |
|
18 | 18 | if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?> |
19 | 19 | <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice" |
20 | 20 | style="display: none;"> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | <span id="spco-registration-expiration-spn" class="" style="display:none;"></span> |
32 | 32 | </p> |
33 | 33 | <?php } |
34 | - if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) { |
|
34 | + if ( ! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) { |
|
35 | 35 | ?> |
36 | 36 | <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr"> |
37 | 37 | <?php esc_html_e(' Steps', 'event_espresso'); ?> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | foreach ($reg_steps as $reg_step) { |
78 | 78 | if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
79 | 79 | $slug = $reg_step->slug(); |
80 | - do_action('AHEE__' . $slug . '__reg_step_start', $reg_step); |
|
80 | + do_action('AHEE__'.$slug.'__reg_step_start', $reg_step); |
|
81 | 81 | // todo: deprecate hook AHEE__registration_page_attendee_information__start |
82 | 82 | ?> |
83 | 83 | <div id="spco-<?php echo esc_attr($slug); ?>-dv" |
@@ -16,38 +16,38 @@ discard block |
||
16 | 16 | |
17 | 17 | <div id="ee-single-page-checkout-dv" class=""> |
18 | 18 | <?php |
19 | - if (! $empty_cart) { |
|
20 | - if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?> |
|
19 | + if (! $empty_cart) { |
|
20 | + if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?> |
|
21 | 21 | <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice" |
22 | 22 | style="display: none;"> |
23 | 23 | <?php echo sprintf( |
24 | - apply_filters( |
|
25 | - 'FHEE__registration_page_wrapper_template___time_limit', |
|
26 | - esc_html__('You have %1$s to complete your registration.', 'event_espresso') |
|
27 | - ), |
|
28 | - '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' |
|
29 | - . $registration_time_limit |
|
30 | - . '</span>' |
|
31 | - ); |
|
32 | - ?> |
|
24 | + apply_filters( |
|
25 | + 'FHEE__registration_page_wrapper_template___time_limit', |
|
26 | + esc_html__('You have %1$s to complete your registration.', 'event_espresso') |
|
27 | + ), |
|
28 | + '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' |
|
29 | + . $registration_time_limit |
|
30 | + . '</span>' |
|
31 | + ); |
|
32 | + ?> |
|
33 | 33 | <span id="spco-registration-expiration-spn" class="" style="display:none;"></span> |
34 | 34 | </p> |
35 | 35 | <?php } |
36 | - if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) { |
|
37 | - ?> |
|
36 | + if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) { |
|
37 | + ?> |
|
38 | 38 | <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr"> |
39 | 39 | <?php esc_html_e(' Steps', 'event_espresso'); ?> |
40 | 40 | </h2> |
41 | 41 | |
42 | 42 | <div id="spco-steps-display-dv"> |
43 | 43 | <?php |
44 | - $step_nmbr = 1; |
|
45 | - $total_steps = count($reg_steps) - 1; |
|
46 | - foreach ($reg_steps as $reg_step) { |
|
47 | - if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
48 | - $slug = $reg_step->slug(); |
|
49 | - $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step'; |
|
50 | - ?> |
|
44 | + $step_nmbr = 1; |
|
45 | + $total_steps = count($reg_steps) - 1; |
|
46 | + foreach ($reg_steps as $reg_step) { |
|
47 | + if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
48 | + $slug = $reg_step->slug(); |
|
49 | + $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step'; |
|
50 | + ?> |
|
51 | 51 | <div id="spco-step-<?php echo esc_attr($slug); ?>-display-dv" |
52 | 52 | class="spco-step-display-dv <?php echo esc_attr($step_display_dv_class); ?> steps-<?php echo esc_attr($total_steps); ?>" |
53 | 53 | > |
@@ -60,28 +60,28 @@ discard block |
||
60 | 60 | </div> |
61 | 61 | |
62 | 62 | <?php |
63 | - if ($step_nmbr < $total_steps) { ?> |
|
63 | + if ($step_nmbr < $total_steps) { ?> |
|
64 | 64 | <div class="spco-step-arrow-dv">»</div> |
65 | 65 | <?php |
66 | - } |
|
67 | - $step_nmbr++; |
|
68 | - } |
|
69 | - } |
|
70 | - ?> |
|
66 | + } |
|
67 | + $step_nmbr++; |
|
68 | + } |
|
69 | + } |
|
70 | + ?> |
|
71 | 71 | <div class="clear-float"></div> |
72 | 72 | </div> |
73 | 73 | |
74 | 74 | <?php |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - do_action('AHEE__SPCO__before_registration_steps'); |
|
78 | - $step_nmbr = 1; |
|
79 | - foreach ($reg_steps as $reg_step) { |
|
80 | - if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
81 | - $slug = $reg_step->slug(); |
|
82 | - do_action('AHEE__' . $slug . '__reg_step_start', $reg_step); |
|
83 | - // todo: deprecate hook AHEE__registration_page_attendee_information__start |
|
84 | - ?> |
|
77 | + do_action('AHEE__SPCO__before_registration_steps'); |
|
78 | + $step_nmbr = 1; |
|
79 | + foreach ($reg_steps as $reg_step) { |
|
80 | + if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
81 | + $slug = $reg_step->slug(); |
|
82 | + do_action('AHEE__' . $slug . '__reg_step_start', $reg_step); |
|
83 | + // todo: deprecate hook AHEE__registration_page_attendee_information__start |
|
84 | + ?> |
|
85 | 85 | <div id="spco-<?php echo esc_attr($slug); ?>-dv" |
86 | 86 | class="spco-step-dv <?php echo esc_attr($reg_step->div_class()); ?>" |
87 | 87 | > |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | <?php do_action('AHEE__SPCO_after_reg_step_form', $slug, $next_step); ?> |
90 | 90 | </div> |
91 | 91 | <?php $step_nmbr++; |
92 | - } |
|
93 | - } |
|
94 | - do_action('AHEE__SPCO__after_registration_steps'); |
|
95 | - } else { |
|
96 | - ?> |
|
92 | + } |
|
93 | + } |
|
94 | + do_action('AHEE__SPCO__after_registration_steps'); |
|
95 | + } else { |
|
96 | + ?> |
|
97 | 97 | <h3 id="spco-empty-cart-hdr" class="spco-step-title-hdr"> |
98 | 98 | <?php esc_html_e('Nothing in your Event Queue', 'event_espresso'); ?> |
99 | 99 | </h3> |
100 | 100 | <p><?php echo wp_kses($empty_msg, AllowedTags::getWithFormTags()); ?></p> |
101 | 101 | <?php echo wp_kses($cookies_not_set_msg, AllowedTags::getWithFormTags()); ?> |
102 | 102 | <?php |
103 | - } |
|
104 | - do_action('AHEE__SPCO__reg_form_footer'); |
|
105 | - ?> |
|
103 | + } |
|
104 | + do_action('AHEE__SPCO__reg_form_footer'); |
|
105 | + ?> |
|
106 | 106 | |
107 | 107 | </div> |
108 | 108 |
@@ -3,36 +3,36 @@ |
||
3 | 3 | /** @type array $registrations_for_free_events */ |
4 | 4 | |
5 | 5 | if (is_array($registrations_for_free_events) && ! empty($registrations_for_free_events)) { |
6 | - echo apply_filters( |
|
7 | - 'FHEE__registration_page_payment_options__no_payment_required_hdr', |
|
8 | - sprintf( |
|
9 | - esc_html__('%1$sNo Payment Required%2$s', 'event_espresso'), |
|
10 | - '<h6>', |
|
11 | - '</h6>' |
|
12 | - ) |
|
13 | - ); |
|
14 | - foreach ($registrations_for_free_events as $registration_for_free_event) { |
|
15 | - if ( |
|
16 | - $registration_for_free_event instanceof EE_Registration |
|
17 | - && $registration_for_free_event->ticket()->is_free() |
|
18 | - ) { |
|
19 | - if ($registration_for_free_event->event() instanceof EE_Event) { |
|
20 | - ?> |
|
6 | + echo apply_filters( |
|
7 | + 'FHEE__registration_page_payment_options__no_payment_required_hdr', |
|
8 | + sprintf( |
|
9 | + esc_html__('%1$sNo Payment Required%2$s', 'event_espresso'), |
|
10 | + '<h6>', |
|
11 | + '</h6>' |
|
12 | + ) |
|
13 | + ); |
|
14 | + foreach ($registrations_for_free_events as $registration_for_free_event) { |
|
15 | + if ( |
|
16 | + $registration_for_free_event instanceof EE_Registration |
|
17 | + && $registration_for_free_event->ticket()->is_free() |
|
18 | + ) { |
|
19 | + if ($registration_for_free_event->event() instanceof EE_Event) { |
|
20 | + ?> |
|
21 | 21 | <p> |
22 | 22 | <?php echo apply_filters( |
23 | - 'FHEE__registration_page_payment_options__no_payment_required_pg', |
|
24 | - sprintf( |
|
25 | - esc_html__( |
|
26 | - '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', |
|
27 | - 'event_espresso' |
|
28 | - ), |
|
29 | - $registration_for_free_event->ticket()->name(), |
|
30 | - $registration_for_free_event->event()->name() |
|
31 | - ) |
|
32 | - ); ?> |
|
23 | + 'FHEE__registration_page_payment_options__no_payment_required_pg', |
|
24 | + sprintf( |
|
25 | + esc_html__( |
|
26 | + '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', |
|
27 | + 'event_espresso' |
|
28 | + ), |
|
29 | + $registration_for_free_event->ticket()->name(), |
|
30 | + $registration_for_free_event->event()->name() |
|
31 | + ) |
|
32 | + ); ?> |
|
33 | 33 | </p> |
34 | 34 | <?php |
35 | - } |
|
36 | - } |
|
37 | - } |
|
35 | + } |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |