@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param int | \EE_Event $event |
15 | 15 | * @return bool |
16 | 16 | */ |
17 | -function is_espresso_event( $event = NULL ) { |
|
18 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
17 | +function is_espresso_event($event = NULL) { |
|
18 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
19 | 19 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
20 | - $event = EEH_Event_View::get_event( $event ); |
|
20 | + $event = EEH_Event_View::get_event($event); |
|
21 | 21 | // do we have a valid event ? |
22 | - return $event instanceof EE_Event ? TRUE : FALSE; |
|
22 | + return $event instanceof EE_Event ? TRUE : FALSE; |
|
23 | 23 | } |
24 | 24 | return FALSE; |
25 | 25 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return bool |
32 | 32 | */ |
33 | 33 | function is_espresso_event_single() { |
34 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
34 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
35 | 35 | global $wp_query; |
36 | 36 | // return conditionals set by CPTs |
37 | 37 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return bool |
47 | 47 | */ |
48 | 48 | function is_espresso_event_archive() { |
49 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
49 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
50 | 50 | global $wp_query; |
51 | 51 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE; |
52 | 52 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @return bool |
61 | 61 | */ |
62 | 62 | function is_espresso_event_taxonomy() { |
63 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
63 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
64 | 64 | global $wp_query; |
65 | 65 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE; |
66 | 66 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * @param int | \EE_Venue $venue |
75 | 75 | * @return bool |
76 | 76 | */ |
77 | -function is_espresso_venue( $venue = NULL ) { |
|
78 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
77 | +function is_espresso_venue($venue = NULL) { |
|
78 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
79 | 79 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
80 | - $venue = EEH_Venue_View::get_venue( $venue, FALSE ); |
|
80 | + $venue = EEH_Venue_View::get_venue($venue, FALSE); |
|
81 | 81 | // do we have a valid event ? |
82 | 82 | return $venue instanceof EE_Venue ? TRUE : FALSE; |
83 | 83 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return bool |
92 | 92 | */ |
93 | 93 | function is_espresso_venue_single() { |
94 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
94 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
95 | 95 | global $wp_query; |
96 | 96 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE; |
97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return bool |
106 | 106 | */ |
107 | 107 | function is_espresso_venue_archive() { |
108 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
108 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
109 | 109 | global $wp_query; |
110 | 110 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE; |
111 | 111 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return bool |
120 | 120 | */ |
121 | 121 | function is_espresso_venue_taxonomy() { |
122 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
122 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
123 | 123 | global $wp_query; |
124 | 124 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE; |
125 | 125 | } |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | * @param $conditional_tag |
134 | 134 | * @return bool |
135 | 135 | */ |
136 | -function can_use_espresso_conditionals( $conditional_tag ) { |
|
137 | - if ( ! did_action( 'AHEE__EE_System__initialize' )) { |
|
136 | +function can_use_espresso_conditionals($conditional_tag) { |
|
137 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
138 | 138 | EE_Error::doing_it_wrong( |
139 | 139 | __FUNCTION__, |
140 | 140 | sprintf( |
141 | - __( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'), |
|
141 | + __('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'), |
|
142 | 142 | $conditional_tag |
143 | 143 | ), |
144 | 144 | '4.4.0' |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | |
154 | 154 | /*************************** Event Queries ***************************/ |
155 | 155 | |
156 | -if ( ! function_exists( 'espresso_get_events' )) { |
|
156 | +if ( ! function_exists('espresso_get_events')) { |
|
157 | 157 | /** |
158 | 158 | * espresso_get_events |
159 | 159 | * @param array $params |
160 | 160 | * @return array |
161 | 161 | */ |
162 | - function espresso_get_events( $params = array() ) { |
|
162 | + function espresso_get_events($params = array()) { |
|
163 | 163 | //set default params |
164 | 164 | $default_espresso_events_params = array( |
165 | 165 | 'limit' => 10, |
@@ -170,18 +170,18 @@ discard block |
||
170 | 170 | 'sort' => 'ASC' |
171 | 171 | ); |
172 | 172 | // allow the defaults to be filtered |
173 | - $default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params ); |
|
173 | + $default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params); |
|
174 | 174 | // grab params and merge with defaults, then extract |
175 | - $params = array_merge( $default_espresso_events_params, $params ); |
|
175 | + $params = array_merge($default_espresso_events_params, $params); |
|
176 | 176 | // run the query |
177 | - $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery( $params ); |
|
177 | + $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params); |
|
178 | 178 | // assign results to a variable so we can return it |
179 | 179 | $events = $events_query->have_posts() ? $events_query->posts : array(); |
180 | 180 | // but first reset the query and postdata |
181 | 181 | wp_reset_query(); |
182 | 182 | wp_reset_postdata(); |
183 | 183 | EED_Events_Archive::remove_all_events_archive_filters(); |
184 | - unset( $events_query ); |
|
184 | + unset($events_query); |
|
185 | 185 | return $events; |
186 | 186 | } |
187 | 187 | } |
@@ -195,32 +195,32 @@ discard block |
||
195 | 195 | * espresso_load_ticket_selector |
196 | 196 | */ |
197 | 197 | function espresso_load_ticket_selector() { |
198 | - EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' ); |
|
198 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
199 | 199 | } |
200 | 200 | |
201 | -if ( ! function_exists( 'espresso_ticket_selector' )) { |
|
201 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
202 | 202 | /** |
203 | 203 | * espresso_ticket_selector |
204 | 204 | * @param null $event |
205 | 205 | */ |
206 | - function espresso_ticket_selector( $event = NULL ) { |
|
207 | - if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
|
206 | + function espresso_ticket_selector($event = NULL) { |
|
207 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) { |
|
208 | 208 | espresso_load_ticket_selector(); |
209 | - echo EED_Ticket_Selector::display_ticket_selector( $event ); |
|
209 | + echo EED_Ticket_Selector::display_ticket_selector($event); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | 214 | |
215 | - if ( ! function_exists( 'espresso_view_details_btn' )) { |
|
215 | + if ( ! function_exists('espresso_view_details_btn')) { |
|
216 | 216 | /** |
217 | 217 | * espresso_view_details_btn |
218 | 218 | * @param null $event |
219 | 219 | */ |
220 | - function espresso_view_details_btn( $event = NULL ) { |
|
221 | - if ( ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) { |
|
220 | + function espresso_view_details_btn($event = NULL) { |
|
221 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) { |
|
222 | 222 | espresso_load_ticket_selector(); |
223 | - echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE ); |
|
223 | + echo EED_Ticket_Selector::display_ticket_selector($event, TRUE); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | /*************************** EEH_Event_View ***************************/ |
232 | 232 | |
233 | -if ( ! function_exists( 'espresso_load_event_list_assets' )) { |
|
233 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
234 | 234 | /** |
235 | 235 | * espresso_load_event_list_assets |
236 | 236 | * ensures that event list styles and scripts are loaded |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | */ |
240 | 240 | function espresso_load_event_list_assets() { |
241 | 241 | $event_list = EED_Events_Archive::instance(); |
242 | - add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 ); |
|
243 | - add_filter( 'FHEE_enable_default_espresso_css', '__return_true' ); |
|
242 | + add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); |
|
243 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | 247 | |
248 | -if ( ! function_exists( 'espresso_event_reg_button' )) { |
|
248 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
249 | 249 | /** |
250 | 250 | * espresso_event_reg_button |
251 | 251 | * returns the "Register Now" button if event is active, |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | * @param bool $EVT_ID |
258 | 258 | * @return string |
259 | 259 | */ |
260 | - function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) { |
|
261 | - $event_status = EEH_Event_View::event_active_status( $EVT_ID ); |
|
262 | - switch ( $event_status ) { |
|
260 | + function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) { |
|
261 | + $event_status = EEH_Event_View::event_active_status($EVT_ID); |
|
262 | + switch ($event_status) { |
|
263 | 263 | case EE_Datetime::sold_out : |
264 | 264 | $btn_text = __('Sold Out', 'event_espresso'); |
265 | 265 | $class = 'ee-pink'; |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | case EE_Datetime::upcoming : |
276 | 276 | case EE_Datetime::active : |
277 | 277 | default : |
278 | - $btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' ); |
|
278 | + $btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso'); |
|
279 | 279 | $class = 'ee-green'; |
280 | 280 | } |
281 | - if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) { |
|
281 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
282 | 282 | $btn_text = $btn_text_if_inactive; |
283 | 283 | $class = 'ee-grey'; |
284 | 284 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | |
293 | 293 | |
294 | 294 | |
295 | -if ( ! function_exists( 'espresso_display_ticket_selector' )) { |
|
295 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
296 | 296 | /** |
297 | 297 | * espresso_display_ticket_selector |
298 | 298 | * whether or not to display the Ticket Selector for an event |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * @param bool $EVT_ID |
301 | 301 | * @return boolean |
302 | 302 | */ |
303 | - function espresso_display_ticket_selector( $EVT_ID = FALSE ) { |
|
304 | - return EEH_Event_View::display_ticket_selector( $EVT_ID ); |
|
303 | + function espresso_display_ticket_selector($EVT_ID = FALSE) { |
|
304 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | 308 | |
309 | 309 | |
310 | -if ( ! function_exists( 'espresso_event_status_banner' )) { |
|
310 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
311 | 311 | /** |
312 | 312 | * espresso_event_status |
313 | 313 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | * @param bool $EVT_ID |
316 | 316 | * @return string |
317 | 317 | */ |
318 | - function espresso_event_status_banner( $EVT_ID = FALSE ) { |
|
319 | - return EEH_Event_View::event_status( $EVT_ID ); |
|
318 | + function espresso_event_status_banner($EVT_ID = FALSE) { |
|
319 | + return EEH_Event_View::event_status($EVT_ID); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | 323 | |
324 | -if ( ! function_exists( 'espresso_event_status' )) { |
|
324 | +if ( ! function_exists('espresso_event_status')) { |
|
325 | 325 | /** |
326 | 326 | * espresso_event_status |
327 | 327 | * returns the event status if it is sold out, expired, or inactive |
@@ -330,17 +330,17 @@ discard block |
||
330 | 330 | * @param bool $echo |
331 | 331 | * @return string |
332 | 332 | */ |
333 | - function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) { |
|
334 | - if ( $echo ) { |
|
335 | - echo EEH_Event_View::event_active_status( $EVT_ID ); |
|
333 | + function espresso_event_status($EVT_ID = 0, $echo = TRUE) { |
|
334 | + if ($echo) { |
|
335 | + echo EEH_Event_View::event_active_status($EVT_ID); |
|
336 | 336 | return ''; |
337 | 337 | } |
338 | - return EEH_Event_View::event_active_status( $EVT_ID ); |
|
338 | + return EEH_Event_View::event_active_status($EVT_ID); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | 342 | |
343 | -if ( ! function_exists( 'espresso_event_categories' )) { |
|
343 | +if ( ! function_exists('espresso_event_categories')) { |
|
344 | 344 | /** |
345 | 345 | * espresso_event_categories |
346 | 346 | * returns the terms associated with an event |
@@ -350,17 +350,17 @@ discard block |
||
350 | 350 | * @param bool $echo |
351 | 351 | * @return string |
352 | 352 | */ |
353 | - function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
354 | - if ( $echo ) { |
|
355 | - echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
353 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
354 | + if ($echo) { |
|
355 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
356 | 356 | return ''; |
357 | 357 | } |
358 | - return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
358 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
362 | 362 | |
363 | -if ( ! function_exists( 'espresso_event_tickets_available' )) { |
|
363 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
364 | 364 | /** |
365 | 365 | * espresso_event_tickets_available |
366 | 366 | * returns the ticket types available for purchase for an event |
@@ -370,26 +370,26 @@ discard block |
||
370 | 370 | * @param bool $format |
371 | 371 | * @return string |
372 | 372 | */ |
373 | - function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) { |
|
374 | - $tickets = EEH_Event_View::event_tickets_available( $EVT_ID ); |
|
375 | - if ( is_array( $tickets ) && ! empty( $tickets )) { |
|
373 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { |
|
374 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
375 | + if (is_array($tickets) && ! empty($tickets)) { |
|
376 | 376 | // if formatting then $html will be a string, else it will be an array of ticket objects |
377 | - $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); |
|
378 | - foreach ( $tickets as $ticket ) { |
|
379 | - if ( $ticket instanceof EE_Ticket ) { |
|
380 | - if ( $format ) { |
|
381 | - $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; |
|
382 | - $html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() ); |
|
377 | + $html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array(); |
|
378 | + foreach ($tickets as $ticket) { |
|
379 | + if ($ticket instanceof EE_Ticket) { |
|
380 | + if ($format) { |
|
381 | + $html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">'; |
|
382 | + $html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); |
|
383 | 383 | $html .= '</li>'; |
384 | 384 | } else { |
385 | 385 | $html[] = $ticket; |
386 | 386 | } |
387 | 387 | } |
388 | 388 | } |
389 | - if ( $format ) { |
|
389 | + if ($format) { |
|
390 | 390 | $html .= '</ul>'; |
391 | 391 | } |
392 | - if ( $echo && ! $format ) { |
|
392 | + if ($echo && ! $format) { |
|
393 | 393 | echo $html; |
394 | 394 | return ''; |
395 | 395 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | -if ( ! function_exists( 'espresso_event_date_obj' )) { |
|
402 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
403 | 403 | /** |
404 | 404 | * espresso_event_date_obj |
405 | 405 | * returns the primary date object for an event |
@@ -407,13 +407,13 @@ discard block |
||
407 | 407 | * @param bool $EVT_ID |
408 | 408 | * @return object |
409 | 409 | */ |
410 | - function espresso_event_date_obj( $EVT_ID = FALSE ) { |
|
411 | - return EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
410 | + function espresso_event_date_obj($EVT_ID = FALSE) { |
|
411 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | 415 | |
416 | -if ( ! function_exists( 'espresso_event_date' )) { |
|
416 | +if ( ! function_exists('espresso_event_date')) { |
|
417 | 417 | /** |
418 | 418 | * espresso_event_date |
419 | 419 | * returns the primary date for an event |
@@ -424,22 +424,22 @@ discard block |
||
424 | 424 | * @param bool $echo |
425 | 425 | * @return string |
426 | 426 | */ |
427 | - function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
428 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
429 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
430 | - $date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format ); |
|
431 | - $time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format ); |
|
432 | - if($echo){ |
|
433 | - echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
427 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
428 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
429 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
430 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
431 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
432 | + if ($echo) { |
|
433 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
434 | 434 | return ''; |
435 | 435 | } |
436 | - return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
436 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
437 | 437 | |
438 | 438 | } |
439 | 439 | } |
440 | 440 | |
441 | 441 | |
442 | -if ( ! function_exists( 'espresso_list_of_event_dates' )) { |
|
442 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
443 | 443 | /** |
444 | 444 | * espresso_list_of_event_dates |
445 | 445 | * returns a unordered list of dates for an event |
@@ -454,40 +454,40 @@ discard block |
||
454 | 454 | * @param null $limit |
455 | 455 | * @return string |
456 | 456 | */ |
457 | - function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) { |
|
458 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
459 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
460 | - $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format ); |
|
461 | - $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format ); |
|
462 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit ); |
|
463 | - if ( ! $format ) { |
|
464 | - return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes ); |
|
457 | + function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) { |
|
458 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
459 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
460 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
461 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
462 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit); |
|
463 | + if ( ! $format) { |
|
464 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
465 | 465 | } |
466 | 466 | //d( $datetimes ); |
467 | - if ( is_array( $datetimes ) && ! empty( $datetimes )) { |
|
467 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
468 | 468 | global $post; |
469 | - $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
470 | - foreach ( $datetimes as $datetime ) { |
|
471 | - if ( $datetime instanceof EE_Datetime ) { |
|
472 | - $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID(); |
|
473 | - $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">'; |
|
469 | + $html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
470 | + foreach ($datetimes as $datetime) { |
|
471 | + if ($datetime instanceof EE_Datetime) { |
|
472 | + $html .= '<li id="ee-event-datetimes-li-'.$datetime->ID(); |
|
473 | + $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">'; |
|
474 | 474 | $datetime_name = $datetime->name(); |
475 | - $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : ''; |
|
476 | - $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : ''; |
|
477 | - $html .= '<span class="dashicons dashicons-calendar"></span><span class="ee-event-datetimes-li-daterange">' . $datetime->date_range( $date_format ) . '</span><br/>'; |
|
478 | - $html .= '<span class="dashicons dashicons-clock"></span><span class="ee-event-datetimes-li-timerange">' . $datetime->time_range( $time_format ) . '</span>'; |
|
475 | + $html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : ''; |
|
476 | + $html .= ! empty($datetime_name) && $add_breaks ? '<br />' : ''; |
|
477 | + $html .= '<span class="dashicons dashicons-calendar"></span><span class="ee-event-datetimes-li-daterange">'.$datetime->date_range($date_format).'</span><br/>'; |
|
478 | + $html .= '<span class="dashicons dashicons-clock"></span><span class="ee-event-datetimes-li-timerange">'.$datetime->time_range($time_format).'</span>'; |
|
479 | 479 | $datetime_description = $datetime->description(); |
480 | - $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : ''; |
|
481 | - $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : ''; |
|
482 | - $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime ); |
|
480 | + $html .= ! empty($datetime_description) && $add_breaks ? '<br />' : ''; |
|
481 | + $html .= ! empty($datetime_description) ? ' - '.$datetime_description : ''; |
|
482 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime); |
|
483 | 483 | $html .= '</li>'; |
484 | 484 | } |
485 | 485 | } |
486 | 486 | $html .= $format ? '</ul>' : ''; |
487 | 487 | } else { |
488 | - $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : ''; |
|
488 | + $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : ''; |
|
489 | 489 | } |
490 | - if ( $echo ) { |
|
490 | + if ($echo) { |
|
491 | 491 | echo $html; |
492 | 492 | return ''; |
493 | 493 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | |
499 | -if ( ! function_exists( 'espresso_event_end_date' )) { |
|
499 | +if ( ! function_exists('espresso_event_end_date')) { |
|
500 | 500 | /** |
501 | 501 | * espresso_event_end_date |
502 | 502 | * returns the last date for an event |
@@ -507,20 +507,20 @@ discard block |
||
507 | 507 | * @param bool $echo |
508 | 508 | * @return string |
509 | 509 | */ |
510 | - function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
511 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
512 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
513 | - $date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format ); |
|
514 | - $time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format ); |
|
515 | - if($echo){ |
|
516 | - echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
510 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
511 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
512 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
513 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
514 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
515 | + if ($echo) { |
|
516 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
517 | 517 | return ''; |
518 | 518 | } |
519 | - return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
519 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | |
523 | -if ( ! function_exists( 'espresso_event_date_range' )) { |
|
523 | +if ( ! function_exists('espresso_event_date_range')) { |
|
524 | 524 | /** |
525 | 525 | * espresso_event_date_range |
526 | 526 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -533,31 +533,31 @@ discard block |
||
533 | 533 | * @param bool $echo |
534 | 534 | * @return string |
535 | 535 | */ |
536 | - function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
536 | + function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
537 | 537 | // set and filter date and time formats when a range is returned |
538 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
539 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format ); |
|
538 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
539 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
540 | 540 | // get the start and end date with NO time portion |
541 | - $the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID ); |
|
542 | - $the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID ); |
|
541 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
542 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
543 | 543 | // now we can determine if date range spans more than one day |
544 | - if ( $the_event_date != $the_event_end_date ) { |
|
545 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
546 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format ); |
|
544 | + if ($the_event_date != $the_event_end_date) { |
|
545 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
546 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
547 | 547 | $html = sprintf( |
548 | - __( '%1$s - %2$s', 'event_espresso' ), |
|
549 | - EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ), |
|
550 | - EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID ) |
|
548 | + __('%1$s - %2$s', 'event_espresso'), |
|
549 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
550 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
551 | 551 | ); |
552 | 552 | } else { |
553 | 553 | // set and filter date and time formats when only a single datetime is returned |
554 | - $single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' ); |
|
555 | - $single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' ); |
|
556 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format ); |
|
557 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format ); |
|
558 | - $html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID ); |
|
554 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
555 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
556 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
557 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
558 | + $html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
559 | 559 | } |
560 | - if ( $echo ) { |
|
560 | + if ($echo) { |
|
561 | 561 | echo $html; |
562 | 562 | return ''; |
563 | 563 | } |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | |
569 | -if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) { |
|
569 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
570 | 570 | /** |
571 | 571 | * espresso_event_date_as_calendar_page |
572 | 572 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -574,15 +574,15 @@ discard block |
||
574 | 574 | * @param bool $EVT_ID |
575 | 575 | * @return string |
576 | 576 | */ |
577 | - function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) { |
|
578 | - EEH_Event_View::event_date_as_calendar_page( $EVT_ID ); |
|
577 | + function espresso_event_date_as_calendar_page($EVT_ID = FALSE) { |
|
578 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
582 | 582 | |
583 | 583 | |
584 | 584 | |
585 | -if ( ! function_exists( 'espresso_event_link_url' )) { |
|
585 | +if ( ! function_exists('espresso_event_link_url')) { |
|
586 | 586 | /** |
587 | 587 | * espresso_event_link_url |
588 | 588 | * |
@@ -590,18 +590,18 @@ discard block |
||
590 | 590 | * @param bool $echo |
591 | 591 | * @return string |
592 | 592 | */ |
593 | - function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) { |
|
594 | - if ( $echo ) { |
|
595 | - echo EEH_Event_View::event_link_url( $EVT_ID ); |
|
593 | + function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) { |
|
594 | + if ($echo) { |
|
595 | + echo EEH_Event_View::event_link_url($EVT_ID); |
|
596 | 596 | return ''; |
597 | 597 | } |
598 | - return EEH_Event_View::event_link_url( $EVT_ID ); |
|
598 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | |
602 | 602 | |
603 | 603 | |
604 | -if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) { |
|
604 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
605 | 605 | /** |
606 | 606 | * espresso_event_has_content_or_excerpt |
607 | 607 | * |
@@ -609,15 +609,15 @@ discard block |
||
609 | 609 | * @param bool $EVT_ID |
610 | 610 | * @return boolean |
611 | 611 | */ |
612 | - function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) { |
|
613 | - return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID ); |
|
612 | + function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) { |
|
613 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | |
617 | 617 | |
618 | 618 | |
619 | 619 | |
620 | -if ( ! function_exists( 'espresso_event_content_or_excerpt' )) { |
|
620 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
621 | 621 | /** |
622 | 622 | * espresso_event_content_or_excerpt |
623 | 623 | * |
@@ -626,18 +626,18 @@ discard block |
||
626 | 626 | * @param bool $echo |
627 | 627 | * @return string |
628 | 628 | */ |
629 | - function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) { |
|
630 | - if ( $echo ) { |
|
631 | - echo EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
629 | + function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) { |
|
630 | + if ($echo) { |
|
631 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
632 | 632 | return ''; |
633 | 633 | } |
634 | - return EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
634 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
635 | 635 | } |
636 | 636 | } |
637 | 637 | |
638 | 638 | |
639 | 639 | |
640 | -if ( ! function_exists( 'espresso_event_phone' )) { |
|
640 | +if ( ! function_exists('espresso_event_phone')) { |
|
641 | 641 | /** |
642 | 642 | * espresso_event_phone |
643 | 643 | * |
@@ -645,18 +645,18 @@ discard block |
||
645 | 645 | * @param bool $echo |
646 | 646 | * @return string |
647 | 647 | */ |
648 | - function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) { |
|
649 | - if ( $echo ) { |
|
650 | - echo EEH_Event_View::event_phone( $EVT_ID ); |
|
648 | + function espresso_event_phone($EVT_ID = 0, $echo = TRUE) { |
|
649 | + if ($echo) { |
|
650 | + echo EEH_Event_View::event_phone($EVT_ID); |
|
651 | 651 | return ''; |
652 | 652 | } |
653 | - return EEH_Event_View::event_phone( $EVT_ID ); |
|
653 | + return EEH_Event_View::event_phone($EVT_ID); |
|
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
657 | 657 | |
658 | 658 | |
659 | -if ( ! function_exists( 'espresso_edit_event_link' )) { |
|
659 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
660 | 660 | /** |
661 | 661 | * espresso_edit_event_link |
662 | 662 | * returns a link to edit an event |
@@ -665,39 +665,39 @@ discard block |
||
665 | 665 | * @param bool $echo |
666 | 666 | * @return string |
667 | 667 | */ |
668 | - function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) { |
|
669 | - if ( $echo ) { |
|
670 | - echo EEH_Event_View::edit_event_link( $EVT_ID ); |
|
668 | + function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { |
|
669 | + if ($echo) { |
|
670 | + echo EEH_Event_View::edit_event_link($EVT_ID); |
|
671 | 671 | return ''; |
672 | 672 | } |
673 | - return EEH_Event_View::edit_event_link( $EVT_ID ); |
|
673 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
674 | 674 | } |
675 | 675 | } |
676 | 676 | |
677 | 677 | |
678 | -if ( ! function_exists( 'espresso_organization_name' )) { |
|
678 | +if ( ! function_exists('espresso_organization_name')) { |
|
679 | 679 | /** |
680 | 680 | * espresso_organization_name |
681 | 681 | * @param bool $echo |
682 | 682 | * @return string |
683 | 683 | */ |
684 | 684 | function espresso_organization_name($echo = TRUE) { |
685 | - if($echo){ |
|
686 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
685 | + if ($echo) { |
|
686 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
687 | 687 | return ''; |
688 | 688 | } |
689 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
689 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
690 | 690 | } |
691 | 691 | } |
692 | 692 | |
693 | -if ( ! function_exists( 'espresso_organization_address' )) { |
|
693 | +if ( ! function_exists('espresso_organization_address')) { |
|
694 | 694 | /** |
695 | 695 | * espresso_organization_address |
696 | 696 | * @param string $type |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - function espresso_organization_address( $type = 'inline' ) { |
|
700 | - if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) { |
|
699 | + function espresso_organization_address($type = 'inline') { |
|
700 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
701 | 701 | $address = new EventEspresso\core\domain\entities\GenericAddress( |
702 | 702 | EE_Registry::instance()->CFG->organization->address_1, |
703 | 703 | EE_Registry::instance()->CFG->organization->address_2, |
@@ -706,129 +706,129 @@ discard block |
||
706 | 706 | EE_Registry::instance()->CFG->organization->zip, |
707 | 707 | EE_Registry::instance()->CFG->organization->CNT_ISO |
708 | 708 | ); |
709 | - return EEH_Address::format( $address, $type ); |
|
709 | + return EEH_Address::format($address, $type); |
|
710 | 710 | } |
711 | 711 | return ''; |
712 | 712 | } |
713 | 713 | } |
714 | 714 | |
715 | -if ( ! function_exists( 'espresso_organization_email' )) { |
|
715 | +if ( ! function_exists('espresso_organization_email')) { |
|
716 | 716 | /** |
717 | 717 | * espresso_organization_email |
718 | 718 | * @param bool $echo |
719 | 719 | * @return string |
720 | 720 | */ |
721 | - function espresso_organization_email( $echo = TRUE ) { |
|
722 | - if($echo){ |
|
723 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
721 | + function espresso_organization_email($echo = TRUE) { |
|
722 | + if ($echo) { |
|
723 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
724 | 724 | return ''; |
725 | 725 | } |
726 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
726 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
727 | 727 | } |
728 | 728 | } |
729 | 729 | |
730 | -if ( ! function_exists( 'espresso_organization_logo_url' )) { |
|
730 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
731 | 731 | /** |
732 | 732 | * espresso_organization_logo_url |
733 | 733 | * @param bool $echo |
734 | 734 | * @return string |
735 | 735 | */ |
736 | - function espresso_organization_logo_url( $echo = TRUE ) { |
|
737 | - if($echo){ |
|
738 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
736 | + function espresso_organization_logo_url($echo = TRUE) { |
|
737 | + if ($echo) { |
|
738 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
739 | 739 | return ''; |
740 | 740 | } |
741 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
741 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
742 | 742 | } |
743 | 743 | } |
744 | 744 | |
745 | -if ( ! function_exists( 'espresso_organization_facebook' )) { |
|
745 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
746 | 746 | /** |
747 | 747 | * espresso_organization_facebook |
748 | 748 | * @param bool $echo |
749 | 749 | * @return string |
750 | 750 | */ |
751 | - function espresso_organization_facebook( $echo = TRUE ) { |
|
752 | - if($echo){ |
|
753 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
751 | + function espresso_organization_facebook($echo = TRUE) { |
|
752 | + if ($echo) { |
|
753 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
754 | 754 | return ''; |
755 | 755 | } |
756 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
756 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
757 | 757 | } |
758 | 758 | } |
759 | 759 | |
760 | -if ( ! function_exists( 'espresso_organization_twitter' )) { |
|
760 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
761 | 761 | /** |
762 | 762 | * espresso_organization_twitter |
763 | 763 | * @param bool $echo |
764 | 764 | * @return string |
765 | 765 | */ |
766 | - function espresso_organization_twitter( $echo = TRUE ) { |
|
767 | - if($echo){ |
|
768 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
766 | + function espresso_organization_twitter($echo = TRUE) { |
|
767 | + if ($echo) { |
|
768 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
769 | 769 | return ''; |
770 | 770 | } |
771 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
771 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
772 | 772 | } |
773 | 773 | } |
774 | 774 | |
775 | -if ( ! function_exists( 'espresso_organization_linkedin' )) { |
|
775 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
776 | 776 | /** |
777 | 777 | * espresso_organization_linkedin |
778 | 778 | * @param bool $echo |
779 | 779 | * @return string |
780 | 780 | */ |
781 | - function espresso_organization_linkedin( $echo = TRUE ) { |
|
782 | - if($echo){ |
|
783 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
781 | + function espresso_organization_linkedin($echo = TRUE) { |
|
782 | + if ($echo) { |
|
783 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
784 | 784 | return ''; |
785 | 785 | } |
786 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
786 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
787 | 787 | } |
788 | 788 | } |
789 | 789 | |
790 | -if ( ! function_exists( 'espresso_organization_pinterest' )) { |
|
790 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
791 | 791 | /** |
792 | 792 | * espresso_organization_pinterest |
793 | 793 | * @param bool $echo |
794 | 794 | * @return string |
795 | 795 | */ |
796 | - function espresso_organization_pinterest( $echo = TRUE ) { |
|
797 | - if($echo){ |
|
798 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
796 | + function espresso_organization_pinterest($echo = TRUE) { |
|
797 | + if ($echo) { |
|
798 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
799 | 799 | return ''; |
800 | 800 | } |
801 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
801 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
802 | 802 | } |
803 | 803 | } |
804 | 804 | |
805 | -if ( ! function_exists( 'espresso_organization_google' )) { |
|
805 | +if ( ! function_exists('espresso_organization_google')) { |
|
806 | 806 | /** |
807 | 807 | * espresso_organization_google |
808 | 808 | * @param bool $echo |
809 | 809 | * @return string |
810 | 810 | */ |
811 | - function espresso_organization_google( $echo = TRUE ) { |
|
812 | - if($echo){ |
|
813 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
811 | + function espresso_organization_google($echo = TRUE) { |
|
812 | + if ($echo) { |
|
813 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
814 | 814 | return ''; |
815 | 815 | } |
816 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
816 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
817 | 817 | } |
818 | 818 | } |
819 | 819 | |
820 | -if ( ! function_exists( 'espresso_organization_instagram' )) { |
|
820 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
821 | 821 | /** |
822 | 822 | * espresso_organization_instagram |
823 | 823 | * @param bool $echo |
824 | 824 | * @return string |
825 | 825 | */ |
826 | - function espresso_organization_instagram( $echo = TRUE ) { |
|
827 | - if($echo){ |
|
828 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
826 | + function espresso_organization_instagram($echo = TRUE) { |
|
827 | + if ($echo) { |
|
828 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
829 | 829 | return ''; |
830 | 830 | } |
831 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
831 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
832 | 832 | } |
833 | 833 | } |
834 | 834 | |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | |
839 | 839 | |
840 | 840 | |
841 | -if ( ! function_exists( 'espresso_event_venues' )) { |
|
841 | +if ( ! function_exists('espresso_event_venues')) { |
|
842 | 842 | /** |
843 | 843 | * espresso_event_venues |
844 | 844 | * |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | |
853 | 853 | |
854 | 854 | |
855 | -if ( ! function_exists( 'espresso_venue_id' )) { |
|
855 | +if ( ! function_exists('espresso_venue_id')) { |
|
856 | 856 | /** |
857 | 857 | * espresso_venue_name |
858 | 858 | * |
@@ -860,15 +860,15 @@ discard block |
||
860 | 860 | * @param int $EVT_ID |
861 | 861 | * @return string |
862 | 862 | */ |
863 | - function espresso_venue_id( $EVT_ID = 0 ) { |
|
864 | - $venue = EEH_Venue_View::get_venue( $EVT_ID ); |
|
863 | + function espresso_venue_id($EVT_ID = 0) { |
|
864 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
865 | 865 | return $venue instanceof EE_Venue ? $venue->ID() : 0; |
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
869 | 869 | |
870 | 870 | |
871 | -if ( ! function_exists( 'espresso_is_venue_private' ) ) { |
|
871 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
872 | 872 | /** |
873 | 873 | * Return whether a venue is private or not. |
874 | 874 | * @see EEH_Venue_View::get_venue() for more info on expected return results. |
@@ -877,45 +877,45 @@ discard block |
||
877 | 877 | * |
878 | 878 | * @return bool | null |
879 | 879 | */ |
880 | - function espresso_is_venue_private( $VNU_ID = 0 ) { |
|
881 | - return EEH_Venue_View::is_venue_private( $VNU_ID ); |
|
880 | + function espresso_is_venue_private($VNU_ID = 0) { |
|
881 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
882 | 882 | } |
883 | 883 | } |
884 | 884 | |
885 | 885 | |
886 | 886 | |
887 | -if ( ! function_exists( 'espresso_venue_is_password_protected' ) ) { |
|
887 | +if ( ! function_exists('espresso_venue_is_password_protected')) { |
|
888 | 888 | /** |
889 | 889 | * returns true or false if a venue is password protected or not |
890 | 890 | * |
891 | 891 | * @param int $VNU_ID optional, the venue id to check. |
892 | 892 | * @return string |
893 | 893 | */ |
894 | - function espresso_venue_is_password_protected( $VNU_ID = 0 ) { |
|
895 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
896 | - return EEH_Venue_View::is_venue_password_protected( $VNU_ID ); |
|
894 | + function espresso_venue_is_password_protected($VNU_ID = 0) { |
|
895 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
896 | + return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
900 | 900 | |
901 | 901 | |
902 | -if ( ! function_exists( 'espresso_password_protected_venue_form' ) ) { |
|
902 | +if ( ! function_exists('espresso_password_protected_venue_form')) { |
|
903 | 903 | /** |
904 | 904 | * Returns a password form if venue is password protected. |
905 | 905 | * |
906 | 906 | * @param int $VNU_ID optional, the venue id to check. |
907 | 907 | * @return string |
908 | 908 | */ |
909 | - function espresso_password_protected_venue_form( $VNU_ID = 0 ) { |
|
910 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
911 | - return EEH_Venue_View::password_protected_venue_form( $VNU_ID ); |
|
909 | + function espresso_password_protected_venue_form($VNU_ID = 0) { |
|
910 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
911 | + return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
912 | 912 | } |
913 | 913 | } |
914 | 914 | |
915 | 915 | |
916 | 916 | |
917 | 917 | |
918 | -if ( ! function_exists( 'espresso_venue_name' )) { |
|
918 | +if ( ! function_exists('espresso_venue_name')) { |
|
919 | 919 | /** |
920 | 920 | * espresso_venue_name |
921 | 921 | * |
@@ -925,19 +925,19 @@ discard block |
||
925 | 925 | * @param bool $echo |
926 | 926 | * @return string |
927 | 927 | */ |
928 | - function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) { |
|
929 | - if($echo){ |
|
930 | - echo EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
928 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) { |
|
929 | + if ($echo) { |
|
930 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
931 | 931 | return ''; |
932 | 932 | } |
933 | - return EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
933 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
934 | 934 | } |
935 | 935 | } |
936 | 936 | |
937 | 937 | |
938 | 938 | |
939 | 939 | |
940 | -if ( ! function_exists( 'espresso_venue_link' )) { |
|
940 | +if ( ! function_exists('espresso_venue_link')) { |
|
941 | 941 | /** |
942 | 942 | * espresso_venue_link |
943 | 943 | * |
@@ -946,14 +946,14 @@ discard block |
||
946 | 946 | * @param string $text |
947 | 947 | * @return string |
948 | 948 | */ |
949 | - function espresso_venue_link( $VNU_ID = 0, $text = '' ) { |
|
950 | - return EEH_Venue_View::venue_details_link( $VNU_ID, $text ); |
|
949 | + function espresso_venue_link($VNU_ID = 0, $text = '') { |
|
950 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
954 | 954 | |
955 | 955 | |
956 | -if ( ! function_exists( 'espresso_venue_description' )) { |
|
956 | +if ( ! function_exists('espresso_venue_description')) { |
|
957 | 957 | /** |
958 | 958 | * espresso_venue_description |
959 | 959 | * |
@@ -962,17 +962,17 @@ discard block |
||
962 | 962 | * @param bool $echo |
963 | 963 | * @return string |
964 | 964 | */ |
965 | - function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) { |
|
966 | - if($echo){ |
|
967 | - echo EEH_Venue_View::venue_description( $VNU_ID ); |
|
965 | + function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) { |
|
966 | + if ($echo) { |
|
967 | + echo EEH_Venue_View::venue_description($VNU_ID); |
|
968 | 968 | return ''; |
969 | 969 | } |
970 | - return EEH_Venue_View::venue_description( $VNU_ID ); |
|
970 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
971 | 971 | } |
972 | 972 | } |
973 | 973 | |
974 | 974 | |
975 | -if ( ! function_exists( 'espresso_venue_excerpt' )) { |
|
975 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
976 | 976 | /** |
977 | 977 | * espresso_venue_excerpt |
978 | 978 | * |
@@ -981,18 +981,18 @@ discard block |
||
981 | 981 | * @param bool $echo |
982 | 982 | * @return string |
983 | 983 | */ |
984 | - function espresso_venue_excerpt( $VNU_ID = 0, $echo = TRUE ) { |
|
985 | - if ( $echo ) { |
|
986 | - echo EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
984 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) { |
|
985 | + if ($echo) { |
|
986 | + echo EEH_Venue_View::venue_excerpt($VNU_ID); |
|
987 | 987 | return ''; |
988 | 988 | } |
989 | - return EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
989 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
990 | 990 | } |
991 | 991 | } |
992 | 992 | |
993 | 993 | |
994 | 994 | |
995 | -if ( ! function_exists( 'espresso_venue_categories' )) { |
|
995 | +if ( ! function_exists('espresso_venue_categories')) { |
|
996 | 996 | /** |
997 | 997 | * espresso_venue_categories |
998 | 998 | * returns the terms associated with a venue |
@@ -1002,17 +1002,17 @@ discard block |
||
1002 | 1002 | * @param bool $echo |
1003 | 1003 | * @return string |
1004 | 1004 | */ |
1005 | - function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
1006 | - if ( $echo ) { |
|
1007 | - echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1005 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
1006 | + if ($echo) { |
|
1007 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1008 | 1008 | return ''; |
1009 | 1009 | } |
1010 | - return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1010 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1011 | 1011 | } |
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | |
1015 | -if ( ! function_exists( 'espresso_venue_address' )) { |
|
1015 | +if ( ! function_exists('espresso_venue_address')) { |
|
1016 | 1016 | /** |
1017 | 1017 | * espresso_venue_address |
1018 | 1018 | * returns a formatted block of html for displaying a venue's address |
@@ -1022,17 +1022,17 @@ discard block |
||
1022 | 1022 | * @param bool $echo |
1023 | 1023 | * @return string |
1024 | 1024 | */ |
1025 | - function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1026 | - if ( $echo ) { |
|
1027 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1025 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1026 | + if ($echo) { |
|
1027 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1028 | 1028 | return ''; |
1029 | 1029 | } |
1030 | - return EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1030 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1031 | 1031 | } |
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | |
1035 | -if ( ! function_exists( 'espresso_venue_raw_address' )) { |
|
1035 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
1036 | 1036 | /** |
1037 | 1037 | * espresso_venue_address |
1038 | 1038 | * returns an UN-formatted string containing a venue's address |
@@ -1042,17 +1042,17 @@ discard block |
||
1042 | 1042 | * @param bool $echo |
1043 | 1043 | * @return string |
1044 | 1044 | */ |
1045 | - function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1046 | - if ( $echo ) { |
|
1047 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1045 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1046 | + if ($echo) { |
|
1047 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1048 | 1048 | return ''; |
1049 | 1049 | } |
1050 | - return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1050 | + return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1051 | 1051 | } |
1052 | 1052 | } |
1053 | 1053 | |
1054 | 1054 | |
1055 | -if ( ! function_exists( 'espresso_venue_has_address' )) { |
|
1055 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
1056 | 1056 | /** |
1057 | 1057 | * espresso_venue_has_address |
1058 | 1058 | * returns TRUE or FALSE if a Venue has address information |
@@ -1060,13 +1060,13 @@ discard block |
||
1060 | 1060 | * @param int $VNU_ID |
1061 | 1061 | * @return bool |
1062 | 1062 | */ |
1063 | - function espresso_venue_has_address( $VNU_ID = 0 ) { |
|
1064 | - return EEH_Venue_View::venue_has_address( $VNU_ID ); |
|
1063 | + function espresso_venue_has_address($VNU_ID = 0) { |
|
1064 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | |
1069 | -if ( ! function_exists( 'espresso_venue_gmap' )) { |
|
1069 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
1070 | 1070 | /** |
1071 | 1071 | * espresso_venue_gmap |
1072 | 1072 | * returns a google map for the venue address |
@@ -1077,17 +1077,17 @@ discard block |
||
1077 | 1077 | * @param bool $echo |
1078 | 1078 | * @return string |
1079 | 1079 | */ |
1080 | - function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE ) { |
|
1081 | - if ( $echo ) { |
|
1082 | - echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1080 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) { |
|
1081 | + if ($echo) { |
|
1082 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1083 | 1083 | return ''; |
1084 | 1084 | } |
1085 | - return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1085 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1086 | 1086 | } |
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | |
1090 | -if ( ! function_exists( 'espresso_venue_phone' )) { |
|
1090 | +if ( ! function_exists('espresso_venue_phone')) { |
|
1091 | 1091 | /** |
1092 | 1092 | * espresso_venue_phone |
1093 | 1093 | * |
@@ -1095,18 +1095,18 @@ discard block |
||
1095 | 1095 | * @param bool $echo |
1096 | 1096 | * @return string |
1097 | 1097 | */ |
1098 | - function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) { |
|
1099 | - if ( $echo ) { |
|
1100 | - echo EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1098 | + function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) { |
|
1099 | + if ($echo) { |
|
1100 | + echo EEH_Venue_View::venue_phone($VNU_ID); |
|
1101 | 1101 | return ''; |
1102 | 1102 | } |
1103 | - return EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1103 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | |
1108 | 1108 | |
1109 | -if ( ! function_exists( 'espresso_venue_website' )) { |
|
1109 | +if ( ! function_exists('espresso_venue_website')) { |
|
1110 | 1110 | /** |
1111 | 1111 | * espresso_venue_website |
1112 | 1112 | * |
@@ -1114,18 +1114,18 @@ discard block |
||
1114 | 1114 | * @param bool $echo |
1115 | 1115 | * @return string |
1116 | 1116 | */ |
1117 | - function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) { |
|
1118 | - if ( $echo ) { |
|
1119 | - echo EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1117 | + function espresso_venue_website($VNU_ID = 0, $echo = TRUE) { |
|
1118 | + if ($echo) { |
|
1119 | + echo EEH_Venue_View::venue_website_link($VNU_ID); |
|
1120 | 1120 | return ''; |
1121 | 1121 | } |
1122 | - return EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1122 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1123 | 1123 | } |
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | |
1127 | 1127 | |
1128 | -if ( ! function_exists( 'espresso_edit_venue_link' )) { |
|
1128 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
1129 | 1129 | /** |
1130 | 1130 | * espresso_edit_venue_link |
1131 | 1131 | * |
@@ -1133,12 +1133,12 @@ discard block |
||
1133 | 1133 | * @param bool $echo |
1134 | 1134 | * @return string |
1135 | 1135 | */ |
1136 | - function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) { |
|
1137 | - if($echo){ |
|
1138 | - echo EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1136 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) { |
|
1137 | + if ($echo) { |
|
1138 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1139 | 1139 | return ''; |
1140 | 1140 | } |
1141 | - return EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1141 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * can_use_espresso_conditionals |
131 | 131 | * tests whether the Espresso Conditional tags like is_espresso_event_single() can be called |
132 | 132 | * |
133 | - * @param $conditional_tag |
|
133 | + * @param string $conditional_tag |
|
134 | 134 | * @return bool |
135 | 135 | */ |
136 | 136 | function can_use_espresso_conditionals( $conditional_tag ) { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | if ( ! function_exists( 'espresso_ticket_selector' )) { |
202 | 202 | /** |
203 | 203 | * espresso_ticket_selector |
204 | - * @param null $event |
|
204 | + * @param EE_Event $event |
|
205 | 205 | */ |
206 | 206 | function espresso_ticket_selector( $event = NULL ) { |
207 | 207 | if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | /** |
843 | 843 | * espresso_event_venues |
844 | 844 | * |
845 | - * @return array all venues related to an event |
|
845 | + * @return EE_Venue[] all venues related to an event |
|
846 | 846 | */ |
847 | 847 | function espresso_event_venues() { |
848 | 848 | return EEH_Venue_View::get_event_venues(); |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | * |
876 | 876 | * @param int $VNU_ID optional, the venue id to check. |
877 | 877 | * |
878 | - * @return bool | null |
|
878 | + * @return null|boolean | null |
|
879 | 879 | */ |
880 | 880 | function espresso_is_venue_private( $VNU_ID = 0 ) { |
881 | 881 | return EEH_Venue_View::is_venue_private( $VNU_ID ); |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | * returns true or false if a venue is password protected or not |
890 | 890 | * |
891 | 891 | * @param int $VNU_ID optional, the venue id to check. |
892 | - * @return string |
|
892 | + * @return boolean |
|
893 | 893 | */ |
894 | 894 | function espresso_venue_is_password_protected( $VNU_ID = 0 ) { |
895 | 895 | EE_Registry::instance()->load_helper( 'Venue_View' ); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | function ee_recurse_into_array_for_display($data) { |
13 | 13 | if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {//is_object($incomplete_class) actually returns false, hence why we check for it |
14 | - $data = json_decode(json_encode($data), true); |
|
14 | + $data = json_decode(json_encode($data), true); |
|
15 | 15 | } |
16 | 16 | if (is_array($data)) { |
17 | 17 | if (EEH_Array::is_associative_array($data)) { |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | ?> |
24 | 24 | <tr> |
25 | 25 | <td> |
26 | - <?php echo $data_key;?> |
|
26 | + <?php echo $data_key; ?> |
|
27 | 27 | </td> |
28 | 28 | <td> |
29 | - <?php ee_recurse_into_array_for_display($data_values);?> |
|
29 | + <?php ee_recurse_into_array_for_display($data_values); ?> |
|
30 | 30 | </td> |
31 | 31 | </tr> |
32 | 32 | <?php |
@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | <ul> |
41 | 41 | <?php |
42 | 42 | foreach ($data as $datum) { |
43 | - echo "<li>";ee_recurse_into_array_for_display($datum);echo "</li>"; |
|
43 | + echo "<li>"; ee_recurse_into_array_for_display($datum); echo "</li>"; |
|
44 | 44 | }?> |
45 | 45 | </ul> |
46 | 46 | <?php |
47 | 47 | } |
48 | - }else { |
|
48 | + } else { |
|
49 | 49 | //simple value |
50 | 50 | echo $data; |
51 | 51 | } |
52 | 52 | } |
53 | 53 | ?> |
54 | 54 | <h1> |
55 | - <?php _e("System Information", "event_espresso");?> <a href="<?php echo $download_system_status_url;?>" class="button-secondary"><?php esc_html_e( 'Download to File', 'event_espresso' );?></a> |
|
55 | + <?php _e("System Information", "event_espresso"); ?> <a href="<?php echo $download_system_status_url; ?>" class="button-secondary"><?php esc_html_e('Download to File', 'event_espresso'); ?></a> |
|
56 | 56 | </h1> |
57 | 57 | <div class="padding"> |
58 | 58 |
@@ -21,59 +21,59 @@ |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * the actual shortcode tag that gets registered with WordPress |
|
26 | - * |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function getTag() |
|
30 | - { |
|
31 | - return 'ESPRESSO_CHECKOUT'; |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * the time in seconds to cache the results of the processShortcode() method |
|
38 | - * 0 means the processShortcode() results will NOT be cached at all |
|
39 | - * |
|
40 | - * @return int |
|
41 | - */ |
|
42 | - public function cacheExpiration() |
|
43 | - { |
|
44 | - return 0; |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
50 | - * this may be required for shortcodes that utilize a corresponding module, |
|
51 | - * and need to enqueue assets for that module |
|
52 | - * |
|
53 | - * @return void |
|
54 | - * @throws \EE_Error |
|
55 | - */ |
|
56 | - public function initializeShortcode() |
|
57 | - { |
|
58 | - global $wp_query; |
|
59 | - EED_Single_Page_Checkout::init($wp_query); |
|
60 | - $this->shortcodeHasBeenInitialized(); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * callback that runs when the shortcode is encountered in post content. |
|
67 | - * IMPORTANT !!! |
|
68 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
69 | - * |
|
70 | - * @param array $attributes |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function processShortcode($attributes = array()) |
|
74 | - { |
|
75 | - return EE_Registry::instance()->REQ->get_output(); |
|
76 | - } |
|
24 | + /** |
|
25 | + * the actual shortcode tag that gets registered with WordPress |
|
26 | + * |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function getTag() |
|
30 | + { |
|
31 | + return 'ESPRESSO_CHECKOUT'; |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * the time in seconds to cache the results of the processShortcode() method |
|
38 | + * 0 means the processShortcode() results will NOT be cached at all |
|
39 | + * |
|
40 | + * @return int |
|
41 | + */ |
|
42 | + public function cacheExpiration() |
|
43 | + { |
|
44 | + return 0; |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
50 | + * this may be required for shortcodes that utilize a corresponding module, |
|
51 | + * and need to enqueue assets for that module |
|
52 | + * |
|
53 | + * @return void |
|
54 | + * @throws \EE_Error |
|
55 | + */ |
|
56 | + public function initializeShortcode() |
|
57 | + { |
|
58 | + global $wp_query; |
|
59 | + EED_Single_Page_Checkout::init($wp_query); |
|
60 | + $this->shortcodeHasBeenInitialized(); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * callback that runs when the shortcode is encountered in post content. |
|
67 | + * IMPORTANT !!! |
|
68 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
69 | + * |
|
70 | + * @param array $attributes |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function processShortcode($attributes = array()) |
|
74 | + { |
|
75 | + return EE_Registry::instance()->REQ->get_output(); |
|
76 | + } |
|
77 | 77 | |
78 | 78 | |
79 | 79 |
@@ -27,92 +27,92 @@ |
||
27 | 27 | |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * the actual shortcode tag that gets registered with WordPress |
|
32 | - * |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function getTag() |
|
36 | - { |
|
37 | - return 'ESPRESSO_TXN_PAGE'; |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * the time in seconds to cache the results of the processShortcode() method |
|
44 | - * 0 means the processShortcode() results will NOT be cached at all |
|
45 | - * |
|
46 | - * @return int |
|
47 | - */ |
|
48 | - public function cacheExpiration() |
|
49 | - { |
|
50 | - return 0; |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
56 | - * this may be required for shortcodes that utilize a corresponding module, |
|
57 | - * and need to enqueue assets for that module |
|
58 | - * |
|
59 | - * @return void |
|
60 | - * @throws \Exception |
|
61 | - * @throws \EE_Error |
|
62 | - */ |
|
63 | - public function initializeShortcode() |
|
64 | - { |
|
65 | - $transaction = null; |
|
66 | - if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
67 | - /** @var EEM_Transaction $EEM_Transaction */ |
|
68 | - $EEM_Transaction = EE_Registry::instance()->load_model('Transaction'); |
|
69 | - $transaction = $EEM_Transaction->get_transaction_from_reg_url_link(); |
|
70 | - } |
|
71 | - if ($transaction instanceof EE_Transaction) { |
|
72 | - $payment_method = null; |
|
73 | - $payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null); |
|
74 | - if ($payment_method_slug) { |
|
75 | - $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug); |
|
76 | - } |
|
77 | - if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) { |
|
78 | - $gateway = $payment_method->type_obj()->get_gateway(); |
|
79 | - if ( |
|
80 | - $gateway instanceof EE_Offsite_Gateway |
|
81 | - && $gateway->handle_IPN_in_this_request( |
|
82 | - \EE_Registry::instance()->REQ->params(), |
|
83 | - true |
|
84 | - ) |
|
85 | - ) { |
|
86 | - /** @type EE_Payment_Processor $payment_processor */ |
|
87 | - $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
88 | - $payment_processor->process_ipn($_REQUEST, $transaction, $payment_method); |
|
89 | - } |
|
90 | - } |
|
91 | - //allow gateways to add a filter to stop rendering the page |
|
92 | - if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', false)) { |
|
93 | - exit; |
|
94 | - } |
|
95 | - } |
|
96 | - $this->shortcodeHasBeenInitialized(); |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * callback that runs when the shortcode is encountered in post content. |
|
103 | - * IMPORTANT !!! |
|
104 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
105 | - * |
|
106 | - * @param array $attributes |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - public function processShortcode($attributes = array()) |
|
110 | - { |
|
111 | - return esc_html__( |
|
112 | - 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', |
|
113 | - 'event_espresso' |
|
114 | - ); |
|
115 | - } |
|
30 | + /** |
|
31 | + * the actual shortcode tag that gets registered with WordPress |
|
32 | + * |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function getTag() |
|
36 | + { |
|
37 | + return 'ESPRESSO_TXN_PAGE'; |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * the time in seconds to cache the results of the processShortcode() method |
|
44 | + * 0 means the processShortcode() results will NOT be cached at all |
|
45 | + * |
|
46 | + * @return int |
|
47 | + */ |
|
48 | + public function cacheExpiration() |
|
49 | + { |
|
50 | + return 0; |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
56 | + * this may be required for shortcodes that utilize a corresponding module, |
|
57 | + * and need to enqueue assets for that module |
|
58 | + * |
|
59 | + * @return void |
|
60 | + * @throws \Exception |
|
61 | + * @throws \EE_Error |
|
62 | + */ |
|
63 | + public function initializeShortcode() |
|
64 | + { |
|
65 | + $transaction = null; |
|
66 | + if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
67 | + /** @var EEM_Transaction $EEM_Transaction */ |
|
68 | + $EEM_Transaction = EE_Registry::instance()->load_model('Transaction'); |
|
69 | + $transaction = $EEM_Transaction->get_transaction_from_reg_url_link(); |
|
70 | + } |
|
71 | + if ($transaction instanceof EE_Transaction) { |
|
72 | + $payment_method = null; |
|
73 | + $payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null); |
|
74 | + if ($payment_method_slug) { |
|
75 | + $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug); |
|
76 | + } |
|
77 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) { |
|
78 | + $gateway = $payment_method->type_obj()->get_gateway(); |
|
79 | + if ( |
|
80 | + $gateway instanceof EE_Offsite_Gateway |
|
81 | + && $gateway->handle_IPN_in_this_request( |
|
82 | + \EE_Registry::instance()->REQ->params(), |
|
83 | + true |
|
84 | + ) |
|
85 | + ) { |
|
86 | + /** @type EE_Payment_Processor $payment_processor */ |
|
87 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
88 | + $payment_processor->process_ipn($_REQUEST, $transaction, $payment_method); |
|
89 | + } |
|
90 | + } |
|
91 | + //allow gateways to add a filter to stop rendering the page |
|
92 | + if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', false)) { |
|
93 | + exit; |
|
94 | + } |
|
95 | + } |
|
96 | + $this->shortcodeHasBeenInitialized(); |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * callback that runs when the shortcode is encountered in post content. |
|
103 | + * IMPORTANT !!! |
|
104 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
105 | + * |
|
106 | + * @param array $attributes |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + public function processShortcode($attributes = array()) |
|
110 | + { |
|
111 | + return esc_html__( |
|
112 | + 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', |
|
113 | + 'event_espresso' |
|
114 | + ); |
|
115 | + } |
|
116 | 116 | } |
117 | 117 | // End of file EspressoTxnPage.php |
118 | 118 | // Location: EventEspresso\core\domain\entities\shortcodes/EspressoTxnPage.php |
119 | 119 | \ No newline at end of file |
@@ -24,79 +24,79 @@ |
||
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * the actual shortcode tag that gets registered with WordPress |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function getTag() |
|
33 | - { |
|
34 | - return 'ESPRESSO_CANCELLED'; |
|
35 | - } |
|
36 | - |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * the time in seconds to cache the results of the processShortcode() method |
|
41 | - * 0 means the processShortcode() results will NOT be cached at all |
|
42 | - * |
|
43 | - * @return int |
|
44 | - */ |
|
45 | - public function cacheExpiration() |
|
46 | - { |
|
47 | - return 0; |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
53 | - * this may be required for shortcodes that utilize a corresponding module, |
|
54 | - * and need to enqueue assets for that module |
|
55 | - * |
|
56 | - * @return void |
|
57 | - */ |
|
58 | - public function initializeShortcode() |
|
59 | - { |
|
60 | - $this->shortcodeHasBeenInitialized(); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * callback that runs when the shortcode is encountered in post content. |
|
66 | - * IMPORTANT !!! |
|
67 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
68 | - * |
|
69 | - * @param array $attributes |
|
70 | - * @return string |
|
71 | - * @throws \EE_Error |
|
72 | - */ |
|
73 | - public function processShortcode($attributes = array()) |
|
74 | - { |
|
75 | - $transaction = EE_Registry::instance()->SSN->get_session_data('transaction'); |
|
76 | - if ($transaction instanceof EE_Transaction) { |
|
77 | - do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', $transaction); |
|
78 | - $registrations = $transaction->registrations(); |
|
79 | - foreach ($registrations as $registration) { |
|
80 | - if ($registration instanceof EE_Registration) { |
|
81 | - do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__registration', $registration); |
|
82 | - } |
|
83 | - } |
|
84 | - } |
|
85 | - do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__clear_session'); |
|
86 | - // remove all unwanted records from the db |
|
87 | - if (EE_Registry::instance()->CART instanceof EE_Cart) { |
|
88 | - EE_Registry::instance()->CART->delete_cart(); |
|
89 | - } |
|
90 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
91 | - return sprintf( |
|
92 | - __( |
|
93 | - '%sAll unsaved registration information entered during this session has been deleted.%s', |
|
94 | - 'event_espresso' |
|
95 | - ), |
|
96 | - '<p class="ee-registrations-cancelled-pg ee-attention">', |
|
97 | - '</p>' |
|
98 | - ); |
|
99 | - } |
|
27 | + /** |
|
28 | + * the actual shortcode tag that gets registered with WordPress |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function getTag() |
|
33 | + { |
|
34 | + return 'ESPRESSO_CANCELLED'; |
|
35 | + } |
|
36 | + |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * the time in seconds to cache the results of the processShortcode() method |
|
41 | + * 0 means the processShortcode() results will NOT be cached at all |
|
42 | + * |
|
43 | + * @return int |
|
44 | + */ |
|
45 | + public function cacheExpiration() |
|
46 | + { |
|
47 | + return 0; |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
53 | + * this may be required for shortcodes that utilize a corresponding module, |
|
54 | + * and need to enqueue assets for that module |
|
55 | + * |
|
56 | + * @return void |
|
57 | + */ |
|
58 | + public function initializeShortcode() |
|
59 | + { |
|
60 | + $this->shortcodeHasBeenInitialized(); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * callback that runs when the shortcode is encountered in post content. |
|
66 | + * IMPORTANT !!! |
|
67 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
68 | + * |
|
69 | + * @param array $attributes |
|
70 | + * @return string |
|
71 | + * @throws \EE_Error |
|
72 | + */ |
|
73 | + public function processShortcode($attributes = array()) |
|
74 | + { |
|
75 | + $transaction = EE_Registry::instance()->SSN->get_session_data('transaction'); |
|
76 | + if ($transaction instanceof EE_Transaction) { |
|
77 | + do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', $transaction); |
|
78 | + $registrations = $transaction->registrations(); |
|
79 | + foreach ($registrations as $registration) { |
|
80 | + if ($registration instanceof EE_Registration) { |
|
81 | + do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__registration', $registration); |
|
82 | + } |
|
83 | + } |
|
84 | + } |
|
85 | + do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__clear_session'); |
|
86 | + // remove all unwanted records from the db |
|
87 | + if (EE_Registry::instance()->CART instanceof EE_Cart) { |
|
88 | + EE_Registry::instance()->CART->delete_cart(); |
|
89 | + } |
|
90 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
91 | + return sprintf( |
|
92 | + __( |
|
93 | + '%sAll unsaved registration information entered during this session has been deleted.%s', |
|
94 | + 'event_espresso' |
|
95 | + ), |
|
96 | + '<p class="ee-registrations-cancelled-pg ee-attention">', |
|
97 | + '</p>' |
|
98 | + ); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | // End of file EspressoCancelled.php |
@@ -8,44 +8,44 @@ |
||
8 | 8 | interface ShortcodeInterface |
9 | 9 | { |
10 | 10 | |
11 | - /** |
|
12 | - * the actual shortcode tag that gets registered with WordPress |
|
13 | - * |
|
14 | - * @return string |
|
15 | - */ |
|
16 | - public function getTag(); |
|
17 | - |
|
18 | - /** |
|
19 | - * the length of time in seconds to cache the results of the processShortcode() method |
|
20 | - * 0 means the processShortcode() results will NOT be cached at all |
|
21 | - * |
|
22 | - * @return int |
|
23 | - */ |
|
24 | - public function cacheExpiration(); |
|
25 | - |
|
26 | - /** |
|
27 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
28 | - * this may be required for shortcodes that utilize a corresponding module, |
|
29 | - * and need to enqueue assets for that module |
|
30 | - * |
|
31 | - * !!! IMPORTANT !!! |
|
32 | - * After performing any logic within this method required for initialization |
|
33 | - * $this->shortcodeHasBeenInitialized(); |
|
34 | - * should be called to ensure that the shortcode is setup correctly. |
|
35 | - * |
|
36 | - * @return void |
|
37 | - */ |
|
38 | - public function initializeShortcode(); |
|
39 | - |
|
40 | - /** |
|
41 | - * callback that runs when the shortcode is encountered in post content. |
|
42 | - * IMPORTANT !!! |
|
43 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
44 | - * |
|
45 | - * @param array $attributes |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function processShortcode($attributes = array()); |
|
11 | + /** |
|
12 | + * the actual shortcode tag that gets registered with WordPress |
|
13 | + * |
|
14 | + * @return string |
|
15 | + */ |
|
16 | + public function getTag(); |
|
17 | + |
|
18 | + /** |
|
19 | + * the length of time in seconds to cache the results of the processShortcode() method |
|
20 | + * 0 means the processShortcode() results will NOT be cached at all |
|
21 | + * |
|
22 | + * @return int |
|
23 | + */ |
|
24 | + public function cacheExpiration(); |
|
25 | + |
|
26 | + /** |
|
27 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
28 | + * this may be required for shortcodes that utilize a corresponding module, |
|
29 | + * and need to enqueue assets for that module |
|
30 | + * |
|
31 | + * !!! IMPORTANT !!! |
|
32 | + * After performing any logic within this method required for initialization |
|
33 | + * $this->shortcodeHasBeenInitialized(); |
|
34 | + * should be called to ensure that the shortcode is setup correctly. |
|
35 | + * |
|
36 | + * @return void |
|
37 | + */ |
|
38 | + public function initializeShortcode(); |
|
39 | + |
|
40 | + /** |
|
41 | + * callback that runs when the shortcode is encountered in post content. |
|
42 | + * IMPORTANT !!! |
|
43 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
44 | + * |
|
45 | + * @param array $attributes |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function processShortcode($attributes = array()); |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | // End of file ShortcodeInterface.php |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | return $this->shortcodeContent( |
84 | - $this->sanitizeAttributes((array)$attributes) |
|
84 | + $this->sanitizeAttributes((array) $attributes) |
|
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | // serialized attributes |
110 | 110 | wp_json_encode($attributes), |
111 | 111 | // Closure for generating content if cache is expired |
112 | - function () use ($shortcode, $attributes) { |
|
113 | - if($shortcode->initialized === false){ |
|
112 | + function() use ($shortcode, $attributes) { |
|
113 | + if ($shortcode->initialized === false) { |
|
114 | 114 | $shortcode->initializeShortcode(); |
115 | 115 | } |
116 | 116 | return $shortcode->processShortcode($attributes); |
@@ -21,219 +21,219 @@ |
||
21 | 21 | abstract class EspressoShortcode implements ShortcodeInterface |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * transient prefix |
|
26 | - * |
|
27 | - * @type string |
|
28 | - */ |
|
29 | - const CACHE_TRANSIENT_PREFIX = 'ee_sc_'; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var PostRelatedCacheManager $cache_manager |
|
33 | - */ |
|
34 | - private $cache_manager; |
|
35 | - |
|
36 | - /** |
|
37 | - * true if ShortcodeInterface::initializeShortcode() has been called |
|
38 | - * if false, then that will get called before processing |
|
39 | - * |
|
40 | - * @var boolean $initialized |
|
41 | - */ |
|
42 | - private $initialized = false; |
|
43 | - |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * EspressoShortcode constructor |
|
48 | - * |
|
49 | - * @param PostRelatedCacheManager $cache_manager |
|
50 | - */ |
|
51 | - public function __construct(PostRelatedCacheManager $cache_manager) |
|
52 | - { |
|
53 | - $this->cache_manager = $cache_manager; |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * @return void |
|
60 | - */ |
|
61 | - public function shortcodeHasBeenInitialized() |
|
62 | - { |
|
63 | - $this->initialized = true; |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * enqueues scripts then processes the shortcode |
|
70 | - * |
|
71 | - * @param array $attributes |
|
72 | - * @return string |
|
73 | - * @throws EE_Error |
|
74 | - */ |
|
75 | - final public function processShortcodeCallback($attributes = array()) |
|
76 | - { |
|
77 | - if ($this instanceof EnqueueAssetsInterface) { |
|
78 | - if (is_admin()) { |
|
79 | - $this->enqueueAdminScripts(); |
|
80 | - } else { |
|
81 | - $this->enqueueScripts(); |
|
82 | - } |
|
83 | - } |
|
84 | - return $this->shortcodeContent( |
|
85 | - $this->sanitizeAttributes((array)$attributes) |
|
86 | - ); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * If shortcode caching is enabled for the shortcode, |
|
93 | - * and cached results exist, then that will be returned |
|
94 | - * else new content will be generated. |
|
95 | - * If caching is enabled, then the new content will be cached for later. |
|
96 | - * |
|
97 | - * @param array $attributes |
|
98 | - * @return mixed|string |
|
99 | - * @throws EE_Error |
|
100 | - */ |
|
101 | - private function shortcodeContent(array $attributes) |
|
102 | - { |
|
103 | - $shortcode = $this; |
|
104 | - $post_ID = $this->currentPostID(); |
|
105 | - // something like "SC_EVENTS-123" |
|
106 | - $cache_ID = $this->shortcodeCacheID($post_ID); |
|
107 | - $this->cache_manager->clearPostRelatedCacheOnUpdate($post_ID, $cache_ID); |
|
108 | - return $this->cache_manager->get( |
|
109 | - $cache_ID, |
|
110 | - // serialized attributes |
|
111 | - wp_json_encode($attributes), |
|
112 | - // Closure for generating content if cache is expired |
|
113 | - function () use ($shortcode, $attributes) { |
|
114 | - if($shortcode->initialized === false){ |
|
115 | - $shortcode->initializeShortcode(); |
|
116 | - } |
|
117 | - return $shortcode->processShortcode($attributes); |
|
118 | - }, |
|
119 | - // filterable cache expiration set by each shortcode |
|
120 | - apply_filters( |
|
121 | - 'FHEE__EventEspresso_core_services_shortcodes_EspressoShortcode__shortcodeContent__cache_expiration', |
|
122 | - $this->cacheExpiration(), |
|
123 | - $this->getTag(), |
|
124 | - $this |
|
125 | - ) |
|
126 | - ); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * @return int |
|
133 | - * @throws EE_Error |
|
134 | - */ |
|
135 | - private function currentPostID() |
|
136 | - { |
|
137 | - // try to get EE_Event any way we can |
|
138 | - $event = EEH_Event_View::get_event(); |
|
139 | - // then get some kind of ID |
|
140 | - if ($event instanceof \EE_Event) { |
|
141 | - $post_ID = $event->ID(); |
|
142 | - } else { |
|
143 | - global $post; |
|
144 | - $post_ID = $post->ID; |
|
145 | - } |
|
146 | - return $post_ID; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * @param int $post_ID |
|
153 | - * @return string |
|
154 | - * @throws EE_Error |
|
155 | - */ |
|
156 | - private function shortcodeCacheID($post_ID) |
|
157 | - { |
|
158 | - $tag = str_replace('ESPRESSO_', '', $this->getTag()); |
|
159 | - return "SC_{$tag}-{$post_ID}"; |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * array for defining custom attribute sanitization callbacks, |
|
166 | - * where keys match keys in your attributes array, |
|
167 | - * and values represent the sanitization function you wish to be applied to that attribute. |
|
168 | - * So for example, if you had an integer attribute named "event_id" |
|
169 | - * that you wanted to be sanitized using absint(), |
|
170 | - * then you would return the following: |
|
171 | - * array('event_id' => 'absint') |
|
172 | - * Entering 'skip_sanitization' for the callback value |
|
173 | - * means that no sanitization will be applied |
|
174 | - * on the assumption that the attribute |
|
175 | - * will be sanitized at some point... right? |
|
176 | - * You wouldn't pass around unsanitized attributes would you? |
|
177 | - * That would be very Tom Foolery of you!!! |
|
178 | - * |
|
179 | - * @return array |
|
180 | - */ |
|
181 | - protected function customAttributeSanitizationMap() |
|
182 | - { |
|
183 | - return array(); |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - |
|
188 | - /** |
|
189 | - * Performs basic sanitization on shortcode attributes |
|
190 | - * Since incoming attributes from the shortcode usage in the WP editor will all be strings, |
|
191 | - * most attributes will by default be sanitized using the sanitize_text_field() function. |
|
192 | - * This can be overridden using the customAttributeSanitizationMap() method (see above), |
|
193 | - * all other attributes would be sanitized using the defaults in the switch statement below |
|
194 | - * |
|
195 | - * @param array $attributes |
|
196 | - * @return array |
|
197 | - */ |
|
198 | - private function sanitizeAttributes(array $attributes) |
|
199 | - { |
|
200 | - $custom_sanitization = $this->customAttributeSanitizationMap(); |
|
201 | - foreach ($attributes as $key => $value) { |
|
202 | - // is a custom sanitization callback specified ? |
|
203 | - if (isset($custom_sanitization[$key])) { |
|
204 | - $callback = $custom_sanitization[$key]; |
|
205 | - if ($callback === 'skip_sanitization') { |
|
206 | - $attributes[$key] = $value; |
|
207 | - continue; |
|
208 | - } |
|
209 | - if (function_exists($callback)) { |
|
210 | - $attributes[$key] = $callback($value); |
|
211 | - continue; |
|
212 | - } |
|
213 | - } |
|
214 | - switch (true) { |
|
215 | - case $value === null : |
|
216 | - case is_int($value) : |
|
217 | - case is_float($value) : |
|
218 | - // typical booleans |
|
219 | - case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true) : |
|
220 | - $attributes[$key] = $value; |
|
221 | - break; |
|
222 | - case is_string($value) : |
|
223 | - $attributes[$key] = sanitize_text_field($value); |
|
224 | - break; |
|
225 | - case is_array($value) : |
|
226 | - $attributes[$key] = $this->sanitizeAttributes($value); |
|
227 | - break; |
|
228 | - default : |
|
229 | - // only remaining data types are Object and Resource |
|
230 | - // which are not allowed as shortcode attributes |
|
231 | - $attributes[$key] = null; |
|
232 | - break; |
|
233 | - } |
|
234 | - } |
|
235 | - return $attributes; |
|
236 | - } |
|
24 | + /** |
|
25 | + * transient prefix |
|
26 | + * |
|
27 | + * @type string |
|
28 | + */ |
|
29 | + const CACHE_TRANSIENT_PREFIX = 'ee_sc_'; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var PostRelatedCacheManager $cache_manager |
|
33 | + */ |
|
34 | + private $cache_manager; |
|
35 | + |
|
36 | + /** |
|
37 | + * true if ShortcodeInterface::initializeShortcode() has been called |
|
38 | + * if false, then that will get called before processing |
|
39 | + * |
|
40 | + * @var boolean $initialized |
|
41 | + */ |
|
42 | + private $initialized = false; |
|
43 | + |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * EspressoShortcode constructor |
|
48 | + * |
|
49 | + * @param PostRelatedCacheManager $cache_manager |
|
50 | + */ |
|
51 | + public function __construct(PostRelatedCacheManager $cache_manager) |
|
52 | + { |
|
53 | + $this->cache_manager = $cache_manager; |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * @return void |
|
60 | + */ |
|
61 | + public function shortcodeHasBeenInitialized() |
|
62 | + { |
|
63 | + $this->initialized = true; |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * enqueues scripts then processes the shortcode |
|
70 | + * |
|
71 | + * @param array $attributes |
|
72 | + * @return string |
|
73 | + * @throws EE_Error |
|
74 | + */ |
|
75 | + final public function processShortcodeCallback($attributes = array()) |
|
76 | + { |
|
77 | + if ($this instanceof EnqueueAssetsInterface) { |
|
78 | + if (is_admin()) { |
|
79 | + $this->enqueueAdminScripts(); |
|
80 | + } else { |
|
81 | + $this->enqueueScripts(); |
|
82 | + } |
|
83 | + } |
|
84 | + return $this->shortcodeContent( |
|
85 | + $this->sanitizeAttributes((array)$attributes) |
|
86 | + ); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * If shortcode caching is enabled for the shortcode, |
|
93 | + * and cached results exist, then that will be returned |
|
94 | + * else new content will be generated. |
|
95 | + * If caching is enabled, then the new content will be cached for later. |
|
96 | + * |
|
97 | + * @param array $attributes |
|
98 | + * @return mixed|string |
|
99 | + * @throws EE_Error |
|
100 | + */ |
|
101 | + private function shortcodeContent(array $attributes) |
|
102 | + { |
|
103 | + $shortcode = $this; |
|
104 | + $post_ID = $this->currentPostID(); |
|
105 | + // something like "SC_EVENTS-123" |
|
106 | + $cache_ID = $this->shortcodeCacheID($post_ID); |
|
107 | + $this->cache_manager->clearPostRelatedCacheOnUpdate($post_ID, $cache_ID); |
|
108 | + return $this->cache_manager->get( |
|
109 | + $cache_ID, |
|
110 | + // serialized attributes |
|
111 | + wp_json_encode($attributes), |
|
112 | + // Closure for generating content if cache is expired |
|
113 | + function () use ($shortcode, $attributes) { |
|
114 | + if($shortcode->initialized === false){ |
|
115 | + $shortcode->initializeShortcode(); |
|
116 | + } |
|
117 | + return $shortcode->processShortcode($attributes); |
|
118 | + }, |
|
119 | + // filterable cache expiration set by each shortcode |
|
120 | + apply_filters( |
|
121 | + 'FHEE__EventEspresso_core_services_shortcodes_EspressoShortcode__shortcodeContent__cache_expiration', |
|
122 | + $this->cacheExpiration(), |
|
123 | + $this->getTag(), |
|
124 | + $this |
|
125 | + ) |
|
126 | + ); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * @return int |
|
133 | + * @throws EE_Error |
|
134 | + */ |
|
135 | + private function currentPostID() |
|
136 | + { |
|
137 | + // try to get EE_Event any way we can |
|
138 | + $event = EEH_Event_View::get_event(); |
|
139 | + // then get some kind of ID |
|
140 | + if ($event instanceof \EE_Event) { |
|
141 | + $post_ID = $event->ID(); |
|
142 | + } else { |
|
143 | + global $post; |
|
144 | + $post_ID = $post->ID; |
|
145 | + } |
|
146 | + return $post_ID; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * @param int $post_ID |
|
153 | + * @return string |
|
154 | + * @throws EE_Error |
|
155 | + */ |
|
156 | + private function shortcodeCacheID($post_ID) |
|
157 | + { |
|
158 | + $tag = str_replace('ESPRESSO_', '', $this->getTag()); |
|
159 | + return "SC_{$tag}-{$post_ID}"; |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * array for defining custom attribute sanitization callbacks, |
|
166 | + * where keys match keys in your attributes array, |
|
167 | + * and values represent the sanitization function you wish to be applied to that attribute. |
|
168 | + * So for example, if you had an integer attribute named "event_id" |
|
169 | + * that you wanted to be sanitized using absint(), |
|
170 | + * then you would return the following: |
|
171 | + * array('event_id' => 'absint') |
|
172 | + * Entering 'skip_sanitization' for the callback value |
|
173 | + * means that no sanitization will be applied |
|
174 | + * on the assumption that the attribute |
|
175 | + * will be sanitized at some point... right? |
|
176 | + * You wouldn't pass around unsanitized attributes would you? |
|
177 | + * That would be very Tom Foolery of you!!! |
|
178 | + * |
|
179 | + * @return array |
|
180 | + */ |
|
181 | + protected function customAttributeSanitizationMap() |
|
182 | + { |
|
183 | + return array(); |
|
184 | + } |
|
185 | + |
|
186 | + |
|
187 | + |
|
188 | + /** |
|
189 | + * Performs basic sanitization on shortcode attributes |
|
190 | + * Since incoming attributes from the shortcode usage in the WP editor will all be strings, |
|
191 | + * most attributes will by default be sanitized using the sanitize_text_field() function. |
|
192 | + * This can be overridden using the customAttributeSanitizationMap() method (see above), |
|
193 | + * all other attributes would be sanitized using the defaults in the switch statement below |
|
194 | + * |
|
195 | + * @param array $attributes |
|
196 | + * @return array |
|
197 | + */ |
|
198 | + private function sanitizeAttributes(array $attributes) |
|
199 | + { |
|
200 | + $custom_sanitization = $this->customAttributeSanitizationMap(); |
|
201 | + foreach ($attributes as $key => $value) { |
|
202 | + // is a custom sanitization callback specified ? |
|
203 | + if (isset($custom_sanitization[$key])) { |
|
204 | + $callback = $custom_sanitization[$key]; |
|
205 | + if ($callback === 'skip_sanitization') { |
|
206 | + $attributes[$key] = $value; |
|
207 | + continue; |
|
208 | + } |
|
209 | + if (function_exists($callback)) { |
|
210 | + $attributes[$key] = $callback($value); |
|
211 | + continue; |
|
212 | + } |
|
213 | + } |
|
214 | + switch (true) { |
|
215 | + case $value === null : |
|
216 | + case is_int($value) : |
|
217 | + case is_float($value) : |
|
218 | + // typical booleans |
|
219 | + case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true) : |
|
220 | + $attributes[$key] = $value; |
|
221 | + break; |
|
222 | + case is_string($value) : |
|
223 | + $attributes[$key] = sanitize_text_field($value); |
|
224 | + break; |
|
225 | + case is_array($value) : |
|
226 | + $attributes[$key] = $this->sanitizeAttributes($value); |
|
227 | + break; |
|
228 | + default : |
|
229 | + // only remaining data types are Object and Resource |
|
230 | + // which are not allowed as shortcode attributes |
|
231 | + $attributes[$key] = null; |
|
232 | + break; |
|
233 | + } |
|
234 | + } |
|
235 | + return $attributes; |
|
236 | + } |
|
237 | 237 | |
238 | 238 | |
239 | 239 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -15,117 +15,117 @@ discard block |
||
15 | 15 | class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param null $validation_error_message |
|
20 | - */ |
|
21 | - public function __construct($validation_error_message = null) |
|
22 | - { |
|
23 | - if (! $validation_error_message) { |
|
24 | - $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
|
25 | - } |
|
26 | - parent::__construct($validation_error_message); |
|
27 | - } |
|
18 | + /** |
|
19 | + * @param null $validation_error_message |
|
20 | + */ |
|
21 | + public function __construct($validation_error_message = null) |
|
22 | + { |
|
23 | + if (! $validation_error_message) { |
|
24 | + $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
|
25 | + } |
|
26 | + parent::__construct($validation_error_message); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * just checks the field isn't blank |
|
33 | - * |
|
34 | - * @param $normalized_value |
|
35 | - * @return bool |
|
36 | - * @throws \EE_Validation_Error |
|
37 | - */ |
|
38 | - public function validate($normalized_value) |
|
39 | - { |
|
40 | - if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
41 | - throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
42 | - } |
|
43 | - } |
|
31 | + /** |
|
32 | + * just checks the field isn't blank |
|
33 | + * |
|
34 | + * @param $normalized_value |
|
35 | + * @return bool |
|
36 | + * @throws \EE_Validation_Error |
|
37 | + */ |
|
38 | + public function validate($normalized_value) |
|
39 | + { |
|
40 | + if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
41 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * @return array |
|
49 | - */ |
|
50 | - public function get_jquery_validation_rule_array() |
|
51 | - { |
|
52 | - return array('email' => true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
53 | - } |
|
47 | + /** |
|
48 | + * @return array |
|
49 | + */ |
|
50 | + public function get_jquery_validation_rule_array() |
|
51 | + { |
|
52 | + return array('email' => true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * Validate an email address. |
|
59 | - * Provide email address (raw input) |
|
60 | - * |
|
61 | - * @param $email |
|
62 | - * @return bool of whether the email is valid or not |
|
63 | - * @throws \EE_Validation_Error |
|
64 | - */ |
|
65 | - private function _validate_email($email) |
|
66 | - { |
|
67 | - $validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
|
68 | - ? EE_Registry::instance()->CFG->registration->email_validation_level |
|
69 | - : 'wp_default'; |
|
70 | - if (! preg_match('/^.+\@\S+$/', $email)) { // \.\S+ |
|
71 | - // email not in correct {string}@{string} format |
|
72 | - return false; |
|
73 | - } else { |
|
74 | - $atIndex = strrpos($email, "@"); |
|
75 | - $domain = substr($email, $atIndex + 1); |
|
76 | - $local = substr($email, 0, $atIndex); |
|
77 | - $localLen = strlen($local); |
|
78 | - $domainLen = strlen($domain); |
|
79 | - if ($localLen < 1 || $localLen > 64) { |
|
80 | - // local part length exceeded |
|
81 | - return false; |
|
82 | - } else if ($domainLen < 1 || $domainLen > 255) { |
|
83 | - // domain part length exceeded |
|
84 | - return false; |
|
85 | - } else if ($local[0] === '.' || $local[$localLen - 1] === '.') { |
|
86 | - // local part starts or ends with '.' |
|
87 | - return false; |
|
88 | - } else if (preg_match('/\\.\\./', $local)) { |
|
89 | - // local part has two consecutive dots |
|
90 | - return false; |
|
91 | - } else if (preg_match('/\\.\\./', $domain)) { |
|
92 | - // domain part has two consecutive dots |
|
93 | - return false; |
|
94 | - } else if ($validation_level === 'wp_default') { |
|
95 | - return is_email($email); |
|
96 | - } else if ( |
|
97 | - ($validation_level === 'i18n' || $validation_level === 'i18n_dns') |
|
98 | - // plz see http://stackoverflow.com/a/24817336 re: the following regex |
|
99 | - && ! preg_match( |
|
100 | - '/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u', |
|
101 | ||
102 | - ) |
|
103 | - ) { |
|
104 | - return false; |
|
105 | - } |
|
106 | - if ($validation_level === 'i18n_dns') { |
|
107 | - if (! checkdnsrr($domain, "MX")) { |
|
108 | - // domain not found in MX records |
|
109 | - throw new EE_Validation_Error( |
|
110 | - __( |
|
111 | - 'Although the email address provided is formatted correctly, a valid "MX record" could not be located for that address and domain. Please enter a valid email address.', |
|
112 | - 'event_espresso' |
|
113 | - ) |
|
114 | - ); |
|
115 | - } else if (! checkdnsrr($domain, "A")) { |
|
116 | - // domain not found in A records |
|
117 | - throw new EE_Validation_Error( |
|
118 | - __( |
|
119 | - 'Although the email address provided is formatted correctly, a valid "A record" could not be located for that address and domain. Please enter a valid email address.', |
|
120 | - 'event_espresso' |
|
121 | - ) |
|
122 | - ); |
|
123 | - } |
|
124 | - } |
|
125 | - } |
|
126 | - // you have successfully run the gauntlet young Padawan |
|
127 | - return true; |
|
128 | - } |
|
57 | + /** |
|
58 | + * Validate an email address. |
|
59 | + * Provide email address (raw input) |
|
60 | + * |
|
61 | + * @param $email |
|
62 | + * @return bool of whether the email is valid or not |
|
63 | + * @throws \EE_Validation_Error |
|
64 | + */ |
|
65 | + private function _validate_email($email) |
|
66 | + { |
|
67 | + $validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
|
68 | + ? EE_Registry::instance()->CFG->registration->email_validation_level |
|
69 | + : 'wp_default'; |
|
70 | + if (! preg_match('/^.+\@\S+$/', $email)) { // \.\S+ |
|
71 | + // email not in correct {string}@{string} format |
|
72 | + return false; |
|
73 | + } else { |
|
74 | + $atIndex = strrpos($email, "@"); |
|
75 | + $domain = substr($email, $atIndex + 1); |
|
76 | + $local = substr($email, 0, $atIndex); |
|
77 | + $localLen = strlen($local); |
|
78 | + $domainLen = strlen($domain); |
|
79 | + if ($localLen < 1 || $localLen > 64) { |
|
80 | + // local part length exceeded |
|
81 | + return false; |
|
82 | + } else if ($domainLen < 1 || $domainLen > 255) { |
|
83 | + // domain part length exceeded |
|
84 | + return false; |
|
85 | + } else if ($local[0] === '.' || $local[$localLen - 1] === '.') { |
|
86 | + // local part starts or ends with '.' |
|
87 | + return false; |
|
88 | + } else if (preg_match('/\\.\\./', $local)) { |
|
89 | + // local part has two consecutive dots |
|
90 | + return false; |
|
91 | + } else if (preg_match('/\\.\\./', $domain)) { |
|
92 | + // domain part has two consecutive dots |
|
93 | + return false; |
|
94 | + } else if ($validation_level === 'wp_default') { |
|
95 | + return is_email($email); |
|
96 | + } else if ( |
|
97 | + ($validation_level === 'i18n' || $validation_level === 'i18n_dns') |
|
98 | + // plz see http://stackoverflow.com/a/24817336 re: the following regex |
|
99 | + && ! preg_match( |
|
100 | + '/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u', |
|
101 | ||
102 | + ) |
|
103 | + ) { |
|
104 | + return false; |
|
105 | + } |
|
106 | + if ($validation_level === 'i18n_dns') { |
|
107 | + if (! checkdnsrr($domain, "MX")) { |
|
108 | + // domain not found in MX records |
|
109 | + throw new EE_Validation_Error( |
|
110 | + __( |
|
111 | + 'Although the email address provided is formatted correctly, a valid "MX record" could not be located for that address and domain. Please enter a valid email address.', |
|
112 | + 'event_espresso' |
|
113 | + ) |
|
114 | + ); |
|
115 | + } else if (! checkdnsrr($domain, "A")) { |
|
116 | + // domain not found in A records |
|
117 | + throw new EE_Validation_Error( |
|
118 | + __( |
|
119 | + 'Although the email address provided is formatted correctly, a valid "A record" could not be located for that address and domain. Please enter a valid email address.', |
|
120 | + 'event_espresso' |
|
121 | + ) |
|
122 | + ); |
|
123 | + } |
|
124 | + } |
|
125 | + } |
|
126 | + // you have successfully run the gauntlet young Padawan |
|
127 | + return true; |
|
128 | + } |
|
129 | 129 | |
130 | 130 | |
131 | 131 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __construct($validation_error_message = null) |
22 | 22 | { |
23 | - if (! $validation_error_message) { |
|
23 | + if ( ! $validation_error_message) { |
|
24 | 24 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
25 | 25 | } |
26 | 26 | parent::__construct($validation_error_message); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
68 | 68 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
69 | 69 | : 'wp_default'; |
70 | - if (! preg_match('/^.+\@\S+$/', $email)) { // \.\S+ |
|
70 | + if ( ! preg_match('/^.+\@\S+$/', $email)) { // \.\S+ |
|
71 | 71 | // email not in correct {string}@{string} format |
72 | 72 | return false; |
73 | 73 | } else { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | if ($validation_level === 'i18n_dns') { |
107 | - if (! checkdnsrr($domain, "MX")) { |
|
107 | + if ( ! checkdnsrr($domain, "MX")) { |
|
108 | 108 | // domain not found in MX records |
109 | 109 | throw new EE_Validation_Error( |
110 | 110 | __( |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'event_espresso' |
113 | 113 | ) |
114 | 114 | ); |
115 | - } else if (! checkdnsrr($domain, "A")) { |
|
115 | + } else if ( ! checkdnsrr($domain, "A")) { |
|
116 | 116 | // domain not found in A records |
117 | 117 | throw new EE_Validation_Error( |
118 | 118 | __( |
@@ -47,7 +47,7 @@ |
||
47 | 47 | /** |
48 | 48 | * This retrieves any EE_Message_Template_Group in the repo by its ID. |
49 | 49 | * |
50 | - * @param $GRP_ID |
|
50 | + * @param integer $GRP_ID |
|
51 | 51 | * @return EE_Message_Template_Group | null |
52 | 52 | */ |
53 | 53 | public function get_by_ID($GRP_ID) |
@@ -14,115 +14,115 @@ |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | |
17 | - /** |
|
18 | - * EE_Message_Template_Group_Collection constructor. |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->interface = 'EE_Message_Template_Group'; |
|
23 | - } |
|
17 | + /** |
|
18 | + * EE_Message_Template_Group_Collection constructor. |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->interface = 'EE_Message_Template_Group'; |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * Adds the Message Template Group object to the repository. |
|
28 | - * |
|
29 | - * @param $message_template_group |
|
30 | - * @param array|int $EVT_ID Some templates are specific to EVT, so this is provided as a way of |
|
31 | - * indexing the template by key. If this template is shared among multiple events then |
|
32 | - * include the events as an array. |
|
33 | - * @return bool |
|
34 | - */ |
|
35 | - public function add($message_template_group, $EVT_ID = array()) |
|
36 | - { |
|
37 | - $EVT_ID = is_array($EVT_ID) ? $EVT_ID : (array) $EVT_ID; |
|
38 | - if ($message_template_group instanceof $this->interface) { |
|
39 | - $data['key'] = $this->getKey( |
|
40 | - $message_template_group->messenger(), |
|
41 | - $message_template_group->message_type(), |
|
42 | - $EVT_ID |
|
43 | - ); |
|
44 | - return parent::add($message_template_group, $data); |
|
45 | - } |
|
46 | - return false; |
|
47 | - } |
|
26 | + /** |
|
27 | + * Adds the Message Template Group object to the repository. |
|
28 | + * |
|
29 | + * @param $message_template_group |
|
30 | + * @param array|int $EVT_ID Some templates are specific to EVT, so this is provided as a way of |
|
31 | + * indexing the template by key. If this template is shared among multiple events then |
|
32 | + * include the events as an array. |
|
33 | + * @return bool |
|
34 | + */ |
|
35 | + public function add($message_template_group, $EVT_ID = array()) |
|
36 | + { |
|
37 | + $EVT_ID = is_array($EVT_ID) ? $EVT_ID : (array) $EVT_ID; |
|
38 | + if ($message_template_group instanceof $this->interface) { |
|
39 | + $data['key'] = $this->getKey( |
|
40 | + $message_template_group->messenger(), |
|
41 | + $message_template_group->message_type(), |
|
42 | + $EVT_ID |
|
43 | + ); |
|
44 | + return parent::add($message_template_group, $data); |
|
45 | + } |
|
46 | + return false; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * This retrieves any EE_Message_Template_Group in the repo by its ID. |
|
52 | - * |
|
53 | - * @param $GRP_ID |
|
54 | - * @return EE_Message_Template_Group | null |
|
55 | - */ |
|
56 | - public function get_by_ID($GRP_ID) |
|
57 | - { |
|
58 | - $this->rewind(); |
|
59 | - while ($this->valid()) { |
|
60 | - if ($this->current()->ID() === $GRP_ID) { |
|
61 | - /** @var EE_Message_Template_Group $message_template_group */ |
|
62 | - $message_template_group = $this->current(); |
|
63 | - $this->rewind(); |
|
64 | - return $message_template_group; |
|
65 | - } |
|
66 | - $this->next(); |
|
67 | - } |
|
68 | - return null; |
|
69 | - } |
|
50 | + /** |
|
51 | + * This retrieves any EE_Message_Template_Group in the repo by its ID. |
|
52 | + * |
|
53 | + * @param $GRP_ID |
|
54 | + * @return EE_Message_Template_Group | null |
|
55 | + */ |
|
56 | + public function get_by_ID($GRP_ID) |
|
57 | + { |
|
58 | + $this->rewind(); |
|
59 | + while ($this->valid()) { |
|
60 | + if ($this->current()->ID() === $GRP_ID) { |
|
61 | + /** @var EE_Message_Template_Group $message_template_group */ |
|
62 | + $message_template_group = $this->current(); |
|
63 | + $this->rewind(); |
|
64 | + return $message_template_group; |
|
65 | + } |
|
66 | + $this->next(); |
|
67 | + } |
|
68 | + return null; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * Generates a hash used to identify a given Message Template Group. |
|
74 | - * |
|
75 | - * @param string $messenger The EE_messenger->name |
|
76 | - * @param string $message_type The EE_message_type->name |
|
77 | - * @param int $EVT_ID Optional. If the template is for a specific EVT then that should be included. |
|
78 | - * @deprecated 4.9.40.rc.017 Use getKey instead. |
|
79 | - * @return string |
|
80 | - */ |
|
81 | - public function get_key($messenger, $message_type, $EVT_ID = 0) |
|
82 | - { |
|
83 | - $EVT_ID = (array) $EVT_ID; |
|
84 | - return $this->getKey($messenger, $message_type, $EVT_ID); |
|
85 | - } |
|
72 | + /** |
|
73 | + * Generates a hash used to identify a given Message Template Group. |
|
74 | + * |
|
75 | + * @param string $messenger The EE_messenger->name |
|
76 | + * @param string $message_type The EE_message_type->name |
|
77 | + * @param int $EVT_ID Optional. If the template is for a specific EVT then that should be included. |
|
78 | + * @deprecated 4.9.40.rc.017 Use getKey instead. |
|
79 | + * @return string |
|
80 | + */ |
|
81 | + public function get_key($messenger, $message_type, $EVT_ID = 0) |
|
82 | + { |
|
83 | + $EVT_ID = (array) $EVT_ID; |
|
84 | + return $this->getKey($messenger, $message_type, $EVT_ID); |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * Generates a hash used to identify a given Message Template Group |
|
90 | - * @param string $messenger The EE_messenger->name |
|
91 | - * @param string $message_type The EE_message_type->name |
|
92 | - * @param array $EVT_ID Optional. If the template is for a specific EVT_ID (or events) then that should |
|
93 | - * be included. |
|
94 | - * @since 4.9.40.rc.017 |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public function getKey($messenger, $message_type, array $EVT_ID = array()) |
|
98 | - { |
|
99 | - sort($EVT_ID); |
|
100 | - $EVT_ID = implode(',', array_unique($EVT_ID)); |
|
101 | - return md5($messenger . $message_type . $EVT_ID); |
|
102 | - } |
|
88 | + /** |
|
89 | + * Generates a hash used to identify a given Message Template Group |
|
90 | + * @param string $messenger The EE_messenger->name |
|
91 | + * @param string $message_type The EE_message_type->name |
|
92 | + * @param array $EVT_ID Optional. If the template is for a specific EVT_ID (or events) then that should |
|
93 | + * be included. |
|
94 | + * @since 4.9.40.rc.017 |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public function getKey($messenger, $message_type, array $EVT_ID = array()) |
|
98 | + { |
|
99 | + sort($EVT_ID); |
|
100 | + $EVT_ID = implode(',', array_unique($EVT_ID)); |
|
101 | + return md5($messenger . $message_type . $EVT_ID); |
|
102 | + } |
|
103 | 103 | |
104 | 104 | |
105 | - /** |
|
106 | - * This returns a saved EE_Message_Template_Group object if there is one in the repository indexed by a key matching |
|
107 | - * the given string. |
|
108 | - * |
|
109 | - * @param string $key @see EE_Message_Template_Group::get_key() to setup a key formatted for searching. |
|
110 | - * @return null|EE_Message_Template_Group |
|
111 | - */ |
|
112 | - public function get_by_key($key) |
|
113 | - { |
|
114 | - $this->rewind(); |
|
115 | - while ($this->valid()) { |
|
116 | - $data = $this->getInfo(); |
|
117 | - if (isset($data['key']) && $data['key'] === $key) { |
|
118 | - /** @var EE_Message_Template_Group $message_template_group */ |
|
119 | - $message_template_group = $this->current(); |
|
120 | - $this->rewind(); |
|
121 | - return $message_template_group; |
|
122 | - } |
|
123 | - $this->next(); |
|
124 | - } |
|
125 | - return null; |
|
126 | - } |
|
105 | + /** |
|
106 | + * This returns a saved EE_Message_Template_Group object if there is one in the repository indexed by a key matching |
|
107 | + * the given string. |
|
108 | + * |
|
109 | + * @param string $key @see EE_Message_Template_Group::get_key() to setup a key formatted for searching. |
|
110 | + * @return null|EE_Message_Template_Group |
|
111 | + */ |
|
112 | + public function get_by_key($key) |
|
113 | + { |
|
114 | + $this->rewind(); |
|
115 | + while ($this->valid()) { |
|
116 | + $data = $this->getInfo(); |
|
117 | + if (isset($data['key']) && $data['key'] === $key) { |
|
118 | + /** @var EE_Message_Template_Group $message_template_group */ |
|
119 | + $message_template_group = $this->current(); |
|
120 | + $this->rewind(); |
|
121 | + return $message_template_group; |
|
122 | + } |
|
123 | + $this->next(); |
|
124 | + } |
|
125 | + return null; |
|
126 | + } |
|
127 | 127 | |
128 | 128 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | { |
99 | 99 | sort($EVT_ID); |
100 | 100 | $EVT_ID = implode(',', array_unique($EVT_ID)); |
101 | - return md5($messenger . $message_type . $EVT_ID); |
|
101 | + return md5($messenger.$message_type.$EVT_ID); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 |