@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php //echo '<h1>' . __FILE__ . '</h1>'; ?> |
2 | 2 | <?php global $post; |
3 | -$wrap_class = has_excerpt( $post->ID ) ? 'has-excerpt' : ''; |
|
3 | +$wrap_class = has_excerpt($post->ID) ? 'has-excerpt' : ''; |
|
4 | 4 | ?> |
5 | 5 | <header class="venue-header <?php echo sanitize_html_class($wrap_class); ?>"> |
6 | 6 | <h1 id="venue-details-h1" class="entry-title"> |
7 | 7 | <a class="" href="<?php the_permalink(); ?>"><?php the_title(); ?></a> |
8 | 8 | </h1> |
9 | - <?php if ( has_excerpt( $post->ID )) { the_excerpt(); } ?> |
|
9 | + <?php if (has_excerpt($post->ID)) { the_excerpt(); } ?> |
|
10 | 10 | </header> |
11 | 11 | <!-- .venue-content --> |
@@ -18,52 +18,52 @@ |
||
18 | 18 | * and/or use any of the template tags functions found in: |
19 | 19 | * \wp-content\plugins\event-espresso-core\public\template_tags.php |
20 | 20 | ************************** IMPORTANT **************************/ |
21 | -add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_true' ); |
|
21 | +add_filter('FHEE__content_espresso_events__template_loaded', '__return_true'); |
|
22 | 22 | |
23 | 23 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
24 | 24 | |
25 | 25 | global $post; |
26 | -$event_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; |
|
27 | -$event_class = apply_filters( 'FHEE__content_espresso_events__event_class', $event_class ); |
|
26 | +$event_class = has_excerpt($post->ID) ? ' has-excerpt' : ''; |
|
27 | +$event_class = apply_filters('FHEE__content_espresso_events__event_class', $event_class); |
|
28 | 28 | ?> |
29 | -<?php do_action( 'AHEE_event_details_before_post', $post ); ?> |
|
30 | -<article id="post-<?php the_ID(); ?>" <?php post_class( $event_class ); ?>> |
|
29 | +<?php do_action('AHEE_event_details_before_post', $post); ?> |
|
30 | +<article id="post-<?php the_ID(); ?>" <?php post_class($event_class); ?>> |
|
31 | 31 | |
32 | -<?php if ( is_single() ) : ?> |
|
32 | +<?php if (is_single()) : ?> |
|
33 | 33 | |
34 | 34 | <div id="espresso-event-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-event-header-dv"> |
35 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
36 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
35 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
36 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
37 | 37 | </div> |
38 | 38 | |
39 | 39 | <div class="espresso-event-wrapper-dv"> |
40 | - <?php espresso_get_template_part( 'content', 'espresso_events-tickets' ); ?> |
|
41 | - <?php espresso_get_template_part( 'content', 'espresso_events-datetimes' ); ?> |
|
42 | - <?php espresso_get_template_part( 'content', 'espresso_events-details' ); ?> |
|
43 | - <?php espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> |
|
40 | + <?php espresso_get_template_part('content', 'espresso_events-tickets'); ?> |
|
41 | + <?php espresso_get_template_part('content', 'espresso_events-datetimes'); ?> |
|
42 | + <?php espresso_get_template_part('content', 'espresso_events-details'); ?> |
|
43 | + <?php espresso_get_template_part('content', 'espresso_events-venues'); ?> |
|
44 | 44 | <footer class="event-meta"> |
45 | - <?php do_action( 'AHEE_event_details_footer_top', $post ); ?> |
|
46 | - <?php do_action( 'AHEE_event_details_footer_bottom', $post ); ?> |
|
45 | + <?php do_action('AHEE_event_details_footer_top', $post); ?> |
|
46 | + <?php do_action('AHEE_event_details_footer_bottom', $post); ?> |
|
47 | 47 | </footer> |
48 | 48 | </div> |
49 | 49 | |
50 | -<?php elseif ( is_archive() ) : ?> |
|
50 | +<?php elseif (is_archive()) : ?> |
|
51 | 51 | |
52 | 52 | <div id="espresso-event-list-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-event-header-dv"> |
53 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
54 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
53 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
54 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
55 | 55 | </div> |
56 | 56 | |
57 | 57 | <div class="espresso-event-list-wrapper-dv"> |
58 | - <?php espresso_get_template_part( 'content', 'espresso_events-tickets' ); ?> |
|
59 | - <?php espresso_get_template_part( 'content', 'espresso_events-datetimes' ); ?> |
|
60 | - <?php espresso_get_template_part( 'content', 'espresso_events-details' ); ?> |
|
61 | - <?php espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> |
|
58 | + <?php espresso_get_template_part('content', 'espresso_events-tickets'); ?> |
|
59 | + <?php espresso_get_template_part('content', 'espresso_events-datetimes'); ?> |
|
60 | + <?php espresso_get_template_part('content', 'espresso_events-details'); ?> |
|
61 | + <?php espresso_get_template_part('content', 'espresso_events-venues'); ?> |
|
62 | 62 | </div> |
63 | 63 | |
64 | 64 | <?php endif; ?> |
65 | 65 | |
66 | 66 | </article> |
67 | 67 | <!-- #post --> |
68 | -<?php do_action( 'AHEE_event_details_after_post', $post ); |
|
68 | +<?php do_action('AHEE_event_details_after_post', $post); |
|
69 | 69 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | global $post; |
4 | -do_action( 'AHEE_event_details_before_featured_img', $post ); |
|
4 | +do_action('AHEE_event_details_before_featured_img', $post); |
|
5 | 5 | |
6 | -if ( has_post_thumbnail( $post->ID )) : |
|
7 | - if ( $img_ID = get_post_thumbnail_id( $post->ID )) : |
|
8 | - if ( $featured_img = wp_get_attachment_image_src( $img_ID, 'large' )) : |
|
9 | - $caption = get_post( get_post( $img_ID ))->post_excerpt; |
|
6 | +if (has_post_thumbnail($post->ID)) : |
|
7 | + if ($img_ID = get_post_thumbnail_id($post->ID)) : |
|
8 | + if ($featured_img = wp_get_attachment_image_src($img_ID, 'large')) : |
|
9 | + $caption = get_post(get_post($img_ID))->post_excerpt; |
|
10 | 10 | ?> |
11 | 11 | <div id="ee-event-img-dv-<?php echo esc_attr($post->ID); ?>" class="ee-event-img-dv"> |
12 | - <a class="ee-event-img-lnk" href="<?php the_permalink(); ?>"<?php echo EED_Events_Archive::link_target();?>> |
|
12 | + <a class="ee-event-img-lnk" href="<?php the_permalink(); ?>"<?php echo EED_Events_Archive::link_target(); ?>> |
|
13 | 13 | <img alt="<?php echo esc_attr($caption); ?>" |
14 | 14 | class="ee-event-img" |
15 | 15 | height="<?php echo esc_attr($featured_img[2]); ?>" |
@@ -23,4 +23,4 @@ discard block |
||
23 | 23 | endif; |
24 | 24 | endif; |
25 | 25 | ?> |
26 | -<?php do_action( 'AHEE_event_details_after_featured_img', $post );?> |
|
26 | +<?php do_action('AHEE_event_details_after_featured_img', $post); ?> |
@@ -11,41 +11,41 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | global $post; |
14 | -$wrap_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; |
|
14 | +$wrap_class = has_excerpt($post->ID) ? ' has-excerpt' : ''; |
|
15 | 15 | ?> |
16 | -<?php do_action( 'AHEE__content_espresso_venues_template__before_post', $post ); ?> |
|
17 | -<article id="post-<?php the_ID(); ?>" <?php post_class( 'espresso-venue-details entry-content ' . $wrap_class ); ?>> |
|
16 | +<?php do_action('AHEE__content_espresso_venues_template__before_post', $post); ?> |
|
17 | +<article id="post-<?php the_ID(); ?>" <?php post_class('espresso-venue-details entry-content '.$wrap_class); ?>> |
|
18 | 18 | |
19 | -<?php if ( is_single() ) : ?> |
|
19 | +<?php if (is_single()) : ?> |
|
20 | 20 | |
21 | 21 | <div id="espresso-venue-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-venue-header-dv"> |
22 | - <?php espresso_get_template_part( 'content', 'espresso_venues-thumbnail' ); ?> |
|
23 | - <?php espresso_get_template_part( 'content', 'espresso_venues-header' ); ?> |
|
22 | + <?php espresso_get_template_part('content', 'espresso_venues-thumbnail'); ?> |
|
23 | + <?php espresso_get_template_part('content', 'espresso_venues-header'); ?> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <div class="espresso-venue-wrapper-dv"> |
27 | - <?php espresso_get_template_part( 'content', 'espresso_venues-details' ); ?> |
|
28 | - <?php espresso_get_template_part( 'content', 'espresso_venues-location' ); ?> |
|
27 | + <?php espresso_get_template_part('content', 'espresso_venues-details'); ?> |
|
28 | + <?php espresso_get_template_part('content', 'espresso_venues-location'); ?> |
|
29 | 29 | <footer class="venue-meta"> |
30 | - <?php do_action( 'AHEE__content_espresso_venues_template__footer_top', $post ); ?> |
|
31 | - <?php do_action( 'AHEE__content_espresso_venues_template__footer_bottom', $post ); ?> |
|
30 | + <?php do_action('AHEE__content_espresso_venues_template__footer_top', $post); ?> |
|
31 | + <?php do_action('AHEE__content_espresso_venues_template__footer_bottom', $post); ?> |
|
32 | 32 | </footer> |
33 | 33 | </div> |
34 | 34 | |
35 | -<?php elseif ( is_archive() ) : ?> |
|
35 | +<?php elseif (is_archive()) : ?> |
|
36 | 36 | |
37 | 37 | <div id="espresso-venue-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-venue-header-dv"> |
38 | - <?php espresso_get_template_part( 'content', 'espresso_venues-thumbnail' ); ?> |
|
39 | - <?php espresso_get_template_part( 'content', 'espresso_venues-header' ); ?> |
|
38 | + <?php espresso_get_template_part('content', 'espresso_venues-thumbnail'); ?> |
|
39 | + <?php espresso_get_template_part('content', 'espresso_venues-header'); ?> |
|
40 | 40 | </div> |
41 | 41 | |
42 | 42 | <div class="espresso-venue-wrapper-dv"> |
43 | - <?php espresso_get_template_part( 'content', 'espresso_venues-details' ); ?> |
|
43 | + <?php espresso_get_template_part('content', 'espresso_venues-details'); ?> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <?php endif; ?> |
47 | 47 | |
48 | 48 | </article> |
49 | 49 | <!-- #post --> |
50 | -<?php do_action( 'AHEE__content_espresso_venues_template__after_post', $post ); |
|
50 | +<?php do_action('AHEE__content_espresso_venues_template__after_post', $post); |
|
51 | 51 |
@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | * and/or use any of the template tags functions found in: |
22 | 22 | * \wp-content\plugins\event-espresso-core\public\template_tags.php |
23 | 23 | ************************** IMPORTANT **************************/ |
24 | -add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_false' ); |
|
24 | +add_filter('FHEE__content_espresso_events__template_loaded', '__return_false'); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | global $post; |
28 | -$event_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; |
|
29 | -$event_class = apply_filters( 'FHEE__content_espresso_events__event_class', $event_class ); |
|
28 | +$event_class = has_excerpt($post->ID) ? ' has-excerpt' : ''; |
|
29 | +$event_class = apply_filters('FHEE__content_espresso_events__event_class', $event_class); |
|
30 | 30 | ?> |
31 | -<?php do_action( 'AHEE_event_details_before_post', $post ); ?> |
|
32 | -<article id="post-<?php the_ID(); ?>" <?php post_class( $event_class ); ?>> |
|
31 | +<?php do_action('AHEE_event_details_before_post', $post); ?> |
|
32 | +<article id="post-<?php the_ID(); ?>" <?php post_class($event_class); ?>> |
|
33 | 33 | |
34 | -<?php if ( is_single() ) : ?> |
|
34 | +<?php if (is_single()) : ?> |
|
35 | 35 | |
36 | - <div id="espresso-event-header-dv-<?php echo esc_attr($post->ID);?>" class="espresso-event-header-dv"> |
|
37 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
38 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
36 | + <div id="espresso-event-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-event-header-dv"> |
|
37 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
38 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <div class="espresso-event-wrapper-dv"> |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | <?php //espresso_get_template_part( 'content', 'espresso_events-details' ); ?> |
46 | 46 | <?php //espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> |
47 | 47 | <footer class="event-meta"> |
48 | - <?php do_action( 'AHEE_event_details_footer_top', $post ); ?> |
|
49 | - <?php do_action( 'AHEE_event_details_footer_bottom', $post ); ?> |
|
48 | + <?php do_action('AHEE_event_details_footer_top', $post); ?> |
|
49 | + <?php do_action('AHEE_event_details_footer_bottom', $post); ?> |
|
50 | 50 | </footer> |
51 | 51 | </div> |
52 | 52 | |
53 | -<?php elseif ( is_archive() ) : ?> |
|
53 | +<?php elseif (is_archive()) : ?> |
|
54 | 54 | |
55 | 55 | <div id="espresso-event-list-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-event-header-dv"> |
56 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
57 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
56 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
57 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
58 | 58 | </div> |
59 | 59 | |
60 | 60 | <div class="espresso-event-list-wrapper-dv"> |
@@ -69,5 +69,5 @@ discard block |
||
69 | 69 | |
70 | 70 | </article> |
71 | 71 | <!-- #post --> |
72 | -<?php do_action( 'AHEE_event_details_after_post', $post ); |
|
72 | +<?php do_action('AHEE_event_details_after_post', $post); |
|
73 | 73 |
@@ -12,109 +12,109 @@ discard block |
||
12 | 12 | class EEW_Upcoming_Events extends EspressoWidget |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - private $title; |
|
19 | - /** |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - private $events_category; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var bool |
|
26 | - */ |
|
27 | - private $show_expired; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - private $image_size; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var bool |
|
36 | - */ |
|
37 | - private $show_desc; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var bool |
|
41 | - */ |
|
42 | - private $show_dates; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private $date_limit; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - private $date_range; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var string |
|
56 | - */ |
|
57 | - private $limit; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var string |
|
61 | - */ |
|
62 | - private $order; |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * Register widget with WordPress. |
|
67 | - */ |
|
68 | - public function __construct() |
|
69 | - { |
|
70 | - parent::__construct( |
|
71 | - esc_html__('Event Espresso Upcoming Events', 'event_espresso'), |
|
72 | - ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')] |
|
73 | - ); |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * Back-end widget form. |
|
79 | - * |
|
80 | - * @param array $instance Previously saved values from database. |
|
81 | - * @return void |
|
82 | - * @throws EE_Error |
|
83 | - * @throws ReflectionException |
|
84 | - * @see WP_Widget::form() |
|
85 | - */ |
|
86 | - public function form($instance) |
|
87 | - { |
|
88 | - |
|
89 | - EE_Registry::instance()->load_class('Question_Option', [], false, false, true); |
|
90 | - // Set up some default widget settings. |
|
91 | - $defaults = [ |
|
92 | - 'title' => esc_html__('Upcoming Events', 'event_espresso'), |
|
93 | - 'category_name' => '', |
|
94 | - 'show_expired' => 0, |
|
95 | - 'show_desc' => true, |
|
96 | - 'show_dates' => true, |
|
97 | - 'show_everywhere' => false, |
|
98 | - 'date_limit' => 2, |
|
99 | - 'limit' => 10, |
|
100 | - 'sort' => 'ASC', |
|
101 | - 'date_range' => false, |
|
102 | - 'image_size' => 'medium', |
|
103 | - ]; |
|
104 | - |
|
105 | - $instance = wp_parse_args((array) $instance, $defaults); |
|
106 | - // don't add HTML labels for EE_Form_Fields generated inputs |
|
107 | - add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
108 | - $yes_no_values = [ |
|
109 | - EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
|
110 | - EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
|
111 | - ]; |
|
112 | - $sort_values = [ |
|
113 | - EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
|
114 | - EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
|
115 | - ]; |
|
116 | - |
|
117 | - ?> |
|
15 | + /** |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + private $title; |
|
19 | + /** |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + private $events_category; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var bool |
|
26 | + */ |
|
27 | + private $show_expired; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + private $image_size; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var bool |
|
36 | + */ |
|
37 | + private $show_desc; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var bool |
|
41 | + */ |
|
42 | + private $show_dates; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private $date_limit; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + private $date_range; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var string |
|
56 | + */ |
|
57 | + private $limit; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var string |
|
61 | + */ |
|
62 | + private $order; |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * Register widget with WordPress. |
|
67 | + */ |
|
68 | + public function __construct() |
|
69 | + { |
|
70 | + parent::__construct( |
|
71 | + esc_html__('Event Espresso Upcoming Events', 'event_espresso'), |
|
72 | + ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')] |
|
73 | + ); |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * Back-end widget form. |
|
79 | + * |
|
80 | + * @param array $instance Previously saved values from database. |
|
81 | + * @return void |
|
82 | + * @throws EE_Error |
|
83 | + * @throws ReflectionException |
|
84 | + * @see WP_Widget::form() |
|
85 | + */ |
|
86 | + public function form($instance) |
|
87 | + { |
|
88 | + |
|
89 | + EE_Registry::instance()->load_class('Question_Option', [], false, false, true); |
|
90 | + // Set up some default widget settings. |
|
91 | + $defaults = [ |
|
92 | + 'title' => esc_html__('Upcoming Events', 'event_espresso'), |
|
93 | + 'category_name' => '', |
|
94 | + 'show_expired' => 0, |
|
95 | + 'show_desc' => true, |
|
96 | + 'show_dates' => true, |
|
97 | + 'show_everywhere' => false, |
|
98 | + 'date_limit' => 2, |
|
99 | + 'limit' => 10, |
|
100 | + 'sort' => 'ASC', |
|
101 | + 'date_range' => false, |
|
102 | + 'image_size' => 'medium', |
|
103 | + ]; |
|
104 | + |
|
105 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
106 | + // don't add HTML labels for EE_Form_Fields generated inputs |
|
107 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
108 | + $yes_no_values = [ |
|
109 | + EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
|
110 | + EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
|
111 | + ]; |
|
112 | + $sort_values = [ |
|
113 | + EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
|
114 | + EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
|
115 | + ]; |
|
116 | + |
|
117 | + ?> |
|
118 | 118 | |
119 | 119 | <!-- Widget Title: Text Input --> |
120 | 120 | |
@@ -151,32 +151,32 @@ discard block |
||
151 | 151 | <?php esc_html_e('Show Expired Events:', 'event_espresso'); ?> |
152 | 152 | </label> |
153 | 153 | <?php |
154 | - $show_expired_options = $yes_no_values; |
|
155 | - $show_expired_options[] = EE_Question_Option::new_instance( |
|
156 | - ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')] |
|
157 | - ); |
|
158 | - echo EEH_Form_Fields::select( |
|
159 | - esc_html__('Show Expired Events:', 'event_espresso'), |
|
160 | - $instance['show_expired'], |
|
161 | - $show_expired_options, |
|
162 | - $this->fieldName('show_expired'), |
|
163 | - $this->fieldID('show_expired') |
|
164 | - ); |
|
165 | - ?> |
|
154 | + $show_expired_options = $yes_no_values; |
|
155 | + $show_expired_options[] = EE_Question_Option::new_instance( |
|
156 | + ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')] |
|
157 | + ); |
|
158 | + echo EEH_Form_Fields::select( |
|
159 | + esc_html__('Show Expired Events:', 'event_espresso'), |
|
160 | + $instance['show_expired'], |
|
161 | + $show_expired_options, |
|
162 | + $this->fieldName('show_expired'), |
|
163 | + $this->fieldID('show_expired') |
|
164 | + ); |
|
165 | + ?> |
|
166 | 166 | </p> |
167 | 167 | <p> |
168 | 168 | <label for="<?php echo esc_attr($this->fieldID('sort')); ?>"> |
169 | 169 | <?php esc_html_e('Sort Events:', 'event_espresso'); ?> |
170 | 170 | </label> |
171 | 171 | <?php |
172 | - echo EEH_Form_Fields::select( |
|
173 | - esc_html__('Sort Events:', 'event_espresso'), |
|
174 | - $instance['sort'], |
|
175 | - $sort_values, |
|
176 | - $this->fieldName('sort'), |
|
177 | - $this->fieldID('sort') |
|
178 | - ); |
|
179 | - ?> |
|
172 | + echo EEH_Form_Fields::select( |
|
173 | + esc_html__('Sort Events:', 'event_espresso'), |
|
174 | + $instance['sort'], |
|
175 | + $sort_values, |
|
176 | + $this->fieldName('sort'), |
|
177 | + $this->fieldID('sort') |
|
178 | + ); |
|
179 | + ?> |
|
180 | 180 | </p> |
181 | 181 | <p> |
182 | 182 | <label for="<?php echo esc_attr($this->fieldID('image_size')); ?>"> |
@@ -190,42 +190,42 @@ discard block |
||
190 | 190 | <?php esc_html_e('Show Description:', 'event_espresso'); ?> |
191 | 191 | </label> |
192 | 192 | <?php |
193 | - echo EEH_Form_Fields::select( |
|
194 | - esc_html__('Show Description:', 'event_espresso'), |
|
195 | - $instance['show_desc'], |
|
196 | - $yes_no_values, |
|
197 | - $this->fieldName('show_desc'), |
|
198 | - $this->fieldID('show_desc') |
|
199 | - ); |
|
200 | - ?> |
|
193 | + echo EEH_Form_Fields::select( |
|
194 | + esc_html__('Show Description:', 'event_espresso'), |
|
195 | + $instance['show_desc'], |
|
196 | + $yes_no_values, |
|
197 | + $this->fieldName('show_desc'), |
|
198 | + $this->fieldID('show_desc') |
|
199 | + ); |
|
200 | + ?> |
|
201 | 201 | </p> |
202 | 202 | <p> |
203 | 203 | <label for="<?php echo esc_attr($this->fieldID('show_dates')); ?>"> |
204 | 204 | <?php esc_html_e('Show Dates:', 'event_espresso'); ?> |
205 | 205 | </label> |
206 | 206 | <?php |
207 | - echo EEH_Form_Fields::select( |
|
208 | - esc_html__('Show Dates:', 'event_espresso'), |
|
209 | - $instance['show_dates'], |
|
210 | - $yes_no_values, |
|
211 | - $this->fieldName('show_dates'), |
|
212 | - $this->fieldID('show_dates') |
|
213 | - ); |
|
214 | - ?> |
|
207 | + echo EEH_Form_Fields::select( |
|
208 | + esc_html__('Show Dates:', 'event_espresso'), |
|
209 | + $instance['show_dates'], |
|
210 | + $yes_no_values, |
|
211 | + $this->fieldName('show_dates'), |
|
212 | + $this->fieldID('show_dates') |
|
213 | + ); |
|
214 | + ?> |
|
215 | 215 | </p> |
216 | 216 | <p> |
217 | 217 | <label for="<?php echo esc_attr($this->fieldID('show_everywhere')); ?>"> |
218 | 218 | <?php esc_html_e('Show on all Pages:', 'event_espresso'); ?> |
219 | 219 | </label> |
220 | 220 | <?php |
221 | - echo EEH_Form_Fields::select( |
|
222 | - esc_html__('Show on all Pages:', 'event_espresso'), |
|
223 | - $instance['show_everywhere'], |
|
224 | - $yes_no_values, |
|
225 | - $this->fieldName('show_everywhere'), |
|
226 | - $this->fieldID('show_everywhere') |
|
227 | - ); |
|
228 | - ?> |
|
221 | + echo EEH_Form_Fields::select( |
|
222 | + esc_html__('Show on all Pages:', 'event_espresso'), |
|
223 | + $instance['show_everywhere'], |
|
224 | + $yes_no_values, |
|
225 | + $this->fieldName('show_everywhere'), |
|
226 | + $this->fieldID('show_everywhere') |
|
227 | + ); |
|
228 | + ?> |
|
229 | 229 | </p> |
230 | 230 | <p> |
231 | 231 | <label for="<?php echo esc_attr($this->fieldID('date_limit')); ?>"> |
@@ -243,278 +243,278 @@ discard block |
||
243 | 243 | <?php esc_html_e('Show Date Range:', 'event_espresso'); ?> |
244 | 244 | </label> |
245 | 245 | <?php |
246 | - echo EEH_Form_Fields::select( |
|
247 | - esc_html__('Show Date Range:', 'event_espresso'), |
|
248 | - $instance['date_range'], |
|
249 | - $yes_no_values, |
|
250 | - $this->fieldName('date_range'), |
|
251 | - $this->fieldID('date_range') |
|
252 | - ); |
|
253 | - ?> |
|
246 | + echo EEH_Form_Fields::select( |
|
247 | + esc_html__('Show Date Range:', 'event_espresso'), |
|
248 | + $instance['date_range'], |
|
249 | + $yes_no_values, |
|
250 | + $this->fieldName('date_range'), |
|
251 | + $this->fieldID('date_range') |
|
252 | + ); |
|
253 | + ?> |
|
254 | 254 | <span class="description"> |
255 | 255 | <br /> |
256 | 256 | <?php esc_html_e( |
257 | - 'This setting will replace the list of dates in the widget.', |
|
258 | - 'event_espresso' |
|
259 | - ); ?> |
|
257 | + 'This setting will replace the list of dates in the widget.', |
|
258 | + 'event_espresso' |
|
259 | + ); ?> |
|
260 | 260 | </span> |
261 | 261 | </p> |
262 | 262 | |
263 | 263 | <?php |
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * Sanitize widget form values as they are saved. |
|
269 | - * |
|
270 | - * @param array $new_instance Values just sent to be saved. |
|
271 | - * @param array $old_instance Previously saved values from database. |
|
272 | - * |
|
273 | - * @return array Updated safe values to be saved. |
|
274 | - * @see WP_Widget::update() |
|
275 | - * |
|
276 | - */ |
|
277 | - public function update($new_instance, $old_instance) |
|
278 | - { |
|
279 | - $instance = $old_instance; |
|
280 | - $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
281 | - $instance['category_name'] = $new_instance['category_name']; |
|
282 | - $instance['show_expired'] = $new_instance['show_expired']; |
|
283 | - $instance['limit'] = $new_instance['limit']; |
|
284 | - $instance['sort'] = $new_instance['sort']; |
|
285 | - $instance['image_size'] = $new_instance['image_size']; |
|
286 | - $instance['show_desc'] = $new_instance['show_desc']; |
|
287 | - $instance['show_dates'] = $new_instance['show_dates']; |
|
288 | - $instance['show_everywhere'] = $new_instance['show_everywhere']; |
|
289 | - $instance['date_limit'] = $new_instance['date_limit']; |
|
290 | - $instance['date_range'] = $new_instance['date_range']; |
|
291 | - return $instance; |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * Front-end display of widget. |
|
297 | - * |
|
298 | - * @param array $args Widget arguments. |
|
299 | - * @param array $instance Saved values from database. |
|
300 | - * @throws EE_Error |
|
301 | - * @throws ReflectionException |
|
302 | - * @see WP_Widget::widget() |
|
303 | - * |
|
304 | - */ |
|
305 | - public function widget($args, $instance) |
|
306 | - { |
|
307 | - |
|
308 | - global $post; |
|
309 | - // make sure there is some kinda post object |
|
310 | - if ($post instanceof WP_Post) { |
|
311 | - $before_widget = ''; |
|
312 | - $before_title = ''; |
|
313 | - $after_title = ''; |
|
314 | - $after_widget = ''; |
|
315 | - // but NOT an events archives page, cuz that would be like two event lists on the same page |
|
316 | - $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']); |
|
317 | - if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
318 | - // let's use some of the event helper functions' |
|
319 | - // make separate vars out of attributes |
|
320 | - extract($args); |
|
321 | - |
|
322 | - // grab widget settings |
|
323 | - $this->parseWidgetSettings($instance); |
|
324 | - $title = $this->widgetTitle(); |
|
325 | - |
|
326 | - // Before widget (defined by themes). |
|
327 | - echo $before_widget; |
|
328 | - // Display the widget title if one was input (before and after defined by themes). |
|
329 | - if (! empty($title)) { |
|
330 | - echo $before_title . $title . $after_title; |
|
331 | - } |
|
332 | - echo $this->widgetContent($post); |
|
333 | - // After widget (defined by themes). |
|
334 | - echo $after_widget; |
|
335 | - } |
|
336 | - } |
|
337 | - } |
|
338 | - |
|
339 | - |
|
340 | - /** |
|
341 | - * make_the_title_a_link |
|
342 | - * callback for widget_title filter |
|
343 | - * |
|
344 | - * @param $title |
|
345 | - * @return string |
|
346 | - */ |
|
347 | - public function make_the_title_a_link($title) |
|
348 | - { |
|
349 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
350 | - } |
|
351 | - |
|
352 | - |
|
353 | - /** |
|
354 | - * @param string $field_name |
|
355 | - * @return string |
|
356 | - * @since 4.10.14.p |
|
357 | - */ |
|
358 | - public function fieldID($field_name) |
|
359 | - { |
|
360 | - return parent::get_field_id($field_name); |
|
361 | - } |
|
362 | - |
|
363 | - |
|
364 | - /** |
|
365 | - * @param string $field_name |
|
366 | - * @return string |
|
367 | - * @since 4.10.14.p |
|
368 | - */ |
|
369 | - public function fieldName($field_name) |
|
370 | - { |
|
371 | - return parent::get_field_name($field_name); |
|
372 | - } |
|
373 | - |
|
374 | - |
|
375 | - /** |
|
376 | - * @param array $instance |
|
377 | - * @throws EE_Error |
|
378 | - * @throws ReflectionException |
|
379 | - * @since 4.10.14.p |
|
380 | - */ |
|
381 | - private function eventCategoriesSelector(array $instance) |
|
382 | - { |
|
383 | - $event_categories = []; |
|
384 | - $categories = EEM_Term::instance()->get_all_ee_categories(true); |
|
385 | - if ($categories) { |
|
386 | - foreach ($categories as $category) { |
|
387 | - if ($category instanceof EE_Term) { |
|
388 | - $event_categories[] = |
|
389 | - EE_Question_Option::new_instance( |
|
390 | - [ |
|
391 | - 'QSO_value' => $category->get('slug'), |
|
392 | - 'QSO_desc' => $category->get('name'), |
|
393 | - ] |
|
394 | - ); |
|
395 | - } |
|
396 | - } |
|
397 | - } |
|
398 | - array_unshift( |
|
399 | - $event_categories, |
|
400 | - EE_Question_Option::new_instance( |
|
401 | - [ |
|
402 | - 'QSO_value' => '', |
|
403 | - 'QSO_desc' => esc_html__(' - display all - ', 'event_espresso'), |
|
404 | - ] |
|
405 | - ) |
|
406 | - ); |
|
407 | - echo EEH_Form_Fields::select( |
|
408 | - esc_html__('Event Category:', 'event_espresso'), |
|
409 | - $instance['category_name'], |
|
410 | - $event_categories, |
|
411 | - $this->fieldName('category_name'), |
|
412 | - $this->fieldID('category_name') |
|
413 | - ); |
|
414 | - } |
|
415 | - |
|
416 | - |
|
417 | - /** |
|
418 | - * @param array $instance |
|
419 | - * @since 4.10.14.p |
|
420 | - */ |
|
421 | - private function imageSizeSelector(array $instance) |
|
422 | - { |
|
423 | - $image_sizes = []; |
|
424 | - $sizes = get_intermediate_image_sizes(); |
|
425 | - if ($sizes) { |
|
426 | - // loop thru images and create option objects out of them |
|
427 | - foreach ($sizes as $image_size) { |
|
428 | - $image_size = trim($image_size); |
|
429 | - // no big images plz |
|
430 | - if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
431 | - $image_sizes[] = |
|
432 | - EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
|
433 | - } |
|
434 | - } |
|
435 | - $image_sizes[] = |
|
436 | - EE_Question_Option::new_instance( |
|
437 | - ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')] |
|
438 | - ); |
|
439 | - } |
|
440 | - echo EEH_Form_Fields::select( |
|
441 | - esc_html__('Image Size:', 'event_espresso'), |
|
442 | - $instance['image_size'], |
|
443 | - $image_sizes, |
|
444 | - $this->fieldName('image_size'), |
|
445 | - $this->fieldID('image_size') |
|
446 | - ); |
|
447 | - } |
|
448 | - |
|
449 | - |
|
450 | - /** |
|
451 | - * @param array $instance |
|
452 | - * @since 4.10.14.p |
|
453 | - */ |
|
454 | - private function parseWidgetSettings(array $instance) |
|
455 | - { |
|
456 | - $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
457 | - $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
458 | - ? $instance['category_name'] |
|
459 | - : false; |
|
460 | - $this->show_expired = isset($instance['show_expired']) |
|
461 | - ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN) |
|
462 | - : 0; |
|
463 | - $this->image_size = isset($instance['image_size']) && ! empty($instance['image_size']) |
|
464 | - ? $instance['image_size'] |
|
465 | - : 'medium'; |
|
466 | - $this->show_desc = ! isset($instance['show_desc']) |
|
467 | - || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN); |
|
468 | - $this->show_dates = ! isset($instance['show_dates']) |
|
469 | - || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN); |
|
470 | - $this->date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) |
|
471 | - ? $instance['date_limit'] |
|
472 | - : null; |
|
473 | - $this->date_range = isset($instance['date_range']) && ! empty($instance['date_range']) |
|
474 | - ? $instance['date_range'] |
|
475 | - : false; |
|
476 | - $this->limit = isset($instance['limit']) ? absint($instance['limit']) : 10; |
|
477 | - $this->order = isset($instance['sort']) && $instance['sort'] === 'DESC' |
|
478 | - ? 'DESC' |
|
479 | - : 'ASC'; |
|
480 | - } |
|
481 | - |
|
482 | - |
|
483 | - /** |
|
484 | - * @return mixed|void |
|
485 | - * @since 4.10.14.p |
|
486 | - */ |
|
487 | - private function widgetTitle() |
|
488 | - { |
|
489 | - // add function to make the title a link |
|
490 | - add_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
491 | - // filter the title |
|
492 | - $title = apply_filters('widget_title', $this->title); |
|
493 | - // remove the function from the filter, so it does not affect other widgets |
|
494 | - remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
495 | - return $title; |
|
496 | - } |
|
497 | - |
|
498 | - |
|
499 | - /** |
|
500 | - * @param WP_Post $post |
|
501 | - * @return string |
|
502 | - * @throws EE_Error |
|
503 | - * @throws ReflectionException |
|
504 | - * @since 4.10.14.p |
|
505 | - */ |
|
506 | - private function widgetContent(WP_Post $post) |
|
507 | - { |
|
508 | - // run the query |
|
509 | - $events = $this->getUpcomingEvents(); |
|
510 | - if (empty($events)) { |
|
511 | - return ''; |
|
512 | - } |
|
513 | - $list_items = ''; |
|
514 | - foreach ($events as $event) { |
|
515 | - if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
516 | - $event_url = $this->eventUrl($event); |
|
517 | - $list_items .= ' |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * Sanitize widget form values as they are saved. |
|
269 | + * |
|
270 | + * @param array $new_instance Values just sent to be saved. |
|
271 | + * @param array $old_instance Previously saved values from database. |
|
272 | + * |
|
273 | + * @return array Updated safe values to be saved. |
|
274 | + * @see WP_Widget::update() |
|
275 | + * |
|
276 | + */ |
|
277 | + public function update($new_instance, $old_instance) |
|
278 | + { |
|
279 | + $instance = $old_instance; |
|
280 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
281 | + $instance['category_name'] = $new_instance['category_name']; |
|
282 | + $instance['show_expired'] = $new_instance['show_expired']; |
|
283 | + $instance['limit'] = $new_instance['limit']; |
|
284 | + $instance['sort'] = $new_instance['sort']; |
|
285 | + $instance['image_size'] = $new_instance['image_size']; |
|
286 | + $instance['show_desc'] = $new_instance['show_desc']; |
|
287 | + $instance['show_dates'] = $new_instance['show_dates']; |
|
288 | + $instance['show_everywhere'] = $new_instance['show_everywhere']; |
|
289 | + $instance['date_limit'] = $new_instance['date_limit']; |
|
290 | + $instance['date_range'] = $new_instance['date_range']; |
|
291 | + return $instance; |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * Front-end display of widget. |
|
297 | + * |
|
298 | + * @param array $args Widget arguments. |
|
299 | + * @param array $instance Saved values from database. |
|
300 | + * @throws EE_Error |
|
301 | + * @throws ReflectionException |
|
302 | + * @see WP_Widget::widget() |
|
303 | + * |
|
304 | + */ |
|
305 | + public function widget($args, $instance) |
|
306 | + { |
|
307 | + |
|
308 | + global $post; |
|
309 | + // make sure there is some kinda post object |
|
310 | + if ($post instanceof WP_Post) { |
|
311 | + $before_widget = ''; |
|
312 | + $before_title = ''; |
|
313 | + $after_title = ''; |
|
314 | + $after_widget = ''; |
|
315 | + // but NOT an events archives page, cuz that would be like two event lists on the same page |
|
316 | + $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']); |
|
317 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
318 | + // let's use some of the event helper functions' |
|
319 | + // make separate vars out of attributes |
|
320 | + extract($args); |
|
321 | + |
|
322 | + // grab widget settings |
|
323 | + $this->parseWidgetSettings($instance); |
|
324 | + $title = $this->widgetTitle(); |
|
325 | + |
|
326 | + // Before widget (defined by themes). |
|
327 | + echo $before_widget; |
|
328 | + // Display the widget title if one was input (before and after defined by themes). |
|
329 | + if (! empty($title)) { |
|
330 | + echo $before_title . $title . $after_title; |
|
331 | + } |
|
332 | + echo $this->widgetContent($post); |
|
333 | + // After widget (defined by themes). |
|
334 | + echo $after_widget; |
|
335 | + } |
|
336 | + } |
|
337 | + } |
|
338 | + |
|
339 | + |
|
340 | + /** |
|
341 | + * make_the_title_a_link |
|
342 | + * callback for widget_title filter |
|
343 | + * |
|
344 | + * @param $title |
|
345 | + * @return string |
|
346 | + */ |
|
347 | + public function make_the_title_a_link($title) |
|
348 | + { |
|
349 | + return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
350 | + } |
|
351 | + |
|
352 | + |
|
353 | + /** |
|
354 | + * @param string $field_name |
|
355 | + * @return string |
|
356 | + * @since 4.10.14.p |
|
357 | + */ |
|
358 | + public function fieldID($field_name) |
|
359 | + { |
|
360 | + return parent::get_field_id($field_name); |
|
361 | + } |
|
362 | + |
|
363 | + |
|
364 | + /** |
|
365 | + * @param string $field_name |
|
366 | + * @return string |
|
367 | + * @since 4.10.14.p |
|
368 | + */ |
|
369 | + public function fieldName($field_name) |
|
370 | + { |
|
371 | + return parent::get_field_name($field_name); |
|
372 | + } |
|
373 | + |
|
374 | + |
|
375 | + /** |
|
376 | + * @param array $instance |
|
377 | + * @throws EE_Error |
|
378 | + * @throws ReflectionException |
|
379 | + * @since 4.10.14.p |
|
380 | + */ |
|
381 | + private function eventCategoriesSelector(array $instance) |
|
382 | + { |
|
383 | + $event_categories = []; |
|
384 | + $categories = EEM_Term::instance()->get_all_ee_categories(true); |
|
385 | + if ($categories) { |
|
386 | + foreach ($categories as $category) { |
|
387 | + if ($category instanceof EE_Term) { |
|
388 | + $event_categories[] = |
|
389 | + EE_Question_Option::new_instance( |
|
390 | + [ |
|
391 | + 'QSO_value' => $category->get('slug'), |
|
392 | + 'QSO_desc' => $category->get('name'), |
|
393 | + ] |
|
394 | + ); |
|
395 | + } |
|
396 | + } |
|
397 | + } |
|
398 | + array_unshift( |
|
399 | + $event_categories, |
|
400 | + EE_Question_Option::new_instance( |
|
401 | + [ |
|
402 | + 'QSO_value' => '', |
|
403 | + 'QSO_desc' => esc_html__(' - display all - ', 'event_espresso'), |
|
404 | + ] |
|
405 | + ) |
|
406 | + ); |
|
407 | + echo EEH_Form_Fields::select( |
|
408 | + esc_html__('Event Category:', 'event_espresso'), |
|
409 | + $instance['category_name'], |
|
410 | + $event_categories, |
|
411 | + $this->fieldName('category_name'), |
|
412 | + $this->fieldID('category_name') |
|
413 | + ); |
|
414 | + } |
|
415 | + |
|
416 | + |
|
417 | + /** |
|
418 | + * @param array $instance |
|
419 | + * @since 4.10.14.p |
|
420 | + */ |
|
421 | + private function imageSizeSelector(array $instance) |
|
422 | + { |
|
423 | + $image_sizes = []; |
|
424 | + $sizes = get_intermediate_image_sizes(); |
|
425 | + if ($sizes) { |
|
426 | + // loop thru images and create option objects out of them |
|
427 | + foreach ($sizes as $image_size) { |
|
428 | + $image_size = trim($image_size); |
|
429 | + // no big images plz |
|
430 | + if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
431 | + $image_sizes[] = |
|
432 | + EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
|
433 | + } |
|
434 | + } |
|
435 | + $image_sizes[] = |
|
436 | + EE_Question_Option::new_instance( |
|
437 | + ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')] |
|
438 | + ); |
|
439 | + } |
|
440 | + echo EEH_Form_Fields::select( |
|
441 | + esc_html__('Image Size:', 'event_espresso'), |
|
442 | + $instance['image_size'], |
|
443 | + $image_sizes, |
|
444 | + $this->fieldName('image_size'), |
|
445 | + $this->fieldID('image_size') |
|
446 | + ); |
|
447 | + } |
|
448 | + |
|
449 | + |
|
450 | + /** |
|
451 | + * @param array $instance |
|
452 | + * @since 4.10.14.p |
|
453 | + */ |
|
454 | + private function parseWidgetSettings(array $instance) |
|
455 | + { |
|
456 | + $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
457 | + $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
458 | + ? $instance['category_name'] |
|
459 | + : false; |
|
460 | + $this->show_expired = isset($instance['show_expired']) |
|
461 | + ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN) |
|
462 | + : 0; |
|
463 | + $this->image_size = isset($instance['image_size']) && ! empty($instance['image_size']) |
|
464 | + ? $instance['image_size'] |
|
465 | + : 'medium'; |
|
466 | + $this->show_desc = ! isset($instance['show_desc']) |
|
467 | + || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN); |
|
468 | + $this->show_dates = ! isset($instance['show_dates']) |
|
469 | + || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN); |
|
470 | + $this->date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) |
|
471 | + ? $instance['date_limit'] |
|
472 | + : null; |
|
473 | + $this->date_range = isset($instance['date_range']) && ! empty($instance['date_range']) |
|
474 | + ? $instance['date_range'] |
|
475 | + : false; |
|
476 | + $this->limit = isset($instance['limit']) ? absint($instance['limit']) : 10; |
|
477 | + $this->order = isset($instance['sort']) && $instance['sort'] === 'DESC' |
|
478 | + ? 'DESC' |
|
479 | + : 'ASC'; |
|
480 | + } |
|
481 | + |
|
482 | + |
|
483 | + /** |
|
484 | + * @return mixed|void |
|
485 | + * @since 4.10.14.p |
|
486 | + */ |
|
487 | + private function widgetTitle() |
|
488 | + { |
|
489 | + // add function to make the title a link |
|
490 | + add_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
491 | + // filter the title |
|
492 | + $title = apply_filters('widget_title', $this->title); |
|
493 | + // remove the function from the filter, so it does not affect other widgets |
|
494 | + remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
495 | + return $title; |
|
496 | + } |
|
497 | + |
|
498 | + |
|
499 | + /** |
|
500 | + * @param WP_Post $post |
|
501 | + * @return string |
|
502 | + * @throws EE_Error |
|
503 | + * @throws ReflectionException |
|
504 | + * @since 4.10.14.p |
|
505 | + */ |
|
506 | + private function widgetContent(WP_Post $post) |
|
507 | + { |
|
508 | + // run the query |
|
509 | + $events = $this->getUpcomingEvents(); |
|
510 | + if (empty($events)) { |
|
511 | + return ''; |
|
512 | + } |
|
513 | + $list_items = ''; |
|
514 | + foreach ($events as $event) { |
|
515 | + if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
516 | + $event_url = $this->eventUrl($event); |
|
517 | + $list_items .= ' |
|
518 | 518 | <li id="ee-upcoming-events-widget-li-' . esc_attr($event->ID()) . '" |
519 | 519 | class="ee-upcoming-events-widget-li" |
520 | 520 | > |
@@ -525,194 +525,194 @@ discard block |
||
525 | 525 | </h5> |
526 | 526 | ' . $this->eventWidgetContent($event, $event_url) . ' |
527 | 527 | </li>'; |
528 | - } |
|
529 | - } |
|
530 | - return ' |
|
528 | + } |
|
529 | + } |
|
530 | + return ' |
|
531 | 531 | <ul class="ee-upcoming-events-widget-ul"> |
532 | 532 | ' . $list_items . ' |
533 | 533 | </ul>'; |
534 | - } |
|
535 | - |
|
536 | - |
|
537 | - /** |
|
538 | - * @param EE_Event $event |
|
539 | - * @return string|null |
|
540 | - * @throws EE_Error |
|
541 | - * @since 4.10.14.p |
|
542 | - */ |
|
543 | - private function eventUrl(EE_Event $event) |
|
544 | - { |
|
545 | - return esc_url_raw( |
|
546 | - apply_filters( |
|
547 | - 'FHEE_EEW_Upcoming_Events__widget__event_url', |
|
548 | - $event->get_permalink(), |
|
549 | - $event |
|
550 | - ) |
|
551 | - ); |
|
552 | - } |
|
553 | - |
|
554 | - |
|
555 | - /** |
|
556 | - * @return EE_Base_Class[] |
|
557 | - * @throws EE_Error |
|
558 | - */ |
|
559 | - private function getUpcomingEvents() |
|
560 | - { |
|
561 | - return EEM_Event::instance()->get_all( |
|
562 | - [ |
|
563 | - $this->queryWhereParams(), |
|
564 | - 'limit' => '0,' . $this->limit, |
|
565 | - 'order_by' => 'Datetime.DTT_EVT_start', |
|
566 | - 'order' => $this->order, |
|
567 | - 'group_by' => 'EVT_ID', |
|
568 | - ] |
|
569 | - ); |
|
570 | - } |
|
571 | - |
|
572 | - |
|
573 | - /** |
|
574 | - * @return mixed|void |
|
575 | - * @throws EE_Error |
|
576 | - * @since 4.10.14.p |
|
577 | - */ |
|
578 | - private function queryWhereParams() |
|
579 | - { |
|
580 | - // start to build our where clause |
|
581 | - $where = [ |
|
582 | - 'status' => ['IN', ['publish', 'sold_out']], |
|
583 | - ]; |
|
584 | - // add category |
|
585 | - if ($this->events_category) { |
|
586 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
587 | - $where['Term_Taxonomy.Term.slug'] = $this->events_category; |
|
588 | - } |
|
589 | - // if NOT expired then we want events that start today or in the future |
|
590 | - // if NOT show expired then we want events that start today or in the future |
|
591 | - if ($this->show_expired == 0) { |
|
592 | - $where['Datetime.DTT_EVT_end'] = [ |
|
593 | - '>=', |
|
594 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
595 | - ]; |
|
596 | - } |
|
597 | - // if show ONLY expired we want events that ended prior to today |
|
598 | - if ($this->show_expired == 2) { |
|
599 | - $where['Datetime.DTT_EVT_end'] = [ |
|
600 | - '<=', |
|
601 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), |
|
602 | - ]; |
|
603 | - } |
|
604 | - // allow $where to be filtered |
|
605 | - return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired); |
|
606 | - } |
|
607 | - |
|
608 | - |
|
609 | - /** |
|
610 | - * @param EE_Event $event |
|
611 | - * @return string |
|
612 | - * @throws EE_Error |
|
613 | - * @throws ReflectionException |
|
614 | - * @since 4.10.14.p |
|
615 | - */ |
|
616 | - private function linkClass(EE_Event $event) |
|
617 | - { |
|
618 | - // how big is the event name ? |
|
619 | - $name_length = strlen($event->name()); |
|
620 | - switch ($name_length) { |
|
621 | - case $name_length > 70: |
|
622 | - return ' three-line'; |
|
623 | - case $name_length > 35: |
|
624 | - return ' two-line'; |
|
625 | - } |
|
626 | - return ' one-line'; |
|
627 | - } |
|
628 | - |
|
629 | - |
|
630 | - /** |
|
631 | - * @param EE_Event $event |
|
632 | - * @param string $event_url |
|
633 | - * @return mixed|string|void |
|
634 | - * @throws EE_Error |
|
635 | - * @throws ReflectionException |
|
636 | - * @since 4.10.14.p |
|
637 | - */ |
|
638 | - private function eventWidgetContent(EE_Event $event, $event_url = '') |
|
639 | - { |
|
640 | - if (post_password_required($event->ID())) { |
|
641 | - return apply_filters( |
|
642 | - 'FHEE_EEW_Upcoming_Events__widget__password_form', |
|
643 | - get_the_password_form($event->ID()), |
|
644 | - $event |
|
645 | - ); |
|
646 | - } |
|
647 | - |
|
648 | - $content = ''; |
|
649 | - if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
|
650 | - $content .= ' |
|
534 | + } |
|
535 | + |
|
536 | + |
|
537 | + /** |
|
538 | + * @param EE_Event $event |
|
539 | + * @return string|null |
|
540 | + * @throws EE_Error |
|
541 | + * @since 4.10.14.p |
|
542 | + */ |
|
543 | + private function eventUrl(EE_Event $event) |
|
544 | + { |
|
545 | + return esc_url_raw( |
|
546 | + apply_filters( |
|
547 | + 'FHEE_EEW_Upcoming_Events__widget__event_url', |
|
548 | + $event->get_permalink(), |
|
549 | + $event |
|
550 | + ) |
|
551 | + ); |
|
552 | + } |
|
553 | + |
|
554 | + |
|
555 | + /** |
|
556 | + * @return EE_Base_Class[] |
|
557 | + * @throws EE_Error |
|
558 | + */ |
|
559 | + private function getUpcomingEvents() |
|
560 | + { |
|
561 | + return EEM_Event::instance()->get_all( |
|
562 | + [ |
|
563 | + $this->queryWhereParams(), |
|
564 | + 'limit' => '0,' . $this->limit, |
|
565 | + 'order_by' => 'Datetime.DTT_EVT_start', |
|
566 | + 'order' => $this->order, |
|
567 | + 'group_by' => 'EVT_ID', |
|
568 | + ] |
|
569 | + ); |
|
570 | + } |
|
571 | + |
|
572 | + |
|
573 | + /** |
|
574 | + * @return mixed|void |
|
575 | + * @throws EE_Error |
|
576 | + * @since 4.10.14.p |
|
577 | + */ |
|
578 | + private function queryWhereParams() |
|
579 | + { |
|
580 | + // start to build our where clause |
|
581 | + $where = [ |
|
582 | + 'status' => ['IN', ['publish', 'sold_out']], |
|
583 | + ]; |
|
584 | + // add category |
|
585 | + if ($this->events_category) { |
|
586 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
587 | + $where['Term_Taxonomy.Term.slug'] = $this->events_category; |
|
588 | + } |
|
589 | + // if NOT expired then we want events that start today or in the future |
|
590 | + // if NOT show expired then we want events that start today or in the future |
|
591 | + if ($this->show_expired == 0) { |
|
592 | + $where['Datetime.DTT_EVT_end'] = [ |
|
593 | + '>=', |
|
594 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
595 | + ]; |
|
596 | + } |
|
597 | + // if show ONLY expired we want events that ended prior to today |
|
598 | + if ($this->show_expired == 2) { |
|
599 | + $where['Datetime.DTT_EVT_end'] = [ |
|
600 | + '<=', |
|
601 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), |
|
602 | + ]; |
|
603 | + } |
|
604 | + // allow $where to be filtered |
|
605 | + return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired); |
|
606 | + } |
|
607 | + |
|
608 | + |
|
609 | + /** |
|
610 | + * @param EE_Event $event |
|
611 | + * @return string |
|
612 | + * @throws EE_Error |
|
613 | + * @throws ReflectionException |
|
614 | + * @since 4.10.14.p |
|
615 | + */ |
|
616 | + private function linkClass(EE_Event $event) |
|
617 | + { |
|
618 | + // how big is the event name ? |
|
619 | + $name_length = strlen($event->name()); |
|
620 | + switch ($name_length) { |
|
621 | + case $name_length > 70: |
|
622 | + return ' three-line'; |
|
623 | + case $name_length > 35: |
|
624 | + return ' two-line'; |
|
625 | + } |
|
626 | + return ' one-line'; |
|
627 | + } |
|
628 | + |
|
629 | + |
|
630 | + /** |
|
631 | + * @param EE_Event $event |
|
632 | + * @param string $event_url |
|
633 | + * @return mixed|string|void |
|
634 | + * @throws EE_Error |
|
635 | + * @throws ReflectionException |
|
636 | + * @since 4.10.14.p |
|
637 | + */ |
|
638 | + private function eventWidgetContent(EE_Event $event, $event_url = '') |
|
639 | + { |
|
640 | + if (post_password_required($event->ID())) { |
|
641 | + return apply_filters( |
|
642 | + 'FHEE_EEW_Upcoming_Events__widget__password_form', |
|
643 | + get_the_password_form($event->ID()), |
|
644 | + $event |
|
645 | + ); |
|
646 | + } |
|
647 | + |
|
648 | + $content = ''; |
|
649 | + if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
|
650 | + $content .= ' |
|
651 | 651 | <div class="ee-upcoming-events-widget-img-dv"> |
652 | 652 | <a class="ee-upcoming-events-widget-img" href="' . $event_url . '"> |
653 | 653 | ' . get_the_post_thumbnail($event->ID(), $this->image_size) . ' |
654 | 654 | </a> |
655 | 655 | </div>'; |
656 | - } |
|
657 | - |
|
658 | - if ($this->show_dates) { |
|
659 | - $content .= $this->eventDates($event); |
|
660 | - } |
|
661 | - |
|
662 | - if ($this->show_desc) { |
|
663 | - global $allowedtags; |
|
664 | - $desc = $event->short_description(25); |
|
665 | - $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
666 | - } |
|
667 | - |
|
668 | - return $content; |
|
669 | - } |
|
670 | - |
|
671 | - |
|
672 | - /** |
|
673 | - * @param EE_Event $event |
|
674 | - * @return string |
|
675 | - * @throws EE_Error |
|
676 | - * @throws ReflectionException |
|
677 | - * @since 4.10.14.p |
|
678 | - */ |
|
679 | - private function eventDates(EE_Event $event) |
|
680 | - { |
|
681 | - $date_format = apply_filters( |
|
682 | - 'FHEE__espresso_event_date_range__date_format', |
|
683 | - get_option('date_format') |
|
684 | - ); |
|
685 | - $time_format = apply_filters( |
|
686 | - 'FHEE__espresso_event_date_range__time_format', |
|
687 | - get_option('time_format') |
|
688 | - ); |
|
689 | - $single_date_format = apply_filters( |
|
690 | - 'FHEE__espresso_event_date_range__single_date_format', |
|
691 | - get_option('date_format') |
|
692 | - ); |
|
693 | - $single_time_format = apply_filters( |
|
694 | - 'FHEE__espresso_event_date_range__single_time_format', |
|
695 | - get_option('time_format') |
|
696 | - ); |
|
697 | - if ($this->date_range == true) { |
|
698 | - return espresso_event_date_range( |
|
699 | - $date_format, |
|
700 | - $time_format, |
|
701 | - $single_date_format, |
|
702 | - $single_time_format, |
|
703 | - $event->ID(), |
|
704 | - false |
|
705 | - ); |
|
706 | - } |
|
707 | - return espresso_list_of_event_dates( |
|
708 | - $event->ID(), |
|
709 | - $date_format, |
|
710 | - $time_format, |
|
711 | - false, |
|
712 | - null, |
|
713 | - true, |
|
714 | - true, |
|
715 | - $this->date_limit |
|
716 | - ); |
|
717 | - } |
|
656 | + } |
|
657 | + |
|
658 | + if ($this->show_dates) { |
|
659 | + $content .= $this->eventDates($event); |
|
660 | + } |
|
661 | + |
|
662 | + if ($this->show_desc) { |
|
663 | + global $allowedtags; |
|
664 | + $desc = $event->short_description(25); |
|
665 | + $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
666 | + } |
|
667 | + |
|
668 | + return $content; |
|
669 | + } |
|
670 | + |
|
671 | + |
|
672 | + /** |
|
673 | + * @param EE_Event $event |
|
674 | + * @return string |
|
675 | + * @throws EE_Error |
|
676 | + * @throws ReflectionException |
|
677 | + * @since 4.10.14.p |
|
678 | + */ |
|
679 | + private function eventDates(EE_Event $event) |
|
680 | + { |
|
681 | + $date_format = apply_filters( |
|
682 | + 'FHEE__espresso_event_date_range__date_format', |
|
683 | + get_option('date_format') |
|
684 | + ); |
|
685 | + $time_format = apply_filters( |
|
686 | + 'FHEE__espresso_event_date_range__time_format', |
|
687 | + get_option('time_format') |
|
688 | + ); |
|
689 | + $single_date_format = apply_filters( |
|
690 | + 'FHEE__espresso_event_date_range__single_date_format', |
|
691 | + get_option('date_format') |
|
692 | + ); |
|
693 | + $single_time_format = apply_filters( |
|
694 | + 'FHEE__espresso_event_date_range__single_time_format', |
|
695 | + get_option('time_format') |
|
696 | + ); |
|
697 | + if ($this->date_range == true) { |
|
698 | + return espresso_event_date_range( |
|
699 | + $date_format, |
|
700 | + $time_format, |
|
701 | + $single_date_format, |
|
702 | + $single_time_format, |
|
703 | + $event->ID(), |
|
704 | + false |
|
705 | + ); |
|
706 | + } |
|
707 | + return espresso_list_of_event_dates( |
|
708 | + $event->ID(), |
|
709 | + $date_format, |
|
710 | + $time_format, |
|
711 | + false, |
|
712 | + null, |
|
713 | + true, |
|
714 | + true, |
|
715 | + $this->date_limit |
|
716 | + ); |
|
717 | + } |
|
718 | 718 | } |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | <label><?php esc_html_e('Amount Owing: ', 'event_espresso'); ?></label> |
27 | 27 | </td> |
28 | 28 | <td class="<?php |
29 | - echo ($transaction->paid() == $transaction->total()) |
|
30 | - ? 'ee-transaction-paid' |
|
31 | - : 'ee-transaction-unpaid' |
|
32 | - ?>" |
|
29 | + echo ($transaction->paid() == $transaction->total()) |
|
30 | + ? 'ee-transaction-paid' |
|
31 | + : 'ee-transaction-unpaid' |
|
32 | + ?>" |
|
33 | 33 | > |
34 | 34 | <?php echo EEH_Template::format_currency($transaction->remaining()); ?> |
35 | 35 | </td> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | </td> |
41 | 41 | <td> |
42 | 42 | <?php $transaction->e_pretty_status(true); |
43 | - if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
43 | + if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
44 | 44 | <span class="small-text"> |
45 | 45 | <a href='<?php echo esc_url_raw($SPCO_payment_options_url); ?>'> |
46 | 46 | <?php esc_html_e('View Payment Options', 'event_espresso'); ?> |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | </td> |
59 | 59 | </tr> |
60 | 60 | <?php do_action( |
61 | - 'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', |
|
62 | - $transaction |
|
63 | - ); ?> |
|
61 | + 'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', |
|
62 | + $transaction |
|
63 | + ); ?> |
|
64 | 64 | </tbody> |
65 | 65 | </table> |
66 | 66 | |
67 | 67 | <?php if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
68 | 68 | <p class="small-text jst-rght"> |
69 | 69 | <a href='<?php echo esc_url_raw($SPCO_payment_options_url); ?>'><?php |
70 | - esc_html_e("Click here to view Payment Options", 'event_espresso'); ?></a> |
|
70 | + esc_html_e("Click here to view Payment Options", 'event_espresso'); ?></a> |
|
71 | 71 | </p> |
72 | 72 | <br /> |
73 | 73 |
@@ -11,236 +11,236 @@ |
||
11 | 11 | class EEH_Money extends EEH_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * This removes all localized money formatting from the incoming value |
|
16 | - * Note: uses this site's currency settings for deciding what is considered a |
|
17 | - * "thousands separator" (usually the character "," ) |
|
18 | - * and what is a "decimal mark" (usually the character ".") |
|
19 | - * |
|
20 | - * @param int|float|string $money_value |
|
21 | - * @param string|null $CNT_ISO |
|
22 | - * @return float |
|
23 | - * @throws EE_Error |
|
24 | - * @throws ReflectionException |
|
25 | - */ |
|
26 | - public static function strip_localized_money_formatting($money_value, ?string $CNT_ISO = ''): float |
|
27 | - { |
|
28 | - $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
29 | - $money_value = str_replace( |
|
30 | - [ |
|
31 | - $currency_config->thsnds, |
|
32 | - $currency_config->dec_mrk, |
|
33 | - ], |
|
34 | - [ |
|
35 | - '', // remove thousands separator |
|
36 | - '.', // convert decimal mark to what PHP expects |
|
37 | - ], |
|
38 | - $money_value |
|
39 | - ); |
|
40 | - return (float) filter_var( |
|
41 | - $money_value, |
|
42 | - FILTER_SANITIZE_NUMBER_FLOAT, |
|
43 | - FILTER_FLAG_ALLOW_FRACTION |
|
44 | - ); |
|
45 | - } |
|
14 | + /** |
|
15 | + * This removes all localized money formatting from the incoming value |
|
16 | + * Note: uses this site's currency settings for deciding what is considered a |
|
17 | + * "thousands separator" (usually the character "," ) |
|
18 | + * and what is a "decimal mark" (usually the character ".") |
|
19 | + * |
|
20 | + * @param int|float|string $money_value |
|
21 | + * @param string|null $CNT_ISO |
|
22 | + * @return float |
|
23 | + * @throws EE_Error |
|
24 | + * @throws ReflectionException |
|
25 | + */ |
|
26 | + public static function strip_localized_money_formatting($money_value, ?string $CNT_ISO = ''): float |
|
27 | + { |
|
28 | + $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
29 | + $money_value = str_replace( |
|
30 | + [ |
|
31 | + $currency_config->thsnds, |
|
32 | + $currency_config->dec_mrk, |
|
33 | + ], |
|
34 | + [ |
|
35 | + '', // remove thousands separator |
|
36 | + '.', // convert decimal mark to what PHP expects |
|
37 | + ], |
|
38 | + $money_value |
|
39 | + ); |
|
40 | + return (float) filter_var( |
|
41 | + $money_value, |
|
42 | + FILTER_SANITIZE_NUMBER_FLOAT, |
|
43 | + FILTER_FLAG_ALLOW_FRACTION |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * This converts an incoming localized money value into a standard float item (to three decimal places) |
|
50 | - * Only use this if you know the $money_value follows your currency configuration's |
|
51 | - * settings. Note: this uses this site's currency settings for deciding what is considered a |
|
52 | - * "thousands separator" (usually the character "," ) |
|
53 | - * and what is a "decimal mark" (usually the character ".") |
|
54 | - * |
|
55 | - * @param int|float|string $money_value |
|
56 | - * @return float |
|
57 | - * @throws EE_Error |
|
58 | - * @throws ReflectionException |
|
59 | - */ |
|
60 | - public static function convert_to_float_from_localized_money($money_value): float |
|
61 | - { |
|
62 | - // float it! and round to three decimal places |
|
63 | - return round(EEH_Money::strip_localized_money_formatting($money_value), 3); |
|
64 | - } |
|
48 | + /** |
|
49 | + * This converts an incoming localized money value into a standard float item (to three decimal places) |
|
50 | + * Only use this if you know the $money_value follows your currency configuration's |
|
51 | + * settings. Note: this uses this site's currency settings for deciding what is considered a |
|
52 | + * "thousands separator" (usually the character "," ) |
|
53 | + * and what is a "decimal mark" (usually the character ".") |
|
54 | + * |
|
55 | + * @param int|float|string $money_value |
|
56 | + * @return float |
|
57 | + * @throws EE_Error |
|
58 | + * @throws ReflectionException |
|
59 | + */ |
|
60 | + public static function convert_to_float_from_localized_money($money_value): float |
|
61 | + { |
|
62 | + // float it! and round to three decimal places |
|
63 | + return round(EEH_Money::strip_localized_money_formatting($money_value), 3); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * For comparing floats. Default operator is '=', but see the $operator below for all options. |
|
69 | - * This should be used to compare floats instead of normal '==' because floats |
|
70 | - * are inherently imprecise, and so you can sometimes have two floats that appear to be identical |
|
71 | - * but actually differ by 0.00000001. |
|
72 | - * |
|
73 | - * @see http://biostall.com/php-function-to-compare-floating-point-numbers |
|
74 | - * @param int|float|string $float1 |
|
75 | - * @param int|float|string $float2 |
|
76 | - * @param string|null $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
|
77 | - * @return bool whether the equation is true or false |
|
78 | - * @throws EE_Error |
|
79 | - */ |
|
80 | - public static function compare_floats($float1, $float2, ?string $operator = '='): bool |
|
81 | - { |
|
82 | - // Check numbers to 5 digits of precision |
|
83 | - $epsilon = 0.00001; |
|
84 | - $float1 = (float) $float1; |
|
85 | - $float2 = (float) $float2; |
|
86 | - switch ($operator) { |
|
87 | - // equal |
|
88 | - case '=': |
|
89 | - case '==': |
|
90 | - case '===': |
|
91 | - case 'eq': |
|
92 | - if (abs($float1 - $float2) < $epsilon) { |
|
93 | - return true; |
|
94 | - } |
|
95 | - break; |
|
96 | - // less than |
|
97 | - case '<': |
|
98 | - case 'lt': |
|
99 | - if (abs($float1 - $float2) < $epsilon) { |
|
100 | - return false; |
|
101 | - } |
|
102 | - if ($float1 < $float2) { |
|
103 | - return true; |
|
104 | - } |
|
105 | - break; |
|
106 | - // less than or equal |
|
107 | - case '<=': |
|
108 | - case 'lte': |
|
109 | - if ( |
|
110 | - self::compare_floats($float1, $float2, '<') |
|
111 | - || self::compare_floats($float1, $float2) |
|
112 | - ) { |
|
113 | - return true; |
|
114 | - } |
|
115 | - break; |
|
116 | - // greater than |
|
117 | - case '>': |
|
118 | - case 'gt': |
|
119 | - if (abs($float1 - $float2) < $epsilon) { |
|
120 | - return false; |
|
121 | - } |
|
122 | - if ($float1 > $float2) { |
|
123 | - return true; |
|
124 | - } |
|
125 | - break; |
|
126 | - // greater than or equal |
|
127 | - case '>=': |
|
128 | - case 'gte': |
|
129 | - if ( |
|
130 | - self::compare_floats($float1, $float2, '>') |
|
131 | - || self::compare_floats($float1, $float2) |
|
132 | - ) { |
|
133 | - return true; |
|
134 | - } |
|
135 | - break; |
|
136 | - case '<>': |
|
137 | - case '!=': |
|
138 | - case '!==': |
|
139 | - case 'ne': |
|
140 | - if (abs($float1 - $float2) > $epsilon) { |
|
141 | - return true; |
|
142 | - } |
|
143 | - break; |
|
144 | - default: |
|
145 | - throw new EE_Error( |
|
146 | - sprintf( |
|
147 | - esc_html__( |
|
148 | - "Unknown operator %s in EEH_Money::compare_floats()", |
|
149 | - 'event_espresso' |
|
150 | - ), |
|
151 | - $operator |
|
152 | - ) |
|
153 | - ); |
|
154 | - } |
|
155 | - return false; |
|
156 | - } |
|
67 | + /** |
|
68 | + * For comparing floats. Default operator is '=', but see the $operator below for all options. |
|
69 | + * This should be used to compare floats instead of normal '==' because floats |
|
70 | + * are inherently imprecise, and so you can sometimes have two floats that appear to be identical |
|
71 | + * but actually differ by 0.00000001. |
|
72 | + * |
|
73 | + * @see http://biostall.com/php-function-to-compare-floating-point-numbers |
|
74 | + * @param int|float|string $float1 |
|
75 | + * @param int|float|string $float2 |
|
76 | + * @param string|null $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
|
77 | + * @return bool whether the equation is true or false |
|
78 | + * @throws EE_Error |
|
79 | + */ |
|
80 | + public static function compare_floats($float1, $float2, ?string $operator = '='): bool |
|
81 | + { |
|
82 | + // Check numbers to 5 digits of precision |
|
83 | + $epsilon = 0.00001; |
|
84 | + $float1 = (float) $float1; |
|
85 | + $float2 = (float) $float2; |
|
86 | + switch ($operator) { |
|
87 | + // equal |
|
88 | + case '=': |
|
89 | + case '==': |
|
90 | + case '===': |
|
91 | + case 'eq': |
|
92 | + if (abs($float1 - $float2) < $epsilon) { |
|
93 | + return true; |
|
94 | + } |
|
95 | + break; |
|
96 | + // less than |
|
97 | + case '<': |
|
98 | + case 'lt': |
|
99 | + if (abs($float1 - $float2) < $epsilon) { |
|
100 | + return false; |
|
101 | + } |
|
102 | + if ($float1 < $float2) { |
|
103 | + return true; |
|
104 | + } |
|
105 | + break; |
|
106 | + // less than or equal |
|
107 | + case '<=': |
|
108 | + case 'lte': |
|
109 | + if ( |
|
110 | + self::compare_floats($float1, $float2, '<') |
|
111 | + || self::compare_floats($float1, $float2) |
|
112 | + ) { |
|
113 | + return true; |
|
114 | + } |
|
115 | + break; |
|
116 | + // greater than |
|
117 | + case '>': |
|
118 | + case 'gt': |
|
119 | + if (abs($float1 - $float2) < $epsilon) { |
|
120 | + return false; |
|
121 | + } |
|
122 | + if ($float1 > $float2) { |
|
123 | + return true; |
|
124 | + } |
|
125 | + break; |
|
126 | + // greater than or equal |
|
127 | + case '>=': |
|
128 | + case 'gte': |
|
129 | + if ( |
|
130 | + self::compare_floats($float1, $float2, '>') |
|
131 | + || self::compare_floats($float1, $float2) |
|
132 | + ) { |
|
133 | + return true; |
|
134 | + } |
|
135 | + break; |
|
136 | + case '<>': |
|
137 | + case '!=': |
|
138 | + case '!==': |
|
139 | + case 'ne': |
|
140 | + if (abs($float1 - $float2) > $epsilon) { |
|
141 | + return true; |
|
142 | + } |
|
143 | + break; |
|
144 | + default: |
|
145 | + throw new EE_Error( |
|
146 | + sprintf( |
|
147 | + esc_html__( |
|
148 | + "Unknown operator %s in EEH_Money::compare_floats()", |
|
149 | + 'event_espresso' |
|
150 | + ), |
|
151 | + $operator |
|
152 | + ) |
|
153 | + ); |
|
154 | + } |
|
155 | + return false; |
|
156 | + } |
|
157 | 157 | |
158 | 158 | |
159 | - /** |
|
160 | - * This returns a localized format string suitable for jQplot. |
|
161 | - * |
|
162 | - * @param string|null $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
163 | - * Otherwise will use currency settings for current active country on site. |
|
164 | - * @return string |
|
165 | - * @throws EE_Error |
|
166 | - * @throws ReflectionException |
|
167 | - */ |
|
168 | - public static function get_format_for_jqplot(?string $CNT_ISO = ''): string |
|
169 | - { |
|
170 | - // default format |
|
171 | - $format = 'f'; |
|
172 | - $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
173 | - // first get the decimal place and number of places |
|
174 | - $format = "%'." . $currency_config->dec_plc . $format; |
|
175 | - // currency symbol on right side. |
|
176 | - return $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
177 | - } |
|
159 | + /** |
|
160 | + * This returns a localized format string suitable for jQplot. |
|
161 | + * |
|
162 | + * @param string|null $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
163 | + * Otherwise will use currency settings for current active country on site. |
|
164 | + * @return string |
|
165 | + * @throws EE_Error |
|
166 | + * @throws ReflectionException |
|
167 | + */ |
|
168 | + public static function get_format_for_jqplot(?string $CNT_ISO = ''): string |
|
169 | + { |
|
170 | + // default format |
|
171 | + $format = 'f'; |
|
172 | + $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
173 | + // first get the decimal place and number of places |
|
174 | + $format = "%'." . $currency_config->dec_plc . $format; |
|
175 | + // currency symbol on right side. |
|
176 | + return $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
177 | + } |
|
178 | 178 | |
179 | 179 | |
180 | - /** |
|
181 | - * This returns a localized format string suitable for usage with the Google Charts API format param. |
|
182 | - * |
|
183 | - * @param string|null $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
184 | - * Otherwise will use currency settings for current active country on site. |
|
185 | - * Note: GoogleCharts uses ICU pattern set |
|
186 | - * (@return array |
|
187 | - * @return array |
|
188 | - * @throws EE_Error |
|
189 | - * @throws ReflectionException |
|
190 | - * @see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details) |
|
191 | - */ |
|
192 | - public static function get_format_for_google_charts(?string $CNT_ISO = ''): array |
|
193 | - { |
|
194 | - $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
195 | - $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
|
196 | - // first get the decimal place and number of places |
|
197 | - $format = '#,##0.' . $decimal_places_placeholder; |
|
198 | - // currency symbol on right side. |
|
199 | - $format = $currency_config->sign_b4 |
|
200 | - ? $currency_config->sign . $format |
|
201 | - : $format |
|
202 | - . $currency_config->sign; |
|
203 | - $formatterObject = [ |
|
204 | - 'decimalSymbol' => $currency_config->dec_mrk, |
|
205 | - 'groupingSymbol' => $currency_config->thsnds, |
|
206 | - 'fractionDigits' => $currency_config->dec_plc, |
|
207 | - ]; |
|
208 | - if ($currency_config->sign_b4) { |
|
209 | - $formatterObject['prefix'] = $currency_config->sign; |
|
210 | - } else { |
|
211 | - $formatterObject['suffix'] = $currency_config->sign; |
|
212 | - } |
|
213 | - return [ |
|
214 | - 'format' => $format, |
|
215 | - 'formatterObject' => $formatterObject, |
|
216 | - ]; |
|
217 | - } |
|
180 | + /** |
|
181 | + * This returns a localized format string suitable for usage with the Google Charts API format param. |
|
182 | + * |
|
183 | + * @param string|null $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
184 | + * Otherwise will use currency settings for current active country on site. |
|
185 | + * Note: GoogleCharts uses ICU pattern set |
|
186 | + * (@return array |
|
187 | + * @return array |
|
188 | + * @throws EE_Error |
|
189 | + * @throws ReflectionException |
|
190 | + * @see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details) |
|
191 | + */ |
|
192 | + public static function get_format_for_google_charts(?string $CNT_ISO = ''): array |
|
193 | + { |
|
194 | + $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
195 | + $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
|
196 | + // first get the decimal place and number of places |
|
197 | + $format = '#,##0.' . $decimal_places_placeholder; |
|
198 | + // currency symbol on right side. |
|
199 | + $format = $currency_config->sign_b4 |
|
200 | + ? $currency_config->sign . $format |
|
201 | + : $format |
|
202 | + . $currency_config->sign; |
|
203 | + $formatterObject = [ |
|
204 | + 'decimalSymbol' => $currency_config->dec_mrk, |
|
205 | + 'groupingSymbol' => $currency_config->thsnds, |
|
206 | + 'fractionDigits' => $currency_config->dec_plc, |
|
207 | + ]; |
|
208 | + if ($currency_config->sign_b4) { |
|
209 | + $formatterObject['prefix'] = $currency_config->sign; |
|
210 | + } else { |
|
211 | + $formatterObject['suffix'] = $currency_config->sign; |
|
212 | + } |
|
213 | + return [ |
|
214 | + 'format' => $format, |
|
215 | + 'formatterObject' => $formatterObject, |
|
216 | + ]; |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | - /** |
|
221 | - * @param string|null $CNT_ISO |
|
222 | - * @return EE_Currency_Config |
|
223 | - * @throws EE_Error |
|
224 | - * @throws ReflectionException |
|
225 | - */ |
|
226 | - public static function get_currency_config(?string $CNT_ISO = ''): EE_Currency_Config |
|
227 | - { |
|
228 | - return EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
229 | - } |
|
220 | + /** |
|
221 | + * @param string|null $CNT_ISO |
|
222 | + * @return EE_Currency_Config |
|
223 | + * @throws EE_Error |
|
224 | + * @throws ReflectionException |
|
225 | + */ |
|
226 | + public static function get_currency_config(?string $CNT_ISO = ''): EE_Currency_Config |
|
227 | + { |
|
228 | + return EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
229 | + } |
|
230 | 230 | |
231 | 231 | |
232 | - /** |
|
233 | - * @param string|null $CNT_ISO |
|
234 | - * @param bool $as_decimal if false [default] will return the number of decimal places ex: 1, 2, 3 |
|
235 | - * if true, will return the subunits as a decimal fraction ex: .1, .01, .001 |
|
236 | - * @return float |
|
237 | - * @throws EE_Error |
|
238 | - * @throws ReflectionException |
|
239 | - * @since $VID:$ |
|
240 | - */ |
|
241 | - public static function getCurrencySubUnits(?string $CNT_ISO = '', bool $as_decimal = false): float |
|
242 | - { |
|
243 | - $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
244 | - return $as_decimal ? pow(10, ($currency_config->dec_plc * -1)) : $currency_config->dec_plc; |
|
245 | - } |
|
232 | + /** |
|
233 | + * @param string|null $CNT_ISO |
|
234 | + * @param bool $as_decimal if false [default] will return the number of decimal places ex: 1, 2, 3 |
|
235 | + * if true, will return the subunits as a decimal fraction ex: .1, .01, .001 |
|
236 | + * @return float |
|
237 | + * @throws EE_Error |
|
238 | + * @throws ReflectionException |
|
239 | + * @since $VID:$ |
|
240 | + */ |
|
241 | + public static function getCurrencySubUnits(?string $CNT_ISO = '', bool $as_decimal = false): float |
|
242 | + { |
|
243 | + $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
|
244 | + return $as_decimal ? pow(10, ($currency_config->dec_plc * -1)) : $currency_config->dec_plc; |
|
245 | + } |
|
246 | 246 | } |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | $format = 'f'; |
172 | 172 | $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
173 | 173 | // first get the decimal place and number of places |
174 | - $format = "%'." . $currency_config->dec_plc . $format; |
|
174 | + $format = "%'.".$currency_config->dec_plc.$format; |
|
175 | 175 | // currency symbol on right side. |
176 | - return $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
176 | + return $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | $currency_config = EE_Currency_Config::getCurrencyConfig($CNT_ISO); |
195 | 195 | $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
196 | 196 | // first get the decimal place and number of places |
197 | - $format = '#,##0.' . $decimal_places_placeholder; |
|
197 | + $format = '#,##0.'.$decimal_places_placeholder; |
|
198 | 198 | // currency symbol on right side. |
199 | - $format = $currency_config->sign_b4 |
|
200 | - ? $currency_config->sign . $format |
|
199 | + $format = $currency_config->sign_b4 |
|
200 | + ? $currency_config->sign.$format |
|
201 | 201 | : $format |
202 | 202 | . $currency_config->sign; |
203 | 203 | $formatterObject = [ |
@@ -21,1130 +21,1130 @@ |
||
21 | 21 | class EE_Dependency_Map |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * This means that the requested class dependency is not present in the dependency map |
|
26 | - */ |
|
27 | - const not_registered = 0; |
|
28 | - |
|
29 | - /** |
|
30 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
31 | - */ |
|
32 | - const load_new_object = 1; |
|
33 | - |
|
34 | - /** |
|
35 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
36 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
37 | - */ |
|
38 | - const load_from_cache = 2; |
|
39 | - |
|
40 | - /** |
|
41 | - * When registering a dependency, |
|
42 | - * this indicates to keep any existing dependencies that already exist, |
|
43 | - * and simply discard any new dependencies declared in the incoming data |
|
44 | - */ |
|
45 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
46 | - |
|
47 | - /** |
|
48 | - * When registering a dependency, |
|
49 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
50 | - */ |
|
51 | - const OVERWRITE_DEPENDENCIES = 1; |
|
52 | - |
|
53 | - /** |
|
54 | - * @type EE_Dependency_Map $_instance |
|
55 | - */ |
|
56 | - protected static $_instance; |
|
57 | - |
|
58 | - /** |
|
59 | - * @var ClassInterfaceCache $class_cache |
|
60 | - */ |
|
61 | - private $class_cache; |
|
62 | - |
|
63 | - /** |
|
64 | - * @type RequestInterface $request |
|
65 | - */ |
|
66 | - protected $request; |
|
67 | - |
|
68 | - /** |
|
69 | - * @type LegacyRequestInterface $legacy_request |
|
70 | - */ |
|
71 | - protected $legacy_request; |
|
72 | - |
|
73 | - /** |
|
74 | - * @type ResponseInterface $response |
|
75 | - */ |
|
76 | - protected $response; |
|
77 | - |
|
78 | - /** |
|
79 | - * @type LoaderInterface $loader |
|
80 | - */ |
|
81 | - protected $loader; |
|
82 | - |
|
83 | - /** |
|
84 | - * @type array $_dependency_map |
|
85 | - */ |
|
86 | - protected $_dependency_map = []; |
|
87 | - |
|
88 | - /** |
|
89 | - * @type array $_class_loaders |
|
90 | - */ |
|
91 | - protected $_class_loaders = []; |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * EE_Dependency_Map constructor. |
|
96 | - * |
|
97 | - * @param ClassInterfaceCache $class_cache |
|
98 | - */ |
|
99 | - protected function __construct(ClassInterfaceCache $class_cache) |
|
100 | - { |
|
101 | - $this->class_cache = $class_cache; |
|
102 | - do_action('EE_Dependency_Map____construct', $this); |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @return void |
|
108 | - * @throws InvalidAliasException |
|
109 | - */ |
|
110 | - public function initialize() |
|
111 | - { |
|
112 | - $this->_register_core_dependencies(); |
|
113 | - $this->_register_core_class_loaders(); |
|
114 | - $this->_register_core_aliases(); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * @singleton method used to instantiate class object |
|
120 | - * @param ClassInterfaceCache|null $class_cache |
|
121 | - * @return EE_Dependency_Map |
|
122 | - */ |
|
123 | - public static function instance(ClassInterfaceCache $class_cache = null): EE_Dependency_Map |
|
124 | - { |
|
125 | - // check if class object is instantiated, and instantiated properly |
|
126 | - if ( |
|
127 | - ! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map |
|
128 | - && $class_cache instanceof ClassInterfaceCache |
|
129 | - ) { |
|
130 | - EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache); |
|
131 | - } |
|
132 | - return EE_Dependency_Map::$_instance; |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * @param RequestInterface $request |
|
138 | - */ |
|
139 | - public function setRequest(RequestInterface $request) |
|
140 | - { |
|
141 | - $this->request = $request; |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - /** |
|
146 | - * @param LegacyRequestInterface $legacy_request |
|
147 | - */ |
|
148 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
149 | - { |
|
150 | - $this->legacy_request = $legacy_request; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - /** |
|
155 | - * @param ResponseInterface $response |
|
156 | - */ |
|
157 | - public function setResponse(ResponseInterface $response) |
|
158 | - { |
|
159 | - $this->response = $response; |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - /** |
|
164 | - * @param LoaderInterface $loader |
|
165 | - */ |
|
166 | - public function setLoader(LoaderInterface $loader) |
|
167 | - { |
|
168 | - $this->loader = $loader; |
|
169 | - } |
|
170 | - |
|
171 | - |
|
172 | - /** |
|
173 | - * @param string $class |
|
174 | - * @param array $dependencies |
|
175 | - * @param int $overwrite |
|
176 | - * @return bool |
|
177 | - */ |
|
178 | - public static function register_dependencies( |
|
179 | - string $class, |
|
180 | - array $dependencies, |
|
181 | - int $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
182 | - ): bool { |
|
183 | - return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - /** |
|
188 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
189 | - * to the class specified by the first parameter. |
|
190 | - * IMPORTANT !!! |
|
191 | - * The order of elements in the incoming $dependencies array MUST match |
|
192 | - * the order of the constructor parameters for the class in question. |
|
193 | - * This is especially important when overriding any existing dependencies that are registered. |
|
194 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
195 | - * |
|
196 | - * @param string $class |
|
197 | - * @param array $dependencies |
|
198 | - * @param int $overwrite |
|
199 | - * @return bool |
|
200 | - */ |
|
201 | - public function registerDependencies( |
|
202 | - string $class, |
|
203 | - array $dependencies, |
|
204 | - int $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
205 | - ): bool { |
|
206 | - $class = trim($class, '\\'); |
|
207 | - $registered = false; |
|
208 | - if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
209 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
210 | - } |
|
211 | - // we need to make sure that any aliases used when registering a dependency |
|
212 | - // get resolved to the correct class name |
|
213 | - foreach ($dependencies as $dependency => $load_source) { |
|
214 | - $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
|
215 | - if ( |
|
216 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
217 | - || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
218 | - ) { |
|
219 | - unset($dependencies[ $dependency ]); |
|
220 | - $dependencies[ $alias ] = $load_source; |
|
221 | - $registered = true; |
|
222 | - } |
|
223 | - } |
|
224 | - // now add our two lists of dependencies together. |
|
225 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
226 | - // so $dependencies is NOT overwritten because it is listed first |
|
227 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
228 | - // Union is way faster than array_merge() but should be used with caution... |
|
229 | - // especially with numerically indexed arrays |
|
230 | - $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
231 | - // now we need to ensure that the resulting dependencies |
|
232 | - // array only has the entries that are required for the class |
|
233 | - // so first count how many dependencies were originally registered for the class |
|
234 | - $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
235 | - // if that count is non-zero (meaning dependencies were already registered) |
|
236 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
237 | - // then truncate the final array to match that count |
|
238 | - ? array_slice($dependencies, 0, $dependency_count) |
|
239 | - // otherwise just take the incoming array because nothing previously existed |
|
240 | - : $dependencies; |
|
241 | - return $registered; |
|
242 | - } |
|
243 | - |
|
244 | - |
|
245 | - /** |
|
246 | - * @param string $class_name |
|
247 | - * @param callable|string $loader |
|
248 | - * @param bool $overwrite |
|
249 | - * @return bool |
|
250 | - * @throws DomainException |
|
251 | - */ |
|
252 | - public static function register_class_loader( |
|
253 | - string $class_name, |
|
254 | - $loader = 'load_core', |
|
255 | - bool $overwrite = false |
|
256 | - ): bool { |
|
257 | - return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader, $overwrite); |
|
258 | - } |
|
259 | - |
|
260 | - |
|
261 | - /** |
|
262 | - * @param string $class_name |
|
263 | - * @param Closure|string $loader |
|
264 | - * @param bool $overwrite |
|
265 | - * @return bool |
|
266 | - * @throws DomainException |
|
267 | - */ |
|
268 | - public function registerClassLoader(string $class_name, $loader = 'load_core', bool $overwrite = false): bool |
|
269 | - { |
|
270 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
271 | - throw new DomainException( |
|
272 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
273 | - ); |
|
274 | - } |
|
275 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
276 | - if ( |
|
277 | - ! is_callable($loader) |
|
278 | - && ( |
|
279 | - strpos($loader, 'load_') !== 0 |
|
280 | - || ! method_exists('EE_Registry', $loader) |
|
281 | - ) |
|
282 | - ) { |
|
283 | - throw new DomainException( |
|
284 | - sprintf( |
|
285 | - esc_html__( |
|
286 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
287 | - 'event_espresso' |
|
288 | - ), |
|
289 | - $loader |
|
290 | - ) |
|
291 | - ); |
|
292 | - } |
|
293 | - $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
|
294 | - if ($overwrite || ! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
295 | - EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
296 | - return true; |
|
297 | - } |
|
298 | - return false; |
|
299 | - } |
|
300 | - |
|
301 | - |
|
302 | - /** |
|
303 | - * @return array |
|
304 | - */ |
|
305 | - public function dependency_map(): array |
|
306 | - { |
|
307 | - return $this->_dependency_map; |
|
308 | - } |
|
309 | - |
|
310 | - |
|
311 | - /** |
|
312 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
313 | - * |
|
314 | - * @param string $class_name |
|
315 | - * @return boolean |
|
316 | - */ |
|
317 | - public function has(string $class_name = ''): bool |
|
318 | - { |
|
319 | - // all legacy models have the same dependencies |
|
320 | - if (strpos($class_name, 'EEM_') === 0) { |
|
321 | - $class_name = 'LEGACY_MODELS'; |
|
322 | - } |
|
323 | - return isset($this->_dependency_map[ $class_name ]); |
|
324 | - } |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
329 | - * |
|
330 | - * @param string $class_name |
|
331 | - * @param string $dependency |
|
332 | - * @return bool |
|
333 | - */ |
|
334 | - public function has_dependency_for_class(string $class_name = '', string $dependency = ''): bool |
|
335 | - { |
|
336 | - // all legacy models have the same dependencies |
|
337 | - if (strpos($class_name, 'EEM_') === 0) { |
|
338 | - $class_name = 'LEGACY_MODELS'; |
|
339 | - } |
|
340 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
341 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
342 | - } |
|
343 | - |
|
344 | - |
|
345 | - /** |
|
346 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
347 | - * |
|
348 | - * @param string $class_name |
|
349 | - * @param string $dependency |
|
350 | - * @return int |
|
351 | - */ |
|
352 | - public function loading_strategy_for_class_dependency(string $class_name = '', string $dependency = ''): int |
|
353 | - { |
|
354 | - // all legacy models have the same dependencies |
|
355 | - if (strpos($class_name, 'EEM_') === 0) { |
|
356 | - $class_name = 'LEGACY_MODELS'; |
|
357 | - } |
|
358 | - $dependency = $this->getFqnForAlias($dependency); |
|
359 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
360 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
361 | - : EE_Dependency_Map::not_registered; |
|
362 | - } |
|
363 | - |
|
364 | - |
|
365 | - /** |
|
366 | - * @param string $class_name |
|
367 | - * @return string | Closure |
|
368 | - */ |
|
369 | - public function class_loader(string $class_name) |
|
370 | - { |
|
371 | - // all legacy models use load_model() |
|
372 | - if (strpos($class_name, 'EEM_') === 0) { |
|
373 | - return 'load_model'; |
|
374 | - } |
|
375 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
376 | - // perform strpos() first to avoid loading regex every time we load a class |
|
377 | - if ( |
|
378 | - strpos($class_name, 'EE_CPT_') === 0 |
|
379 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
380 | - ) { |
|
381 | - return 'load_core'; |
|
382 | - } |
|
383 | - $class_name = $this->getFqnForAlias($class_name); |
|
384 | - return $this->_class_loaders[ $class_name ] ?? ''; |
|
385 | - } |
|
386 | - |
|
387 | - |
|
388 | - /** |
|
389 | - * @return array |
|
390 | - */ |
|
391 | - public function class_loaders(): array |
|
392 | - { |
|
393 | - return $this->_class_loaders; |
|
394 | - } |
|
395 | - |
|
396 | - |
|
397 | - /** |
|
398 | - * adds an alias for a classname |
|
399 | - * |
|
400 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
401 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
402 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
403 | - * @throws InvalidAliasException |
|
404 | - */ |
|
405 | - public function add_alias(string $fqcn, string $alias, string $for_class = '') |
|
406 | - { |
|
407 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
408 | - } |
|
409 | - |
|
410 | - |
|
411 | - /** |
|
412 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
413 | - * WHY? |
|
414 | - * Because if a class is type hinting for a concretion, |
|
415 | - * then why would we need to find another class to supply it? |
|
416 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
417 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
418 | - * Don't go looking for some substitute. |
|
419 | - * Whereas if a class is type hinting for an interface... |
|
420 | - * then we need to find an actual class to use. |
|
421 | - * So the interface IS the alias for some other FQN, |
|
422 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
423 | - * represents some other class. |
|
424 | - * |
|
425 | - * @param string $fqn |
|
426 | - * @param string $for_class |
|
427 | - * @return bool |
|
428 | - */ |
|
429 | - public function isAlias(string $fqn = '', string $for_class = ''): bool |
|
430 | - { |
|
431 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
432 | - } |
|
433 | - |
|
434 | - |
|
435 | - /** |
|
436 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
437 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
438 | - * for example: |
|
439 | - * if the following two entries were added to the _aliases array: |
|
440 | - * array( |
|
441 | - * 'interface_alias' => 'some\namespace\interface' |
|
442 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
443 | - * ) |
|
444 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
445 | - * to load an instance of 'some\namespace\classname' |
|
446 | - * |
|
447 | - * @param string $alias |
|
448 | - * @param string $for_class |
|
449 | - * @return string |
|
450 | - */ |
|
451 | - public function getFqnForAlias(string $alias = '', string $for_class = ''): string |
|
452 | - { |
|
453 | - return $this->class_cache->getFqnForAlias($alias, $for_class); |
|
454 | - } |
|
455 | - |
|
456 | - |
|
457 | - /** |
|
458 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
459 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
460 | - * This is done by using the following class constants: |
|
461 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
462 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
463 | - */ |
|
464 | - protected function _register_core_dependencies() |
|
465 | - { |
|
466 | - $this->_dependency_map = [ |
|
467 | - 'EE_Admin' => [ |
|
468 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
469 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
470 | - ], |
|
471 | - 'EE_Request_Handler' => [ |
|
472 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
473 | - 'EventEspresso\core\services\request\Response' => EE_Dependency_Map::load_from_cache, |
|
474 | - ], |
|
475 | - 'EE_System' => [ |
|
476 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
477 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
478 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
479 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
480 | - 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache, |
|
481 | - ], |
|
482 | - 'EE_Session' => [ |
|
483 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
484 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
485 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
486 | - 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
487 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
488 | - ], |
|
489 | - 'EE_Cart' => [ |
|
490 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
491 | - ], |
|
492 | - 'EE_Messenger_Collection_Loader' => [ |
|
493 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
494 | - ], |
|
495 | - 'EE_Message_Type_Collection_Loader' => [ |
|
496 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
497 | - ], |
|
498 | - 'EE_Message_Resource_Manager' => [ |
|
499 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
500 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
501 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
502 | - ], |
|
503 | - 'EE_Message_Factory' => [ |
|
504 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
505 | - ], |
|
506 | - 'EE_messages' => [ |
|
507 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
508 | - ], |
|
509 | - 'EE_Messages_Generator' => [ |
|
510 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
511 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
512 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
513 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
514 | - ], |
|
515 | - 'EE_Messages_Processor' => [ |
|
516 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
517 | - ], |
|
518 | - 'EE_Messages_Queue' => [ |
|
519 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
520 | - ], |
|
521 | - 'EE_Messages_Template_Defaults' => [ |
|
522 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
523 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
524 | - ], |
|
525 | - 'EE_Message_To_Generate_From_Request' => [ |
|
526 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
527 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
528 | - ], |
|
529 | - 'EventEspresso\core\services\commands\CommandBus' => [ |
|
530 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
531 | - ], |
|
532 | - 'EventEspresso\services\commands\CommandHandler' => [ |
|
533 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
534 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
535 | - ], |
|
536 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
537 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
538 | - ], |
|
539 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
540 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
541 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
542 | - ], |
|
543 | - 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
544 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
545 | - ], |
|
546 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
547 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
548 | - ], |
|
549 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
550 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
551 | - ], |
|
552 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
553 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
554 | - ], |
|
555 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
556 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
557 | - ], |
|
558 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
559 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
560 | - ], |
|
561 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
562 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
563 | - ], |
|
564 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
565 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
566 | - ], |
|
567 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
568 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
569 | - ], |
|
570 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
571 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
572 | - ], |
|
573 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
574 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
575 | - ], |
|
576 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
577 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
578 | - ], |
|
579 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
580 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
581 | - ], |
|
582 | - 'EventEspresso\core\services\database\TableManager' => [ |
|
583 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
584 | - ], |
|
585 | - 'EE_Data_Migration_Class_Base' => [ |
|
586 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | - ], |
|
589 | - 'EE_DMS_Core_4_1_0' => [ |
|
590 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | - ], |
|
593 | - 'EE_DMS_Core_4_2_0' => [ |
|
594 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | - ], |
|
597 | - 'EE_DMS_Core_4_3_0' => [ |
|
598 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | - ], |
|
601 | - 'EE_DMS_Core_4_4_0' => [ |
|
602 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | - ], |
|
605 | - 'EE_DMS_Core_4_5_0' => [ |
|
606 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | - ], |
|
609 | - 'EE_DMS_Core_4_6_0' => [ |
|
610 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | - ], |
|
613 | - 'EE_DMS_Core_4_7_0' => [ |
|
614 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
615 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
616 | - ], |
|
617 | - 'EE_DMS_Core_4_8_0' => [ |
|
618 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
619 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
620 | - ], |
|
621 | - 'EE_DMS_Core_4_9_0' => [ |
|
622 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
623 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
624 | - ], |
|
625 | - 'EE_DMS_Core_4_10_0' => [ |
|
626 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
627 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
628 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
629 | - ], |
|
630 | - 'EE_DMS_Core_4_11_0' => [ |
|
631 | - 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache, |
|
632 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
633 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
634 | - ], |
|
635 | - 'EE_DMS_Core_4_12_0' => [ |
|
636 | - 'EE_DMS_Core_4_11_0' => EE_Dependency_Map::load_from_cache, |
|
637 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
638 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
639 | - ], |
|
640 | - 'EventEspresso\core\services\assets\I18nRegistry' => [ |
|
641 | - [], |
|
642 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
643 | - ], |
|
644 | - 'EventEspresso\core\services\assets\Registry' => [ |
|
645 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
646 | - 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache, |
|
647 | - ], |
|
648 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => [ |
|
649 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
650 | - ], |
|
651 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => [ |
|
652 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
653 | - ], |
|
654 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => [ |
|
655 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
656 | - ], |
|
657 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => [ |
|
658 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
659 | - ], |
|
660 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => [ |
|
661 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
662 | - ], |
|
663 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => [ |
|
664 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
665 | - ], |
|
666 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => [ |
|
667 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
668 | - ], |
|
669 | - 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
670 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
671 | - ], |
|
672 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
673 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
674 | - ], |
|
675 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
676 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
677 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
678 | - ], |
|
679 | - 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
680 | - null, |
|
681 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
682 | - ], |
|
683 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
684 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
685 | - ], |
|
686 | - 'LEGACY_MODELS' => [ |
|
687 | - null, |
|
688 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
689 | - ], |
|
690 | - 'EE_Module_Request_Router' => [ |
|
691 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
692 | - ], |
|
693 | - 'EE_Registration_Processor' => [ |
|
694 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
695 | - ], |
|
696 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
697 | - null, |
|
698 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
699 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
700 | - ], |
|
701 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
702 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
703 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
704 | - ], |
|
705 | - 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
706 | - 'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
707 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
708 | - 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
709 | - ], |
|
710 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
711 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
712 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
713 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
714 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
715 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
716 | - ], |
|
717 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
718 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
719 | - ], |
|
720 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
721 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
722 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
723 | - ], |
|
724 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
725 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
726 | - ], |
|
727 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
728 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
729 | - ], |
|
730 | - 'EE_CPT_Strategy' => [ |
|
731 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
732 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
733 | - ], |
|
734 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
735 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
736 | - ], |
|
737 | - 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
738 | - null, |
|
739 | - null, |
|
740 | - null, |
|
741 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
742 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
743 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
744 | - ], |
|
745 | - 'EventEspresso\core\services\dependencies\DependencyResolver' => [ |
|
746 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
747 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
748 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
749 | - ], |
|
750 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [ |
|
751 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
752 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
753 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
754 | - ], |
|
755 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [ |
|
756 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
757 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
758 | - ], |
|
759 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [ |
|
760 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
761 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
762 | - ], |
|
763 | - 'EE_URL_Validation_Strategy' => [ |
|
764 | - null, |
|
765 | - null, |
|
766 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
767 | - ], |
|
768 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
769 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
770 | - ], |
|
771 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
772 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
773 | - ], |
|
774 | - 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
775 | - 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
776 | - 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
777 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
778 | - null, |
|
779 | - ], |
|
780 | - 'EventEspresso\core\services\routing\RouteHandler' => [ |
|
781 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache, |
|
782 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
783 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
784 | - 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache, |
|
785 | - ], |
|
786 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => [ |
|
787 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
788 | - ], |
|
789 | - 'EventEspresso\core\services\routing\Router' => [ |
|
790 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
791 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
792 | - 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache, |
|
793 | - ], |
|
794 | - 'EventEspresso\core\services\assets\AssetManifest' => [ |
|
795 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
796 | - ], |
|
797 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => [ |
|
798 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
799 | - ], |
|
800 | - 'EventEspresso\core\services\assets\BaristaFactory' => [ |
|
801 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache, |
|
802 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
803 | - ], |
|
804 | - 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [ |
|
805 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
806 | - ], |
|
807 | - 'EventEspresso\core\services\addon\AddonManager' => [ |
|
808 | - 'EventEspresso\core\services\addon\AddonCollection' => EE_Dependency_Map::load_from_cache, |
|
809 | - 'EventEspresso\core\Psr4Autoloader' => EE_Dependency_Map::load_from_cache, |
|
810 | - 'EventEspresso\core\services\addon\api\v1\RegisterAddon' => EE_Dependency_Map::load_from_cache, |
|
811 | - 'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache, |
|
812 | - 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => EE_Dependency_Map::load_from_cache, |
|
813 | - ], |
|
814 | - 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [ |
|
815 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
816 | - ], |
|
817 | - 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
818 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
819 | - ], |
|
820 | - 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
821 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
822 | - ], |
|
823 | - 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
824 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
825 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
826 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
827 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
828 | - ], |
|
829 | - 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
830 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
831 | - ], |
|
832 | - 'EventEspresso\core\services\request\CurrentPage' => [ |
|
833 | - 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
834 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
835 | - ], |
|
836 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
837 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
838 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
839 | - ], |
|
840 | - 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
841 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
842 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
843 | - ], |
|
844 | - 'EventEspresso\core\domain\entities\users\CurrentUser' => [ |
|
845 | - 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache, |
|
846 | - ], |
|
847 | - 'EventEspresso\core\services\form\meta\InputTypes' => [ |
|
848 | - 'EventEspresso\core\services\form\meta\inputs\Block' => EE_Dependency_Map::load_from_cache, |
|
849 | - 'EventEspresso\core\services\form\meta\inputs\Button' => EE_Dependency_Map::load_from_cache, |
|
850 | - 'EventEspresso\core\services\form\meta\inputs\DateTime' => EE_Dependency_Map::load_from_cache, |
|
851 | - 'EventEspresso\core\services\form\meta\inputs\Input' => EE_Dependency_Map::load_from_cache, |
|
852 | - 'EventEspresso\core\services\form\meta\inputs\Number' => EE_Dependency_Map::load_from_cache, |
|
853 | - 'EventEspresso\core\services\form\meta\inputs\Phone' => EE_Dependency_Map::load_from_cache, |
|
854 | - 'EventEspresso\core\services\form\meta\inputs\Select' => EE_Dependency_Map::load_from_cache, |
|
855 | - 'EventEspresso\core\services\form\meta\inputs\Text' => EE_Dependency_Map::load_from_cache, |
|
856 | - ], |
|
857 | - 'EventEspresso\core\domain\services\registration\form\v1\RegFormDependencyHandler' => [ |
|
858 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
859 | - ], |
|
860 | - 'EventEspresso\core\services\calculators\LineItemCalculator' => [ |
|
861 | - 'EventEspresso\core\services\helpers\DecimalValues' => EE_Dependency_Map::load_from_cache, |
|
862 | - ], |
|
863 | - 'EventEspresso\core\services\helpers\DecimalValues' => [ |
|
864 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
865 | - ], |
|
866 | - ]; |
|
867 | - } |
|
868 | - |
|
869 | - |
|
870 | - /** |
|
871 | - * Registers how core classes are loaded. |
|
872 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
873 | - * 'EE_Request_Handler' => 'load_core' |
|
874 | - * 'EE_Messages_Queue' => 'load_lib' |
|
875 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
876 | - * or, if greater control is required, by providing a custom closure. For example: |
|
877 | - * 'Some_Class' => function () { |
|
878 | - * return new Some_Class(); |
|
879 | - * }, |
|
880 | - * This is required for instantiating dependencies |
|
881 | - * where an interface has been type hinted in a class constructor. For example: |
|
882 | - * 'Required_Interface' => function () { |
|
883 | - * return new A_Class_That_Implements_Required_Interface(); |
|
884 | - * }, |
|
885 | - */ |
|
886 | - protected function _register_core_class_loaders() |
|
887 | - { |
|
888 | - $this->_class_loaders = [ |
|
889 | - // load_core |
|
890 | - 'EE_Dependency_Map' => function () { |
|
891 | - return $this; |
|
892 | - }, |
|
893 | - 'EE_Capabilities' => 'load_core', |
|
894 | - 'EE_Encryption' => 'load_core', |
|
895 | - 'EE_Front_Controller' => 'load_core', |
|
896 | - 'EE_Module_Request_Router' => 'load_core', |
|
897 | - 'EE_Registry' => 'load_core', |
|
898 | - 'EE_Request' => function () { |
|
899 | - return $this->legacy_request; |
|
900 | - }, |
|
901 | - 'EventEspresso\core\services\request\Request' => function () { |
|
902 | - return $this->request; |
|
903 | - }, |
|
904 | - 'EventEspresso\core\services\request\Response' => function () { |
|
905 | - return $this->response; |
|
906 | - }, |
|
907 | - 'EE_Base' => 'load_core', |
|
908 | - 'EE_Request_Handler' => 'load_core', |
|
909 | - 'EE_Session' => 'load_core', |
|
910 | - 'EE_Cron_Tasks' => 'load_core', |
|
911 | - 'EE_System' => 'load_core', |
|
912 | - 'EE_Maintenance_Mode' => 'load_core', |
|
913 | - 'EE_Register_CPTs' => 'load_core', |
|
914 | - 'EE_Admin' => 'load_core', |
|
915 | - 'EE_CPT_Strategy' => 'load_core', |
|
916 | - // load_class |
|
917 | - 'EE_Registration_Processor' => 'load_class', |
|
918 | - // load_lib |
|
919 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
920 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
921 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
922 | - 'EE_Messenger_Collection' => 'load_lib', |
|
923 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
924 | - 'EE_Messages_Processor' => 'load_lib', |
|
925 | - 'EE_Message_Repository' => 'load_lib', |
|
926 | - 'EE_Messages_Queue' => 'load_lib', |
|
927 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
928 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
929 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
930 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
931 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
932 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
933 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
934 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
935 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
936 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
937 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
938 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
939 | - 'EE_DMS_Core_4_11_0' => 'load_dms', |
|
940 | - 'EE_DMS_Core_4_12_0' => 'load_dms', |
|
941 | - 'EE_Messages_Generator' => static function () { |
|
942 | - return EE_Registry::instance()->load_lib( |
|
943 | - 'Messages_Generator', |
|
944 | - [], |
|
945 | - false, |
|
946 | - false |
|
947 | - ); |
|
948 | - }, |
|
949 | - 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
950 | - return EE_Registry::instance()->load_lib( |
|
951 | - 'Messages_Template_Defaults', |
|
952 | - $arguments, |
|
953 | - false, |
|
954 | - false |
|
955 | - ); |
|
956 | - }, |
|
957 | - // load_helper |
|
958 | - 'EEH_Parse_Shortcodes' => static function () { |
|
959 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
960 | - return new EEH_Parse_Shortcodes(); |
|
961 | - } |
|
962 | - return null; |
|
963 | - }, |
|
964 | - 'EE_Template_Config' => static function () { |
|
965 | - return EE_Config::instance()->template_settings; |
|
966 | - }, |
|
967 | - 'EE_Currency_Config' => static function () { |
|
968 | - return EE_Currency_Config::getCurrencyConfig(); |
|
969 | - }, |
|
970 | - 'EE_Registration_Config' => static function () { |
|
971 | - return EE_Config::instance()->registration; |
|
972 | - }, |
|
973 | - 'EE_Core_Config' => static function () { |
|
974 | - return EE_Config::instance()->core; |
|
975 | - }, |
|
976 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
977 | - return LoaderFactory::getLoader(); |
|
978 | - }, |
|
979 | - 'EE_Network_Config' => static function () { |
|
980 | - return EE_Network_Config::instance(); |
|
981 | - }, |
|
982 | - 'EE_Config' => static function () { |
|
983 | - return EE_Config::instance(); |
|
984 | - }, |
|
985 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
986 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
987 | - }, |
|
988 | - 'EE_Admin_Config' => static function () { |
|
989 | - return EE_Config::instance()->admin; |
|
990 | - }, |
|
991 | - 'EE_Organization_Config' => static function () { |
|
992 | - return EE_Config::instance()->organization; |
|
993 | - }, |
|
994 | - 'EE_Network_Core_Config' => static function () { |
|
995 | - return EE_Network_Config::instance()->core; |
|
996 | - }, |
|
997 | - 'EE_Environment_Config' => static function () { |
|
998 | - return EE_Config::instance()->environment; |
|
999 | - }, |
|
1000 | - 'EED_Core_Rest_Api' => static function () { |
|
1001 | - return EED_Core_Rest_Api::instance(); |
|
1002 | - }, |
|
1003 | - 'WP_REST_Server' => static function () { |
|
1004 | - return rest_get_server(); |
|
1005 | - }, |
|
1006 | - 'EventEspresso\core\Psr4Autoloader' => static function () { |
|
1007 | - return EE_Psr4AutoloaderInit::psr4_loader(); |
|
1008 | - }, |
|
1009 | - 'EE_Ticket_Selector_Config' => function () { |
|
1010 | - return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1011 | - }, |
|
1012 | - ]; |
|
1013 | - } |
|
1014 | - |
|
1015 | - |
|
1016 | - /** |
|
1017 | - * can be used for supplying alternate names for classes, |
|
1018 | - * or for connecting interface names to instantiable classes |
|
1019 | - * |
|
1020 | - * @throws InvalidAliasException |
|
1021 | - */ |
|
1022 | - protected function _register_core_aliases() |
|
1023 | - { |
|
1024 | - $aliases = [ |
|
1025 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1026 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1027 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1028 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1029 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1030 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1031 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1032 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1033 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1034 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1035 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
1036 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1037 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1038 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1039 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1040 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
1041 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
1042 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1043 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1044 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1045 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1046 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1047 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1048 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1049 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1050 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1051 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1052 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1053 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1054 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1055 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1056 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1057 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1058 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1059 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1060 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1061 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1062 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
1063 | - 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest', |
|
1064 | - ]; |
|
1065 | - foreach ($aliases as $alias => $fqn) { |
|
1066 | - if (is_array($fqn)) { |
|
1067 | - foreach ($fqn as $class => $for_class) { |
|
1068 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
1069 | - } |
|
1070 | - continue; |
|
1071 | - } |
|
1072 | - $this->class_cache->addAlias($fqn, $alias); |
|
1073 | - } |
|
1074 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1075 | - $this->class_cache->addAlias( |
|
1076 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1077 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1078 | - ); |
|
1079 | - } |
|
1080 | - } |
|
1081 | - |
|
1082 | - |
|
1083 | - public function debug($for_class = '') |
|
1084 | - { |
|
1085 | - if (method_exists($this->class_cache, 'debug')) { |
|
1086 | - $this->class_cache->debug($for_class); |
|
1087 | - } |
|
1088 | - } |
|
1089 | - |
|
1090 | - |
|
1091 | - /** |
|
1092 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1093 | - * request Primarily used by unit tests. |
|
1094 | - */ |
|
1095 | - public function reset() |
|
1096 | - { |
|
1097 | - $this->_register_core_class_loaders(); |
|
1098 | - $this->_register_core_dependencies(); |
|
1099 | - } |
|
1100 | - |
|
1101 | - |
|
1102 | - /** |
|
1103 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
1104 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
1105 | - * WHY? |
|
1106 | - * Because if a class is type hinting for a concretion, |
|
1107 | - * then why would we need to find another class to supply it? |
|
1108 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1109 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1110 | - * Don't go looking for some substitute. |
|
1111 | - * Whereas if a class is type hinting for an interface... |
|
1112 | - * then we need to find an actual class to use. |
|
1113 | - * So the interface IS the alias for some other FQN, |
|
1114 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1115 | - * represents some other class. |
|
1116 | - * |
|
1117 | - * @param string $fqn |
|
1118 | - * @param string $for_class |
|
1119 | - * @return bool |
|
1120 | - * @deprecated 4.9.62.p |
|
1121 | - */ |
|
1122 | - public function has_alias(string $fqn = '', string $for_class = ''): bool |
|
1123 | - { |
|
1124 | - return $this->isAlias($fqn, $for_class); |
|
1125 | - } |
|
1126 | - |
|
1127 | - |
|
1128 | - /** |
|
1129 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1130 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1131 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1132 | - * for example: |
|
1133 | - * if the following two entries were added to the _aliases array: |
|
1134 | - * array( |
|
1135 | - * 'interface_alias' => 'some\namespace\interface' |
|
1136 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
1137 | - * ) |
|
1138 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1139 | - * to load an instance of 'some\namespace\classname' |
|
1140 | - * |
|
1141 | - * @param string $alias |
|
1142 | - * @param string $for_class |
|
1143 | - * @return string |
|
1144 | - * @deprecated 4.9.62.p |
|
1145 | - */ |
|
1146 | - public function get_alias(string $alias = '', string $for_class = ''): string |
|
1147 | - { |
|
1148 | - return $this->getFqnForAlias($alias, $for_class); |
|
1149 | - } |
|
24 | + /** |
|
25 | + * This means that the requested class dependency is not present in the dependency map |
|
26 | + */ |
|
27 | + const not_registered = 0; |
|
28 | + |
|
29 | + /** |
|
30 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
31 | + */ |
|
32 | + const load_new_object = 1; |
|
33 | + |
|
34 | + /** |
|
35 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
36 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
37 | + */ |
|
38 | + const load_from_cache = 2; |
|
39 | + |
|
40 | + /** |
|
41 | + * When registering a dependency, |
|
42 | + * this indicates to keep any existing dependencies that already exist, |
|
43 | + * and simply discard any new dependencies declared in the incoming data |
|
44 | + */ |
|
45 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
46 | + |
|
47 | + /** |
|
48 | + * When registering a dependency, |
|
49 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
50 | + */ |
|
51 | + const OVERWRITE_DEPENDENCIES = 1; |
|
52 | + |
|
53 | + /** |
|
54 | + * @type EE_Dependency_Map $_instance |
|
55 | + */ |
|
56 | + protected static $_instance; |
|
57 | + |
|
58 | + /** |
|
59 | + * @var ClassInterfaceCache $class_cache |
|
60 | + */ |
|
61 | + private $class_cache; |
|
62 | + |
|
63 | + /** |
|
64 | + * @type RequestInterface $request |
|
65 | + */ |
|
66 | + protected $request; |
|
67 | + |
|
68 | + /** |
|
69 | + * @type LegacyRequestInterface $legacy_request |
|
70 | + */ |
|
71 | + protected $legacy_request; |
|
72 | + |
|
73 | + /** |
|
74 | + * @type ResponseInterface $response |
|
75 | + */ |
|
76 | + protected $response; |
|
77 | + |
|
78 | + /** |
|
79 | + * @type LoaderInterface $loader |
|
80 | + */ |
|
81 | + protected $loader; |
|
82 | + |
|
83 | + /** |
|
84 | + * @type array $_dependency_map |
|
85 | + */ |
|
86 | + protected $_dependency_map = []; |
|
87 | + |
|
88 | + /** |
|
89 | + * @type array $_class_loaders |
|
90 | + */ |
|
91 | + protected $_class_loaders = []; |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * EE_Dependency_Map constructor. |
|
96 | + * |
|
97 | + * @param ClassInterfaceCache $class_cache |
|
98 | + */ |
|
99 | + protected function __construct(ClassInterfaceCache $class_cache) |
|
100 | + { |
|
101 | + $this->class_cache = $class_cache; |
|
102 | + do_action('EE_Dependency_Map____construct', $this); |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @return void |
|
108 | + * @throws InvalidAliasException |
|
109 | + */ |
|
110 | + public function initialize() |
|
111 | + { |
|
112 | + $this->_register_core_dependencies(); |
|
113 | + $this->_register_core_class_loaders(); |
|
114 | + $this->_register_core_aliases(); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * @singleton method used to instantiate class object |
|
120 | + * @param ClassInterfaceCache|null $class_cache |
|
121 | + * @return EE_Dependency_Map |
|
122 | + */ |
|
123 | + public static function instance(ClassInterfaceCache $class_cache = null): EE_Dependency_Map |
|
124 | + { |
|
125 | + // check if class object is instantiated, and instantiated properly |
|
126 | + if ( |
|
127 | + ! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map |
|
128 | + && $class_cache instanceof ClassInterfaceCache |
|
129 | + ) { |
|
130 | + EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache); |
|
131 | + } |
|
132 | + return EE_Dependency_Map::$_instance; |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * @param RequestInterface $request |
|
138 | + */ |
|
139 | + public function setRequest(RequestInterface $request) |
|
140 | + { |
|
141 | + $this->request = $request; |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + /** |
|
146 | + * @param LegacyRequestInterface $legacy_request |
|
147 | + */ |
|
148 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
149 | + { |
|
150 | + $this->legacy_request = $legacy_request; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + /** |
|
155 | + * @param ResponseInterface $response |
|
156 | + */ |
|
157 | + public function setResponse(ResponseInterface $response) |
|
158 | + { |
|
159 | + $this->response = $response; |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + /** |
|
164 | + * @param LoaderInterface $loader |
|
165 | + */ |
|
166 | + public function setLoader(LoaderInterface $loader) |
|
167 | + { |
|
168 | + $this->loader = $loader; |
|
169 | + } |
|
170 | + |
|
171 | + |
|
172 | + /** |
|
173 | + * @param string $class |
|
174 | + * @param array $dependencies |
|
175 | + * @param int $overwrite |
|
176 | + * @return bool |
|
177 | + */ |
|
178 | + public static function register_dependencies( |
|
179 | + string $class, |
|
180 | + array $dependencies, |
|
181 | + int $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
182 | + ): bool { |
|
183 | + return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
184 | + } |
|
185 | + |
|
186 | + |
|
187 | + /** |
|
188 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
189 | + * to the class specified by the first parameter. |
|
190 | + * IMPORTANT !!! |
|
191 | + * The order of elements in the incoming $dependencies array MUST match |
|
192 | + * the order of the constructor parameters for the class in question. |
|
193 | + * This is especially important when overriding any existing dependencies that are registered. |
|
194 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
195 | + * |
|
196 | + * @param string $class |
|
197 | + * @param array $dependencies |
|
198 | + * @param int $overwrite |
|
199 | + * @return bool |
|
200 | + */ |
|
201 | + public function registerDependencies( |
|
202 | + string $class, |
|
203 | + array $dependencies, |
|
204 | + int $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
205 | + ): bool { |
|
206 | + $class = trim($class, '\\'); |
|
207 | + $registered = false; |
|
208 | + if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
209 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
210 | + } |
|
211 | + // we need to make sure that any aliases used when registering a dependency |
|
212 | + // get resolved to the correct class name |
|
213 | + foreach ($dependencies as $dependency => $load_source) { |
|
214 | + $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
|
215 | + if ( |
|
216 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
217 | + || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
218 | + ) { |
|
219 | + unset($dependencies[ $dependency ]); |
|
220 | + $dependencies[ $alias ] = $load_source; |
|
221 | + $registered = true; |
|
222 | + } |
|
223 | + } |
|
224 | + // now add our two lists of dependencies together. |
|
225 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
226 | + // so $dependencies is NOT overwritten because it is listed first |
|
227 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
228 | + // Union is way faster than array_merge() but should be used with caution... |
|
229 | + // especially with numerically indexed arrays |
|
230 | + $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
231 | + // now we need to ensure that the resulting dependencies |
|
232 | + // array only has the entries that are required for the class |
|
233 | + // so first count how many dependencies were originally registered for the class |
|
234 | + $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
235 | + // if that count is non-zero (meaning dependencies were already registered) |
|
236 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
237 | + // then truncate the final array to match that count |
|
238 | + ? array_slice($dependencies, 0, $dependency_count) |
|
239 | + // otherwise just take the incoming array because nothing previously existed |
|
240 | + : $dependencies; |
|
241 | + return $registered; |
|
242 | + } |
|
243 | + |
|
244 | + |
|
245 | + /** |
|
246 | + * @param string $class_name |
|
247 | + * @param callable|string $loader |
|
248 | + * @param bool $overwrite |
|
249 | + * @return bool |
|
250 | + * @throws DomainException |
|
251 | + */ |
|
252 | + public static function register_class_loader( |
|
253 | + string $class_name, |
|
254 | + $loader = 'load_core', |
|
255 | + bool $overwrite = false |
|
256 | + ): bool { |
|
257 | + return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader, $overwrite); |
|
258 | + } |
|
259 | + |
|
260 | + |
|
261 | + /** |
|
262 | + * @param string $class_name |
|
263 | + * @param Closure|string $loader |
|
264 | + * @param bool $overwrite |
|
265 | + * @return bool |
|
266 | + * @throws DomainException |
|
267 | + */ |
|
268 | + public function registerClassLoader(string $class_name, $loader = 'load_core', bool $overwrite = false): bool |
|
269 | + { |
|
270 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
271 | + throw new DomainException( |
|
272 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
273 | + ); |
|
274 | + } |
|
275 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
276 | + if ( |
|
277 | + ! is_callable($loader) |
|
278 | + && ( |
|
279 | + strpos($loader, 'load_') !== 0 |
|
280 | + || ! method_exists('EE_Registry', $loader) |
|
281 | + ) |
|
282 | + ) { |
|
283 | + throw new DomainException( |
|
284 | + sprintf( |
|
285 | + esc_html__( |
|
286 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
287 | + 'event_espresso' |
|
288 | + ), |
|
289 | + $loader |
|
290 | + ) |
|
291 | + ); |
|
292 | + } |
|
293 | + $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
|
294 | + if ($overwrite || ! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
295 | + EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
296 | + return true; |
|
297 | + } |
|
298 | + return false; |
|
299 | + } |
|
300 | + |
|
301 | + |
|
302 | + /** |
|
303 | + * @return array |
|
304 | + */ |
|
305 | + public function dependency_map(): array |
|
306 | + { |
|
307 | + return $this->_dependency_map; |
|
308 | + } |
|
309 | + |
|
310 | + |
|
311 | + /** |
|
312 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
313 | + * |
|
314 | + * @param string $class_name |
|
315 | + * @return boolean |
|
316 | + */ |
|
317 | + public function has(string $class_name = ''): bool |
|
318 | + { |
|
319 | + // all legacy models have the same dependencies |
|
320 | + if (strpos($class_name, 'EEM_') === 0) { |
|
321 | + $class_name = 'LEGACY_MODELS'; |
|
322 | + } |
|
323 | + return isset($this->_dependency_map[ $class_name ]); |
|
324 | + } |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
329 | + * |
|
330 | + * @param string $class_name |
|
331 | + * @param string $dependency |
|
332 | + * @return bool |
|
333 | + */ |
|
334 | + public function has_dependency_for_class(string $class_name = '', string $dependency = ''): bool |
|
335 | + { |
|
336 | + // all legacy models have the same dependencies |
|
337 | + if (strpos($class_name, 'EEM_') === 0) { |
|
338 | + $class_name = 'LEGACY_MODELS'; |
|
339 | + } |
|
340 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
341 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
342 | + } |
|
343 | + |
|
344 | + |
|
345 | + /** |
|
346 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
347 | + * |
|
348 | + * @param string $class_name |
|
349 | + * @param string $dependency |
|
350 | + * @return int |
|
351 | + */ |
|
352 | + public function loading_strategy_for_class_dependency(string $class_name = '', string $dependency = ''): int |
|
353 | + { |
|
354 | + // all legacy models have the same dependencies |
|
355 | + if (strpos($class_name, 'EEM_') === 0) { |
|
356 | + $class_name = 'LEGACY_MODELS'; |
|
357 | + } |
|
358 | + $dependency = $this->getFqnForAlias($dependency); |
|
359 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
360 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
361 | + : EE_Dependency_Map::not_registered; |
|
362 | + } |
|
363 | + |
|
364 | + |
|
365 | + /** |
|
366 | + * @param string $class_name |
|
367 | + * @return string | Closure |
|
368 | + */ |
|
369 | + public function class_loader(string $class_name) |
|
370 | + { |
|
371 | + // all legacy models use load_model() |
|
372 | + if (strpos($class_name, 'EEM_') === 0) { |
|
373 | + return 'load_model'; |
|
374 | + } |
|
375 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
376 | + // perform strpos() first to avoid loading regex every time we load a class |
|
377 | + if ( |
|
378 | + strpos($class_name, 'EE_CPT_') === 0 |
|
379 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
380 | + ) { |
|
381 | + return 'load_core'; |
|
382 | + } |
|
383 | + $class_name = $this->getFqnForAlias($class_name); |
|
384 | + return $this->_class_loaders[ $class_name ] ?? ''; |
|
385 | + } |
|
386 | + |
|
387 | + |
|
388 | + /** |
|
389 | + * @return array |
|
390 | + */ |
|
391 | + public function class_loaders(): array |
|
392 | + { |
|
393 | + return $this->_class_loaders; |
|
394 | + } |
|
395 | + |
|
396 | + |
|
397 | + /** |
|
398 | + * adds an alias for a classname |
|
399 | + * |
|
400 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
401 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
402 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
403 | + * @throws InvalidAliasException |
|
404 | + */ |
|
405 | + public function add_alias(string $fqcn, string $alias, string $for_class = '') |
|
406 | + { |
|
407 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
408 | + } |
|
409 | + |
|
410 | + |
|
411 | + /** |
|
412 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
413 | + * WHY? |
|
414 | + * Because if a class is type hinting for a concretion, |
|
415 | + * then why would we need to find another class to supply it? |
|
416 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
417 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
418 | + * Don't go looking for some substitute. |
|
419 | + * Whereas if a class is type hinting for an interface... |
|
420 | + * then we need to find an actual class to use. |
|
421 | + * So the interface IS the alias for some other FQN, |
|
422 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
423 | + * represents some other class. |
|
424 | + * |
|
425 | + * @param string $fqn |
|
426 | + * @param string $for_class |
|
427 | + * @return bool |
|
428 | + */ |
|
429 | + public function isAlias(string $fqn = '', string $for_class = ''): bool |
|
430 | + { |
|
431 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
432 | + } |
|
433 | + |
|
434 | + |
|
435 | + /** |
|
436 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
437 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
438 | + * for example: |
|
439 | + * if the following two entries were added to the _aliases array: |
|
440 | + * array( |
|
441 | + * 'interface_alias' => 'some\namespace\interface' |
|
442 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
443 | + * ) |
|
444 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
445 | + * to load an instance of 'some\namespace\classname' |
|
446 | + * |
|
447 | + * @param string $alias |
|
448 | + * @param string $for_class |
|
449 | + * @return string |
|
450 | + */ |
|
451 | + public function getFqnForAlias(string $alias = '', string $for_class = ''): string |
|
452 | + { |
|
453 | + return $this->class_cache->getFqnForAlias($alias, $for_class); |
|
454 | + } |
|
455 | + |
|
456 | + |
|
457 | + /** |
|
458 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
459 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
460 | + * This is done by using the following class constants: |
|
461 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
462 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
463 | + */ |
|
464 | + protected function _register_core_dependencies() |
|
465 | + { |
|
466 | + $this->_dependency_map = [ |
|
467 | + 'EE_Admin' => [ |
|
468 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
469 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
470 | + ], |
|
471 | + 'EE_Request_Handler' => [ |
|
472 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
473 | + 'EventEspresso\core\services\request\Response' => EE_Dependency_Map::load_from_cache, |
|
474 | + ], |
|
475 | + 'EE_System' => [ |
|
476 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
477 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
478 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
479 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
480 | + 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache, |
|
481 | + ], |
|
482 | + 'EE_Session' => [ |
|
483 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
484 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
485 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
486 | + 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
487 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
488 | + ], |
|
489 | + 'EE_Cart' => [ |
|
490 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
491 | + ], |
|
492 | + 'EE_Messenger_Collection_Loader' => [ |
|
493 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
494 | + ], |
|
495 | + 'EE_Message_Type_Collection_Loader' => [ |
|
496 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
497 | + ], |
|
498 | + 'EE_Message_Resource_Manager' => [ |
|
499 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
500 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
501 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
502 | + ], |
|
503 | + 'EE_Message_Factory' => [ |
|
504 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
505 | + ], |
|
506 | + 'EE_messages' => [ |
|
507 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
508 | + ], |
|
509 | + 'EE_Messages_Generator' => [ |
|
510 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
511 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
512 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
513 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
514 | + ], |
|
515 | + 'EE_Messages_Processor' => [ |
|
516 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
517 | + ], |
|
518 | + 'EE_Messages_Queue' => [ |
|
519 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
520 | + ], |
|
521 | + 'EE_Messages_Template_Defaults' => [ |
|
522 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
523 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
524 | + ], |
|
525 | + 'EE_Message_To_Generate_From_Request' => [ |
|
526 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
527 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
528 | + ], |
|
529 | + 'EventEspresso\core\services\commands\CommandBus' => [ |
|
530 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
531 | + ], |
|
532 | + 'EventEspresso\services\commands\CommandHandler' => [ |
|
533 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
534 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
535 | + ], |
|
536 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
537 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
538 | + ], |
|
539 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
540 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
541 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
542 | + ], |
|
543 | + 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
544 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
545 | + ], |
|
546 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
547 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
548 | + ], |
|
549 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
550 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
551 | + ], |
|
552 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
553 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
554 | + ], |
|
555 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
556 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
557 | + ], |
|
558 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
559 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
560 | + ], |
|
561 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
562 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
563 | + ], |
|
564 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
565 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
566 | + ], |
|
567 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
568 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
569 | + ], |
|
570 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
571 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
572 | + ], |
|
573 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
574 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
575 | + ], |
|
576 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
577 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
578 | + ], |
|
579 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
580 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
581 | + ], |
|
582 | + 'EventEspresso\core\services\database\TableManager' => [ |
|
583 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
584 | + ], |
|
585 | + 'EE_Data_Migration_Class_Base' => [ |
|
586 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | + ], |
|
589 | + 'EE_DMS_Core_4_1_0' => [ |
|
590 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | + ], |
|
593 | + 'EE_DMS_Core_4_2_0' => [ |
|
594 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | + ], |
|
597 | + 'EE_DMS_Core_4_3_0' => [ |
|
598 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | + ], |
|
601 | + 'EE_DMS_Core_4_4_0' => [ |
|
602 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | + ], |
|
605 | + 'EE_DMS_Core_4_5_0' => [ |
|
606 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | + ], |
|
609 | + 'EE_DMS_Core_4_6_0' => [ |
|
610 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | + ], |
|
613 | + 'EE_DMS_Core_4_7_0' => [ |
|
614 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
615 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
616 | + ], |
|
617 | + 'EE_DMS_Core_4_8_0' => [ |
|
618 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
619 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
620 | + ], |
|
621 | + 'EE_DMS_Core_4_9_0' => [ |
|
622 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
623 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
624 | + ], |
|
625 | + 'EE_DMS_Core_4_10_0' => [ |
|
626 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
627 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
628 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
629 | + ], |
|
630 | + 'EE_DMS_Core_4_11_0' => [ |
|
631 | + 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache, |
|
632 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
633 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
634 | + ], |
|
635 | + 'EE_DMS_Core_4_12_0' => [ |
|
636 | + 'EE_DMS_Core_4_11_0' => EE_Dependency_Map::load_from_cache, |
|
637 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
638 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
639 | + ], |
|
640 | + 'EventEspresso\core\services\assets\I18nRegistry' => [ |
|
641 | + [], |
|
642 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
643 | + ], |
|
644 | + 'EventEspresso\core\services\assets\Registry' => [ |
|
645 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
646 | + 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache, |
|
647 | + ], |
|
648 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => [ |
|
649 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
650 | + ], |
|
651 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => [ |
|
652 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
653 | + ], |
|
654 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => [ |
|
655 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
656 | + ], |
|
657 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => [ |
|
658 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
659 | + ], |
|
660 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => [ |
|
661 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
662 | + ], |
|
663 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => [ |
|
664 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
665 | + ], |
|
666 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => [ |
|
667 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
668 | + ], |
|
669 | + 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
670 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
671 | + ], |
|
672 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
673 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
674 | + ], |
|
675 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
676 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
677 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
678 | + ], |
|
679 | + 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
680 | + null, |
|
681 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
682 | + ], |
|
683 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
684 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
685 | + ], |
|
686 | + 'LEGACY_MODELS' => [ |
|
687 | + null, |
|
688 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
689 | + ], |
|
690 | + 'EE_Module_Request_Router' => [ |
|
691 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
692 | + ], |
|
693 | + 'EE_Registration_Processor' => [ |
|
694 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
695 | + ], |
|
696 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
697 | + null, |
|
698 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
699 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
700 | + ], |
|
701 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
702 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
703 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
704 | + ], |
|
705 | + 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
706 | + 'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
707 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
708 | + 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
709 | + ], |
|
710 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
711 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
712 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
713 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
714 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
715 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
716 | + ], |
|
717 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
718 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
719 | + ], |
|
720 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
721 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
722 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
723 | + ], |
|
724 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
725 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
726 | + ], |
|
727 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
728 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
729 | + ], |
|
730 | + 'EE_CPT_Strategy' => [ |
|
731 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
732 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
733 | + ], |
|
734 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
735 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
736 | + ], |
|
737 | + 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
738 | + null, |
|
739 | + null, |
|
740 | + null, |
|
741 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
742 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
743 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
744 | + ], |
|
745 | + 'EventEspresso\core\services\dependencies\DependencyResolver' => [ |
|
746 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
747 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
748 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
749 | + ], |
|
750 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [ |
|
751 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
752 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
753 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
754 | + ], |
|
755 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [ |
|
756 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
757 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
758 | + ], |
|
759 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [ |
|
760 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
761 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
762 | + ], |
|
763 | + 'EE_URL_Validation_Strategy' => [ |
|
764 | + null, |
|
765 | + null, |
|
766 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
767 | + ], |
|
768 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
769 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
770 | + ], |
|
771 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
772 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
773 | + ], |
|
774 | + 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
775 | + 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
776 | + 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
777 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
778 | + null, |
|
779 | + ], |
|
780 | + 'EventEspresso\core\services\routing\RouteHandler' => [ |
|
781 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache, |
|
782 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
783 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
784 | + 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache, |
|
785 | + ], |
|
786 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => [ |
|
787 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
788 | + ], |
|
789 | + 'EventEspresso\core\services\routing\Router' => [ |
|
790 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
791 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
792 | + 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache, |
|
793 | + ], |
|
794 | + 'EventEspresso\core\services\assets\AssetManifest' => [ |
|
795 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
796 | + ], |
|
797 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => [ |
|
798 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
799 | + ], |
|
800 | + 'EventEspresso\core\services\assets\BaristaFactory' => [ |
|
801 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache, |
|
802 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
803 | + ], |
|
804 | + 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [ |
|
805 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
806 | + ], |
|
807 | + 'EventEspresso\core\services\addon\AddonManager' => [ |
|
808 | + 'EventEspresso\core\services\addon\AddonCollection' => EE_Dependency_Map::load_from_cache, |
|
809 | + 'EventEspresso\core\Psr4Autoloader' => EE_Dependency_Map::load_from_cache, |
|
810 | + 'EventEspresso\core\services\addon\api\v1\RegisterAddon' => EE_Dependency_Map::load_from_cache, |
|
811 | + 'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache, |
|
812 | + 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => EE_Dependency_Map::load_from_cache, |
|
813 | + ], |
|
814 | + 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [ |
|
815 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
816 | + ], |
|
817 | + 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
818 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
819 | + ], |
|
820 | + 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
821 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
822 | + ], |
|
823 | + 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
824 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
825 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
826 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
827 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
828 | + ], |
|
829 | + 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
830 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
831 | + ], |
|
832 | + 'EventEspresso\core\services\request\CurrentPage' => [ |
|
833 | + 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
834 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
835 | + ], |
|
836 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
837 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
838 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
839 | + ], |
|
840 | + 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
841 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
842 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
843 | + ], |
|
844 | + 'EventEspresso\core\domain\entities\users\CurrentUser' => [ |
|
845 | + 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache, |
|
846 | + ], |
|
847 | + 'EventEspresso\core\services\form\meta\InputTypes' => [ |
|
848 | + 'EventEspresso\core\services\form\meta\inputs\Block' => EE_Dependency_Map::load_from_cache, |
|
849 | + 'EventEspresso\core\services\form\meta\inputs\Button' => EE_Dependency_Map::load_from_cache, |
|
850 | + 'EventEspresso\core\services\form\meta\inputs\DateTime' => EE_Dependency_Map::load_from_cache, |
|
851 | + 'EventEspresso\core\services\form\meta\inputs\Input' => EE_Dependency_Map::load_from_cache, |
|
852 | + 'EventEspresso\core\services\form\meta\inputs\Number' => EE_Dependency_Map::load_from_cache, |
|
853 | + 'EventEspresso\core\services\form\meta\inputs\Phone' => EE_Dependency_Map::load_from_cache, |
|
854 | + 'EventEspresso\core\services\form\meta\inputs\Select' => EE_Dependency_Map::load_from_cache, |
|
855 | + 'EventEspresso\core\services\form\meta\inputs\Text' => EE_Dependency_Map::load_from_cache, |
|
856 | + ], |
|
857 | + 'EventEspresso\core\domain\services\registration\form\v1\RegFormDependencyHandler' => [ |
|
858 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
859 | + ], |
|
860 | + 'EventEspresso\core\services\calculators\LineItemCalculator' => [ |
|
861 | + 'EventEspresso\core\services\helpers\DecimalValues' => EE_Dependency_Map::load_from_cache, |
|
862 | + ], |
|
863 | + 'EventEspresso\core\services\helpers\DecimalValues' => [ |
|
864 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
865 | + ], |
|
866 | + ]; |
|
867 | + } |
|
868 | + |
|
869 | + |
|
870 | + /** |
|
871 | + * Registers how core classes are loaded. |
|
872 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
873 | + * 'EE_Request_Handler' => 'load_core' |
|
874 | + * 'EE_Messages_Queue' => 'load_lib' |
|
875 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
876 | + * or, if greater control is required, by providing a custom closure. For example: |
|
877 | + * 'Some_Class' => function () { |
|
878 | + * return new Some_Class(); |
|
879 | + * }, |
|
880 | + * This is required for instantiating dependencies |
|
881 | + * where an interface has been type hinted in a class constructor. For example: |
|
882 | + * 'Required_Interface' => function () { |
|
883 | + * return new A_Class_That_Implements_Required_Interface(); |
|
884 | + * }, |
|
885 | + */ |
|
886 | + protected function _register_core_class_loaders() |
|
887 | + { |
|
888 | + $this->_class_loaders = [ |
|
889 | + // load_core |
|
890 | + 'EE_Dependency_Map' => function () { |
|
891 | + return $this; |
|
892 | + }, |
|
893 | + 'EE_Capabilities' => 'load_core', |
|
894 | + 'EE_Encryption' => 'load_core', |
|
895 | + 'EE_Front_Controller' => 'load_core', |
|
896 | + 'EE_Module_Request_Router' => 'load_core', |
|
897 | + 'EE_Registry' => 'load_core', |
|
898 | + 'EE_Request' => function () { |
|
899 | + return $this->legacy_request; |
|
900 | + }, |
|
901 | + 'EventEspresso\core\services\request\Request' => function () { |
|
902 | + return $this->request; |
|
903 | + }, |
|
904 | + 'EventEspresso\core\services\request\Response' => function () { |
|
905 | + return $this->response; |
|
906 | + }, |
|
907 | + 'EE_Base' => 'load_core', |
|
908 | + 'EE_Request_Handler' => 'load_core', |
|
909 | + 'EE_Session' => 'load_core', |
|
910 | + 'EE_Cron_Tasks' => 'load_core', |
|
911 | + 'EE_System' => 'load_core', |
|
912 | + 'EE_Maintenance_Mode' => 'load_core', |
|
913 | + 'EE_Register_CPTs' => 'load_core', |
|
914 | + 'EE_Admin' => 'load_core', |
|
915 | + 'EE_CPT_Strategy' => 'load_core', |
|
916 | + // load_class |
|
917 | + 'EE_Registration_Processor' => 'load_class', |
|
918 | + // load_lib |
|
919 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
920 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
921 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
922 | + 'EE_Messenger_Collection' => 'load_lib', |
|
923 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
924 | + 'EE_Messages_Processor' => 'load_lib', |
|
925 | + 'EE_Message_Repository' => 'load_lib', |
|
926 | + 'EE_Messages_Queue' => 'load_lib', |
|
927 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
928 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
929 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
930 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
931 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
932 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
933 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
934 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
935 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
936 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
937 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
938 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
939 | + 'EE_DMS_Core_4_11_0' => 'load_dms', |
|
940 | + 'EE_DMS_Core_4_12_0' => 'load_dms', |
|
941 | + 'EE_Messages_Generator' => static function () { |
|
942 | + return EE_Registry::instance()->load_lib( |
|
943 | + 'Messages_Generator', |
|
944 | + [], |
|
945 | + false, |
|
946 | + false |
|
947 | + ); |
|
948 | + }, |
|
949 | + 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
950 | + return EE_Registry::instance()->load_lib( |
|
951 | + 'Messages_Template_Defaults', |
|
952 | + $arguments, |
|
953 | + false, |
|
954 | + false |
|
955 | + ); |
|
956 | + }, |
|
957 | + // load_helper |
|
958 | + 'EEH_Parse_Shortcodes' => static function () { |
|
959 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
960 | + return new EEH_Parse_Shortcodes(); |
|
961 | + } |
|
962 | + return null; |
|
963 | + }, |
|
964 | + 'EE_Template_Config' => static function () { |
|
965 | + return EE_Config::instance()->template_settings; |
|
966 | + }, |
|
967 | + 'EE_Currency_Config' => static function () { |
|
968 | + return EE_Currency_Config::getCurrencyConfig(); |
|
969 | + }, |
|
970 | + 'EE_Registration_Config' => static function () { |
|
971 | + return EE_Config::instance()->registration; |
|
972 | + }, |
|
973 | + 'EE_Core_Config' => static function () { |
|
974 | + return EE_Config::instance()->core; |
|
975 | + }, |
|
976 | + 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
977 | + return LoaderFactory::getLoader(); |
|
978 | + }, |
|
979 | + 'EE_Network_Config' => static function () { |
|
980 | + return EE_Network_Config::instance(); |
|
981 | + }, |
|
982 | + 'EE_Config' => static function () { |
|
983 | + return EE_Config::instance(); |
|
984 | + }, |
|
985 | + 'EventEspresso\core\domain\Domain' => static function () { |
|
986 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
987 | + }, |
|
988 | + 'EE_Admin_Config' => static function () { |
|
989 | + return EE_Config::instance()->admin; |
|
990 | + }, |
|
991 | + 'EE_Organization_Config' => static function () { |
|
992 | + return EE_Config::instance()->organization; |
|
993 | + }, |
|
994 | + 'EE_Network_Core_Config' => static function () { |
|
995 | + return EE_Network_Config::instance()->core; |
|
996 | + }, |
|
997 | + 'EE_Environment_Config' => static function () { |
|
998 | + return EE_Config::instance()->environment; |
|
999 | + }, |
|
1000 | + 'EED_Core_Rest_Api' => static function () { |
|
1001 | + return EED_Core_Rest_Api::instance(); |
|
1002 | + }, |
|
1003 | + 'WP_REST_Server' => static function () { |
|
1004 | + return rest_get_server(); |
|
1005 | + }, |
|
1006 | + 'EventEspresso\core\Psr4Autoloader' => static function () { |
|
1007 | + return EE_Psr4AutoloaderInit::psr4_loader(); |
|
1008 | + }, |
|
1009 | + 'EE_Ticket_Selector_Config' => function () { |
|
1010 | + return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1011 | + }, |
|
1012 | + ]; |
|
1013 | + } |
|
1014 | + |
|
1015 | + |
|
1016 | + /** |
|
1017 | + * can be used for supplying alternate names for classes, |
|
1018 | + * or for connecting interface names to instantiable classes |
|
1019 | + * |
|
1020 | + * @throws InvalidAliasException |
|
1021 | + */ |
|
1022 | + protected function _register_core_aliases() |
|
1023 | + { |
|
1024 | + $aliases = [ |
|
1025 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1026 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1027 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1028 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1029 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1030 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1031 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1032 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1033 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1034 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1035 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
1036 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1037 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1038 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1039 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1040 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
1041 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
1042 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1043 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1044 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1045 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1046 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1047 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1048 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1049 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1050 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1051 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1052 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1053 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1054 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1055 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1056 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1057 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1058 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1059 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1060 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1061 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1062 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
1063 | + 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest', |
|
1064 | + ]; |
|
1065 | + foreach ($aliases as $alias => $fqn) { |
|
1066 | + if (is_array($fqn)) { |
|
1067 | + foreach ($fqn as $class => $for_class) { |
|
1068 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
1069 | + } |
|
1070 | + continue; |
|
1071 | + } |
|
1072 | + $this->class_cache->addAlias($fqn, $alias); |
|
1073 | + } |
|
1074 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1075 | + $this->class_cache->addAlias( |
|
1076 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1077 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1078 | + ); |
|
1079 | + } |
|
1080 | + } |
|
1081 | + |
|
1082 | + |
|
1083 | + public function debug($for_class = '') |
|
1084 | + { |
|
1085 | + if (method_exists($this->class_cache, 'debug')) { |
|
1086 | + $this->class_cache->debug($for_class); |
|
1087 | + } |
|
1088 | + } |
|
1089 | + |
|
1090 | + |
|
1091 | + /** |
|
1092 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1093 | + * request Primarily used by unit tests. |
|
1094 | + */ |
|
1095 | + public function reset() |
|
1096 | + { |
|
1097 | + $this->_register_core_class_loaders(); |
|
1098 | + $this->_register_core_dependencies(); |
|
1099 | + } |
|
1100 | + |
|
1101 | + |
|
1102 | + /** |
|
1103 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
1104 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
1105 | + * WHY? |
|
1106 | + * Because if a class is type hinting for a concretion, |
|
1107 | + * then why would we need to find another class to supply it? |
|
1108 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1109 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1110 | + * Don't go looking for some substitute. |
|
1111 | + * Whereas if a class is type hinting for an interface... |
|
1112 | + * then we need to find an actual class to use. |
|
1113 | + * So the interface IS the alias for some other FQN, |
|
1114 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1115 | + * represents some other class. |
|
1116 | + * |
|
1117 | + * @param string $fqn |
|
1118 | + * @param string $for_class |
|
1119 | + * @return bool |
|
1120 | + * @deprecated 4.9.62.p |
|
1121 | + */ |
|
1122 | + public function has_alias(string $fqn = '', string $for_class = ''): bool |
|
1123 | + { |
|
1124 | + return $this->isAlias($fqn, $for_class); |
|
1125 | + } |
|
1126 | + |
|
1127 | + |
|
1128 | + /** |
|
1129 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1130 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1131 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1132 | + * for example: |
|
1133 | + * if the following two entries were added to the _aliases array: |
|
1134 | + * array( |
|
1135 | + * 'interface_alias' => 'some\namespace\interface' |
|
1136 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
1137 | + * ) |
|
1138 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1139 | + * to load an instance of 'some\namespace\classname' |
|
1140 | + * |
|
1141 | + * @param string $alias |
|
1142 | + * @param string $for_class |
|
1143 | + * @return string |
|
1144 | + * @deprecated 4.9.62.p |
|
1145 | + */ |
|
1146 | + public function get_alias(string $alias = '', string $for_class = ''): string |
|
1147 | + { |
|
1148 | + return $this->getFqnForAlias($alias, $for_class); |
|
1149 | + } |
|
1150 | 1150 | } |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | ): bool { |
206 | 206 | $class = trim($class, '\\'); |
207 | 207 | $registered = false; |
208 | - if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
209 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
208 | + if (empty(EE_Dependency_Map::$_instance->_dependency_map[$class])) { |
|
209 | + EE_Dependency_Map::$_instance->_dependency_map[$class] = []; |
|
210 | 210 | } |
211 | 211 | // we need to make sure that any aliases used when registering a dependency |
212 | 212 | // get resolved to the correct class name |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
215 | 215 | if ( |
216 | 216 | $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
217 | - || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
217 | + || ! isset(EE_Dependency_Map::$_instance->_dependency_map[$class][$alias]) |
|
218 | 218 | ) { |
219 | - unset($dependencies[ $dependency ]); |
|
220 | - $dependencies[ $alias ] = $load_source; |
|
219 | + unset($dependencies[$dependency]); |
|
220 | + $dependencies[$alias] = $load_source; |
|
221 | 221 | $registered = true; |
222 | 222 | } |
223 | 223 | } |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
228 | 228 | // Union is way faster than array_merge() but should be used with caution... |
229 | 229 | // especially with numerically indexed arrays |
230 | - $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
230 | + $dependencies += EE_Dependency_Map::$_instance->_dependency_map[$class]; |
|
231 | 231 | // now we need to ensure that the resulting dependencies |
232 | 232 | // array only has the entries that are required for the class |
233 | 233 | // so first count how many dependencies were originally registered for the class |
234 | - $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
234 | + $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[$class]); |
|
235 | 235 | // if that count is non-zero (meaning dependencies were already registered) |
236 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
236 | + EE_Dependency_Map::$_instance->_dependency_map[$class] = $dependency_count |
|
237 | 237 | // then truncate the final array to match that count |
238 | 238 | ? array_slice($dependencies, 0, $dependency_count) |
239 | 239 | // otherwise just take the incoming array because nothing previously existed |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function registerClassLoader(string $class_name, $loader = 'load_core', bool $overwrite = false): bool |
269 | 269 | { |
270 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
270 | + if ( ! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
271 | 271 | throw new DomainException( |
272 | 272 | esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
273 | 273 | ); |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | ); |
292 | 292 | } |
293 | 293 | $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
294 | - if ($overwrite || ! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
295 | - EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
294 | + if ($overwrite || ! isset(EE_Dependency_Map::$_instance->_class_loaders[$class_name])) { |
|
295 | + EE_Dependency_Map::$_instance->_class_loaders[$class_name] = $loader; |
|
296 | 296 | return true; |
297 | 297 | } |
298 | 298 | return false; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | if (strpos($class_name, 'EEM_') === 0) { |
321 | 321 | $class_name = 'LEGACY_MODELS'; |
322 | 322 | } |
323 | - return isset($this->_dependency_map[ $class_name ]); |
|
323 | + return isset($this->_dependency_map[$class_name]); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $class_name = 'LEGACY_MODELS'; |
339 | 339 | } |
340 | 340 | $dependency = $this->getFqnForAlias($dependency, $class_name); |
341 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
341 | + return isset($this->_dependency_map[$class_name][$dependency]); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | } |
358 | 358 | $dependency = $this->getFqnForAlias($dependency); |
359 | 359 | return $this->has_dependency_for_class($class_name, $dependency) |
360 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
360 | + ? $this->_dependency_map[$class_name][$dependency] |
|
361 | 361 | : EE_Dependency_Map::not_registered; |
362 | 362 | } |
363 | 363 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | return 'load_core'; |
382 | 382 | } |
383 | 383 | $class_name = $this->getFqnForAlias($class_name); |
384 | - return $this->_class_loaders[ $class_name ] ?? ''; |
|
384 | + return $this->_class_loaders[$class_name] ?? ''; |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | { |
888 | 888 | $this->_class_loaders = [ |
889 | 889 | // load_core |
890 | - 'EE_Dependency_Map' => function () { |
|
890 | + 'EE_Dependency_Map' => function() { |
|
891 | 891 | return $this; |
892 | 892 | }, |
893 | 893 | 'EE_Capabilities' => 'load_core', |
@@ -895,13 +895,13 @@ discard block |
||
895 | 895 | 'EE_Front_Controller' => 'load_core', |
896 | 896 | 'EE_Module_Request_Router' => 'load_core', |
897 | 897 | 'EE_Registry' => 'load_core', |
898 | - 'EE_Request' => function () { |
|
898 | + 'EE_Request' => function() { |
|
899 | 899 | return $this->legacy_request; |
900 | 900 | }, |
901 | - 'EventEspresso\core\services\request\Request' => function () { |
|
901 | + 'EventEspresso\core\services\request\Request' => function() { |
|
902 | 902 | return $this->request; |
903 | 903 | }, |
904 | - 'EventEspresso\core\services\request\Response' => function () { |
|
904 | + 'EventEspresso\core\services\request\Response' => function() { |
|
905 | 905 | return $this->response; |
906 | 906 | }, |
907 | 907 | 'EE_Base' => 'load_core', |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | 'EE_DMS_Core_4_10_0' => 'load_dms', |
939 | 939 | 'EE_DMS_Core_4_11_0' => 'load_dms', |
940 | 940 | 'EE_DMS_Core_4_12_0' => 'load_dms', |
941 | - 'EE_Messages_Generator' => static function () { |
|
941 | + 'EE_Messages_Generator' => static function() { |
|
942 | 942 | return EE_Registry::instance()->load_lib( |
943 | 943 | 'Messages_Generator', |
944 | 944 | [], |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | false |
947 | 947 | ); |
948 | 948 | }, |
949 | - 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
949 | + 'EE_Messages_Template_Defaults' => static function($arguments = []) { |
|
950 | 950 | return EE_Registry::instance()->load_lib( |
951 | 951 | 'Messages_Template_Defaults', |
952 | 952 | $arguments, |
@@ -955,58 +955,58 @@ discard block |
||
955 | 955 | ); |
956 | 956 | }, |
957 | 957 | // load_helper |
958 | - 'EEH_Parse_Shortcodes' => static function () { |
|
958 | + 'EEH_Parse_Shortcodes' => static function() { |
|
959 | 959 | if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
960 | 960 | return new EEH_Parse_Shortcodes(); |
961 | 961 | } |
962 | 962 | return null; |
963 | 963 | }, |
964 | - 'EE_Template_Config' => static function () { |
|
964 | + 'EE_Template_Config' => static function() { |
|
965 | 965 | return EE_Config::instance()->template_settings; |
966 | 966 | }, |
967 | - 'EE_Currency_Config' => static function () { |
|
967 | + 'EE_Currency_Config' => static function() { |
|
968 | 968 | return EE_Currency_Config::getCurrencyConfig(); |
969 | 969 | }, |
970 | - 'EE_Registration_Config' => static function () { |
|
970 | + 'EE_Registration_Config' => static function() { |
|
971 | 971 | return EE_Config::instance()->registration; |
972 | 972 | }, |
973 | - 'EE_Core_Config' => static function () { |
|
973 | + 'EE_Core_Config' => static function() { |
|
974 | 974 | return EE_Config::instance()->core; |
975 | 975 | }, |
976 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
976 | + 'EventEspresso\core\services\loaders\Loader' => static function() { |
|
977 | 977 | return LoaderFactory::getLoader(); |
978 | 978 | }, |
979 | - 'EE_Network_Config' => static function () { |
|
979 | + 'EE_Network_Config' => static function() { |
|
980 | 980 | return EE_Network_Config::instance(); |
981 | 981 | }, |
982 | - 'EE_Config' => static function () { |
|
982 | + 'EE_Config' => static function() { |
|
983 | 983 | return EE_Config::instance(); |
984 | 984 | }, |
985 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
985 | + 'EventEspresso\core\domain\Domain' => static function() { |
|
986 | 986 | return DomainFactory::getEventEspressoCoreDomain(); |
987 | 987 | }, |
988 | - 'EE_Admin_Config' => static function () { |
|
988 | + 'EE_Admin_Config' => static function() { |
|
989 | 989 | return EE_Config::instance()->admin; |
990 | 990 | }, |
991 | - 'EE_Organization_Config' => static function () { |
|
991 | + 'EE_Organization_Config' => static function() { |
|
992 | 992 | return EE_Config::instance()->organization; |
993 | 993 | }, |
994 | - 'EE_Network_Core_Config' => static function () { |
|
994 | + 'EE_Network_Core_Config' => static function() { |
|
995 | 995 | return EE_Network_Config::instance()->core; |
996 | 996 | }, |
997 | - 'EE_Environment_Config' => static function () { |
|
997 | + 'EE_Environment_Config' => static function() { |
|
998 | 998 | return EE_Config::instance()->environment; |
999 | 999 | }, |
1000 | - 'EED_Core_Rest_Api' => static function () { |
|
1000 | + 'EED_Core_Rest_Api' => static function() { |
|
1001 | 1001 | return EED_Core_Rest_Api::instance(); |
1002 | 1002 | }, |
1003 | - 'WP_REST_Server' => static function () { |
|
1003 | + 'WP_REST_Server' => static function() { |
|
1004 | 1004 | return rest_get_server(); |
1005 | 1005 | }, |
1006 | - 'EventEspresso\core\Psr4Autoloader' => static function () { |
|
1006 | + 'EventEspresso\core\Psr4Autoloader' => static function() { |
|
1007 | 1007 | return EE_Psr4AutoloaderInit::psr4_loader(); |
1008 | 1008 | }, |
1009 | - 'EE_Ticket_Selector_Config' => function () { |
|
1009 | + 'EE_Ticket_Selector_Config' => function() { |
|
1010 | 1010 | return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
1011 | 1011 | }, |
1012 | 1012 | ]; |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | $this->class_cache->addAlias($fqn, $alias); |
1073 | 1073 | } |
1074 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1074 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1075 | 1075 | $this->class_cache->addAlias( |
1076 | 1076 | 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
1077 | 1077 | 'EventEspresso\core\services\notices\NoticeConverterInterface' |