Completed
Branch fix-dummy-related-question-qst... (e5efcf)
by
unknown
07:49 queued 03:45
created
core/helpers/EEH_Schema.helper.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public static function add_json_linked_data_for_event(EE_Event $event)
22 22
     {
23 23
         // Check we have a valid datetime for the event
24
-        if (! $event->primary_datetime() instanceof EE_Datetime) {
24
+        if ( ! $event->primary_datetime() instanceof EE_Datetime) {
25 25
             return;
26 26
         }
27 27
 
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
                 $event_status = 'EventScheduled';
62 62
         }
63 63
         $template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode';
64
-        $template_args['event_status'] = 'https://schema.org/' . $event_status;
64
+        $template_args['event_status'] = 'https://schema.org/'.$event_status;
65 65
         $template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
66 66
         foreach ($event->tickets() as $original_ticket) {
67 67
             // clone tickets so that date formats don't override those for the original ticket
68 68
             $ticket = clone $original_ticket;
69 69
             $ID = $ticket->ID();
70
-            $template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
71
-            $template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
72
-            $template_args['event_tickets'][ $ID ]['price'] = number_format(
70
+            $template_args['event_tickets'][$ID]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
71
+            $template_args['event_tickets'][$ID]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
72
+            $template_args['event_tickets'][$ID]['price'] = number_format(
73 73
                 $ticket->price(),
74 74
                 EE_Registry::instance()->CFG->currency->dec_plc,
75 75
                 EE_Registry::instance()->CFG->currency->dec_mrk,
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
                     $availability = null;
87 87
                     break;
88 88
             }
89
-            $template_args['event_tickets'][ $ID ]['availability'] = $availability;
89
+            $template_args['event_tickets'][$ID]['availability'] = $availability;
90 90
             unset($ticket);
91 91
         }
92 92
         $VNU_ID = espresso_venue_id();
93
-        if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
93
+        if ( ! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
94 94
             $venue = EEH_Venue_View::get_venue($VNU_ID);
95 95
             $template_args['venue_name'] = get_the_title($VNU_ID);
96 96
             $template_args['venue_url'] = get_permalink($VNU_ID);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             $VNU_ID
113 113
         );
114 114
         extract($template_args, EXTR_OVERWRITE);
115
-        include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
115
+        include EE_TEMPLATES.'json_linked_data_for_event.template.php';
116 116
     }
117 117
 
118 118
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public static function name($name = null)
146 146
     {
147
-        return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : '';
147
+        return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : '';
148 148
     }
149 149
 
150 150
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     public static function streetAddress(EEI_Address $obj_with_address = null)
161 161
     {
162 162
         return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
163
-            ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
163
+            ? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : '';
164 164
     }
165 165
 
166 166
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             )
184 184
         ) {
185 185
             return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
186
-                ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
186
+                ? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : '';
187 187
         } else {
188 188
             return $obj_with_address->address2();
189 189
         }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     public static function addressLocality(EEI_Address $obj_with_address = null)
203 203
     {
204 204
         return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
205
-            ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
205
+            ? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : '';
206 206
     }
207 207
 
208 208
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
     public static function addressRegion(EEI_Address $obj_with_address = null)
219 219
     {
220 220
         $state = $obj_with_address->state_name();
221
-        if (! empty($state)) {
222
-            return '<span itemprop="addressRegion">' . $state . '</span>';
221
+        if ( ! empty($state)) {
222
+            return '<span itemprop="addressRegion">'.$state.'</span>';
223 223
         } else {
224 224
             return '';
225 225
         }
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
     public static function addressCountry(EEI_Address $obj_with_address = null)
239 239
     {
240 240
         $country = $obj_with_address->country_name();
241
-        if (! empty($country)) {
242
-            return '<span itemprop="addressCountry">' . $country . '</span>';
241
+        if ( ! empty($country)) {
242
+            return '<span itemprop="addressCountry">'.$country.'</span>';
243 243
         } else {
244 244
             return '';
245 245
         }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      */
275 275
     public static function telephone($phone_nmbr = null)
276 276
     {
277
-        return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
277
+        return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>'
278 278
             : '';
279 279
     }
280 280
 
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
         // Check the URL includes a scheme
296 296
         $parsed_url = parse_url($url);
297 297
         if (empty($parsed_url['scheme'])) {
298
-            $url = 'https://' . ltrim($url, '/');
298
+            $url = 'https://'.ltrim($url, '/');
299 299
         }
300 300
         $atts = '';
301 301
         foreach ($attributes as $attribute => $value) {
302
-            $atts .= ' ' . $attribute . '="' . $value . '"';
302
+            $atts .= ' '.$attribute.'="'.$value.'"';
303 303
         }
304 304
         $text = $text !== null && $text !== '' ? $text : esc_url($url);
305 305
         return ! empty($url)
306
-            ? '<a itemprop="url" href="' . esc_url_raw($url) . '"' . $atts . '>' . $text . '</a>'
306
+            ? '<a itemprop="url" href="'.esc_url_raw($url).'"'.$atts.'>'.$text.'</a>'
307 307
             : '';
308 308
     }
309 309
 }
Please login to merge, or discard this patch.
Indentation   +264 added lines, -264 removed lines patch added patch discarded remove patch
@@ -10,298 +10,298 @@
 block discarded – undo
10 10
  */
11 11
 class EEH_Schema
12 12
 {
13
-    /**
14
-     * generates JSON-based linked data for an event
15
-     *
16
-     * @param EE_Event $event
17
-     * @throws EE_Error
18
-     */
19
-    public static function add_json_linked_data_for_event(EE_Event $event)
20
-    {
21
-        // Check we have a valid datetime for the event
22
-        if (! $event->primary_datetime() instanceof EE_Datetime) {
23
-            return;
24
-        }
13
+	/**
14
+	 * generates JSON-based linked data for an event
15
+	 *
16
+	 * @param EE_Event $event
17
+	 * @throws EE_Error
18
+	 */
19
+	public static function add_json_linked_data_for_event(EE_Event $event)
20
+	{
21
+		// Check we have a valid datetime for the event
22
+		if (! $event->primary_datetime() instanceof EE_Datetime) {
23
+			return;
24
+		}
25 25
 
26
-        $template_args = array(
27
-            'event_permalink' => '',
28
-            'event_name' => '',
29
-            'event_description' => '',
30
-            'event_start' => '',
31
-            'event_end' => '',
32
-            'event_attendance_mode' => '',
33
-            'event_status' => '',
34
-            'currency' => '',
35
-            'event_tickets' => array(),
36
-            'venue_name' => '',
37
-            'venue_url' => '',
38
-            'venue_locality' => '',
39
-            'venue_region' => '',
40
-            'venue_address' => '',
41
-            'event_image' => '',
42
-        );
43
-        $template_args['event_permalink'] = $event->get_permalink();
44
-        $template_args['event_name'] = $event->name();
45
-        $template_args['event_description'] = wp_strip_all_tags($event->short_description(200));
46
-        // clone datetime so that date formats don't override those for the original datetime
47
-        $primary_datetime = clone $event->primary_datetime();
48
-        $template_args['event_start'] = $primary_datetime->start_date(DateTime::ATOM);
49
-        $template_args['event_end'] = $primary_datetime->end_date(DateTime::ATOM);
50
-        unset($primary_datetime);
51
-        switch ($event->status()) {
52
-            case EEM_Event::cancelled:
53
-                $event_status = 'EventCancelled';
54
-                break;
55
-            case EEM_Event::postponed:
56
-                $event_status = 'EventPostponed';
57
-                break;
58
-            default:
59
-                $event_status = 'EventScheduled';
60
-        }
61
-        $template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode';
62
-        $template_args['event_status'] = 'https://schema.org/' . $event_status;
63
-        $template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
64
-        foreach ($event->tickets() as $original_ticket) {
65
-            // clone tickets so that date formats don't override those for the original ticket
66
-            $ticket = clone $original_ticket;
67
-            $ID = $ticket->ID();
68
-            $template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
69
-            $template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
70
-            $template_args['event_tickets'][ $ID ]['price'] = number_format(
71
-                $ticket->price(),
72
-                EE_Registry::instance()->CFG->currency->dec_plc,
73
-                EE_Registry::instance()->CFG->currency->dec_mrk,
74
-                ''
75
-            );
76
-            switch ($ticket->ticket_status()) {
77
-                case 'TKO':
78
-                    $availability = 'InStock';
79
-                    break;
80
-                case 'TKS':
81
-                    $availability = 'SoldOut';
82
-                    break;
83
-                default:
84
-                    $availability = null;
85
-                    break;
86
-            }
87
-            $template_args['event_tickets'][ $ID ]['availability'] = $availability;
88
-            unset($ticket);
89
-        }
90
-        $VNU_ID = espresso_venue_id();
91
-        if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
92
-            $venue = EEH_Venue_View::get_venue($VNU_ID);
93
-            $template_args['venue_name'] = get_the_title($VNU_ID);
94
-            $template_args['venue_url'] = get_permalink($VNU_ID);
95
-            $template_args['venue_locality'] = $venue->city();
96
-            $template_args['venue_region'] = $venue->state_name();
97
-            $template_args['venue_address'] = $venue->address();
98
-            if ($venue->virtual_url() !== '') {
99
-                $template_args['event_attendance_mode'] = 'OnlineEventAttendanceMode';
100
-            }
101
-            if ($venue->virtual_url() !== '' && $venue->address() !== '') {
102
-                $template_args['event_attendance_mode'] = 'MixedEventAttendanceMode';
103
-            }
104
-        }
105
-        $template_args['event_image'] = $event->feature_image_url();
106
-        $template_args = apply_filters(
107
-            'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args',
108
-            $template_args,
109
-            $event,
110
-            $VNU_ID
111
-        );
112
-        extract($template_args, EXTR_OVERWRITE);
113
-        include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
114
-    }
26
+		$template_args = array(
27
+			'event_permalink' => '',
28
+			'event_name' => '',
29
+			'event_description' => '',
30
+			'event_start' => '',
31
+			'event_end' => '',
32
+			'event_attendance_mode' => '',
33
+			'event_status' => '',
34
+			'currency' => '',
35
+			'event_tickets' => array(),
36
+			'venue_name' => '',
37
+			'venue_url' => '',
38
+			'venue_locality' => '',
39
+			'venue_region' => '',
40
+			'venue_address' => '',
41
+			'event_image' => '',
42
+		);
43
+		$template_args['event_permalink'] = $event->get_permalink();
44
+		$template_args['event_name'] = $event->name();
45
+		$template_args['event_description'] = wp_strip_all_tags($event->short_description(200));
46
+		// clone datetime so that date formats don't override those for the original datetime
47
+		$primary_datetime = clone $event->primary_datetime();
48
+		$template_args['event_start'] = $primary_datetime->start_date(DateTime::ATOM);
49
+		$template_args['event_end'] = $primary_datetime->end_date(DateTime::ATOM);
50
+		unset($primary_datetime);
51
+		switch ($event->status()) {
52
+			case EEM_Event::cancelled:
53
+				$event_status = 'EventCancelled';
54
+				break;
55
+			case EEM_Event::postponed:
56
+				$event_status = 'EventPostponed';
57
+				break;
58
+			default:
59
+				$event_status = 'EventScheduled';
60
+		}
61
+		$template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode';
62
+		$template_args['event_status'] = 'https://schema.org/' . $event_status;
63
+		$template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
64
+		foreach ($event->tickets() as $original_ticket) {
65
+			// clone tickets so that date formats don't override those for the original ticket
66
+			$ticket = clone $original_ticket;
67
+			$ID = $ticket->ID();
68
+			$template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
69
+			$template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
70
+			$template_args['event_tickets'][ $ID ]['price'] = number_format(
71
+				$ticket->price(),
72
+				EE_Registry::instance()->CFG->currency->dec_plc,
73
+				EE_Registry::instance()->CFG->currency->dec_mrk,
74
+				''
75
+			);
76
+			switch ($ticket->ticket_status()) {
77
+				case 'TKO':
78
+					$availability = 'InStock';
79
+					break;
80
+				case 'TKS':
81
+					$availability = 'SoldOut';
82
+					break;
83
+				default:
84
+					$availability = null;
85
+					break;
86
+			}
87
+			$template_args['event_tickets'][ $ID ]['availability'] = $availability;
88
+			unset($ticket);
89
+		}
90
+		$VNU_ID = espresso_venue_id();
91
+		if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
92
+			$venue = EEH_Venue_View::get_venue($VNU_ID);
93
+			$template_args['venue_name'] = get_the_title($VNU_ID);
94
+			$template_args['venue_url'] = get_permalink($VNU_ID);
95
+			$template_args['venue_locality'] = $venue->city();
96
+			$template_args['venue_region'] = $venue->state_name();
97
+			$template_args['venue_address'] = $venue->address();
98
+			if ($venue->virtual_url() !== '') {
99
+				$template_args['event_attendance_mode'] = 'OnlineEventAttendanceMode';
100
+			}
101
+			if ($venue->virtual_url() !== '' && $venue->address() !== '') {
102
+				$template_args['event_attendance_mode'] = 'MixedEventAttendanceMode';
103
+			}
104
+		}
105
+		$template_args['event_image'] = $event->feature_image_url();
106
+		$template_args = apply_filters(
107
+			'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args',
108
+			$template_args,
109
+			$event,
110
+			$VNU_ID
111
+		);
112
+		extract($template_args, EXTR_OVERWRITE);
113
+		include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
114
+	}
115 115
 
116 116
 
117
-    /**
118
-     *    location
119
-     *    The location of the event, organization or action.
120
-     *    Should include the Venue name AND schema formatted address info
121
-     *
122
-     * @access public
123
-     * @param string $location
124
-     * @return string
125
-     */
126
-    public static function location($location = null)
127
-    {
128
-        return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
129
-                                      . $location
130
-                                      . '</div>' : '';
131
-    }
117
+	/**
118
+	 *    location
119
+	 *    The location of the event, organization or action.
120
+	 *    Should include the Venue name AND schema formatted address info
121
+	 *
122
+	 * @access public
123
+	 * @param string $location
124
+	 * @return string
125
+	 */
126
+	public static function location($location = null)
127
+	{
128
+		return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
129
+									  . $location
130
+									  . '</div>' : '';
131
+	}
132 132
 
133 133
 
134 134
 
135
-    /**
136
-     *    name
137
-     *    The name of the Event or Venue.
138
-     *
139
-     * @access public
140
-     * @param string $name
141
-     * @return string
142
-     */
143
-    public static function name($name = null)
144
-    {
145
-        return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : '';
146
-    }
135
+	/**
136
+	 *    name
137
+	 *    The name of the Event or Venue.
138
+	 *
139
+	 * @access public
140
+	 * @param string $name
141
+	 * @return string
142
+	 */
143
+	public static function name($name = null)
144
+	{
145
+		return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : '';
146
+	}
147 147
 
148 148
 
149 149
 
150
-    /**
151
-     *    streetAddress
152
-     *    The street address. For example, 1600 Amphitheatre Pkwy.
153
-     *
154
-     * @access public
155
-     * @param EEI_Address $obj_with_address
156
-     * @return string
157
-     */
158
-    public static function streetAddress(EEI_Address $obj_with_address = null)
159
-    {
160
-        return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
161
-            ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
162
-    }
150
+	/**
151
+	 *    streetAddress
152
+	 *    The street address. For example, 1600 Amphitheatre Pkwy.
153
+	 *
154
+	 * @access public
155
+	 * @param EEI_Address $obj_with_address
156
+	 * @return string
157
+	 */
158
+	public static function streetAddress(EEI_Address $obj_with_address = null)
159
+	{
160
+		return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
161
+			? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
162
+	}
163 163
 
164 164
 
165 165
 
166
-    /**
167
-     *    postOfficeBoxNumber
168
-     *    The post office box number for PO box addresses.
169
-     *
170
-     * @access public
171
-     * @param EEI_Address $obj_with_address
172
-     * @return string
173
-     */
174
-    public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null)
175
-    {
176
-        // regex check for some form of PO Box or P.O. Box, etc, etc, etc
177
-        if (
178
-            preg_match(
179
-                "/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i",
180
-                $obj_with_address->address2()
181
-            )
182
-        ) {
183
-            return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
184
-                ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
185
-        } else {
186
-            return $obj_with_address->address2();
187
-        }
188
-    }
166
+	/**
167
+	 *    postOfficeBoxNumber
168
+	 *    The post office box number for PO box addresses.
169
+	 *
170
+	 * @access public
171
+	 * @param EEI_Address $obj_with_address
172
+	 * @return string
173
+	 */
174
+	public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null)
175
+	{
176
+		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
177
+		if (
178
+			preg_match(
179
+				"/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i",
180
+				$obj_with_address->address2()
181
+			)
182
+		) {
183
+			return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
184
+				? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
185
+		} else {
186
+			return $obj_with_address->address2();
187
+		}
188
+	}
189 189
 
190 190
 
191 191
 
192
-    /**
193
-     *    addressLocality
194
-     *    The locality (city, town, etc). For example, Mountain View.
195
-     *
196
-     * @access public
197
-     * @param EEI_Address $obj_with_address
198
-     * @return string
199
-     */
200
-    public static function addressLocality(EEI_Address $obj_with_address = null)
201
-    {
202
-        return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
203
-            ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
204
-    }
192
+	/**
193
+	 *    addressLocality
194
+	 *    The locality (city, town, etc). For example, Mountain View.
195
+	 *
196
+	 * @access public
197
+	 * @param EEI_Address $obj_with_address
198
+	 * @return string
199
+	 */
200
+	public static function addressLocality(EEI_Address $obj_with_address = null)
201
+	{
202
+		return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
203
+			? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
204
+	}
205 205
 
206 206
 
207 207
 
208
-    /**
209
-     *    addressRegion
210
-     *    The region (state, province, etc). For example, CA.
211
-     *
212
-     * @access public
213
-     * @param EEI_Address $obj_with_address
214
-     * @return string
215
-     */
216
-    public static function addressRegion(EEI_Address $obj_with_address = null)
217
-    {
218
-        $state = $obj_with_address->state_name();
219
-        if (! empty($state)) {
220
-            return '<span itemprop="addressRegion">' . $state . '</span>';
221
-        } else {
222
-            return '';
223
-        }
224
-    }
208
+	/**
209
+	 *    addressRegion
210
+	 *    The region (state, province, etc). For example, CA.
211
+	 *
212
+	 * @access public
213
+	 * @param EEI_Address $obj_with_address
214
+	 * @return string
215
+	 */
216
+	public static function addressRegion(EEI_Address $obj_with_address = null)
217
+	{
218
+		$state = $obj_with_address->state_name();
219
+		if (! empty($state)) {
220
+			return '<span itemprop="addressRegion">' . $state . '</span>';
221
+		} else {
222
+			return '';
223
+		}
224
+	}
225 225
 
226 226
 
227 227
 
228
-    /**
229
-     *    addressCountry
230
-     *    The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
231
-     *
232
-     * @access public
233
-     * @param EEI_Address $obj_with_address
234
-     * @return string
235
-     */
236
-    public static function addressCountry(EEI_Address $obj_with_address = null)
237
-    {
238
-        $country = $obj_with_address->country_name();
239
-        if (! empty($country)) {
240
-            return '<span itemprop="addressCountry">' . $country . '</span>';
241
-        } else {
242
-            return '';
243
-        }
244
-    }
228
+	/**
229
+	 *    addressCountry
230
+	 *    The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
231
+	 *
232
+	 * @access public
233
+	 * @param EEI_Address $obj_with_address
234
+	 * @return string
235
+	 */
236
+	public static function addressCountry(EEI_Address $obj_with_address = null)
237
+	{
238
+		$country = $obj_with_address->country_name();
239
+		if (! empty($country)) {
240
+			return '<span itemprop="addressCountry">' . $country . '</span>';
241
+		} else {
242
+			return '';
243
+		}
244
+	}
245 245
 
246 246
 
247 247
 
248
-    /**
249
-     *    postalCode
250
-     *    The postal code. For example, 94043.
251
-     *
252
-     * @access public
253
-     * @param EEI_Address $obj_with_address
254
-     * @return string
255
-     */
256
-    public static function postalCode(EEI_Address $obj_with_address = null)
257
-    {
258
-        return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
259
-                                                                                      . $obj_with_address->zip()
260
-                                                                                      . '</span>' : '';
261
-    }
248
+	/**
249
+	 *    postalCode
250
+	 *    The postal code. For example, 94043.
251
+	 *
252
+	 * @access public
253
+	 * @param EEI_Address $obj_with_address
254
+	 * @return string
255
+	 */
256
+	public static function postalCode(EEI_Address $obj_with_address = null)
257
+	{
258
+		return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
259
+																					  . $obj_with_address->zip()
260
+																					  . '</span>' : '';
261
+	}
262 262
 
263 263
 
264 264
 
265
-    /**
266
-     *    telephone
267
-     *    The telephone number.
268
-     *
269
-     * @access public
270
-     * @param string $phone_nmbr
271
-     * @return string
272
-     */
273
-    public static function telephone($phone_nmbr = null)
274
-    {
275
-        return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
276
-            : '';
277
-    }
265
+	/**
266
+	 *    telephone
267
+	 *    The telephone number.
268
+	 *
269
+	 * @access public
270
+	 * @param string $phone_nmbr
271
+	 * @return string
272
+	 */
273
+	public static function telephone($phone_nmbr = null)
274
+	{
275
+		return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
276
+			: '';
277
+	}
278 278
 
279 279
 
280 280
 
281
-    /**
282
-     *    URL
283
-     *    URL of the item as a clickable link
284
-     *
285
-     * @access public
286
-     * @param string $url        - the URL that the link will resolve to
287
-     * @param string $text       - the text that will be used for the visible link
288
-     * @param array  $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
289
-     * @return string (link)
290
-     */
291
-    public static function url($url = null, $text = null, $attributes = array())
292
-    {
293
-        // Check the URL includes a scheme
294
-        $parsed_url = parse_url($url);
295
-        if (empty($parsed_url['scheme'])) {
296
-            $url = 'https://' . ltrim($url, '/');
297
-        }
298
-        $atts = '';
299
-        foreach ($attributes as $attribute => $value) {
300
-            $atts .= ' ' . $attribute . '="' . $value . '"';
301
-        }
302
-        $text = $text !== null && $text !== '' ? $text : esc_url($url);
303
-        return ! empty($url)
304
-            ? '<a itemprop="url" href="' . esc_url_raw($url) . '"' . $atts . '>' . $text . '</a>'
305
-            : '';
306
-    }
281
+	/**
282
+	 *    URL
283
+	 *    URL of the item as a clickable link
284
+	 *
285
+	 * @access public
286
+	 * @param string $url        - the URL that the link will resolve to
287
+	 * @param string $text       - the text that will be used for the visible link
288
+	 * @param array  $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
289
+	 * @return string (link)
290
+	 */
291
+	public static function url($url = null, $text = null, $attributes = array())
292
+	{
293
+		// Check the URL includes a scheme
294
+		$parsed_url = parse_url($url);
295
+		if (empty($parsed_url['scheme'])) {
296
+			$url = 'https://' . ltrim($url, '/');
297
+		}
298
+		$atts = '';
299
+		foreach ($attributes as $attribute => $value) {
300
+			$atts .= ' ' . $attribute . '="' . $value . '"';
301
+		}
302
+		$text = $text !== null && $text !== '' ? $text : esc_url($url);
303
+		return ! empty($url)
304
+			? '<a itemprop="url" href="' . esc_url_raw($url) . '"' . $atts . '>' . $text . '</a>'
305
+			: '';
306
+	}
307 307
 }
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
     ) {
205 205
         $class      = trim($class, '\\');
206 206
         $registered = false;
207
-        if (empty(self::$_instance->_dependency_map[ $class ])) {
208
-            self::$_instance->_dependency_map[ $class ] = [];
207
+        if (empty(self::$_instance->_dependency_map[$class])) {
208
+            self::$_instance->_dependency_map[$class] = [];
209 209
         }
210 210
         // we need to make sure that any aliases used when registering a dependency
211 211
         // get resolved to the correct class name
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
             $alias = self::$_instance->getFqnForAlias($dependency);
214 214
             if (
215 215
                 $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
216
-                || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
216
+                || ! isset(self::$_instance->_dependency_map[$class][$alias])
217 217
             ) {
218
-                unset($dependencies[ $dependency ]);
219
-                $dependencies[ $alias ] = $load_source;
218
+                unset($dependencies[$dependency]);
219
+                $dependencies[$alias] = $load_source;
220 220
                 $registered             = true;
221 221
             }
222 222
         }
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
         // ie: with A = B + C, entries in B take precedence over duplicate entries in C
227 227
         // Union is way faster than array_merge() but should be used with caution...
228 228
         // especially with numerically indexed arrays
229
-        $dependencies += self::$_instance->_dependency_map[ $class ];
229
+        $dependencies += self::$_instance->_dependency_map[$class];
230 230
         // now we need to ensure that the resulting dependencies
231 231
         // array only has the entries that are required for the class
232 232
         // so first count how many dependencies were originally registered for the class
233
-        $dependency_count = count(self::$_instance->_dependency_map[ $class ]);
233
+        $dependency_count = count(self::$_instance->_dependency_map[$class]);
234 234
         // if that count is non-zero (meaning dependencies were already registered)
235
-        self::$_instance->_dependency_map[ $class ] = $dependency_count
235
+        self::$_instance->_dependency_map[$class] = $dependency_count
236 236
             // then truncate the  final array to match that count
237 237
             ? array_slice($dependencies, 0, $dependency_count)
238 238
             // otherwise just take the incoming array because nothing previously existed
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false)
252 252
     {
253
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
253
+        if ( ! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
254 254
             throw new DomainException(
255 255
                 esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
256 256
             );
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
             );
275 275
         }
276 276
         $class_name = self::$_instance->getFqnForAlias($class_name);
277
-        if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) {
278
-            self::$_instance->_class_loaders[ $class_name ] = $loader;
277
+        if ($overwrite || ! isset(self::$_instance->_class_loaders[$class_name])) {
278
+            self::$_instance->_class_loaders[$class_name] = $loader;
279 279
             return true;
280 280
         }
281 281
         return false;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         if (strpos($class_name, 'EEM_') === 0) {
304 304
             $class_name = 'LEGACY_MODELS';
305 305
         }
306
-        return isset($this->_dependency_map[ $class_name ]);
306
+        return isset($this->_dependency_map[$class_name]);
307 307
     }
308 308
 
309 309
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             $class_name = 'LEGACY_MODELS';
322 322
         }
323 323
         $dependency = $this->getFqnForAlias($dependency, $class_name);
324
-        return isset($this->_dependency_map[ $class_name ][ $dependency ]);
324
+        return isset($this->_dependency_map[$class_name][$dependency]);
325 325
     }
326 326
 
327 327
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
         }
341 341
         $dependency = $this->getFqnForAlias($dependency);
342 342
         return $this->has_dependency_for_class($class_name, $dependency)
343
-            ? $this->_dependency_map[ $class_name ][ $dependency ]
343
+            ? $this->_dependency_map[$class_name][$dependency]
344 344
             : EE_Dependency_Map::not_registered;
345 345
     }
346 346
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             return 'load_core';
365 365
         }
366 366
         $class_name = $this->getFqnForAlias($class_name);
367
-        return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
367
+        return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';
368 368
     }
369 369
 
370 370
 
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
     {
949 949
         $this->_class_loaders = [
950 950
             // load_core
951
-            'EE_Dependency_Map'                            => function () {
951
+            'EE_Dependency_Map'                            => function() {
952 952
                 return $this;
953 953
             },
954 954
             'EE_Capabilities'                              => 'load_core',
@@ -956,13 +956,13 @@  discard block
 block discarded – undo
956 956
             'EE_Front_Controller'                          => 'load_core',
957 957
             'EE_Module_Request_Router'                     => 'load_core',
958 958
             'EE_Registry'                                  => 'load_core',
959
-            'EE_Request'                                   => function () {
959
+            'EE_Request'                                   => function() {
960 960
                 return $this->legacy_request;
961 961
             },
962
-            'EventEspresso\core\services\request\Request'  => function () {
962
+            'EventEspresso\core\services\request\Request'  => function() {
963 963
                 return $this->request;
964 964
             },
965
-            'EventEspresso\core\services\request\Response' => function () {
965
+            'EventEspresso\core\services\request\Response' => function() {
966 966
                 return $this->response;
967 967
             },
968 968
             'EE_Base'                                      => 'load_core',
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
             'EE_DMS_Core_4_8_0'                            => 'load_dms',
998 998
             'EE_DMS_Core_4_9_0'                            => 'load_dms',
999 999
             'EE_DMS_Core_4_10_0'                           => 'load_dms',
1000
-            'EE_Messages_Generator'                        => function () {
1000
+            'EE_Messages_Generator'                        => function() {
1001 1001
                 return EE_Registry::instance()->load_lib(
1002 1002
                     'Messages_Generator',
1003 1003
                     [],
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
                     false
1006 1006
                 );
1007 1007
             },
1008
-            'EE_Messages_Template_Defaults'                => function ($arguments = []) {
1008
+            'EE_Messages_Template_Defaults'                => function($arguments = []) {
1009 1009
                 return EE_Registry::instance()->load_lib(
1010 1010
                     'Messages_Template_Defaults',
1011 1011
                     $arguments,
@@ -1014,49 +1014,49 @@  discard block
 block discarded – undo
1014 1014
                 );
1015 1015
             },
1016 1016
             // load_helper
1017
-            'EEH_Parse_Shortcodes'                         => function () {
1017
+            'EEH_Parse_Shortcodes'                         => function() {
1018 1018
                 if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
1019 1019
                     return new EEH_Parse_Shortcodes();
1020 1020
                 }
1021 1021
                 return null;
1022 1022
             },
1023
-            'EE_Template_Config'                           => function () {
1023
+            'EE_Template_Config'                           => function() {
1024 1024
                 return EE_Config::instance()->template_settings;
1025 1025
             },
1026
-            'EE_Currency_Config'                           => function () {
1026
+            'EE_Currency_Config'                           => function() {
1027 1027
                 return EE_Config::instance()->currency;
1028 1028
             },
1029
-            'EE_Registration_Config'                       => function () {
1029
+            'EE_Registration_Config'                       => function() {
1030 1030
                 return EE_Config::instance()->registration;
1031 1031
             },
1032
-            'EE_Core_Config'                               => function () {
1032
+            'EE_Core_Config'                               => function() {
1033 1033
                 return EE_Config::instance()->core;
1034 1034
             },
1035
-            'EventEspresso\core\services\loaders\Loader'   => function () {
1035
+            'EventEspresso\core\services\loaders\Loader'   => function() {
1036 1036
                 return LoaderFactory::getLoader();
1037 1037
             },
1038
-            'EE_Network_Config'                            => function () {
1038
+            'EE_Network_Config'                            => function() {
1039 1039
                 return EE_Network_Config::instance();
1040 1040
             },
1041
-            'EE_Config'                                    => function () {
1041
+            'EE_Config'                                    => function() {
1042 1042
                 return EE_Config::instance();
1043 1043
             },
1044
-            'EventEspresso\core\domain\Domain'             => function () {
1044
+            'EventEspresso\core\domain\Domain'             => function() {
1045 1045
                 return DomainFactory::getEventEspressoCoreDomain();
1046 1046
             },
1047
-            'EE_Admin_Config'                              => function () {
1047
+            'EE_Admin_Config'                              => function() {
1048 1048
                 return EE_Config::instance()->admin;
1049 1049
             },
1050
-            'EE_Organization_Config'                       => function () {
1050
+            'EE_Organization_Config'                       => function() {
1051 1051
                 return EE_Config::instance()->organization;
1052 1052
             },
1053
-            'EE_Network_Core_Config'                       => function () {
1053
+            'EE_Network_Core_Config'                       => function() {
1054 1054
                 return EE_Network_Config::instance()->core;
1055 1055
             },
1056
-            'EE_Environment_Config'                        => function () {
1056
+            'EE_Environment_Config'                        => function() {
1057 1057
                 return EE_Config::instance()->environment;
1058 1058
             },
1059
-            'EE_Ticket_Selector_Config'                    => function () {
1059
+            'EE_Ticket_Selector_Config'                    => function() {
1060 1060
                 return EE_Config::instance()->template_settings->EED_Ticket_Selector;
1061 1061
             },
1062 1062
         ];
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
             }
1119 1119
             $this->class_cache->addAlias($fqn, $alias);
1120 1120
         }
1121
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1121
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1122 1122
             $this->class_cache->addAlias(
1123 1123
                 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
1124 1124
                 'EventEspresso\core\services\notices\NoticeConverterInterface'
Please login to merge, or discard this patch.
Indentation   +1169 added lines, -1169 removed lines patch added patch discarded remove patch
@@ -19,1173 +19,1173 @@
 block discarded – undo
19 19
  */
20 20
 class EE_Dependency_Map
21 21
 {
22
-    /**
23
-     * This means that the requested class dependency is not present in the dependency map
24
-     */
25
-    const not_registered = 0;
26
-
27
-    /**
28
-     * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
29
-     */
30
-    const load_new_object = 1;
31
-
32
-    /**
33
-     * This instructs class loaders to return a previously instantiated and cached object for the requested class.
34
-     * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
35
-     */
36
-    const load_from_cache = 2;
37
-
38
-    /**
39
-     * When registering a dependency,
40
-     * this indicates to keep any existing dependencies that already exist,
41
-     * and simply discard any new dependencies declared in the incoming data
42
-     */
43
-    const KEEP_EXISTING_DEPENDENCIES = 0;
44
-
45
-    /**
46
-     * When registering a dependency,
47
-     * this indicates to overwrite any existing dependencies that already exist using the incoming data
48
-     */
49
-    const OVERWRITE_DEPENDENCIES = 1;
50
-
51
-
52
-    /**
53
-     * @type EE_Dependency_Map $_instance
54
-     */
55
-    protected static $_instance;
56
-
57
-    /**
58
-     * @var ClassInterfaceCache $class_cache
59
-     */
60
-    private $class_cache;
61
-
62
-    /**
63
-     * @type RequestInterface $request
64
-     */
65
-    protected $request;
66
-
67
-    /**
68
-     * @type LegacyRequestInterface $legacy_request
69
-     */
70
-    protected $legacy_request;
71
-
72
-    /**
73
-     * @type ResponseInterface $response
74
-     */
75
-    protected $response;
76
-
77
-    /**
78
-     * @type LoaderInterface $loader
79
-     */
80
-    protected $loader;
81
-
82
-    /**
83
-     * @type array $_dependency_map
84
-     */
85
-    protected $_dependency_map = [];
86
-
87
-    /**
88
-     * @type array $_class_loaders
89
-     */
90
-    protected $_class_loaders = [];
91
-
92
-
93
-    /**
94
-     * EE_Dependency_Map constructor.
95
-     *
96
-     * @param ClassInterfaceCache $class_cache
97
-     */
98
-    protected function __construct(ClassInterfaceCache $class_cache)
99
-    {
100
-        $this->class_cache = $class_cache;
101
-        do_action('EE_Dependency_Map____construct', $this);
102
-    }
103
-
104
-
105
-    /**
106
-     * @return void
107
-     */
108
-    public function initialize()
109
-    {
110
-        $this->_register_core_dependencies();
111
-        $this->_register_core_class_loaders();
112
-        $this->_register_core_aliases();
113
-    }
114
-
115
-
116
-    /**
117
-     * @singleton method used to instantiate class object
118
-     * @param ClassInterfaceCache|null $class_cache
119
-     * @return EE_Dependency_Map
120
-     */
121
-    public static function instance(ClassInterfaceCache $class_cache = null)
122
-    {
123
-        // check if class object is instantiated, and instantiated properly
124
-        if (
125
-            ! self::$_instance instanceof EE_Dependency_Map
126
-            && $class_cache instanceof ClassInterfaceCache
127
-        ) {
128
-            self::$_instance = new EE_Dependency_Map($class_cache);
129
-        }
130
-        return self::$_instance;
131
-    }
132
-
133
-
134
-    /**
135
-     * @param RequestInterface $request
136
-     */
137
-    public function setRequest(RequestInterface $request)
138
-    {
139
-        $this->request = $request;
140
-    }
141
-
142
-
143
-    /**
144
-     * @param LegacyRequestInterface $legacy_request
145
-     */
146
-    public function setLegacyRequest(LegacyRequestInterface $legacy_request)
147
-    {
148
-        $this->legacy_request = $legacy_request;
149
-    }
150
-
151
-
152
-    /**
153
-     * @param ResponseInterface $response
154
-     */
155
-    public function setResponse(ResponseInterface $response)
156
-    {
157
-        $this->response = $response;
158
-    }
159
-
160
-
161
-    /**
162
-     * @param LoaderInterface $loader
163
-     */
164
-    public function setLoader(LoaderInterface $loader)
165
-    {
166
-        $this->loader = $loader;
167
-    }
168
-
169
-
170
-    /**
171
-     * @param string $class
172
-     * @param array  $dependencies
173
-     * @param int    $overwrite
174
-     * @return bool
175
-     */
176
-    public static function register_dependencies(
177
-        $class,
178
-        array $dependencies,
179
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
180
-    ) {
181
-        return self::$_instance->registerDependencies($class, $dependencies, $overwrite);
182
-    }
183
-
184
-
185
-    /**
186
-     * Assigns an array of class names and corresponding load sources (new or cached)
187
-     * to the class specified by the first parameter.
188
-     * IMPORTANT !!!
189
-     * The order of elements in the incoming $dependencies array MUST match
190
-     * the order of the constructor parameters for the class in question.
191
-     * This is especially important when overriding any existing dependencies that are registered.
192
-     * the third parameter controls whether any duplicate dependencies are overwritten or not.
193
-     *
194
-     * @param string $class
195
-     * @param array  $dependencies
196
-     * @param int    $overwrite
197
-     * @return bool
198
-     */
199
-    public function registerDependencies(
200
-        $class,
201
-        array $dependencies,
202
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
203
-    ) {
204
-        $class      = trim($class, '\\');
205
-        $registered = false;
206
-        if (empty(self::$_instance->_dependency_map[ $class ])) {
207
-            self::$_instance->_dependency_map[ $class ] = [];
208
-        }
209
-        // we need to make sure that any aliases used when registering a dependency
210
-        // get resolved to the correct class name
211
-        foreach ($dependencies as $dependency => $load_source) {
212
-            $alias = self::$_instance->getFqnForAlias($dependency);
213
-            if (
214
-                $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
215
-                || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
216
-            ) {
217
-                unset($dependencies[ $dependency ]);
218
-                $dependencies[ $alias ] = $load_source;
219
-                $registered             = true;
220
-            }
221
-        }
222
-        // now add our two lists of dependencies together.
223
-        // using Union (+=) favours the arrays in precedence from left to right,
224
-        // so $dependencies is NOT overwritten because it is listed first
225
-        // ie: with A = B + C, entries in B take precedence over duplicate entries in C
226
-        // Union is way faster than array_merge() but should be used with caution...
227
-        // especially with numerically indexed arrays
228
-        $dependencies += self::$_instance->_dependency_map[ $class ];
229
-        // now we need to ensure that the resulting dependencies
230
-        // array only has the entries that are required for the class
231
-        // so first count how many dependencies were originally registered for the class
232
-        $dependency_count = count(self::$_instance->_dependency_map[ $class ]);
233
-        // if that count is non-zero (meaning dependencies were already registered)
234
-        self::$_instance->_dependency_map[ $class ] = $dependency_count
235
-            // then truncate the  final array to match that count
236
-            ? array_slice($dependencies, 0, $dependency_count)
237
-            // otherwise just take the incoming array because nothing previously existed
238
-            : $dependencies;
239
-        return $registered;
240
-    }
241
-
242
-
243
-    /**
244
-     * @param string $class_name
245
-     * @param string $loader
246
-     * @param bool   $overwrite
247
-     * @return bool
248
-     * @throws DomainException
249
-     */
250
-    public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false)
251
-    {
252
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
253
-            throw new DomainException(
254
-                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
255
-            );
256
-        }
257
-        // check that loader is callable or method starts with "load_" and exists in EE_Registry
258
-        if (
259
-            ! is_callable($loader)
260
-            && (
261
-                strpos($loader, 'load_') !== 0
262
-                || ! method_exists('EE_Registry', $loader)
263
-            )
264
-        ) {
265
-            throw new DomainException(
266
-                sprintf(
267
-                    esc_html__(
268
-                        '"%1$s" is not a valid loader method on EE_Registry.',
269
-                        'event_espresso'
270
-                    ),
271
-                    $loader
272
-                )
273
-            );
274
-        }
275
-        $class_name = self::$_instance->getFqnForAlias($class_name);
276
-        if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) {
277
-            self::$_instance->_class_loaders[ $class_name ] = $loader;
278
-            return true;
279
-        }
280
-        return false;
281
-    }
282
-
283
-
284
-    /**
285
-     * @return array
286
-     */
287
-    public function dependency_map()
288
-    {
289
-        return $this->_dependency_map;
290
-    }
291
-
292
-
293
-    /**
294
-     * returns TRUE if dependency map contains a listing for the provided class name
295
-     *
296
-     * @param string $class_name
297
-     * @return boolean
298
-     */
299
-    public function has($class_name = '')
300
-    {
301
-        // all legacy models have the same dependencies
302
-        if (strpos($class_name, 'EEM_') === 0) {
303
-            $class_name = 'LEGACY_MODELS';
304
-        }
305
-        return isset($this->_dependency_map[ $class_name ]);
306
-    }
307
-
308
-
309
-    /**
310
-     * returns TRUE if dependency map contains a listing for the provided class name AND dependency
311
-     *
312
-     * @param string $class_name
313
-     * @param string $dependency
314
-     * @return bool
315
-     */
316
-    public function has_dependency_for_class($class_name = '', $dependency = '')
317
-    {
318
-        // all legacy models have the same dependencies
319
-        if (strpos($class_name, 'EEM_') === 0) {
320
-            $class_name = 'LEGACY_MODELS';
321
-        }
322
-        $dependency = $this->getFqnForAlias($dependency, $class_name);
323
-        return isset($this->_dependency_map[ $class_name ][ $dependency ]);
324
-    }
325
-
326
-
327
-    /**
328
-     * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
329
-     *
330
-     * @param string $class_name
331
-     * @param string $dependency
332
-     * @return int
333
-     */
334
-    public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
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);
341
-        return $this->has_dependency_for_class($class_name, $dependency)
342
-            ? $this->_dependency_map[ $class_name ][ $dependency ]
343
-            : EE_Dependency_Map::not_registered;
344
-    }
345
-
346
-
347
-    /**
348
-     * @param string $class_name
349
-     * @return string | Closure
350
-     */
351
-    public function class_loader($class_name)
352
-    {
353
-        // all legacy models use load_model()
354
-        if (strpos($class_name, 'EEM_') === 0) {
355
-            return 'load_model';
356
-        }
357
-        // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
358
-        // perform strpos() first to avoid loading regex every time we load a class
359
-        if (
360
-            strpos($class_name, 'EE_CPT_') === 0
361
-            && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
362
-        ) {
363
-            return 'load_core';
364
-        }
365
-        $class_name = $this->getFqnForAlias($class_name);
366
-        return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
367
-    }
368
-
369
-
370
-    /**
371
-     * @return array
372
-     */
373
-    public function class_loaders()
374
-    {
375
-        return $this->_class_loaders;
376
-    }
377
-
378
-
379
-    /**
380
-     * adds an alias for a classname
381
-     *
382
-     * @param string $fqcn      the class name that should be used (concrete class to replace interface)
383
-     * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
384
-     * @param string $for_class the class that has the dependency (is type hinting for the interface)
385
-     */
386
-    public function add_alias($fqcn, $alias, $for_class = '')
387
-    {
388
-        $this->class_cache->addAlias($fqcn, $alias, $for_class);
389
-    }
390
-
391
-
392
-    /**
393
-     * Returns TRUE if the provided fully qualified name IS an alias
394
-     * WHY?
395
-     * Because if a class is type hinting for a concretion,
396
-     * then why would we need to find another class to supply it?
397
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
398
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
399
-     * Don't go looking for some substitute.
400
-     * Whereas if a class is type hinting for an interface...
401
-     * then we need to find an actual class to use.
402
-     * So the interface IS the alias for some other FQN,
403
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
404
-     * represents some other class.
405
-     *
406
-     * @param string $fqn
407
-     * @param string $for_class
408
-     * @return bool
409
-     */
410
-    public function isAlias($fqn = '', $for_class = '')
411
-    {
412
-        return $this->class_cache->isAlias($fqn, $for_class);
413
-    }
414
-
415
-
416
-    /**
417
-     * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
418
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
419
-     *  for example:
420
-     *      if the following two entries were added to the _aliases array:
421
-     *          array(
422
-     *              'interface_alias'           => 'some\namespace\interface'
423
-     *              'some\namespace\interface'  => 'some\namespace\classname'
424
-     *          )
425
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
426
-     *      to load an instance of 'some\namespace\classname'
427
-     *
428
-     * @param string $alias
429
-     * @param string $for_class
430
-     * @return string
431
-     */
432
-    public function getFqnForAlias($alias = '', $for_class = '')
433
-    {
434
-        return $this->class_cache->getFqnForAlias($alias, $for_class);
435
-    }
436
-
437
-
438
-    /**
439
-     * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
440
-     * if one exists, or whether a new object should be generated every time the requested class is loaded.
441
-     * This is done by using the following class constants:
442
-     *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
443
-     *        EE_Dependency_Map::load_new_object - generates a new object every time
444
-     */
445
-    protected function _register_core_dependencies()
446
-    {
447
-        $this->_dependency_map = [
448
-            'EE_Admin'                                                                                          => [
449
-                'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
450
-            ],
451
-            'EE_Request_Handler'                                                                                          => [
452
-                'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
453
-                'EventEspresso\core\services\request\Response'    => EE_Dependency_Map::load_from_cache,
454
-            ],
455
-            'EE_System'                                                                                                   => [
456
-                'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
457
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
458
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
459
-                'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
460
-            ],
461
-            'EE_Session'                                                                                                  => [
462
-                'EventEspresso\core\services\cache\TransientCacheStorage'  => EE_Dependency_Map::load_from_cache,
463
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
464
-                'EventEspresso\core\services\request\Request'              => EE_Dependency_Map::load_from_cache,
465
-                'EventEspresso\core\services\session\SessionStartHandler'  => EE_Dependency_Map::load_from_cache,
466
-                'EE_Encryption'                                            => EE_Dependency_Map::load_from_cache,
467
-            ],
468
-            'EE_Cart'                                                                                                     => [
469
-                'EE_Session' => EE_Dependency_Map::load_from_cache,
470
-            ],
471
-            'EE_Front_Controller'                                                                                         => [
472
-                'EE_Registry'                                     => EE_Dependency_Map::load_from_cache,
473
-                'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
474
-                'EE_Module_Request_Router'                        => EE_Dependency_Map::load_from_cache,
475
-            ],
476
-            'EE_Messenger_Collection_Loader'                                                                              => [
477
-                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
478
-            ],
479
-            'EE_Message_Type_Collection_Loader'                                                                           => [
480
-                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
481
-            ],
482
-            'EE_Message_Resource_Manager'                                                                                 => [
483
-                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
484
-                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
485
-                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
486
-            ],
487
-            'EE_Message_Factory'                                                                                          => [
488
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
489
-            ],
490
-            'EE_messages'                                                                                                 => [
491
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
492
-            ],
493
-            'EE_Messages_Generator'                                                                                       => [
494
-                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
495
-                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
496
-                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
497
-                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
498
-            ],
499
-            'EE_Messages_Processor'                                                                                       => [
500
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
501
-            ],
502
-            'EE_Messages_Queue'                                                                                           => [
503
-                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
504
-            ],
505
-            'EE_Messages_Template_Defaults'                                                                               => [
506
-                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
507
-                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
508
-            ],
509
-            'EE_Message_To_Generate_From_Request'                                                                         => [
510
-                'EE_Message_Resource_Manager'                 => EE_Dependency_Map::load_from_cache,
511
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
512
-            ],
513
-            'EventEspresso\core\services\commands\CommandBus'                                                             => [
514
-                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
515
-            ],
516
-            'EventEspresso\services\commands\CommandHandler'                                                              => [
517
-                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
518
-                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
519
-            ],
520
-            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
521
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
522
-            ],
523
-            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
524
-                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
525
-                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
526
-            ],
527
-            'EventEspresso\core\services\commands\CommandFactory'                                                         => [
528
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
529
-            ],
530
-            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
531
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
532
-            ],
533
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
534
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
535
-            ],
536
-            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
537
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
538
-            ],
539
-            'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommandHandler'                          => [
540
-                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
541
-            ],
542
-            'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
543
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
544
-            ],
545
-            'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
546
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
547
-            ],
548
-            'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
549
-                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
550
-            ],
551
-            'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
552
-                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
553
-            ],
554
-            'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
555
-                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
556
-            ],
557
-            'EventEspresso\core\domain\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
558
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
559
-            ],
560
-            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
561
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
562
-            ],
563
-            'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
564
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
565
-            ],
566
-            'EventEspresso\core\services\database\TableManager'                                                           => [
567
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
568
-            ],
569
-            'EE_Data_Migration_Class_Base'                                                                                => [
570
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
571
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
572
-            ],
573
-            'EE_DMS_Core_4_1_0'                                                                                           => [
574
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
575
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
576
-            ],
577
-            'EE_DMS_Core_4_2_0'                                                                                           => [
578
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
579
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
580
-            ],
581
-            'EE_DMS_Core_4_3_0'                                                                                           => [
582
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
583
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
584
-            ],
585
-            'EE_DMS_Core_4_4_0'                                                                                           => [
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_5_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_6_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_7_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_8_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_9_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_10_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
-                'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
613
-            ],
614
-            'EventEspresso\core\services\assets\I18nRegistry'                                                             => [
615
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
616
-            ],
617
-            'EventEspresso\core\services\assets\Registry'                                                                 => [
618
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
619
-                'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
620
-            ],
621
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => [
622
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
623
-            ],
624
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => [
625
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
626
-            ],
627
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => [
628
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
629
-            ],
630
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => [
631
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
632
-            ],
633
-            'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => [
634
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
635
-            ],
636
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => [
637
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
638
-            ],
639
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => [
640
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
641
-            ],
642
-            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
643
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
644
-            ],
645
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
646
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
647
-            ],
648
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
649
-                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
650
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
651
-            ],
652
-            'EventEspresso\core\domain\values\EmailAddress'                                                               => [
653
-                null,
654
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
655
-            ],
656
-            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
657
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
658
-            ],
659
-            'LEGACY_MODELS'                                                                                               => [
660
-                null,
661
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
662
-            ],
663
-            'EE_Module_Request_Router'                                                                                    => [
664
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
665
-            ],
666
-            'EE_Registration_Processor'                                                                                   => [
667
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
668
-            ],
669
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
670
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
671
-                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
672
-            ],
673
-            'EventEspresso\core\services\licensing\LicenseService'                                                        => [
674
-                'EventEspresso\core\domain\services\pue\Stats'  => EE_Dependency_Map::load_from_cache,
675
-                'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,
676
-            ],
677
-            'EE_Admin_Transactions_List_Table'                                                                            => [
678
-                null,
679
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
680
-            ],
681
-            'EventEspresso\core\domain\services\pue\Stats'                                                                => [
682
-                'EventEspresso\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
683
-                'EE_Maintenance_Mode'                                  => EE_Dependency_Map::load_from_cache,
684
-                'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
685
-            ],
686
-            'EventEspresso\core\domain\services\pue\Config'                                                               => [
687
-                'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
688
-                'EE_Config'         => EE_Dependency_Map::load_from_cache,
689
-            ],
690
-            'EventEspresso\core\domain\services\pue\StatsGatherer'                                                        => [
691
-                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
692
-                'EEM_Event'          => EE_Dependency_Map::load_from_cache,
693
-                'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
694
-                'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
695
-                'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
696
-                'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
697
-                'EE_Config'          => EE_Dependency_Map::load_from_cache,
698
-            ],
699
-            'EventEspresso\core\domain\services\admin\ExitModal'                                                          => [
700
-                'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache,
701
-            ],
702
-            'EventEspresso\core\domain\services\admin\PluginUpsells'                                                      => [
703
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
704
-            ],
705
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
706
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
707
-                'EE_Session'             => EE_Dependency_Map::load_from_cache,
708
-            ],
709
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings'                                => [
710
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
711
-            ],
712
-            'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [
713
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
714
-                'EE_Ticket_Selector_Config'                   => EE_Dependency_Map::load_from_cache,
715
-            ],
716
-            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
717
-                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
718
-                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
719
-                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
720
-                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
721
-                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
722
-            ],
723
-            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
724
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
725
-            ],
726
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
727
-                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
728
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
729
-            ],
730
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
731
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
732
-            ],
733
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
734
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
735
-            ],
736
-            'EE_CPT_Strategy'                                                                                             => [
737
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
738
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
739
-            ],
740
-            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
741
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
742
-            ],
743
-            'EventEspresso\core\domain\services\assets\CoreAssetManager'                                                  => [
744
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
745
-                'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
746
-                'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
747
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
748
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
749
-            ],
750
-            'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy'                                       => [
751
-                'EEM_Payment_Method'                                       => EE_Dependency_Map::load_from_cache,
752
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
753
-            ],
754
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee'                                      => [
755
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
756
-            ],
757
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData'                           => [
758
-                'EEM_Attendee'       => EE_Dependency_Map::load_from_cache,
759
-                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
760
-            ],
761
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins'                                      => [
762
-                'EEM_Checkin' => EE_Dependency_Map::load_from_cache,
763
-            ],
764
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration'                                  => [
765
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
766
-            ],
767
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction'                                   => [
768
-                'EEM_Transaction' => EE_Dependency_Map::load_from_cache,
769
-            ],
770
-            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData'                                  => [
771
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
772
-            ],
773
-            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers'                                       => [
774
-                'EEM_Answer'   => EE_Dependency_Map::load_from_cache,
775
-                'EEM_Question' => EE_Dependency_Map::load_from_cache,
776
-            ],
777
-            'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
778
-                null,
779
-                null,
780
-                null,
781
-                'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
782
-                'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
783
-                'EventEspresso\core\services\loaders\Loader'      => EE_Dependency_Map::load_from_cache,
784
-            ],
785
-            'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler'                           => [
786
-                'EE_Registry' => EE_Dependency_Map::load_from_cache,
787
-                'EE_Config'   => EE_Dependency_Map::load_from_cache,
788
-            ],
789
-            'EventEspresso\core\services\editor\BlockRegistrationManager'                                                 => [
790
-                'EventEspresso\core\services\assets\BlockAssetManagerCollection'         => EE_Dependency_Map::load_from_cache,
791
-                'EventEspresso\core\domain\entities\editor\BlockCollection'              => EE_Dependency_Map::load_from_cache,
792
-                'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
793
-                'EventEspresso\core\services\request\Request'                            => EE_Dependency_Map::load_from_cache,
794
-            ],
795
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'                                            => [
796
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
797
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
798
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
799
-            ],
800
-            'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer'                                       => [
801
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
802
-                'EEM_Attendee'                     => EE_Dependency_Map::load_from_cache,
803
-            ],
804
-            'EventEspresso\core\domain\entities\editor\blocks\EventAttendees'                                             => [
805
-                'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'      => self::load_from_cache,
806
-                'EventEspresso\core\services\request\Request'                           => EE_Dependency_Map::load_from_cache,
807
-                'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache,
808
-            ],
809
-            'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver'                           => [
810
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
811
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
812
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
813
-            ],
814
-            'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory'                                      => [
815
-                'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
816
-                'EventEspresso\core\services\loaders\Loader'                                        => EE_Dependency_Map::load_from_cache,
817
-            ],
818
-            'EventEspresso\core\services\route_match\RouteMatchSpecificationManager'                                      => [
819
-                'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
820
-                'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
821
-            ],
822
-            'EventEspresso\core\libraries\rest_api\CalculatedModelFields'                                                 => [
823
-                'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache,
824
-            ],
825
-            'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory'                             => [
826
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
827
-            ],
828
-            'EventEspresso\core\libraries\rest_api\controllers\model\Read'                                                => [
829
-                'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache,
830
-            ],
831
-            'EventEspresso\core\libraries\rest_api\calculations\Datetime'                                                 => [
832
-                'EEM_Datetime'     => EE_Dependency_Map::load_from_cache,
833
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
834
-            ],
835
-            'EventEspresso\core\libraries\rest_api\calculations\Event'                                                    => [
836
-                'EEM_Event'        => EE_Dependency_Map::load_from_cache,
837
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
838
-            ],
839
-            'EventEspresso\core\libraries\rest_api\calculations\Registration'                                             => [
840
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
841
-            ],
842
-            'EventEspresso\core\services\session\SessionStartHandler'                                                     => [
843
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
844
-            ],
845
-            'EE_URL_Validation_Strategy'                                                                                  => [
846
-                null,
847
-                null,
848
-                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
849
-            ],
850
-            'EventEspresso\admin_pages\general_settings\OrganizationSettings'                                             => [
851
-                'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
852
-                'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
853
-                'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
854
-                'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
855
-                'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
856
-            ],
857
-            'EventEspresso\core\services\address\CountrySubRegionDao'                                                     => [
858
-                'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
859
-                'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache,
860
-            ],
861
-            'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'                                            => [
862
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
863
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
864
-            ],
865
-            'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'                                          => [
866
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
867
-                'EE_Environment_Config'            => EE_Dependency_Map::load_from_cache,
868
-            ],
869
-            'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
870
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
871
-            ],
872
-            'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
873
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
874
-            ],
875
-            'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder'                              => [
876
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
877
-                'EEM_Registration'                            => EE_Dependency_Map::load_from_cache,
878
-                null,
879
-            ],
880
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader'          => [
881
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
882
-                'EEM_Attendee'                                => EE_Dependency_Map::load_from_cache,
883
-            ],
884
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader'              => [
885
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
886
-                'EEM_Datetime'                                => EE_Dependency_Map::load_from_cache,
887
-            ],
888
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader'             => [
889
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
890
-                'EEM_Event'                                   => EE_Dependency_Map::load_from_cache,
891
-            ],
892
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader'            => [
893
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
894
-                'EEM_Ticket'                                  => EE_Dependency_Map::load_from_cache,
895
-            ],
896
-            'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion'                                                  => [
897
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
898
-            ],
899
-            'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion'                                                  => [
900
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
901
-            ],
902
-            'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion'                                        => [
903
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
904
-                'EEM_Event'                                                   => EE_Dependency_Map::load_from_cache,
905
-                'EEM_Datetime'                                                => EE_Dependency_Map::load_from_cache,
906
-                'EEM_Registration'                                            => EE_Dependency_Map::load_from_cache,
907
-            ],
908
-            'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion'                                        => [
909
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
910
-            ],
911
-            'EventEspresso\core\services\request\CurrentPage'                                                             => [
912
-                'EE_CPT_Strategy'                             => EE_Dependency_Map::load_from_cache,
913
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
914
-            ],
915
-            'EventEspresso\core\services\shortcodes\LegacyShortcodesManager'                                              => [
916
-                'EE_Registry'                                     => EE_Dependency_Map::load_from_cache,
917
-                'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
918
-            ],
919
-            'EventEspresso\core\services\shortcodes\ShortcodesManager'                                                    => [
920
-                'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache,
921
-                'EventEspresso\core\services\request\CurrentPage'                => EE_Dependency_Map::load_from_cache,
922
-            ],
923
-        ];
924
-    }
925
-
926
-
927
-    /**
928
-     * Registers how core classes are loaded.
929
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
930
-     *        'EE_Request_Handler' => 'load_core'
931
-     *        'EE_Messages_Queue'  => 'load_lib'
932
-     *        'EEH_Debug_Tools'    => 'load_helper'
933
-     * or, if greater control is required, by providing a custom closure. For example:
934
-     *        'Some_Class' => function () {
935
-     *            return new Some_Class();
936
-     *        },
937
-     * This is required for instantiating dependencies
938
-     * where an interface has been type hinted in a class constructor. For example:
939
-     *        'Required_Interface' => function () {
940
-     *            return new A_Class_That_Implements_Required_Interface();
941
-     *        },
942
-     */
943
-    protected function _register_core_class_loaders()
944
-    {
945
-        $this->_class_loaders = [
946
-            // load_core
947
-            'EE_Dependency_Map'                            => function () {
948
-                return $this;
949
-            },
950
-            'EE_Capabilities'                              => 'load_core',
951
-            'EE_Encryption'                                => 'load_core',
952
-            'EE_Front_Controller'                          => 'load_core',
953
-            'EE_Module_Request_Router'                     => 'load_core',
954
-            'EE_Registry'                                  => 'load_core',
955
-            'EE_Request'                                   => function () {
956
-                return $this->legacy_request;
957
-            },
958
-            'EventEspresso\core\services\request\Request'  => function () {
959
-                return $this->request;
960
-            },
961
-            'EventEspresso\core\services\request\Response' => function () {
962
-                return $this->response;
963
-            },
964
-            'EE_Base'                                      => 'load_core',
965
-            'EE_Request_Handler'                           => 'load_core',
966
-            'EE_Session'                                   => 'load_core',
967
-            'EE_Cron_Tasks'                                => 'load_core',
968
-            'EE_System'                                    => 'load_core',
969
-            'EE_Maintenance_Mode'                          => 'load_core',
970
-            'EE_Register_CPTs'                             => 'load_core',
971
-            'EE_Admin'                                     => 'load_core',
972
-            'EE_CPT_Strategy'                              => 'load_core',
973
-            // load_class
974
-            'EE_Registration_Processor'                    => 'load_class',
975
-            // load_lib
976
-            'EE_Message_Resource_Manager'                  => 'load_lib',
977
-            'EE_Message_Type_Collection'                   => 'load_lib',
978
-            'EE_Message_Type_Collection_Loader'            => 'load_lib',
979
-            'EE_Messenger_Collection'                      => 'load_lib',
980
-            'EE_Messenger_Collection_Loader'               => 'load_lib',
981
-            'EE_Messages_Processor'                        => 'load_lib',
982
-            'EE_Message_Repository'                        => 'load_lib',
983
-            'EE_Messages_Queue'                            => 'load_lib',
984
-            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
985
-            'EE_Message_Template_Group_Collection'         => 'load_lib',
986
-            'EE_Payment_Method_Manager'                    => 'load_lib',
987
-            'EE_DMS_Core_4_1_0'                            => 'load_dms',
988
-            'EE_DMS_Core_4_2_0'                            => 'load_dms',
989
-            'EE_DMS_Core_4_3_0'                            => 'load_dms',
990
-            'EE_DMS_Core_4_5_0'                            => 'load_dms',
991
-            'EE_DMS_Core_4_6_0'                            => 'load_dms',
992
-            'EE_DMS_Core_4_7_0'                            => 'load_dms',
993
-            'EE_DMS_Core_4_8_0'                            => 'load_dms',
994
-            'EE_DMS_Core_4_9_0'                            => 'load_dms',
995
-            'EE_DMS_Core_4_10_0'                           => 'load_dms',
996
-            'EE_Messages_Generator'                        => function () {
997
-                return EE_Registry::instance()->load_lib(
998
-                    'Messages_Generator',
999
-                    [],
1000
-                    false,
1001
-                    false
1002
-                );
1003
-            },
1004
-            'EE_Messages_Template_Defaults'                => function ($arguments = []) {
1005
-                return EE_Registry::instance()->load_lib(
1006
-                    'Messages_Template_Defaults',
1007
-                    $arguments,
1008
-                    false,
1009
-                    false
1010
-                );
1011
-            },
1012
-            // load_helper
1013
-            'EEH_Parse_Shortcodes'                         => function () {
1014
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
1015
-                    return new EEH_Parse_Shortcodes();
1016
-                }
1017
-                return null;
1018
-            },
1019
-            'EE_Template_Config'                           => function () {
1020
-                return EE_Config::instance()->template_settings;
1021
-            },
1022
-            'EE_Currency_Config'                           => function () {
1023
-                return EE_Config::instance()->currency;
1024
-            },
1025
-            'EE_Registration_Config'                       => function () {
1026
-                return EE_Config::instance()->registration;
1027
-            },
1028
-            'EE_Core_Config'                               => function () {
1029
-                return EE_Config::instance()->core;
1030
-            },
1031
-            'EventEspresso\core\services\loaders\Loader'   => function () {
1032
-                return LoaderFactory::getLoader();
1033
-            },
1034
-            'EE_Network_Config'                            => function () {
1035
-                return EE_Network_Config::instance();
1036
-            },
1037
-            'EE_Config'                                    => function () {
1038
-                return EE_Config::instance();
1039
-            },
1040
-            'EventEspresso\core\domain\Domain'             => function () {
1041
-                return DomainFactory::getEventEspressoCoreDomain();
1042
-            },
1043
-            'EE_Admin_Config'                              => function () {
1044
-                return EE_Config::instance()->admin;
1045
-            },
1046
-            'EE_Organization_Config'                       => function () {
1047
-                return EE_Config::instance()->organization;
1048
-            },
1049
-            'EE_Network_Core_Config'                       => function () {
1050
-                return EE_Network_Config::instance()->core;
1051
-            },
1052
-            'EE_Environment_Config'                        => function () {
1053
-                return EE_Config::instance()->environment;
1054
-            },
1055
-            'EE_Ticket_Selector_Config'                    => function () {
1056
-                return EE_Config::instance()->template_settings->EED_Ticket_Selector;
1057
-            },
1058
-        ];
1059
-    }
1060
-
1061
-
1062
-    /**
1063
-     * can be used for supplying alternate names for classes,
1064
-     * or for connecting interface names to instantiable classes
1065
-     */
1066
-    protected function _register_core_aliases()
1067
-    {
1068
-        $aliases = [
1069
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
1070
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
1071
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
1072
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
1073
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
1074
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
1075
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1076
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
1077
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1078
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
1079
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommand',
1080
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommand',
1081
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommand',
1082
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
1083
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
1084
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommand',
1085
-            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\domain\services\commands\transaction\CreateTransactionCommandHandler',
1086
-            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler',
1087
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
1088
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
1089
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1090
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
1091
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1092
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
1093
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
1094
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
1095
-            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
1096
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
1097
-            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
1098
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
1099
-            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
1100
-            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
1101
-            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
1102
-            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
1103
-            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
1104
-            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
1105
-            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
1106
-            'Registration_Processor'                                                       => 'EE_Registration_Processor',
1107
-        ];
1108
-        foreach ($aliases as $alias => $fqn) {
1109
-            if (is_array($fqn)) {
1110
-                foreach ($fqn as $class => $for_class) {
1111
-                    $this->class_cache->addAlias($class, $alias, $for_class);
1112
-                }
1113
-                continue;
1114
-            }
1115
-            $this->class_cache->addAlias($fqn, $alias);
1116
-        }
1117
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1118
-            $this->class_cache->addAlias(
1119
-                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
1120
-                'EventEspresso\core\services\notices\NoticeConverterInterface'
1121
-            );
1122
-        }
1123
-    }
1124
-
1125
-
1126
-    public function debug($for_class = '')
1127
-    {
1128
-        $this->class_cache->debug($for_class);
1129
-    }
1130
-
1131
-
1132
-    /**
1133
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1134
-     * request Primarily used by unit tests.
1135
-     */
1136
-    public function reset()
1137
-    {
1138
-        $this->_register_core_class_loaders();
1139
-        $this->_register_core_dependencies();
1140
-    }
1141
-
1142
-
1143
-    /**
1144
-     * PLZ NOTE: a better name for this method would be is_alias()
1145
-     * because it returns TRUE if the provided fully qualified name IS an alias
1146
-     * WHY?
1147
-     * Because if a class is type hinting for a concretion,
1148
-     * then why would we need to find another class to supply it?
1149
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1150
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1151
-     * Don't go looking for some substitute.
1152
-     * Whereas if a class is type hinting for an interface...
1153
-     * then we need to find an actual class to use.
1154
-     * So the interface IS the alias for some other FQN,
1155
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1156
-     * represents some other class.
1157
-     *
1158
-     * @param string $fqn
1159
-     * @param string $for_class
1160
-     * @return bool
1161
-     * @deprecated 4.9.62.p
1162
-     */
1163
-    public function has_alias($fqn = '', $for_class = '')
1164
-    {
1165
-        return $this->isAlias($fqn, $for_class);
1166
-    }
1167
-
1168
-
1169
-    /**
1170
-     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1171
-     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1172
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
1173
-     *  for example:
1174
-     *      if the following two entries were added to the _aliases array:
1175
-     *          array(
1176
-     *              'interface_alias'           => 'some\namespace\interface'
1177
-     *              'some\namespace\interface'  => 'some\namespace\classname'
1178
-     *          )
1179
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1180
-     *      to load an instance of 'some\namespace\classname'
1181
-     *
1182
-     * @param string $alias
1183
-     * @param string $for_class
1184
-     * @return string
1185
-     * @deprecated 4.9.62.p
1186
-     */
1187
-    public function get_alias($alias = '', $for_class = '')
1188
-    {
1189
-        return $this->getFqnForAlias($alias, $for_class);
1190
-    }
22
+	/**
23
+	 * This means that the requested class dependency is not present in the dependency map
24
+	 */
25
+	const not_registered = 0;
26
+
27
+	/**
28
+	 * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
29
+	 */
30
+	const load_new_object = 1;
31
+
32
+	/**
33
+	 * This instructs class loaders to return a previously instantiated and cached object for the requested class.
34
+	 * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
35
+	 */
36
+	const load_from_cache = 2;
37
+
38
+	/**
39
+	 * When registering a dependency,
40
+	 * this indicates to keep any existing dependencies that already exist,
41
+	 * and simply discard any new dependencies declared in the incoming data
42
+	 */
43
+	const KEEP_EXISTING_DEPENDENCIES = 0;
44
+
45
+	/**
46
+	 * When registering a dependency,
47
+	 * this indicates to overwrite any existing dependencies that already exist using the incoming data
48
+	 */
49
+	const OVERWRITE_DEPENDENCIES = 1;
50
+
51
+
52
+	/**
53
+	 * @type EE_Dependency_Map $_instance
54
+	 */
55
+	protected static $_instance;
56
+
57
+	/**
58
+	 * @var ClassInterfaceCache $class_cache
59
+	 */
60
+	private $class_cache;
61
+
62
+	/**
63
+	 * @type RequestInterface $request
64
+	 */
65
+	protected $request;
66
+
67
+	/**
68
+	 * @type LegacyRequestInterface $legacy_request
69
+	 */
70
+	protected $legacy_request;
71
+
72
+	/**
73
+	 * @type ResponseInterface $response
74
+	 */
75
+	protected $response;
76
+
77
+	/**
78
+	 * @type LoaderInterface $loader
79
+	 */
80
+	protected $loader;
81
+
82
+	/**
83
+	 * @type array $_dependency_map
84
+	 */
85
+	protected $_dependency_map = [];
86
+
87
+	/**
88
+	 * @type array $_class_loaders
89
+	 */
90
+	protected $_class_loaders = [];
91
+
92
+
93
+	/**
94
+	 * EE_Dependency_Map constructor.
95
+	 *
96
+	 * @param ClassInterfaceCache $class_cache
97
+	 */
98
+	protected function __construct(ClassInterfaceCache $class_cache)
99
+	{
100
+		$this->class_cache = $class_cache;
101
+		do_action('EE_Dependency_Map____construct', $this);
102
+	}
103
+
104
+
105
+	/**
106
+	 * @return void
107
+	 */
108
+	public function initialize()
109
+	{
110
+		$this->_register_core_dependencies();
111
+		$this->_register_core_class_loaders();
112
+		$this->_register_core_aliases();
113
+	}
114
+
115
+
116
+	/**
117
+	 * @singleton method used to instantiate class object
118
+	 * @param ClassInterfaceCache|null $class_cache
119
+	 * @return EE_Dependency_Map
120
+	 */
121
+	public static function instance(ClassInterfaceCache $class_cache = null)
122
+	{
123
+		// check if class object is instantiated, and instantiated properly
124
+		if (
125
+			! self::$_instance instanceof EE_Dependency_Map
126
+			&& $class_cache instanceof ClassInterfaceCache
127
+		) {
128
+			self::$_instance = new EE_Dependency_Map($class_cache);
129
+		}
130
+		return self::$_instance;
131
+	}
132
+
133
+
134
+	/**
135
+	 * @param RequestInterface $request
136
+	 */
137
+	public function setRequest(RequestInterface $request)
138
+	{
139
+		$this->request = $request;
140
+	}
141
+
142
+
143
+	/**
144
+	 * @param LegacyRequestInterface $legacy_request
145
+	 */
146
+	public function setLegacyRequest(LegacyRequestInterface $legacy_request)
147
+	{
148
+		$this->legacy_request = $legacy_request;
149
+	}
150
+
151
+
152
+	/**
153
+	 * @param ResponseInterface $response
154
+	 */
155
+	public function setResponse(ResponseInterface $response)
156
+	{
157
+		$this->response = $response;
158
+	}
159
+
160
+
161
+	/**
162
+	 * @param LoaderInterface $loader
163
+	 */
164
+	public function setLoader(LoaderInterface $loader)
165
+	{
166
+		$this->loader = $loader;
167
+	}
168
+
169
+
170
+	/**
171
+	 * @param string $class
172
+	 * @param array  $dependencies
173
+	 * @param int    $overwrite
174
+	 * @return bool
175
+	 */
176
+	public static function register_dependencies(
177
+		$class,
178
+		array $dependencies,
179
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
180
+	) {
181
+		return self::$_instance->registerDependencies($class, $dependencies, $overwrite);
182
+	}
183
+
184
+
185
+	/**
186
+	 * Assigns an array of class names and corresponding load sources (new or cached)
187
+	 * to the class specified by the first parameter.
188
+	 * IMPORTANT !!!
189
+	 * The order of elements in the incoming $dependencies array MUST match
190
+	 * the order of the constructor parameters for the class in question.
191
+	 * This is especially important when overriding any existing dependencies that are registered.
192
+	 * the third parameter controls whether any duplicate dependencies are overwritten or not.
193
+	 *
194
+	 * @param string $class
195
+	 * @param array  $dependencies
196
+	 * @param int    $overwrite
197
+	 * @return bool
198
+	 */
199
+	public function registerDependencies(
200
+		$class,
201
+		array $dependencies,
202
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
203
+	) {
204
+		$class      = trim($class, '\\');
205
+		$registered = false;
206
+		if (empty(self::$_instance->_dependency_map[ $class ])) {
207
+			self::$_instance->_dependency_map[ $class ] = [];
208
+		}
209
+		// we need to make sure that any aliases used when registering a dependency
210
+		// get resolved to the correct class name
211
+		foreach ($dependencies as $dependency => $load_source) {
212
+			$alias = self::$_instance->getFqnForAlias($dependency);
213
+			if (
214
+				$overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
215
+				|| ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
216
+			) {
217
+				unset($dependencies[ $dependency ]);
218
+				$dependencies[ $alias ] = $load_source;
219
+				$registered             = true;
220
+			}
221
+		}
222
+		// now add our two lists of dependencies together.
223
+		// using Union (+=) favours the arrays in precedence from left to right,
224
+		// so $dependencies is NOT overwritten because it is listed first
225
+		// ie: with A = B + C, entries in B take precedence over duplicate entries in C
226
+		// Union is way faster than array_merge() but should be used with caution...
227
+		// especially with numerically indexed arrays
228
+		$dependencies += self::$_instance->_dependency_map[ $class ];
229
+		// now we need to ensure that the resulting dependencies
230
+		// array only has the entries that are required for the class
231
+		// so first count how many dependencies were originally registered for the class
232
+		$dependency_count = count(self::$_instance->_dependency_map[ $class ]);
233
+		// if that count is non-zero (meaning dependencies were already registered)
234
+		self::$_instance->_dependency_map[ $class ] = $dependency_count
235
+			// then truncate the  final array to match that count
236
+			? array_slice($dependencies, 0, $dependency_count)
237
+			// otherwise just take the incoming array because nothing previously existed
238
+			: $dependencies;
239
+		return $registered;
240
+	}
241
+
242
+
243
+	/**
244
+	 * @param string $class_name
245
+	 * @param string $loader
246
+	 * @param bool   $overwrite
247
+	 * @return bool
248
+	 * @throws DomainException
249
+	 */
250
+	public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false)
251
+	{
252
+		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
253
+			throw new DomainException(
254
+				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
255
+			);
256
+		}
257
+		// check that loader is callable or method starts with "load_" and exists in EE_Registry
258
+		if (
259
+			! is_callable($loader)
260
+			&& (
261
+				strpos($loader, 'load_') !== 0
262
+				|| ! method_exists('EE_Registry', $loader)
263
+			)
264
+		) {
265
+			throw new DomainException(
266
+				sprintf(
267
+					esc_html__(
268
+						'"%1$s" is not a valid loader method on EE_Registry.',
269
+						'event_espresso'
270
+					),
271
+					$loader
272
+				)
273
+			);
274
+		}
275
+		$class_name = self::$_instance->getFqnForAlias($class_name);
276
+		if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) {
277
+			self::$_instance->_class_loaders[ $class_name ] = $loader;
278
+			return true;
279
+		}
280
+		return false;
281
+	}
282
+
283
+
284
+	/**
285
+	 * @return array
286
+	 */
287
+	public function dependency_map()
288
+	{
289
+		return $this->_dependency_map;
290
+	}
291
+
292
+
293
+	/**
294
+	 * returns TRUE if dependency map contains a listing for the provided class name
295
+	 *
296
+	 * @param string $class_name
297
+	 * @return boolean
298
+	 */
299
+	public function has($class_name = '')
300
+	{
301
+		// all legacy models have the same dependencies
302
+		if (strpos($class_name, 'EEM_') === 0) {
303
+			$class_name = 'LEGACY_MODELS';
304
+		}
305
+		return isset($this->_dependency_map[ $class_name ]);
306
+	}
307
+
308
+
309
+	/**
310
+	 * returns TRUE if dependency map contains a listing for the provided class name AND dependency
311
+	 *
312
+	 * @param string $class_name
313
+	 * @param string $dependency
314
+	 * @return bool
315
+	 */
316
+	public function has_dependency_for_class($class_name = '', $dependency = '')
317
+	{
318
+		// all legacy models have the same dependencies
319
+		if (strpos($class_name, 'EEM_') === 0) {
320
+			$class_name = 'LEGACY_MODELS';
321
+		}
322
+		$dependency = $this->getFqnForAlias($dependency, $class_name);
323
+		return isset($this->_dependency_map[ $class_name ][ $dependency ]);
324
+	}
325
+
326
+
327
+	/**
328
+	 * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
329
+	 *
330
+	 * @param string $class_name
331
+	 * @param string $dependency
332
+	 * @return int
333
+	 */
334
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
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);
341
+		return $this->has_dependency_for_class($class_name, $dependency)
342
+			? $this->_dependency_map[ $class_name ][ $dependency ]
343
+			: EE_Dependency_Map::not_registered;
344
+	}
345
+
346
+
347
+	/**
348
+	 * @param string $class_name
349
+	 * @return string | Closure
350
+	 */
351
+	public function class_loader($class_name)
352
+	{
353
+		// all legacy models use load_model()
354
+		if (strpos($class_name, 'EEM_') === 0) {
355
+			return 'load_model';
356
+		}
357
+		// EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
358
+		// perform strpos() first to avoid loading regex every time we load a class
359
+		if (
360
+			strpos($class_name, 'EE_CPT_') === 0
361
+			&& preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
362
+		) {
363
+			return 'load_core';
364
+		}
365
+		$class_name = $this->getFqnForAlias($class_name);
366
+		return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
367
+	}
368
+
369
+
370
+	/**
371
+	 * @return array
372
+	 */
373
+	public function class_loaders()
374
+	{
375
+		return $this->_class_loaders;
376
+	}
377
+
378
+
379
+	/**
380
+	 * adds an alias for a classname
381
+	 *
382
+	 * @param string $fqcn      the class name that should be used (concrete class to replace interface)
383
+	 * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
384
+	 * @param string $for_class the class that has the dependency (is type hinting for the interface)
385
+	 */
386
+	public function add_alias($fqcn, $alias, $for_class = '')
387
+	{
388
+		$this->class_cache->addAlias($fqcn, $alias, $for_class);
389
+	}
390
+
391
+
392
+	/**
393
+	 * Returns TRUE if the provided fully qualified name IS an alias
394
+	 * WHY?
395
+	 * Because if a class is type hinting for a concretion,
396
+	 * then why would we need to find another class to supply it?
397
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
398
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
399
+	 * Don't go looking for some substitute.
400
+	 * Whereas if a class is type hinting for an interface...
401
+	 * then we need to find an actual class to use.
402
+	 * So the interface IS the alias for some other FQN,
403
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
404
+	 * represents some other class.
405
+	 *
406
+	 * @param string $fqn
407
+	 * @param string $for_class
408
+	 * @return bool
409
+	 */
410
+	public function isAlias($fqn = '', $for_class = '')
411
+	{
412
+		return $this->class_cache->isAlias($fqn, $for_class);
413
+	}
414
+
415
+
416
+	/**
417
+	 * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
418
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
419
+	 *  for example:
420
+	 *      if the following two entries were added to the _aliases array:
421
+	 *          array(
422
+	 *              'interface_alias'           => 'some\namespace\interface'
423
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
424
+	 *          )
425
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
426
+	 *      to load an instance of 'some\namespace\classname'
427
+	 *
428
+	 * @param string $alias
429
+	 * @param string $for_class
430
+	 * @return string
431
+	 */
432
+	public function getFqnForAlias($alias = '', $for_class = '')
433
+	{
434
+		return $this->class_cache->getFqnForAlias($alias, $for_class);
435
+	}
436
+
437
+
438
+	/**
439
+	 * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
440
+	 * if one exists, or whether a new object should be generated every time the requested class is loaded.
441
+	 * This is done by using the following class constants:
442
+	 *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
443
+	 *        EE_Dependency_Map::load_new_object - generates a new object every time
444
+	 */
445
+	protected function _register_core_dependencies()
446
+	{
447
+		$this->_dependency_map = [
448
+			'EE_Admin'                                                                                          => [
449
+				'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
450
+			],
451
+			'EE_Request_Handler'                                                                                          => [
452
+				'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
453
+				'EventEspresso\core\services\request\Response'    => EE_Dependency_Map::load_from_cache,
454
+			],
455
+			'EE_System'                                                                                                   => [
456
+				'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
457
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
458
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
459
+				'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
460
+			],
461
+			'EE_Session'                                                                                                  => [
462
+				'EventEspresso\core\services\cache\TransientCacheStorage'  => EE_Dependency_Map::load_from_cache,
463
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
464
+				'EventEspresso\core\services\request\Request'              => EE_Dependency_Map::load_from_cache,
465
+				'EventEspresso\core\services\session\SessionStartHandler'  => EE_Dependency_Map::load_from_cache,
466
+				'EE_Encryption'                                            => EE_Dependency_Map::load_from_cache,
467
+			],
468
+			'EE_Cart'                                                                                                     => [
469
+				'EE_Session' => EE_Dependency_Map::load_from_cache,
470
+			],
471
+			'EE_Front_Controller'                                                                                         => [
472
+				'EE_Registry'                                     => EE_Dependency_Map::load_from_cache,
473
+				'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
474
+				'EE_Module_Request_Router'                        => EE_Dependency_Map::load_from_cache,
475
+			],
476
+			'EE_Messenger_Collection_Loader'                                                                              => [
477
+				'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
478
+			],
479
+			'EE_Message_Type_Collection_Loader'                                                                           => [
480
+				'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
481
+			],
482
+			'EE_Message_Resource_Manager'                                                                                 => [
483
+				'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
484
+				'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
485
+				'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
486
+			],
487
+			'EE_Message_Factory'                                                                                          => [
488
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
489
+			],
490
+			'EE_messages'                                                                                                 => [
491
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
492
+			],
493
+			'EE_Messages_Generator'                                                                                       => [
494
+				'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
495
+				'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
496
+				'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
497
+				'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
498
+			],
499
+			'EE_Messages_Processor'                                                                                       => [
500
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
501
+			],
502
+			'EE_Messages_Queue'                                                                                           => [
503
+				'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
504
+			],
505
+			'EE_Messages_Template_Defaults'                                                                               => [
506
+				'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
507
+				'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
508
+			],
509
+			'EE_Message_To_Generate_From_Request'                                                                         => [
510
+				'EE_Message_Resource_Manager'                 => EE_Dependency_Map::load_from_cache,
511
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
512
+			],
513
+			'EventEspresso\core\services\commands\CommandBus'                                                             => [
514
+				'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
515
+			],
516
+			'EventEspresso\services\commands\CommandHandler'                                                              => [
517
+				'EE_Registry'         => EE_Dependency_Map::load_from_cache,
518
+				'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
519
+			],
520
+			'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
521
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
522
+			],
523
+			'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
524
+				'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
525
+				'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
526
+			],
527
+			'EventEspresso\core\services\commands\CommandFactory'                                                         => [
528
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
529
+			],
530
+			'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
531
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
532
+			],
533
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
534
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
535
+			],
536
+			'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
537
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
538
+			],
539
+			'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommandHandler'                          => [
540
+				'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
541
+			],
542
+			'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
543
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
544
+			],
545
+			'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
546
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
547
+			],
548
+			'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
549
+				'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
550
+			],
551
+			'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
552
+				'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
553
+			],
554
+			'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
555
+				'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
556
+			],
557
+			'EventEspresso\core\domain\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
558
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
559
+			],
560
+			'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
561
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
562
+			],
563
+			'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
564
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
565
+			],
566
+			'EventEspresso\core\services\database\TableManager'                                                           => [
567
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
568
+			],
569
+			'EE_Data_Migration_Class_Base'                                                                                => [
570
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
571
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
572
+			],
573
+			'EE_DMS_Core_4_1_0'                                                                                           => [
574
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
575
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
576
+			],
577
+			'EE_DMS_Core_4_2_0'                                                                                           => [
578
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
579
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
580
+			],
581
+			'EE_DMS_Core_4_3_0'                                                                                           => [
582
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
583
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
584
+			],
585
+			'EE_DMS_Core_4_4_0'                                                                                           => [
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_5_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_6_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_7_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_8_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_9_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_10_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
+				'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
613
+			],
614
+			'EventEspresso\core\services\assets\I18nRegistry'                                                             => [
615
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
616
+			],
617
+			'EventEspresso\core\services\assets\Registry'                                                                 => [
618
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
619
+				'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
620
+			],
621
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => [
622
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
623
+			],
624
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => [
625
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
626
+			],
627
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => [
628
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
629
+			],
630
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => [
631
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
632
+			],
633
+			'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => [
634
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
635
+			],
636
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => [
637
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
638
+			],
639
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => [
640
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
641
+			],
642
+			'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
643
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
644
+			],
645
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
646
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
647
+			],
648
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
649
+				'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
650
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
651
+			],
652
+			'EventEspresso\core\domain\values\EmailAddress'                                                               => [
653
+				null,
654
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
655
+			],
656
+			'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
657
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
658
+			],
659
+			'LEGACY_MODELS'                                                                                               => [
660
+				null,
661
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
662
+			],
663
+			'EE_Module_Request_Router'                                                                                    => [
664
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
665
+			],
666
+			'EE_Registration_Processor'                                                                                   => [
667
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
668
+			],
669
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
670
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
671
+				'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
672
+			],
673
+			'EventEspresso\core\services\licensing\LicenseService'                                                        => [
674
+				'EventEspresso\core\domain\services\pue\Stats'  => EE_Dependency_Map::load_from_cache,
675
+				'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,
676
+			],
677
+			'EE_Admin_Transactions_List_Table'                                                                            => [
678
+				null,
679
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
680
+			],
681
+			'EventEspresso\core\domain\services\pue\Stats'                                                                => [
682
+				'EventEspresso\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
683
+				'EE_Maintenance_Mode'                                  => EE_Dependency_Map::load_from_cache,
684
+				'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
685
+			],
686
+			'EventEspresso\core\domain\services\pue\Config'                                                               => [
687
+				'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
688
+				'EE_Config'         => EE_Dependency_Map::load_from_cache,
689
+			],
690
+			'EventEspresso\core\domain\services\pue\StatsGatherer'                                                        => [
691
+				'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
692
+				'EEM_Event'          => EE_Dependency_Map::load_from_cache,
693
+				'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
694
+				'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
695
+				'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
696
+				'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
697
+				'EE_Config'          => EE_Dependency_Map::load_from_cache,
698
+			],
699
+			'EventEspresso\core\domain\services\admin\ExitModal'                                                          => [
700
+				'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache,
701
+			],
702
+			'EventEspresso\core\domain\services\admin\PluginUpsells'                                                      => [
703
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
704
+			],
705
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
706
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
707
+				'EE_Session'             => EE_Dependency_Map::load_from_cache,
708
+			],
709
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings'                                => [
710
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
711
+			],
712
+			'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [
713
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
714
+				'EE_Ticket_Selector_Config'                   => EE_Dependency_Map::load_from_cache,
715
+			],
716
+			'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
717
+				'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
718
+				'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
719
+				'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
720
+				'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
721
+				'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
722
+			],
723
+			'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
724
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
725
+			],
726
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
727
+				'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
728
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
729
+			],
730
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
731
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
732
+			],
733
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
734
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
735
+			],
736
+			'EE_CPT_Strategy'                                                                                             => [
737
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
738
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
739
+			],
740
+			'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
741
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
742
+			],
743
+			'EventEspresso\core\domain\services\assets\CoreAssetManager'                                                  => [
744
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
745
+				'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
746
+				'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
747
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
748
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
749
+			],
750
+			'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy'                                       => [
751
+				'EEM_Payment_Method'                                       => EE_Dependency_Map::load_from_cache,
752
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
753
+			],
754
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee'                                      => [
755
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
756
+			],
757
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData'                           => [
758
+				'EEM_Attendee'       => EE_Dependency_Map::load_from_cache,
759
+				'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
760
+			],
761
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins'                                      => [
762
+				'EEM_Checkin' => EE_Dependency_Map::load_from_cache,
763
+			],
764
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration'                                  => [
765
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
766
+			],
767
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction'                                   => [
768
+				'EEM_Transaction' => EE_Dependency_Map::load_from_cache,
769
+			],
770
+			'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData'                                  => [
771
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
772
+			],
773
+			'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers'                                       => [
774
+				'EEM_Answer'   => EE_Dependency_Map::load_from_cache,
775
+				'EEM_Question' => EE_Dependency_Map::load_from_cache,
776
+			],
777
+			'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
778
+				null,
779
+				null,
780
+				null,
781
+				'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
782
+				'EventEspresso\core\services\request\Request'     => EE_Dependency_Map::load_from_cache,
783
+				'EventEspresso\core\services\loaders\Loader'      => EE_Dependency_Map::load_from_cache,
784
+			],
785
+			'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler'                           => [
786
+				'EE_Registry' => EE_Dependency_Map::load_from_cache,
787
+				'EE_Config'   => EE_Dependency_Map::load_from_cache,
788
+			],
789
+			'EventEspresso\core\services\editor\BlockRegistrationManager'                                                 => [
790
+				'EventEspresso\core\services\assets\BlockAssetManagerCollection'         => EE_Dependency_Map::load_from_cache,
791
+				'EventEspresso\core\domain\entities\editor\BlockCollection'              => EE_Dependency_Map::load_from_cache,
792
+				'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
793
+				'EventEspresso\core\services\request\Request'                            => EE_Dependency_Map::load_from_cache,
794
+			],
795
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'                                            => [
796
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
797
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
798
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
799
+			],
800
+			'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer'                                       => [
801
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
802
+				'EEM_Attendee'                     => EE_Dependency_Map::load_from_cache,
803
+			],
804
+			'EventEspresso\core\domain\entities\editor\blocks\EventAttendees'                                             => [
805
+				'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'      => self::load_from_cache,
806
+				'EventEspresso\core\services\request\Request'                           => EE_Dependency_Map::load_from_cache,
807
+				'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache,
808
+			],
809
+			'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver'                           => [
810
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
811
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
812
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
813
+			],
814
+			'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory'                                      => [
815
+				'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
816
+				'EventEspresso\core\services\loaders\Loader'                                        => EE_Dependency_Map::load_from_cache,
817
+			],
818
+			'EventEspresso\core\services\route_match\RouteMatchSpecificationManager'                                      => [
819
+				'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
820
+				'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
821
+			],
822
+			'EventEspresso\core\libraries\rest_api\CalculatedModelFields'                                                 => [
823
+				'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache,
824
+			],
825
+			'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory'                             => [
826
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
827
+			],
828
+			'EventEspresso\core\libraries\rest_api\controllers\model\Read'                                                => [
829
+				'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache,
830
+			],
831
+			'EventEspresso\core\libraries\rest_api\calculations\Datetime'                                                 => [
832
+				'EEM_Datetime'     => EE_Dependency_Map::load_from_cache,
833
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
834
+			],
835
+			'EventEspresso\core\libraries\rest_api\calculations\Event'                                                    => [
836
+				'EEM_Event'        => EE_Dependency_Map::load_from_cache,
837
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
838
+			],
839
+			'EventEspresso\core\libraries\rest_api\calculations\Registration'                                             => [
840
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
841
+			],
842
+			'EventEspresso\core\services\session\SessionStartHandler'                                                     => [
843
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
844
+			],
845
+			'EE_URL_Validation_Strategy'                                                                                  => [
846
+				null,
847
+				null,
848
+				'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
849
+			],
850
+			'EventEspresso\admin_pages\general_settings\OrganizationSettings'                                             => [
851
+				'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
852
+				'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
853
+				'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
854
+				'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
855
+				'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
856
+			],
857
+			'EventEspresso\core\services\address\CountrySubRegionDao'                                                     => [
858
+				'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
859
+				'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache,
860
+			],
861
+			'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'                                            => [
862
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
863
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
864
+			],
865
+			'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'                                          => [
866
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
867
+				'EE_Environment_Config'            => EE_Dependency_Map::load_from_cache,
868
+			],
869
+			'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
870
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
871
+			],
872
+			'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
873
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
874
+			],
875
+			'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder'                              => [
876
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
877
+				'EEM_Registration'                            => EE_Dependency_Map::load_from_cache,
878
+				null,
879
+			],
880
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader'          => [
881
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
882
+				'EEM_Attendee'                                => EE_Dependency_Map::load_from_cache,
883
+			],
884
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader'              => [
885
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
886
+				'EEM_Datetime'                                => EE_Dependency_Map::load_from_cache,
887
+			],
888
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader'             => [
889
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
890
+				'EEM_Event'                                   => EE_Dependency_Map::load_from_cache,
891
+			],
892
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader'            => [
893
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
894
+				'EEM_Ticket'                                  => EE_Dependency_Map::load_from_cache,
895
+			],
896
+			'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion'                                                  => [
897
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
898
+			],
899
+			'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion'                                                  => [
900
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
901
+			],
902
+			'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion'                                        => [
903
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
904
+				'EEM_Event'                                                   => EE_Dependency_Map::load_from_cache,
905
+				'EEM_Datetime'                                                => EE_Dependency_Map::load_from_cache,
906
+				'EEM_Registration'                                            => EE_Dependency_Map::load_from_cache,
907
+			],
908
+			'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion'                                        => [
909
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
910
+			],
911
+			'EventEspresso\core\services\request\CurrentPage'                                                             => [
912
+				'EE_CPT_Strategy'                             => EE_Dependency_Map::load_from_cache,
913
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
914
+			],
915
+			'EventEspresso\core\services\shortcodes\LegacyShortcodesManager'                                              => [
916
+				'EE_Registry'                                     => EE_Dependency_Map::load_from_cache,
917
+				'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
918
+			],
919
+			'EventEspresso\core\services\shortcodes\ShortcodesManager'                                                    => [
920
+				'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache,
921
+				'EventEspresso\core\services\request\CurrentPage'                => EE_Dependency_Map::load_from_cache,
922
+			],
923
+		];
924
+	}
925
+
926
+
927
+	/**
928
+	 * Registers how core classes are loaded.
929
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
930
+	 *        'EE_Request_Handler' => 'load_core'
931
+	 *        'EE_Messages_Queue'  => 'load_lib'
932
+	 *        'EEH_Debug_Tools'    => 'load_helper'
933
+	 * or, if greater control is required, by providing a custom closure. For example:
934
+	 *        'Some_Class' => function () {
935
+	 *            return new Some_Class();
936
+	 *        },
937
+	 * This is required for instantiating dependencies
938
+	 * where an interface has been type hinted in a class constructor. For example:
939
+	 *        'Required_Interface' => function () {
940
+	 *            return new A_Class_That_Implements_Required_Interface();
941
+	 *        },
942
+	 */
943
+	protected function _register_core_class_loaders()
944
+	{
945
+		$this->_class_loaders = [
946
+			// load_core
947
+			'EE_Dependency_Map'                            => function () {
948
+				return $this;
949
+			},
950
+			'EE_Capabilities'                              => 'load_core',
951
+			'EE_Encryption'                                => 'load_core',
952
+			'EE_Front_Controller'                          => 'load_core',
953
+			'EE_Module_Request_Router'                     => 'load_core',
954
+			'EE_Registry'                                  => 'load_core',
955
+			'EE_Request'                                   => function () {
956
+				return $this->legacy_request;
957
+			},
958
+			'EventEspresso\core\services\request\Request'  => function () {
959
+				return $this->request;
960
+			},
961
+			'EventEspresso\core\services\request\Response' => function () {
962
+				return $this->response;
963
+			},
964
+			'EE_Base'                                      => 'load_core',
965
+			'EE_Request_Handler'                           => 'load_core',
966
+			'EE_Session'                                   => 'load_core',
967
+			'EE_Cron_Tasks'                                => 'load_core',
968
+			'EE_System'                                    => 'load_core',
969
+			'EE_Maintenance_Mode'                          => 'load_core',
970
+			'EE_Register_CPTs'                             => 'load_core',
971
+			'EE_Admin'                                     => 'load_core',
972
+			'EE_CPT_Strategy'                              => 'load_core',
973
+			// load_class
974
+			'EE_Registration_Processor'                    => 'load_class',
975
+			// load_lib
976
+			'EE_Message_Resource_Manager'                  => 'load_lib',
977
+			'EE_Message_Type_Collection'                   => 'load_lib',
978
+			'EE_Message_Type_Collection_Loader'            => 'load_lib',
979
+			'EE_Messenger_Collection'                      => 'load_lib',
980
+			'EE_Messenger_Collection_Loader'               => 'load_lib',
981
+			'EE_Messages_Processor'                        => 'load_lib',
982
+			'EE_Message_Repository'                        => 'load_lib',
983
+			'EE_Messages_Queue'                            => 'load_lib',
984
+			'EE_Messages_Data_Handler_Collection'          => 'load_lib',
985
+			'EE_Message_Template_Group_Collection'         => 'load_lib',
986
+			'EE_Payment_Method_Manager'                    => 'load_lib',
987
+			'EE_DMS_Core_4_1_0'                            => 'load_dms',
988
+			'EE_DMS_Core_4_2_0'                            => 'load_dms',
989
+			'EE_DMS_Core_4_3_0'                            => 'load_dms',
990
+			'EE_DMS_Core_4_5_0'                            => 'load_dms',
991
+			'EE_DMS_Core_4_6_0'                            => 'load_dms',
992
+			'EE_DMS_Core_4_7_0'                            => 'load_dms',
993
+			'EE_DMS_Core_4_8_0'                            => 'load_dms',
994
+			'EE_DMS_Core_4_9_0'                            => 'load_dms',
995
+			'EE_DMS_Core_4_10_0'                           => 'load_dms',
996
+			'EE_Messages_Generator'                        => function () {
997
+				return EE_Registry::instance()->load_lib(
998
+					'Messages_Generator',
999
+					[],
1000
+					false,
1001
+					false
1002
+				);
1003
+			},
1004
+			'EE_Messages_Template_Defaults'                => function ($arguments = []) {
1005
+				return EE_Registry::instance()->load_lib(
1006
+					'Messages_Template_Defaults',
1007
+					$arguments,
1008
+					false,
1009
+					false
1010
+				);
1011
+			},
1012
+			// load_helper
1013
+			'EEH_Parse_Shortcodes'                         => function () {
1014
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
1015
+					return new EEH_Parse_Shortcodes();
1016
+				}
1017
+				return null;
1018
+			},
1019
+			'EE_Template_Config'                           => function () {
1020
+				return EE_Config::instance()->template_settings;
1021
+			},
1022
+			'EE_Currency_Config'                           => function () {
1023
+				return EE_Config::instance()->currency;
1024
+			},
1025
+			'EE_Registration_Config'                       => function () {
1026
+				return EE_Config::instance()->registration;
1027
+			},
1028
+			'EE_Core_Config'                               => function () {
1029
+				return EE_Config::instance()->core;
1030
+			},
1031
+			'EventEspresso\core\services\loaders\Loader'   => function () {
1032
+				return LoaderFactory::getLoader();
1033
+			},
1034
+			'EE_Network_Config'                            => function () {
1035
+				return EE_Network_Config::instance();
1036
+			},
1037
+			'EE_Config'                                    => function () {
1038
+				return EE_Config::instance();
1039
+			},
1040
+			'EventEspresso\core\domain\Domain'             => function () {
1041
+				return DomainFactory::getEventEspressoCoreDomain();
1042
+			},
1043
+			'EE_Admin_Config'                              => function () {
1044
+				return EE_Config::instance()->admin;
1045
+			},
1046
+			'EE_Organization_Config'                       => function () {
1047
+				return EE_Config::instance()->organization;
1048
+			},
1049
+			'EE_Network_Core_Config'                       => function () {
1050
+				return EE_Network_Config::instance()->core;
1051
+			},
1052
+			'EE_Environment_Config'                        => function () {
1053
+				return EE_Config::instance()->environment;
1054
+			},
1055
+			'EE_Ticket_Selector_Config'                    => function () {
1056
+				return EE_Config::instance()->template_settings->EED_Ticket_Selector;
1057
+			},
1058
+		];
1059
+	}
1060
+
1061
+
1062
+	/**
1063
+	 * can be used for supplying alternate names for classes,
1064
+	 * or for connecting interface names to instantiable classes
1065
+	 */
1066
+	protected function _register_core_aliases()
1067
+	{
1068
+		$aliases = [
1069
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
1070
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
1071
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
1072
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
1073
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
1074
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
1075
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1076
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
1077
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1078
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
1079
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommand',
1080
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommand',
1081
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommand',
1082
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
1083
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
1084
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommand',
1085
+			'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\domain\services\commands\transaction\CreateTransactionCommandHandler',
1086
+			'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler',
1087
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
1088
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
1089
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1090
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
1091
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1092
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
1093
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
1094
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
1095
+			'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
1096
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
1097
+			'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
1098
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
1099
+			'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
1100
+			'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
1101
+			'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
1102
+			'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
1103
+			'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
1104
+			'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
1105
+			'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
1106
+			'Registration_Processor'                                                       => 'EE_Registration_Processor',
1107
+		];
1108
+		foreach ($aliases as $alias => $fqn) {
1109
+			if (is_array($fqn)) {
1110
+				foreach ($fqn as $class => $for_class) {
1111
+					$this->class_cache->addAlias($class, $alias, $for_class);
1112
+				}
1113
+				continue;
1114
+			}
1115
+			$this->class_cache->addAlias($fqn, $alias);
1116
+		}
1117
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1118
+			$this->class_cache->addAlias(
1119
+				'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
1120
+				'EventEspresso\core\services\notices\NoticeConverterInterface'
1121
+			);
1122
+		}
1123
+	}
1124
+
1125
+
1126
+	public function debug($for_class = '')
1127
+	{
1128
+		$this->class_cache->debug($for_class);
1129
+	}
1130
+
1131
+
1132
+	/**
1133
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1134
+	 * request Primarily used by unit tests.
1135
+	 */
1136
+	public function reset()
1137
+	{
1138
+		$this->_register_core_class_loaders();
1139
+		$this->_register_core_dependencies();
1140
+	}
1141
+
1142
+
1143
+	/**
1144
+	 * PLZ NOTE: a better name for this method would be is_alias()
1145
+	 * because it returns TRUE if the provided fully qualified name IS an alias
1146
+	 * WHY?
1147
+	 * Because if a class is type hinting for a concretion,
1148
+	 * then why would we need to find another class to supply it?
1149
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1150
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1151
+	 * Don't go looking for some substitute.
1152
+	 * Whereas if a class is type hinting for an interface...
1153
+	 * then we need to find an actual class to use.
1154
+	 * So the interface IS the alias for some other FQN,
1155
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1156
+	 * represents some other class.
1157
+	 *
1158
+	 * @param string $fqn
1159
+	 * @param string $for_class
1160
+	 * @return bool
1161
+	 * @deprecated 4.9.62.p
1162
+	 */
1163
+	public function has_alias($fqn = '', $for_class = '')
1164
+	{
1165
+		return $this->isAlias($fqn, $for_class);
1166
+	}
1167
+
1168
+
1169
+	/**
1170
+	 * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1171
+	 * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1172
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
1173
+	 *  for example:
1174
+	 *      if the following two entries were added to the _aliases array:
1175
+	 *          array(
1176
+	 *              'interface_alias'           => 'some\namespace\interface'
1177
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
1178
+	 *          )
1179
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1180
+	 *      to load an instance of 'some\namespace\classname'
1181
+	 *
1182
+	 * @param string $alias
1183
+	 * @param string $for_class
1184
+	 * @return string
1185
+	 * @deprecated 4.9.62.p
1186
+	 */
1187
+	public function get_alias($alias = '', $for_class = '')
1188
+	{
1189
+		return $this->getFqnForAlias($alias, $for_class);
1190
+	}
1191 1191
 }
Please login to merge, or discard this patch.
core/EE_Request_Handler.core.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 
74 74
     private function getCurrentPage()
75 75
     {
76
-        if (! $this->current_page instanceof CurrentPage) {
76
+        if ( ! $this->current_page instanceof CurrentPage) {
77 77
             $this->current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class);
78 78
         }
79 79
         return $this->current_page;
Please login to merge, or discard this patch.
Indentation   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -16,273 +16,273 @@
 block discarded – undo
16 16
  */
17 17
 final class EE_Request_Handler implements InterminableInterface
18 18
 {
19
-    /**
20
-     * @var CurrentPage
21
-     */
22
-    private $current_page;
23
-
24
-    /**
25
-     * @var RequestInterface
26
-     */
27
-    private $request;
28
-
29
-    /**
30
-     * @var ResponseInterface
31
-     */
32
-    private $response;
33
-
34
-    /**
35
-     * whether current request is via AJAX
36
-     *
37
-     * @var boolean
38
-     */
39
-    public $ajax = false;
40
-
41
-    /**
42
-     * whether current request is via AJAX from the frontend of the site
43
-     *
44
-     * @var boolean
45
-     */
46
-    public $front_ajax = false;
47
-
48
-
49
-    /**
50
-     * @param RequestInterface  $request
51
-     * @param ResponseInterface $response
52
-     */
53
-    public function __construct(RequestInterface $request, ResponseInterface $response)
54
-    {
55
-        $this->request      = $request;
56
-        $this->response     = $response;
57
-        $this->ajax         = $this->request->isAjax();
58
-        $this->front_ajax   = $this->request->isFrontAjax();
59
-        do_action('AHEE__EE_Request_Handler__construct__complete');
60
-    }
61
-
62
-
63
-    /**
64
-     * @param WP $WP
65
-     * @return void
66
-     * @deprecated  4.10.14.p
67
-     */
68
-    public function parse_request($WP = null)
69
-    {
70
-    }
71
-
72
-
73
-    private function getCurrentPage()
74
-    {
75
-        if (! $this->current_page instanceof CurrentPage) {
76
-            $this->current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class);
77
-        }
78
-        return $this->current_page;
79
-    }
80
-
81
-
82
-    /**
83
-     * @param WP $WP
84
-     * @return void
85
-     * @deprecated  4.10.14.p
86
-     */
87
-    public function set_request_vars($WP = null)
88
-    {
89
-        $this->getCurrentPage()->parseQueryVars($WP);
90
-    }
91
-
92
-
93
-    /**
94
-     * @param WP $WP
95
-     * @return int
96
-     * @deprecated  4.10.14.p
97
-     */
98
-    public function get_post_id_from_request($WP = null)
99
-    {
100
-        return $this->getCurrentPage()->postId();
101
-    }
102
-
103
-
104
-    /**
105
-     * @param WP $WP
106
-     * @return string
107
-     * @deprecated  4.10.14.p
108
-     */
109
-    public function get_post_name_from_request($WP = null)
110
-    {
111
-        return $this->getCurrentPage()->postName();
112
-    }
113
-
114
-
115
-    /**
116
-     * @param WP $WP
117
-     * @return array
118
-     * @deprecated  4.10.14.p
119
-     */
120
-    public function get_post_type_from_request($WP = null)
121
-    {
122
-        return $this->getCurrentPage()->postType();
123
-    }
124
-
125
-
126
-    /**
127
-     * Just a helper method for getting the url for the displayed page.
128
-     *
129
-     * @param WP $WP
130
-     * @return string
131
-     * @deprecated  4.10.14.p
132
-     */
133
-    public function get_current_page_permalink($WP = null)
134
-    {
135
-        return $this->getCurrentPage()->getPermalink($WP);
136
-    }
137
-
138
-
139
-    /**
140
-     * @return bool
141
-     * @deprecated  4.10.14.p
142
-     */
143
-    public function test_for_espresso_page()
144
-    {
145
-        return $this->getCurrentPage()->isEspressoPage();
146
-    }
147
-
148
-
149
-    /**
150
-     * @param $key
151
-     * @param $value
152
-     * @return void
153
-     * @deprecated  4.10.14.p
154
-     */
155
-    public function set_notice($key, $value)
156
-    {
157
-        $this->response->setNotice($key, $value);
158
-    }
159
-
160
-
161
-    /**
162
-     * @param $key
163
-     * @return mixed
164
-     * @deprecated  4.10.14.p
165
-     */
166
-    public function get_notice($key)
167
-    {
168
-        return $this->response->getNotice($key);
169
-    }
170
-
171
-
172
-    /**
173
-     * @param $string
174
-     * @return void
175
-     * @deprecated  4.10.14.p
176
-     */
177
-    public function add_output($string)
178
-    {
179
-        $this->response->addOutput($string);
180
-    }
181
-
182
-
183
-    /**
184
-     * @return string
185
-     * @deprecated  4.10.14.p
186
-     */
187
-    public function get_output()
188
-    {
189
-        return $this->response->getOutput();
190
-    }
191
-
192
-
193
-    /**
194
-     * @param $item
195
-     * @param $key
196
-     * @deprecated  4.10.14.p
197
-     */
198
-    public function sanitize_text_field_for_array_walk(&$item, &$key)
199
-    {
200
-        $item = strpos($item, 'email') !== false
201
-            ? sanitize_email($item)
202
-            : sanitize_text_field($item);
203
-    }
204
-
205
-
206
-    /**
207
-     * @param null|bool $value
208
-     * @return void
209
-     * @deprecated  4.10.14.p
210
-     */
211
-    public function set_espresso_page($value = null)
212
-    {
213
-        $this->getCurrentPage()->setEspressoPage($value);
214
-    }
215
-
216
-
217
-    /**
218
-     * @return bool
219
-     * @deprecated  4.10.14.p
220
-     */
221
-    public function is_espresso_page()
222
-    {
223
-        return $this->getCurrentPage()->isEspressoPage();
224
-    }
225
-
226
-
227
-    /**
228
-     * returns sanitized contents of $_REQUEST
229
-     *
230
-     * @return array
231
-     * @deprecated  4.10.14.p
232
-     */
233
-    public function params()
234
-    {
235
-        return $this->request->requestParams();
236
-    }
237
-
238
-
239
-    /**
240
-     * @param      $key
241
-     * @param      $value
242
-     * @param bool $override_ee
243
-     * @return    void
244
-     * @deprecated  4.10.14.p
245
-     */
246
-    public function set($key, $value, $override_ee = false)
247
-    {
248
-        $this->request->setRequestParam($key, $value, $override_ee);
249
-    }
250
-
251
-
252
-    /**
253
-     * @param      $key
254
-     * @param null $default
255
-     * @return    mixed
256
-     * @deprecated  4.10.14.p
257
-     */
258
-    public function get($key, $default = null)
259
-    {
260
-        return $this->request->getRequestParam($key, $default);
261
-    }
262
-
263
-
264
-    /**
265
-     * check if param exists
266
-     *
267
-     * @param $key
268
-     * @return    boolean
269
-     * @deprecated  4.10.14.p
270
-     */
271
-    public function is_set($key)
272
-    {
273
-        return $this->request->requestParamIsSet($key);
274
-    }
275
-
276
-
277
-    /**
278
-     * remove param
279
-     *
280
-     * @param $key
281
-     * @return    void
282
-     * @deprecated  4.10.14.p
283
-     */
284
-    public function un_set($key)
285
-    {
286
-        $this->request->unSetRequestParam($key);
287
-    }
19
+	/**
20
+	 * @var CurrentPage
21
+	 */
22
+	private $current_page;
23
+
24
+	/**
25
+	 * @var RequestInterface
26
+	 */
27
+	private $request;
28
+
29
+	/**
30
+	 * @var ResponseInterface
31
+	 */
32
+	private $response;
33
+
34
+	/**
35
+	 * whether current request is via AJAX
36
+	 *
37
+	 * @var boolean
38
+	 */
39
+	public $ajax = false;
40
+
41
+	/**
42
+	 * whether current request is via AJAX from the frontend of the site
43
+	 *
44
+	 * @var boolean
45
+	 */
46
+	public $front_ajax = false;
47
+
48
+
49
+	/**
50
+	 * @param RequestInterface  $request
51
+	 * @param ResponseInterface $response
52
+	 */
53
+	public function __construct(RequestInterface $request, ResponseInterface $response)
54
+	{
55
+		$this->request      = $request;
56
+		$this->response     = $response;
57
+		$this->ajax         = $this->request->isAjax();
58
+		$this->front_ajax   = $this->request->isFrontAjax();
59
+		do_action('AHEE__EE_Request_Handler__construct__complete');
60
+	}
61
+
62
+
63
+	/**
64
+	 * @param WP $WP
65
+	 * @return void
66
+	 * @deprecated  4.10.14.p
67
+	 */
68
+	public function parse_request($WP = null)
69
+	{
70
+	}
71
+
72
+
73
+	private function getCurrentPage()
74
+	{
75
+		if (! $this->current_page instanceof CurrentPage) {
76
+			$this->current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class);
77
+		}
78
+		return $this->current_page;
79
+	}
80
+
81
+
82
+	/**
83
+	 * @param WP $WP
84
+	 * @return void
85
+	 * @deprecated  4.10.14.p
86
+	 */
87
+	public function set_request_vars($WP = null)
88
+	{
89
+		$this->getCurrentPage()->parseQueryVars($WP);
90
+	}
91
+
92
+
93
+	/**
94
+	 * @param WP $WP
95
+	 * @return int
96
+	 * @deprecated  4.10.14.p
97
+	 */
98
+	public function get_post_id_from_request($WP = null)
99
+	{
100
+		return $this->getCurrentPage()->postId();
101
+	}
102
+
103
+
104
+	/**
105
+	 * @param WP $WP
106
+	 * @return string
107
+	 * @deprecated  4.10.14.p
108
+	 */
109
+	public function get_post_name_from_request($WP = null)
110
+	{
111
+		return $this->getCurrentPage()->postName();
112
+	}
113
+
114
+
115
+	/**
116
+	 * @param WP $WP
117
+	 * @return array
118
+	 * @deprecated  4.10.14.p
119
+	 */
120
+	public function get_post_type_from_request($WP = null)
121
+	{
122
+		return $this->getCurrentPage()->postType();
123
+	}
124
+
125
+
126
+	/**
127
+	 * Just a helper method for getting the url for the displayed page.
128
+	 *
129
+	 * @param WP $WP
130
+	 * @return string
131
+	 * @deprecated  4.10.14.p
132
+	 */
133
+	public function get_current_page_permalink($WP = null)
134
+	{
135
+		return $this->getCurrentPage()->getPermalink($WP);
136
+	}
137
+
138
+
139
+	/**
140
+	 * @return bool
141
+	 * @deprecated  4.10.14.p
142
+	 */
143
+	public function test_for_espresso_page()
144
+	{
145
+		return $this->getCurrentPage()->isEspressoPage();
146
+	}
147
+
148
+
149
+	/**
150
+	 * @param $key
151
+	 * @param $value
152
+	 * @return void
153
+	 * @deprecated  4.10.14.p
154
+	 */
155
+	public function set_notice($key, $value)
156
+	{
157
+		$this->response->setNotice($key, $value);
158
+	}
159
+
160
+
161
+	/**
162
+	 * @param $key
163
+	 * @return mixed
164
+	 * @deprecated  4.10.14.p
165
+	 */
166
+	public function get_notice($key)
167
+	{
168
+		return $this->response->getNotice($key);
169
+	}
170
+
171
+
172
+	/**
173
+	 * @param $string
174
+	 * @return void
175
+	 * @deprecated  4.10.14.p
176
+	 */
177
+	public function add_output($string)
178
+	{
179
+		$this->response->addOutput($string);
180
+	}
181
+
182
+
183
+	/**
184
+	 * @return string
185
+	 * @deprecated  4.10.14.p
186
+	 */
187
+	public function get_output()
188
+	{
189
+		return $this->response->getOutput();
190
+	}
191
+
192
+
193
+	/**
194
+	 * @param $item
195
+	 * @param $key
196
+	 * @deprecated  4.10.14.p
197
+	 */
198
+	public function sanitize_text_field_for_array_walk(&$item, &$key)
199
+	{
200
+		$item = strpos($item, 'email') !== false
201
+			? sanitize_email($item)
202
+			: sanitize_text_field($item);
203
+	}
204
+
205
+
206
+	/**
207
+	 * @param null|bool $value
208
+	 * @return void
209
+	 * @deprecated  4.10.14.p
210
+	 */
211
+	public function set_espresso_page($value = null)
212
+	{
213
+		$this->getCurrentPage()->setEspressoPage($value);
214
+	}
215
+
216
+
217
+	/**
218
+	 * @return bool
219
+	 * @deprecated  4.10.14.p
220
+	 */
221
+	public function is_espresso_page()
222
+	{
223
+		return $this->getCurrentPage()->isEspressoPage();
224
+	}
225
+
226
+
227
+	/**
228
+	 * returns sanitized contents of $_REQUEST
229
+	 *
230
+	 * @return array
231
+	 * @deprecated  4.10.14.p
232
+	 */
233
+	public function params()
234
+	{
235
+		return $this->request->requestParams();
236
+	}
237
+
238
+
239
+	/**
240
+	 * @param      $key
241
+	 * @param      $value
242
+	 * @param bool $override_ee
243
+	 * @return    void
244
+	 * @deprecated  4.10.14.p
245
+	 */
246
+	public function set($key, $value, $override_ee = false)
247
+	{
248
+		$this->request->setRequestParam($key, $value, $override_ee);
249
+	}
250
+
251
+
252
+	/**
253
+	 * @param      $key
254
+	 * @param null $default
255
+	 * @return    mixed
256
+	 * @deprecated  4.10.14.p
257
+	 */
258
+	public function get($key, $default = null)
259
+	{
260
+		return $this->request->getRequestParam($key, $default);
261
+	}
262
+
263
+
264
+	/**
265
+	 * check if param exists
266
+	 *
267
+	 * @param $key
268
+	 * @return    boolean
269
+	 * @deprecated  4.10.14.p
270
+	 */
271
+	public function is_set($key)
272
+	{
273
+		return $this->request->requestParamIsSet($key);
274
+	}
275
+
276
+
277
+	/**
278
+	 * remove param
279
+	 *
280
+	 * @param $key
281
+	 * @return    void
282
+	 * @deprecated  4.10.14.p
283
+	 */
284
+	public function un_set($key)
285
+	{
286
+		$this->request->unSetRequestParam($key);
287
+	}
288 288
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Country.model.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             'Country' => new EE_Primary_Table('esp_country', 'CNT_ISO'),
47 47
         ];
48 48
 
49
-        $this->_fields          = [
49
+        $this->_fields = [
50 50
             'Country' => [
51 51
                 'CNT_active'      => new EE_Boolean_Field(
52 52
                     'CNT_active',
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             'Venue'    => new EE_Has_Many_Relation(),
142 142
         ];
143 143
         // only anyone to view, but only those with the default role can do anything
144
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
144
+        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
145 145
 
146 146
         parent::__construct($timezone);
147 147
     }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      */
154 154
     public function get_all_countries()
155 155
     {
156
-        if (! self::$_all_countries) {
156
+        if ( ! self::$_all_countries) {
157 157
             self::$_all_countries = $this->get_all(['order_by' => ['CNT_name' => 'ASC'], 'limit' => [0, 99999]]);
158 158
         }
159 159
         return self::$_all_countries;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function get_all_active_countries()
171 171
     {
172
-        if (! self::$_active_countries) {
172
+        if ( ! self::$_active_countries) {
173 173
             self::$_active_countries =
174 174
                 $this->get_all([['CNT_active' => true], 'order_by' => ['CNT_name' => 'ASC'], 'limit' => [0, 99999]]);
175 175
         }
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
     public function get_country_name_by_ISO($country_ISO)
188 188
     {
189 189
         $countries = $this->get_all_countries();
190
-        if (isset($countries[ $country_ISO ]) && $countries[ $country_ISO ] instanceof EE_Country) {
191
-            return $countries[ $country_ISO ]->name();
190
+        if (isset($countries[$country_ISO]) && $countries[$country_ISO] instanceof EE_Country) {
191
+            return $countries[$country_ISO]->name();
192 192
         }
193 193
         $names = $this->get_col([['CNT_ISO' => $country_ISO], 'limit' => 1], 'CNT_name');
194 194
         if (is_array($names) && ! empty($names)) {
Please login to merge, or discard this patch.
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -10,209 +10,209 @@
 block discarded – undo
10 10
  */
11 11
 class EEM_Country extends EEM_Base
12 12
 {
13
-    // private instance of the Attendee object
14
-    protected static $_instance = null;
15
-
16
-    // array of all countries
17
-    private static $_all_countries = false;
18
-
19
-    // array of all active countries
20
-    private static $_active_countries = false;
21
-
22
-
23
-    /**
24
-     * Resets the country
25
-     *
26
-     * @param string $timezone
27
-     * @return EEM_Country|EEM_Base|null
28
-     * @throws EE_Error
29
-     * @throws ReflectionException
30
-     */
31
-    public static function reset($timezone = null)
32
-    {
33
-        self::$_active_countries = null;
34
-        self::$_all_countries    = null;
35
-        return parent::reset($timezone);
36
-    }
37
-
38
-
39
-    protected function __construct($timezone = '')
40
-    {
41
-        $this->singular_item = esc_html__('Country', 'event_espresso');
42
-        $this->plural_item   = esc_html__('Countries', 'event_espresso');
43
-
44
-        $this->_tables = [
45
-            'Country' => new EE_Primary_Table('esp_country', 'CNT_ISO'),
46
-        ];
47
-
48
-        $this->_fields          = [
49
-            'Country' => [
50
-                'CNT_active'      => new EE_Boolean_Field(
51
-                    'CNT_active',
52
-                    esc_html__('Country Appears in Dropdown Select Lists', 'event_espresso'),
53
-                    false,
54
-                    true
55
-                ),
56
-                'CNT_ISO'         => new EE_Primary_Key_String_Field(
57
-                    'CNT_ISO',
58
-                    esc_html__('Country ISO Code', 'event_espresso')
59
-                ),
60
-                'CNT_ISO3'        => new EE_All_Caps_Text_Field(
61
-                    'CNT_ISO3',
62
-                    esc_html__('Country ISO3 Code', 'event_espresso'),
63
-                    false,
64
-                    ''
65
-                ),
66
-                'RGN_ID'          => new EE_Integer_Field(
67
-                    'RGN_ID',
68
-                    esc_html__('Region ID', 'event_espresso'),
69
-                    false,
70
-                    0
71
-                ),
72
-                // should be a foreign key, but no region table exists yet
73
-                'CNT_name'        => new EE_Plain_Text_Field(
74
-                    'CNT_name',
75
-                    esc_html__('Country Name', 'event_espresso'),
76
-                    false,
77
-                    ''
78
-                ),
79
-                'CNT_cur_code'    => new EE_All_Caps_Text_Field(
80
-                    'CNT_cur_code',
81
-                    esc_html__('Country Currency Code', 'event_espresso'),
82
-                    false
83
-                ),
84
-                'CNT_cur_single'  => new EE_Plain_Text_Field(
85
-                    'CNT_cur_single',
86
-                    esc_html__('Currency Name Singular', 'event_espresso'),
87
-                    false
88
-                ),
89
-                'CNT_cur_plural'  => new EE_Plain_Text_Field(
90
-                    'CNT_cur_plural',
91
-                    esc_html__('Currency Name Plural', 'event_espresso'),
92
-                    false
93
-                ),
94
-                'CNT_cur_sign'    => new EE_Plain_Text_Field(
95
-                    'CNT_cur_sign',
96
-                    esc_html__('Currency Sign', 'event_espresso'),
97
-                    false
98
-                ),
99
-                'CNT_cur_sign_b4' => new EE_Boolean_Field(
100
-                    'CNT_cur_sign_b4',
101
-                    esc_html__('Currency Sign Before Number', 'event_espresso'),
102
-                    false,
103
-                    true
104
-                ),
105
-                'CNT_cur_dec_plc' => new EE_Integer_Field(
106
-                    'CNT_cur_dec_plc',
107
-                    esc_html__('Currency Decimal Places', 'event_espresso'),
108
-                    false,
109
-                    2
110
-                ),
111
-                'CNT_cur_dec_mrk' => new EE_Plain_Text_Field(
112
-                    'CNT_cur_dec_mrk',
113
-                    esc_html__('Currency Decimal Mark', 'event_espresso'),
114
-                    false,
115
-                    '.'
116
-                ),
117
-                'CNT_cur_thsnds'  => new EE_Plain_Text_Field(
118
-                    'CNT_cur_thsnds',
119
-                    esc_html__('Currency Thousands Separator', 'event_espresso'),
120
-                    false,
121
-                    ','
122
-                ),
123
-                'CNT_tel_code'    => new EE_Plain_Text_Field(
124
-                    'CNT_tel_code',
125
-                    esc_html__('Country Telephone Code', 'event_espresso'),
126
-                    false,
127
-                    ''
128
-                ),
129
-                'CNT_is_EU'       => new EE_Boolean_Field(
130
-                    'CNT_is_EU',
131
-                    esc_html__('Country is Member of EU', 'event_espresso'),
132
-                    false,
133
-                    false
134
-                ),
135
-            ],
136
-        ];
137
-        $this->_model_relations = [
138
-            'Attendee' => new EE_Has_Many_Relation(),
139
-            'State'    => new EE_Has_Many_Relation(),
140
-            'Venue'    => new EE_Has_Many_Relation(),
141
-        ];
142
-        // only anyone to view, but only those with the default role can do anything
143
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
144
-
145
-        parent::__construct($timezone);
146
-    }
147
-
148
-
149
-    /**
150
-     * @return EE_Country[]
151
-     * @throws EE_Error
152
-     */
153
-    public function get_all_countries()
154
-    {
155
-        if (! self::$_all_countries) {
156
-            self::$_all_countries = $this->get_all(['order_by' => ['CNT_name' => 'ASC'], 'limit' => [0, 99999]]);
157
-        }
158
-        return self::$_all_countries;
159
-    }
160
-
161
-
162
-    /**
163
-     * Gets and caches the list of active countries. If you know the list of active countries
164
-     * has changed during this request, first use EEM_Country::reset() to flush the cache
165
-     *
166
-     * @return EE_Country[]
167
-     * @throws EE_Error
168
-     */
169
-    public function get_all_active_countries()
170
-    {
171
-        if (! self::$_active_countries) {
172
-            self::$_active_countries =
173
-                $this->get_all([['CNT_active' => true], 'order_by' => ['CNT_name' => 'ASC'], 'limit' => [0, 99999]]);
174
-        }
175
-        return self::$_active_countries;
176
-    }
177
-
178
-
179
-    /**
180
-     * Gets the country's name by its ISO
181
-     *
182
-     * @param string $country_ISO
183
-     * @return string
184
-     * @throws EE_Error
185
-     */
186
-    public function get_country_name_by_ISO($country_ISO)
187
-    {
188
-        $countries = $this->get_all_countries();
189
-        if (isset($countries[ $country_ISO ]) && $countries[ $country_ISO ] instanceof EE_Country) {
190
-            return $countries[ $country_ISO ]->name();
191
-        }
192
-        $names = $this->get_col([['CNT_ISO' => $country_ISO], 'limit' => 1], 'CNT_name');
193
-        if (is_array($names) && ! empty($names)) {
194
-            return reset($names);
195
-        } else {
196
-            return '';
197
-        }
198
-    }
199
-
200
-
201
-    /**
202
-     * Gets the country's name by its name
203
-     *
204
-     * @param string $country_name
205
-     * @return EE_Country|null
206
-     * @throws EE_Error
207
-     */
208
-    public function getCountryByName($country_name)
209
-    {
210
-        $countries = $this->get_all_countries();
211
-        foreach ($countries as $country) {
212
-            if ($country instanceof EE_Country && $country->name() === $country_name) {
213
-                return $country;
214
-            }
215
-        }
216
-        return $this->get_one([['CNT_name' => $country_name]]);
217
-    }
13
+	// private instance of the Attendee object
14
+	protected static $_instance = null;
15
+
16
+	// array of all countries
17
+	private static $_all_countries = false;
18
+
19
+	// array of all active countries
20
+	private static $_active_countries = false;
21
+
22
+
23
+	/**
24
+	 * Resets the country
25
+	 *
26
+	 * @param string $timezone
27
+	 * @return EEM_Country|EEM_Base|null
28
+	 * @throws EE_Error
29
+	 * @throws ReflectionException
30
+	 */
31
+	public static function reset($timezone = null)
32
+	{
33
+		self::$_active_countries = null;
34
+		self::$_all_countries    = null;
35
+		return parent::reset($timezone);
36
+	}
37
+
38
+
39
+	protected function __construct($timezone = '')
40
+	{
41
+		$this->singular_item = esc_html__('Country', 'event_espresso');
42
+		$this->plural_item   = esc_html__('Countries', 'event_espresso');
43
+
44
+		$this->_tables = [
45
+			'Country' => new EE_Primary_Table('esp_country', 'CNT_ISO'),
46
+		];
47
+
48
+		$this->_fields          = [
49
+			'Country' => [
50
+				'CNT_active'      => new EE_Boolean_Field(
51
+					'CNT_active',
52
+					esc_html__('Country Appears in Dropdown Select Lists', 'event_espresso'),
53
+					false,
54
+					true
55
+				),
56
+				'CNT_ISO'         => new EE_Primary_Key_String_Field(
57
+					'CNT_ISO',
58
+					esc_html__('Country ISO Code', 'event_espresso')
59
+				),
60
+				'CNT_ISO3'        => new EE_All_Caps_Text_Field(
61
+					'CNT_ISO3',
62
+					esc_html__('Country ISO3 Code', 'event_espresso'),
63
+					false,
64
+					''
65
+				),
66
+				'RGN_ID'          => new EE_Integer_Field(
67
+					'RGN_ID',
68
+					esc_html__('Region ID', 'event_espresso'),
69
+					false,
70
+					0
71
+				),
72
+				// should be a foreign key, but no region table exists yet
73
+				'CNT_name'        => new EE_Plain_Text_Field(
74
+					'CNT_name',
75
+					esc_html__('Country Name', 'event_espresso'),
76
+					false,
77
+					''
78
+				),
79
+				'CNT_cur_code'    => new EE_All_Caps_Text_Field(
80
+					'CNT_cur_code',
81
+					esc_html__('Country Currency Code', 'event_espresso'),
82
+					false
83
+				),
84
+				'CNT_cur_single'  => new EE_Plain_Text_Field(
85
+					'CNT_cur_single',
86
+					esc_html__('Currency Name Singular', 'event_espresso'),
87
+					false
88
+				),
89
+				'CNT_cur_plural'  => new EE_Plain_Text_Field(
90
+					'CNT_cur_plural',
91
+					esc_html__('Currency Name Plural', 'event_espresso'),
92
+					false
93
+				),
94
+				'CNT_cur_sign'    => new EE_Plain_Text_Field(
95
+					'CNT_cur_sign',
96
+					esc_html__('Currency Sign', 'event_espresso'),
97
+					false
98
+				),
99
+				'CNT_cur_sign_b4' => new EE_Boolean_Field(
100
+					'CNT_cur_sign_b4',
101
+					esc_html__('Currency Sign Before Number', 'event_espresso'),
102
+					false,
103
+					true
104
+				),
105
+				'CNT_cur_dec_plc' => new EE_Integer_Field(
106
+					'CNT_cur_dec_plc',
107
+					esc_html__('Currency Decimal Places', 'event_espresso'),
108
+					false,
109
+					2
110
+				),
111
+				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field(
112
+					'CNT_cur_dec_mrk',
113
+					esc_html__('Currency Decimal Mark', 'event_espresso'),
114
+					false,
115
+					'.'
116
+				),
117
+				'CNT_cur_thsnds'  => new EE_Plain_Text_Field(
118
+					'CNT_cur_thsnds',
119
+					esc_html__('Currency Thousands Separator', 'event_espresso'),
120
+					false,
121
+					','
122
+				),
123
+				'CNT_tel_code'    => new EE_Plain_Text_Field(
124
+					'CNT_tel_code',
125
+					esc_html__('Country Telephone Code', 'event_espresso'),
126
+					false,
127
+					''
128
+				),
129
+				'CNT_is_EU'       => new EE_Boolean_Field(
130
+					'CNT_is_EU',
131
+					esc_html__('Country is Member of EU', 'event_espresso'),
132
+					false,
133
+					false
134
+				),
135
+			],
136
+		];
137
+		$this->_model_relations = [
138
+			'Attendee' => new EE_Has_Many_Relation(),
139
+			'State'    => new EE_Has_Many_Relation(),
140
+			'Venue'    => new EE_Has_Many_Relation(),
141
+		];
142
+		// only anyone to view, but only those with the default role can do anything
143
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
144
+
145
+		parent::__construct($timezone);
146
+	}
147
+
148
+
149
+	/**
150
+	 * @return EE_Country[]
151
+	 * @throws EE_Error
152
+	 */
153
+	public function get_all_countries()
154
+	{
155
+		if (! self::$_all_countries) {
156
+			self::$_all_countries = $this->get_all(['order_by' => ['CNT_name' => 'ASC'], 'limit' => [0, 99999]]);
157
+		}
158
+		return self::$_all_countries;
159
+	}
160
+
161
+
162
+	/**
163
+	 * Gets and caches the list of active countries. If you know the list of active countries
164
+	 * has changed during this request, first use EEM_Country::reset() to flush the cache
165
+	 *
166
+	 * @return EE_Country[]
167
+	 * @throws EE_Error
168
+	 */
169
+	public function get_all_active_countries()
170
+	{
171
+		if (! self::$_active_countries) {
172
+			self::$_active_countries =
173
+				$this->get_all([['CNT_active' => true], 'order_by' => ['CNT_name' => 'ASC'], 'limit' => [0, 99999]]);
174
+		}
175
+		return self::$_active_countries;
176
+	}
177
+
178
+
179
+	/**
180
+	 * Gets the country's name by its ISO
181
+	 *
182
+	 * @param string $country_ISO
183
+	 * @return string
184
+	 * @throws EE_Error
185
+	 */
186
+	public function get_country_name_by_ISO($country_ISO)
187
+	{
188
+		$countries = $this->get_all_countries();
189
+		if (isset($countries[ $country_ISO ]) && $countries[ $country_ISO ] instanceof EE_Country) {
190
+			return $countries[ $country_ISO ]->name();
191
+		}
192
+		$names = $this->get_col([['CNT_ISO' => $country_ISO], 'limit' => 1], 'CNT_name');
193
+		if (is_array($names) && ! empty($names)) {
194
+			return reset($names);
195
+		} else {
196
+			return '';
197
+		}
198
+	}
199
+
200
+
201
+	/**
202
+	 * Gets the country's name by its name
203
+	 *
204
+	 * @param string $country_name
205
+	 * @return EE_Country|null
206
+	 * @throws EE_Error
207
+	 */
208
+	public function getCountryByName($country_name)
209
+	{
210
+		$countries = $this->get_all_countries();
211
+		foreach ($countries as $country) {
212
+			if ($country instanceof EE_Country && $country->name() === $country_name) {
213
+				return $country;
214
+			}
215
+		}
216
+		return $this->get_one([['CNT_name' => $country_name]]);
217
+	}
218 218
 }
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/migration_options_from_ee3.template.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
                     <td><h3><?php esc_html_e('1', 'event_espresso'); ?></h3></td>
37 37
                     <td>
38 38
                         <?php echo apply_filters(
39
-                            'FHEE__ee_migration_page__option_1_main',
40
-                            sprintf(
41
-                                __(
42
-                                    '%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.',
43
-                                    "event_espresso"
44
-                                ),
45
-                                '<strong>',
46
-                                '</strong>',
47
-                                '<a id="migration-risks" class="" title="'
48
-                                . esc_attr__('click for more details', "event_espresso")
49
-                                . '">',
50
-                                '</a>',
51
-                                $current_db_state,
52
-                                $next_db_state
53
-                            ),
54
-                            $current_db_state,
55
-                            $next_db_state
56
-                        );
57
-                            ?>
39
+							'FHEE__ee_migration_page__option_1_main',
40
+							sprintf(
41
+								__(
42
+									'%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.',
43
+									"event_espresso"
44
+								),
45
+								'<strong>',
46
+								'</strong>',
47
+								'<a id="migration-risks" class="" title="'
48
+								. esc_attr__('click for more details', "event_espresso")
49
+								. '">',
50
+								'</a>',
51
+								$current_db_state,
52
+								$next_db_state
53
+							),
54
+							$current_db_state,
55
+							$next_db_state
56
+						);
57
+							?>
58 58
                         <a id="display-migration-details"
59 59
                            class="display-the-hidden lt-grey-text smaller-text hide-if-no-js"
60 60
                            rel="migration-details"
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
                            style="display:none;"
68 68
                         >
69 69
                             <?php printf(
70
-                                esc_html__('hide%1$sdetails%1$s-', 'event_espresso'),
71
-                                '&nbsp;'
72
-                            ); ?>
70
+								esc_html__('hide%1$sdetails%1$s-', 'event_espresso'),
71
+								'&nbsp;'
72
+							); ?>
73 73
                         </a>
74 74
                     </td>
75 75
                     <td>
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
                            class="toggle-migration-monitor button-primary"
78 78
                         >
79 79
                             <?php echo esc_html(
80
-                                apply_filters(
81
-                                    'FHEE__ee_migration_page__option_1_button_text',
82
-                                    sprintf(
83
-                                        __("Migrate My %s Data to %s", "event_espresso"),
84
-                                        $current_db_state,
85
-                                        $next_db_state
86
-                                    ),
87
-                                    $current_db_state,
88
-                                    $next_db_state
89
-                                )
90
-                            ); ?>
80
+								apply_filters(
81
+									'FHEE__ee_migration_page__option_1_button_text',
82
+									sprintf(
83
+										__("Migrate My %s Data to %s", "event_espresso"),
84
+										$current_db_state,
85
+										$next_db_state
86
+									),
87
+									$current_db_state,
88
+									$next_db_state
89
+								)
90
+							); ?>
91 91
                         </a>
92 92
                     </td>
93 93
                 </tr>
@@ -96,34 +96,34 @@  discard block
 block discarded – undo
96 96
                         <div id="migration-details-dv" style="display: none; padding: 1em;">
97 97
                             <span class="reminder-spn">
98 98
                             <?php printf(
99
-                                esc_html__(
100
-                                    "%s Important: %s Before migrating, please back up your database and files.",
101
-                                    "event_espresso"
102
-                                ),
103
-                                "<b>",
104
-                                "</b>"
105
-                            );
99
+								esc_html__(
100
+									"%s Important: %s Before migrating, please back up your database and files.",
101
+									"event_espresso"
102
+								),
103
+								"<b>",
104
+								"</b>"
105
+							);
106 106
 ?>
107 107
                             </span>
108 108
                             <p>
109 109
                                 <?php printf(
110
-                                    esc_html__(
111
-                                        '%1$sNot sure how to backup your existing data?%2$s Here is %3$sWordPress\'s explanation%7$s, and here\'s %6$sour explanation%7$s.%8$sYou can also search the WordPress plugin database for %4$s database backup plugins %7$s,%8$sor have one of our dedicated support technicians help you by purchasing a %5$sPriority Support Token%7$s.',
112
-                                        "event_espresso"
113
-                                    ),
114
-                                    '<b>',
115
-                                    '</b>',
116
-                                    "<a href='https://codex.wordpress.org/Backing_Up_Your_Database'>",
117
-                                    "<a href='"
118
-                                    . admin_url(
119
-                                        'plugin-install.php?tab=search&type=term&s=database+backup&plugin-search-input=Search+Plugins'
120
-                                    )
121
-                                    . "'>",
122
-                                    "<a href='https://eventespresso.com/product/priority-support-tokens/'>",
123
-                                    '<a href="https://eventespresso.com/wiki/how-to-back-up-your-site/">',
124
-                                    "</a>",
125
-                                    '<br/>'
126
-                                );
110
+									esc_html__(
111
+										'%1$sNot sure how to backup your existing data?%2$s Here is %3$sWordPress\'s explanation%7$s, and here\'s %6$sour explanation%7$s.%8$sYou can also search the WordPress plugin database for %4$s database backup plugins %7$s,%8$sor have one of our dedicated support technicians help you by purchasing a %5$sPriority Support Token%7$s.',
112
+										"event_espresso"
113
+									),
114
+									'<b>',
115
+									'</b>',
116
+									"<a href='https://codex.wordpress.org/Backing_Up_Your_Database'>",
117
+									"<a href='"
118
+									. admin_url(
119
+										'plugin-install.php?tab=search&type=term&s=database+backup&plugin-search-input=Search+Plugins'
120
+									)
121
+									. "'>",
122
+									"<a href='https://eventespresso.com/product/priority-support-tokens/'>",
123
+									'<a href="https://eventespresso.com/wiki/how-to-back-up-your-site/">',
124
+									"</a>",
125
+									'<br/>'
126
+								);
127 127
 ?>
128 128
                             </p>
129 129
                             <?php do_action('AHEE__ee_migration_page__option_1_extra_details'); ?>
@@ -136,29 +136,29 @@  discard block
 block discarded – undo
136 136
                     </td>
137 137
                     <td>
138 138
                         <?php echo esc_html(
139
-                            apply_filters(
140
-                                'FHEE__ee_migration_page__option_2_main',
141
-                                sprintf(
142
-                                    __(
143
-                                        'I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.',
144
-                                        "event_espresso"
145
-                                    ),
146
-                                    $current_db_state,
147
-                                    $next_db_state,
148
-                                    $ultimate_db_state
149
-                                ),
150
-                                $current_db_state,
151
-                                $next_db_state,
152
-                                $ultimate_db_state
153
-                            )
154
-                        );
155
-                            ?>
139
+							apply_filters(
140
+								'FHEE__ee_migration_page__option_2_main',
141
+								sprintf(
142
+									__(
143
+										'I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.',
144
+										"event_espresso"
145
+									),
146
+									$current_db_state,
147
+									$next_db_state,
148
+									$ultimate_db_state
149
+								),
150
+								$current_db_state,
151
+								$next_db_state,
152
+								$ultimate_db_state
153
+							)
154
+						);
155
+							?>
156 156
                         <br />
157 157
                         <span class="reminder-spn">
158 158
                             <?php esc_html_e(
159
-                                'Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.',
160
-                                'event_espresso'
161
-                            ); ?>
159
+								'Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.',
160
+								'event_espresso'
161
+							); ?>
162 162
                         </span>
163 163
                         <a id="display-no-migration-details"
164 164
                            class="display-the-hidden lt-grey-text smaller-text hide-if-no-js"
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
                            style="display:none;"
173 173
                         >
174 174
                             <?php printf(
175
-                                esc_html__('hide%1$sdetails%1$s-', 'event_espresso'),
176
-                                '&nbsp;'
177
-                            );
175
+								esc_html__('hide%1$sdetails%1$s-', 'event_espresso'),
176
+								'&nbsp;'
177
+							);
178 178
 ?>
179 179
                         </a>
180 180
                     </td>
@@ -184,16 +184,16 @@  discard block
 block discarded – undo
184 184
                            href="<?php echo esc_url_raw($reset_db_page_link); ?>"
185 185
                         >
186 186
                             <?php echo esc_html(
187
-                                apply_filters(
188
-                                    'FHEE__ee_migration_page__option_2_button_text',
189
-                                    sprintf(
190
-                                        __("Just Start %s and Delete Existing Data", "event_espresso"),
191
-                                        $ultimate_db_state
192
-                                    ),
193
-                                    $ultimate_db_state
194
-                                )
195
-                            );
196
-                                    ?>
187
+								apply_filters(
188
+									'FHEE__ee_migration_page__option_2_button_text',
189
+									sprintf(
190
+										__("Just Start %s and Delete Existing Data", "event_espresso"),
191
+										$ultimate_db_state
192
+									),
193
+									$ultimate_db_state
194
+								)
195
+							);
196
+									?>
197 197
                         </a>
198 198
                     </td>
199 199
                 </tr>
@@ -202,18 +202,18 @@  discard block
 block discarded – undo
202 202
                         <div id="no-migration-details-dv" style="display: none; padding: 1em;">
203 203
                             <p>
204 204
                                 <?php echo esc_html(
205
-                                    apply_filters(
206
-                                        'FHEE__ee_migration_page__option_2_details',
207
-                                        sprintf(
208
-                                            __(
209
-                                                "If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.",
210
-                                                "event_espresso"
211
-                                            ),
212
-                                            $ultimate_db_state
213
-                                        ),
214
-                                        $ultimate_db_state
215
-                                    )
216
-                                ); ?>
205
+									apply_filters(
206
+										'FHEE__ee_migration_page__option_2_details',
207
+										sprintf(
208
+											__(
209
+												"If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.",
210
+												"event_espresso"
211
+											),
212
+											$ultimate_db_state
213
+										),
214
+										$ultimate_db_state
215
+									)
216
+								); ?>
217 217
                             </p>
218 218
                         </div>
219 219
                     </td>
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelector.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -118,13 +118,13 @@
 block discarded – undo
118 118
     public function getHiddenInputs()
119 119
     {
120 120
         $html = '<input type="hidden" name="noheader" value="true"/>';
121
-        $html .= '<input type="hidden" name="tkt-slctr-return-url-' . $this->event->ID() . '"';
122
-        $html .= ' value="' . EEH_URL::current_url() . $this->template_args['anchor_id'] . '"/>';
123
-        $html .= '<input type="hidden" name="tkt-slctr-rows-' . $this->event->ID();
124
-        $html .= '" value="' . $this->ticket_rows . '"/>';
125
-        $html .= '<input type="hidden" name="tkt-slctr-max-atndz-' . $this->event->ID();
126
-        $html .= '" value="' . $this->template_args['max_atndz'] . '"/>';
127
-        $html .= '<input type="hidden" name="tkt-slctr-event-id" value="' . $this->event->ID() . '"/>';
121
+        $html .= '<input type="hidden" name="tkt-slctr-return-url-'.$this->event->ID().'"';
122
+        $html .= ' value="'.EEH_URL::current_url().$this->template_args['anchor_id'].'"/>';
123
+        $html .= '<input type="hidden" name="tkt-slctr-rows-'.$this->event->ID();
124
+        $html .= '" value="'.$this->ticket_rows.'"/>';
125
+        $html .= '<input type="hidden" name="tkt-slctr-max-atndz-'.$this->event->ID();
126
+        $html .= '" value="'.$this->template_args['max_atndz'].'"/>';
127
+        $html .= '<input type="hidden" name="tkt-slctr-event-id" value="'.$this->event->ID().'"/>';
128 128
         return $html;
129 129
     }
130 130
 }
Please login to merge, or discard this patch.
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -19,111 +19,111 @@
 block discarded – undo
19 19
  */
20 20
 abstract class TicketSelector
21 21
 {
22
-    /**
23
-     * @var EE_Event
24
-     */
25
-    protected $event;
26
-
27
-    /**
28
-     * @var EE_Ticket[]
29
-     */
30
-    protected $tickets;
31
-
32
-    /**
33
-     * @var int
34
-     */
35
-    protected $max_attendees;
36
-
37
-    /**
38
-     * @var array
39
-     */
40
-    protected $template_args;
41
-
42
-    /**
43
-     * @var int
44
-     */
45
-    protected $ticket_rows = 0;
46
-
47
-
48
-    /**
49
-     * TicketSelectorSimple constructor.
50
-     *
51
-     * @param EE_Event    $event
52
-     * @param EE_Ticket[] $tickets
53
-     * @param int          $max_attendees
54
-     * @param array        $template_args
55
-     */
56
-    public function __construct(EE_Event $event, array $tickets, $max_attendees, array $template_args)
57
-    {
58
-        $this->event = $event;
59
-        $this->tickets = $tickets;
60
-        $this->max_attendees = $max_attendees;
61
-        $this->template_args = $template_args;
62
-        $this->addTemplateArgs();
63
-    }
64
-
65
-
66
-    /**
67
-     * sets any and all template args that are required for this Ticket Selector
68
-     *
69
-     * @return void
70
-     */
71
-    abstract protected function addTemplateArgs();
72
-
73
-
74
-    /**
75
-     * loadTicketSelectorTemplate
76
-     *
77
-     * @return string
78
-     */
79
-    protected function loadTicketSelectorTemplate()
80
-    {
81
-        try {
82
-            $this->template_args['hidden_inputs'] = $this->getHiddenInputs();
83
-            return EEH_Template::locate_template(
84
-                apply_filters(
85
-                    'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path',
86
-                    $this->template_args['template_path'],
87
-                    $this->event
88
-                ),
89
-                $this->template_args
90
-            );
91
-        } catch (Exception $e) {
92
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
93
-        }
94
-        return '';
95
-    }
96
-
97
-
98
-    /**
99
-     * The __toString method allows a class to decide how it will react when it is converted to a string.
100
-     *
101
-     * @return string
102
-     * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring
103
-     */
104
-    public function __toString()
105
-    {
106
-        return $this->loadTicketSelectorTemplate();
107
-    }
108
-
109
-
110
-    /**
111
-     * getHiddenInputs
112
-     *
113
-     * @return string
114
-     * @throws EE_Error
115
-     * @throws ReflectionException
116
-     */
117
-    public function getHiddenInputs()
118
-    {
119
-        $html = '<input type="hidden" name="noheader" value="true"/>';
120
-        $html .= '<input type="hidden" name="tkt-slctr-return-url-' . $this->event->ID() . '"';
121
-        $html .= ' value="' . EEH_URL::current_url() . $this->template_args['anchor_id'] . '"/>';
122
-        $html .= '<input type="hidden" name="tkt-slctr-rows-' . $this->event->ID();
123
-        $html .= '" value="' . $this->ticket_rows . '"/>';
124
-        $html .= '<input type="hidden" name="tkt-slctr-max-atndz-' . $this->event->ID();
125
-        $html .= '" value="' . $this->template_args['max_atndz'] . '"/>';
126
-        $html .= '<input type="hidden" name="tkt-slctr-event-id" value="' . $this->event->ID() . '"/>';
127
-        return $html;
128
-    }
22
+	/**
23
+	 * @var EE_Event
24
+	 */
25
+	protected $event;
26
+
27
+	/**
28
+	 * @var EE_Ticket[]
29
+	 */
30
+	protected $tickets;
31
+
32
+	/**
33
+	 * @var int
34
+	 */
35
+	protected $max_attendees;
36
+
37
+	/**
38
+	 * @var array
39
+	 */
40
+	protected $template_args;
41
+
42
+	/**
43
+	 * @var int
44
+	 */
45
+	protected $ticket_rows = 0;
46
+
47
+
48
+	/**
49
+	 * TicketSelectorSimple constructor.
50
+	 *
51
+	 * @param EE_Event    $event
52
+	 * @param EE_Ticket[] $tickets
53
+	 * @param int          $max_attendees
54
+	 * @param array        $template_args
55
+	 */
56
+	public function __construct(EE_Event $event, array $tickets, $max_attendees, array $template_args)
57
+	{
58
+		$this->event = $event;
59
+		$this->tickets = $tickets;
60
+		$this->max_attendees = $max_attendees;
61
+		$this->template_args = $template_args;
62
+		$this->addTemplateArgs();
63
+	}
64
+
65
+
66
+	/**
67
+	 * sets any and all template args that are required for this Ticket Selector
68
+	 *
69
+	 * @return void
70
+	 */
71
+	abstract protected function addTemplateArgs();
72
+
73
+
74
+	/**
75
+	 * loadTicketSelectorTemplate
76
+	 *
77
+	 * @return string
78
+	 */
79
+	protected function loadTicketSelectorTemplate()
80
+	{
81
+		try {
82
+			$this->template_args['hidden_inputs'] = $this->getHiddenInputs();
83
+			return EEH_Template::locate_template(
84
+				apply_filters(
85
+					'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path',
86
+					$this->template_args['template_path'],
87
+					$this->event
88
+				),
89
+				$this->template_args
90
+			);
91
+		} catch (Exception $e) {
92
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
93
+		}
94
+		return '';
95
+	}
96
+
97
+
98
+	/**
99
+	 * The __toString method allows a class to decide how it will react when it is converted to a string.
100
+	 *
101
+	 * @return string
102
+	 * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring
103
+	 */
104
+	public function __toString()
105
+	{
106
+		return $this->loadTicketSelectorTemplate();
107
+	}
108
+
109
+
110
+	/**
111
+	 * getHiddenInputs
112
+	 *
113
+	 * @return string
114
+	 * @throws EE_Error
115
+	 * @throws ReflectionException
116
+	 */
117
+	public function getHiddenInputs()
118
+	{
119
+		$html = '<input type="hidden" name="noheader" value="true"/>';
120
+		$html .= '<input type="hidden" name="tkt-slctr-return-url-' . $this->event->ID() . '"';
121
+		$html .= ' value="' . EEH_URL::current_url() . $this->template_args['anchor_id'] . '"/>';
122
+		$html .= '<input type="hidden" name="tkt-slctr-rows-' . $this->event->ID();
123
+		$html .= '" value="' . $this->ticket_rows . '"/>';
124
+		$html .= '<input type="hidden" name="tkt-slctr-max-atndz-' . $this->event->ID();
125
+		$html .= '" value="' . $this->template_args['max_atndz'] . '"/>';
126
+		$html .= '<input type="hidden" name="tkt-slctr-event-id" value="' . $this->event->ID() . '"/>';
127
+		return $html;
128
+	}
129 129
 }
Please login to merge, or discard this patch.
core/services/shortcodes/LegacyShortcodesManager.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
85 85
             array()
86 86
         );
87
-        if (! empty($shortcodes_to_register)) {
87
+        if ( ! empty($shortcodes_to_register)) {
88 88
             // cycle thru shortcode folders
89 89
             foreach ($shortcodes_to_register as $shortcode_path) {
90 90
                 // add to list of installed shortcode modules
@@ -128,44 +128,44 @@  discard block
 block discarded – undo
128 128
             // remove last segment
129 129
             array_pop($shortcode_path);
130 130
             // glue it back together
131
-            $shortcode_path = implode('/', $shortcode_path) . '/';
131
+            $shortcode_path = implode('/', $shortcode_path).'/';
132 132
         } else {
133 133
             // we need to generate the filename based off of the folder name
134 134
             // grab and sanitize shortcode directory name
135 135
             $shortcode = sanitize_key(basename($shortcode_path));
136
-            $shortcode_path = rtrim($shortcode_path, '/') . '/';
136
+            $shortcode_path = rtrim($shortcode_path, '/').'/';
137 137
         }
138 138
         // create classname from shortcode directory or file name
139 139
         $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
140 140
         // add class prefix
141
-        $shortcode_class = 'EES_' . $shortcode;
141
+        $shortcode_class = 'EES_'.$shortcode;
142 142
         // does the shortcode exist ?
143
-        if (! is_readable($shortcode_path . '/' . $shortcode_class . $shortcode_ext)) {
143
+        if ( ! is_readable($shortcode_path.'/'.$shortcode_class.$shortcode_ext)) {
144 144
             $msg = sprintf(
145 145
                 esc_html__(
146 146
                     'The requested %1$s shortcode file could not be found or is not readable due to file permissions. It should be in %2$s',
147 147
                     'event_espresso'
148 148
                 ),
149 149
                 $shortcode_class,
150
-                $shortcode_path . '/' . $shortcode_class . $shortcode_ext
150
+                $shortcode_path.'/'.$shortcode_class.$shortcode_ext
151 151
             );
152
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
152
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
153 153
             return false;
154 154
         }
155 155
         // load the shortcode class file
156
-        require_once($shortcode_path . $shortcode_class . $shortcode_ext);
156
+        require_once($shortcode_path.$shortcode_class.$shortcode_ext);
157 157
         // verify that class exists
158
-        if (! class_exists($shortcode_class)) {
158
+        if ( ! class_exists($shortcode_class)) {
159 159
             $msg = sprintf(
160 160
                 esc_html__('The requested %s shortcode class does not exist.', 'event_espresso'),
161 161
                 $shortcode_class
162 162
             );
163
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
163
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
164 164
             return false;
165 165
         }
166 166
         $shortcode = strtoupper($shortcode);
167 167
         // add to array of registered shortcodes
168
-        $this->registry->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
168
+        $this->registry->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext;
169 169
         return true;
170 170
     }
171 171
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         // cycle thru shortcode folders
182 182
         foreach ($this->registry->shortcodes as $shortcode => $shortcode_path) {
183 183
             // add class prefix
184
-            $shortcode_class = 'EES_' . $shortcode;
184
+            $shortcode_class = 'EES_'.$shortcode;
185 185
             // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
186 186
             // which set hooks ?
187 187
             if (is_admin()) {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                 $shortcode_tag = strtoupper($shortcode);
198 198
                 // but first check if the shortcode has already
199 199
                 // been added before assigning 'fallback_shortcode_processor'
200
-                if (! shortcode_exists($shortcode_tag)) {
200
+                if ( ! shortcode_exists($shortcode_tag)) {
201 201
                     // NOTE: this shortcode declaration will get overridden if the shortcode
202 202
                     // is successfully detected in the post content in initializeShortcode()
203 203
                     add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
             }
313 313
         }
314 314
         // one last test for an [espresso_*] shortcode
315
-        if (! $has_shortcode) {
315
+        if ( ! $has_shortcode) {
316 316
             $has_shortcode = strpos($content, '[espresso_') !== false;
317 317
         }
318 318
         return $has_shortcode;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
      */
419 419
     public static function addShortcodeClassPrefix($class_name)
420 420
     {
421
-        return strpos($class_name, 'EES_') === 0 ? $class_name : 'EES_' . $class_name;
421
+        return strpos($class_name, 'EES_') === 0 ? $class_name : 'EES_'.$class_name;
422 422
     }
423 423
 
424 424
 
Please login to merge, or discard this patch.
Indentation   +435 added lines, -435 removed lines patch added patch discarded remove patch
@@ -25,439 +25,439 @@
 block discarded – undo
25 25
  */
26 26
 class LegacyShortcodesManager
27 27
 {
28
-    /**
29
-     * @type CurrentPage
30
-     */
31
-    protected $current_page;
32
-
33
-    /**
34
-     * @var EE_Registry $registry
35
-     */
36
-    private $registry;
37
-
38
-
39
-    /**
40
-     * LegacyShortcodesManager constructor.
41
-     *
42
-     * @param EE_Registry $registry
43
-     * @param CurrentPage $current_page
44
-     */
45
-    public function __construct(EE_Registry $registry, CurrentPage $current_page)
46
-    {
47
-        $this->registry = $registry;
48
-        $this->current_page = $current_page;
49
-    }
50
-
51
-
52
-    /**
53
-     * @return EE_Registry
54
-     */
55
-    public function registry()
56
-    {
57
-        return $this->registry;
58
-    }
59
-
60
-
61
-    /**
62
-     * registerShortcodes
63
-     *
64
-     * @return void
65
-     */
66
-    public function registerShortcodes()
67
-    {
68
-        $this->registry->shortcodes = $this->getShortcodes();
69
-    }
70
-
71
-
72
-    /**
73
-     * getShortcodes
74
-     *
75
-     * @return array
76
-     */
77
-    public function getShortcodes()
78
-    {
79
-        // previously this method would glob the shortcodes directory
80
-        // then filter that list of shortcodes to register,
81
-        // but now we are going to just supply an empty array.
82
-        // this allows any shortcodes that have not yet been converted to the new system
83
-        // to still get loaded and processed, albeit using the same legacy logic as before
84
-        $shortcodes_to_register = apply_filters(
85
-            'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
86
-            array()
87
-        );
88
-        if (! empty($shortcodes_to_register)) {
89
-            // cycle thru shortcode folders
90
-            foreach ($shortcodes_to_register as $shortcode_path) {
91
-                // add to list of installed shortcode modules
92
-                $this->registerShortcode($shortcode_path);
93
-            }
94
-        }
95
-        // filter list of installed modules
96
-        return apply_filters(
97
-            'FHEE__EE_Config___register_shortcodes__installed_shortcodes',
98
-            ! empty($this->registry->shortcodes)
99
-                ? $this->registry->shortcodes
100
-                : array()
101
-        );
102
-    }
103
-
104
-
105
-    /**
106
-     * register_shortcode - makes core aware of this shortcode
107
-     *
108
-     * @param    string $shortcode_path - full path up to and including shortcode folder
109
-     * @return    bool
110
-     */
111
-    public function registerShortcode($shortcode_path = null)
112
-    {
113
-        do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
114
-        $shortcode_ext = '.shortcode.php';
115
-        // make all separators match
116
-        $shortcode_path = str_replace(array('\\', '/'), '/', $shortcode_path);
117
-        // does the file path INCLUDE the actual file name as part of the path ?
118
-        if (strpos($shortcode_path, $shortcode_ext) !== false) {
119
-            // grab shortcode file name from directory name and break apart at dots
120
-            $shortcode_file = explode('.', basename($shortcode_path));
121
-            // take first segment from file name pieces and remove class prefix if it exists
122
-            $shortcode = strpos($shortcode_file[0], 'EES_') === 0
123
-                ? substr($shortcode_file[0], 4)
124
-                : $shortcode_file[0];
125
-            // sanitize shortcode directory name
126
-            $shortcode = sanitize_key($shortcode);
127
-            // now we need to rebuild the shortcode path
128
-            $shortcode_path = explode('/', $shortcode_path);
129
-            // remove last segment
130
-            array_pop($shortcode_path);
131
-            // glue it back together
132
-            $shortcode_path = implode('/', $shortcode_path) . '/';
133
-        } else {
134
-            // we need to generate the filename based off of the folder name
135
-            // grab and sanitize shortcode directory name
136
-            $shortcode = sanitize_key(basename($shortcode_path));
137
-            $shortcode_path = rtrim($shortcode_path, '/') . '/';
138
-        }
139
-        // create classname from shortcode directory or file name
140
-        $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
141
-        // add class prefix
142
-        $shortcode_class = 'EES_' . $shortcode;
143
-        // does the shortcode exist ?
144
-        if (! is_readable($shortcode_path . '/' . $shortcode_class . $shortcode_ext)) {
145
-            $msg = sprintf(
146
-                esc_html__(
147
-                    'The requested %1$s shortcode file could not be found or is not readable due to file permissions. It should be in %2$s',
148
-                    'event_espresso'
149
-                ),
150
-                $shortcode_class,
151
-                $shortcode_path . '/' . $shortcode_class . $shortcode_ext
152
-            );
153
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
154
-            return false;
155
-        }
156
-        // load the shortcode class file
157
-        require_once($shortcode_path . $shortcode_class . $shortcode_ext);
158
-        // verify that class exists
159
-        if (! class_exists($shortcode_class)) {
160
-            $msg = sprintf(
161
-                esc_html__('The requested %s shortcode class does not exist.', 'event_espresso'),
162
-                $shortcode_class
163
-            );
164
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
165
-            return false;
166
-        }
167
-        $shortcode = strtoupper($shortcode);
168
-        // add to array of registered shortcodes
169
-        $this->registry->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
170
-        return true;
171
-    }
172
-
173
-
174
-    /**
175
-     *    _initialize_shortcodes
176
-     *    allow shortcodes to set hooks for the rest of the system
177
-     *
178
-     * @return void
179
-     */
180
-    public function addShortcodes()
181
-    {
182
-        // cycle thru shortcode folders
183
-        foreach ($this->registry->shortcodes as $shortcode => $shortcode_path) {
184
-            // add class prefix
185
-            $shortcode_class = 'EES_' . $shortcode;
186
-            // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
187
-            // which set hooks ?
188
-            if (is_admin()) {
189
-                // fire immediately
190
-                call_user_func(array($shortcode_class, 'set_hooks_admin'));
191
-            } else {
192
-                // delay until other systems are online
193
-                add_action(
194
-                    'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
195
-                    array($shortcode_class, 'set_hooks')
196
-                );
197
-                // convert classname to UPPERCASE and create WP shortcode.
198
-                $shortcode_tag = strtoupper($shortcode);
199
-                // but first check if the shortcode has already
200
-                // been added before assigning 'fallback_shortcode_processor'
201
-                if (! shortcode_exists($shortcode_tag)) {
202
-                    // NOTE: this shortcode declaration will get overridden if the shortcode
203
-                    // is successfully detected in the post content in initializeShortcode()
204
-                    add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
205
-                }
206
-            }
207
-        }
208
-    }
209
-
210
-
211
-    /**
212
-     * callback for the WP "get_header" hook point
213
-     * checks posts for EE shortcodes, and initializes them,
214
-     * then toggles filter switch that loads core default assets
215
-     *
216
-     * @param WP_Query $wp_query
217
-     * @return void
218
-     * @throws ReflectionException
219
-     */
220
-    public function initializeShortcodes(WP_Query $wp_query)
221
-    {
222
-        if (empty($this->registry->shortcodes) || ! $wp_query->is_main_query() || is_admin()) {
223
-            return;
224
-        }
225
-        // in case shortcode is loaded unexpectedly and deps haven't been set up correctly
226
-        EE_Dependency_Map::register_dependencies(
227
-            'EE_Front_Controller',
228
-            [
229
-                'EE_Registry' => EE_Dependency_Map::load_from_cache,
230
-                'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
231
-                'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
232
-            ]
233
-        );
234
-        global $wp;
235
-        /** @var EE_Front_controller $Front_Controller */
236
-        $Front_Controller = LoaderFactory::getLoader()->getShared('EE_Front_Controller');
237
-        do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $wp, $Front_Controller);
238
-        $this->current_page->parseQueryVars();
239
-        // grab post_name from request
240
-        $current_post = apply_filters(
241
-            'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name',
242
-            $this->current_page->postName()
243
-        );
244
-        $show_on_front = get_option('show_on_front');
245
-        // if it's not set, then check if frontpage is blog
246
-        if (empty($current_post)) {
247
-            // yup.. this is the posts page, prepare to load all shortcode modules
248
-            $current_post = 'posts';
249
-            // unless..
250
-            if ($show_on_front === 'page') {
251
-                // some other page is set as the homepage
252
-                $page_on_front = get_option('page_on_front');
253
-                if ($page_on_front) {
254
-                    // k now we need to find the post_name for this page
255
-                    global $wpdb;
256
-                    $page_on_front = $wpdb->get_var(
257
-                        $wpdb->prepare(
258
-                            "SELECT post_name from {$wpdb->posts} WHERE post_type='page' AND post_status NOT IN ('auto-draft', 'inherit', 'trash') AND ID=%d",
259
-                            $page_on_front
260
-                        )
261
-                    );
262
-                    // set the current post slug to what it actually is
263
-                    $current_post = $page_on_front ?: $current_post;
264
-                }
265
-            }
266
-        }
267
-        // in case $current_post is hierarchical like: /parent-page/current-page
268
-        $current_post = basename($current_post);
269
-        if (
270
-            // is current page/post the "blog" page ?
271
-            $current_post === EE_Config::get_page_for_posts()
272
-            // or are we on a category page?
273
-            || (
274
-                is_array(term_exists($current_post, 'category'))
275
-                || array_key_exists('category_name', $wp->query_vars)
276
-            )
277
-        ) {
278
-            // initialize all legacy shortcodes
279
-            $load_assets = $this->parseContentForShortcodes('', true);
280
-        } else {
281
-            global $post;
282
-            if ($post instanceof WP_Post) {
283
-                $post_content = $post->post_content;
284
-            } else {
285
-                global $wpdb;
286
-                $post_content = $wpdb->get_var(
287
-                    $wpdb->prepare(
288
-                        "SELECT post_content from {$wpdb->posts} WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash') AND post_name=%s",
289
-                        $current_post
290
-                    )
291
-                );
292
-            }
293
-            $load_assets = $this->parseContentForShortcodes($post_content);
294
-        }
295
-        if ($load_assets) {
296
-            $this->current_page->setEspressoPage(true);
297
-            add_filter('FHEE_load_css', '__return_true');
298
-            add_filter('FHEE_load_js', '__return_true');
299
-        }
300
-        do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $Front_Controller);
301
-    }
302
-
303
-
304
-    /**
305
-     * checks supplied content against list of legacy shortcodes,
306
-     * then initializes any found shortcodes, and returns true.
307
-     * returns false if no shortcodes found.
308
-     *
309
-     * @param string $content
310
-     * @param bool   $load_all if true, then ALL active legacy shortcodes will be initialized
311
-     * @return bool
312
-     * @throws ReflectionException
313
-     */
314
-    public function parseContentForShortcodes($content = '', $load_all = false)
315
-    {
316
-        $has_shortcode = false;
317
-        foreach ($this->registry->shortcodes as $shortcode_class => $shortcode) {
318
-            if ($load_all || has_shortcode($content, $shortcode_class)) {
319
-                // load up the shortcode
320
-                $this->initializeShortcode($shortcode_class);
321
-                $has_shortcode = true;
322
-            }
323
-        }
324
-        // one last test for an [espresso_*] shortcode
325
-        if (! $has_shortcode) {
326
-            $has_shortcode = strpos($content, '[espresso_') !== false;
327
-        }
328
-        return $has_shortcode;
329
-    }
330
-
331
-
332
-    /**
333
-     * given a shortcode name, will instantiate the shortcode and call it's run() method
334
-     *
335
-     * @param string $shortcode_class
336
-     * @param WP     $wp
337
-     * @throws ReflectionException
338
-     */
339
-    public function initializeShortcode($shortcode_class = '', WP $wp = null)
340
-    {
341
-        // don't do anything if shortcode is already initialized
342
-        if (
343
-            empty($this->registry->shortcodes->{$shortcode_class})
344
-            || ! is_string($this->registry->shortcodes->{$shortcode_class})
345
-        ) {
346
-            return;
347
-        }
348
-        // let's pause to reflect on this...
349
-        $sc_reflector = new ReflectionClass(LegacyShortcodesManager::addShortcodeClassPrefix($shortcode_class));
350
-        // ensure that class is actually a shortcode
351
-        if (
352
-            defined('WP_DEBUG')
353
-            && WP_DEBUG === true
354
-            && ! $sc_reflector->isSubclassOf('EES_Shortcode')
355
-        ) {
356
-            EE_Error::add_error(
357
-                sprintf(
358
-                    esc_html__(
359
-                        'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.',
360
-                        'event_espresso'
361
-                    ),
362
-                    $shortcode_class
363
-                ),
364
-                __FILE__,
365
-                __FUNCTION__,
366
-                __LINE__
367
-            );
368
-            add_filter('FHEE_run_EE_the_content', '__return_true');
369
-            return;
370
-        }
371
-        global $wp;
372
-        // and pass the request object to the run method
373
-        $this->registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
374
-        // fire the shortcode class's run method, so that it can activate resources
375
-        $this->registry->shortcodes->{$shortcode_class}->run($wp);
376
-    }
377
-
378
-
379
-    /**
380
-     * get classname, remove EES_prefix, and convert to UPPERCASE
381
-     *
382
-     * @param string $class_name
383
-     * @return string
384
-     */
385
-    public static function generateShortcodeTagFromClassName($class_name)
386
-    {
387
-        return strtoupper(str_replace('EES_', '', $class_name));
388
-    }
389
-
390
-
391
-    /**
392
-     * add EES_prefix and Capitalize words
393
-     *
394
-     * @param string $tag
395
-     * @return string
396
-     */
397
-    public static function generateShortcodeClassNameFromTag($tag)
398
-    {
399
-        // order of operation runs from inside to out
400
-        // 5) maybe add prefix
401
-        return LegacyShortcodesManager::addShortcodeClassPrefix(
402
-            // 4) find spaces, replace with underscores
403
-            str_replace(
404
-                ' ',
405
-                '_',
406
-                // 3) capitalize first letter of each word
407
-                ucwords(
408
-                    // 2) also change to lowercase so ucwords() will work
409
-                    strtolower(
410
-                        // 1) find underscores, replace with spaces so ucwords() will work
411
-                        str_replace(
412
-                            '_',
413
-                            ' ',
414
-                            $tag
415
-                        )
416
-                    )
417
-                )
418
-            )
419
-        );
420
-    }
421
-
422
-
423
-    /**
424
-     * maybe add EES_prefix
425
-     *
426
-     * @param string $class_name
427
-     * @return string
428
-     */
429
-    public static function addShortcodeClassPrefix($class_name)
430
-    {
431
-        return strpos($class_name, 'EES_') === 0 ? $class_name : 'EES_' . $class_name;
432
-    }
433
-
434
-
435
-    /**
436
-     * @return array
437
-     */
438
-    public function getEspressoShortcodeTags()
439
-    {
440
-        static $shortcode_tags = array();
441
-        if (empty($shortcode_tags)) {
442
-            $shortcode_tags = array_keys((array) $this->registry->shortcodes);
443
-        }
444
-        return $shortcode_tags;
445
-    }
446
-
447
-
448
-    /**
449
-     * @param string $content
450
-     * @return string
451
-     * @throws ReflectionException
452
-     */
453
-    public function doShortcode($content)
454
-    {
455
-        foreach ($this->getEspressoShortcodeTags() as $shortcode_tag) {
456
-            if (strpos($content, $shortcode_tag) !== false) {
457
-                $shortcode_class = LegacyShortcodesManager::generateShortcodeClassNameFromTag($shortcode_tag);
458
-                $this->initializeShortcode($shortcode_class);
459
-            }
460
-        }
461
-        return do_shortcode($content);
462
-    }
28
+	/**
29
+	 * @type CurrentPage
30
+	 */
31
+	protected $current_page;
32
+
33
+	/**
34
+	 * @var EE_Registry $registry
35
+	 */
36
+	private $registry;
37
+
38
+
39
+	/**
40
+	 * LegacyShortcodesManager constructor.
41
+	 *
42
+	 * @param EE_Registry $registry
43
+	 * @param CurrentPage $current_page
44
+	 */
45
+	public function __construct(EE_Registry $registry, CurrentPage $current_page)
46
+	{
47
+		$this->registry = $registry;
48
+		$this->current_page = $current_page;
49
+	}
50
+
51
+
52
+	/**
53
+	 * @return EE_Registry
54
+	 */
55
+	public function registry()
56
+	{
57
+		return $this->registry;
58
+	}
59
+
60
+
61
+	/**
62
+	 * registerShortcodes
63
+	 *
64
+	 * @return void
65
+	 */
66
+	public function registerShortcodes()
67
+	{
68
+		$this->registry->shortcodes = $this->getShortcodes();
69
+	}
70
+
71
+
72
+	/**
73
+	 * getShortcodes
74
+	 *
75
+	 * @return array
76
+	 */
77
+	public function getShortcodes()
78
+	{
79
+		// previously this method would glob the shortcodes directory
80
+		// then filter that list of shortcodes to register,
81
+		// but now we are going to just supply an empty array.
82
+		// this allows any shortcodes that have not yet been converted to the new system
83
+		// to still get loaded and processed, albeit using the same legacy logic as before
84
+		$shortcodes_to_register = apply_filters(
85
+			'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
86
+			array()
87
+		);
88
+		if (! empty($shortcodes_to_register)) {
89
+			// cycle thru shortcode folders
90
+			foreach ($shortcodes_to_register as $shortcode_path) {
91
+				// add to list of installed shortcode modules
92
+				$this->registerShortcode($shortcode_path);
93
+			}
94
+		}
95
+		// filter list of installed modules
96
+		return apply_filters(
97
+			'FHEE__EE_Config___register_shortcodes__installed_shortcodes',
98
+			! empty($this->registry->shortcodes)
99
+				? $this->registry->shortcodes
100
+				: array()
101
+		);
102
+	}
103
+
104
+
105
+	/**
106
+	 * register_shortcode - makes core aware of this shortcode
107
+	 *
108
+	 * @param    string $shortcode_path - full path up to and including shortcode folder
109
+	 * @return    bool
110
+	 */
111
+	public function registerShortcode($shortcode_path = null)
112
+	{
113
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
114
+		$shortcode_ext = '.shortcode.php';
115
+		// make all separators match
116
+		$shortcode_path = str_replace(array('\\', '/'), '/', $shortcode_path);
117
+		// does the file path INCLUDE the actual file name as part of the path ?
118
+		if (strpos($shortcode_path, $shortcode_ext) !== false) {
119
+			// grab shortcode file name from directory name and break apart at dots
120
+			$shortcode_file = explode('.', basename($shortcode_path));
121
+			// take first segment from file name pieces and remove class prefix if it exists
122
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0
123
+				? substr($shortcode_file[0], 4)
124
+				: $shortcode_file[0];
125
+			// sanitize shortcode directory name
126
+			$shortcode = sanitize_key($shortcode);
127
+			// now we need to rebuild the shortcode path
128
+			$shortcode_path = explode('/', $shortcode_path);
129
+			// remove last segment
130
+			array_pop($shortcode_path);
131
+			// glue it back together
132
+			$shortcode_path = implode('/', $shortcode_path) . '/';
133
+		} else {
134
+			// we need to generate the filename based off of the folder name
135
+			// grab and sanitize shortcode directory name
136
+			$shortcode = sanitize_key(basename($shortcode_path));
137
+			$shortcode_path = rtrim($shortcode_path, '/') . '/';
138
+		}
139
+		// create classname from shortcode directory or file name
140
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
141
+		// add class prefix
142
+		$shortcode_class = 'EES_' . $shortcode;
143
+		// does the shortcode exist ?
144
+		if (! is_readable($shortcode_path . '/' . $shortcode_class . $shortcode_ext)) {
145
+			$msg = sprintf(
146
+				esc_html__(
147
+					'The requested %1$s shortcode file could not be found or is not readable due to file permissions. It should be in %2$s',
148
+					'event_espresso'
149
+				),
150
+				$shortcode_class,
151
+				$shortcode_path . '/' . $shortcode_class . $shortcode_ext
152
+			);
153
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
154
+			return false;
155
+		}
156
+		// load the shortcode class file
157
+		require_once($shortcode_path . $shortcode_class . $shortcode_ext);
158
+		// verify that class exists
159
+		if (! class_exists($shortcode_class)) {
160
+			$msg = sprintf(
161
+				esc_html__('The requested %s shortcode class does not exist.', 'event_espresso'),
162
+				$shortcode_class
163
+			);
164
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
165
+			return false;
166
+		}
167
+		$shortcode = strtoupper($shortcode);
168
+		// add to array of registered shortcodes
169
+		$this->registry->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
170
+		return true;
171
+	}
172
+
173
+
174
+	/**
175
+	 *    _initialize_shortcodes
176
+	 *    allow shortcodes to set hooks for the rest of the system
177
+	 *
178
+	 * @return void
179
+	 */
180
+	public function addShortcodes()
181
+	{
182
+		// cycle thru shortcode folders
183
+		foreach ($this->registry->shortcodes as $shortcode => $shortcode_path) {
184
+			// add class prefix
185
+			$shortcode_class = 'EES_' . $shortcode;
186
+			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
187
+			// which set hooks ?
188
+			if (is_admin()) {
189
+				// fire immediately
190
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
191
+			} else {
192
+				// delay until other systems are online
193
+				add_action(
194
+					'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
195
+					array($shortcode_class, 'set_hooks')
196
+				);
197
+				// convert classname to UPPERCASE and create WP shortcode.
198
+				$shortcode_tag = strtoupper($shortcode);
199
+				// but first check if the shortcode has already
200
+				// been added before assigning 'fallback_shortcode_processor'
201
+				if (! shortcode_exists($shortcode_tag)) {
202
+					// NOTE: this shortcode declaration will get overridden if the shortcode
203
+					// is successfully detected in the post content in initializeShortcode()
204
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
205
+				}
206
+			}
207
+		}
208
+	}
209
+
210
+
211
+	/**
212
+	 * callback for the WP "get_header" hook point
213
+	 * checks posts for EE shortcodes, and initializes them,
214
+	 * then toggles filter switch that loads core default assets
215
+	 *
216
+	 * @param WP_Query $wp_query
217
+	 * @return void
218
+	 * @throws ReflectionException
219
+	 */
220
+	public function initializeShortcodes(WP_Query $wp_query)
221
+	{
222
+		if (empty($this->registry->shortcodes) || ! $wp_query->is_main_query() || is_admin()) {
223
+			return;
224
+		}
225
+		// in case shortcode is loaded unexpectedly and deps haven't been set up correctly
226
+		EE_Dependency_Map::register_dependencies(
227
+			'EE_Front_Controller',
228
+			[
229
+				'EE_Registry' => EE_Dependency_Map::load_from_cache,
230
+				'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache,
231
+				'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
232
+			]
233
+		);
234
+		global $wp;
235
+		/** @var EE_Front_controller $Front_Controller */
236
+		$Front_Controller = LoaderFactory::getLoader()->getShared('EE_Front_Controller');
237
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $wp, $Front_Controller);
238
+		$this->current_page->parseQueryVars();
239
+		// grab post_name from request
240
+		$current_post = apply_filters(
241
+			'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name',
242
+			$this->current_page->postName()
243
+		);
244
+		$show_on_front = get_option('show_on_front');
245
+		// if it's not set, then check if frontpage is blog
246
+		if (empty($current_post)) {
247
+			// yup.. this is the posts page, prepare to load all shortcode modules
248
+			$current_post = 'posts';
249
+			// unless..
250
+			if ($show_on_front === 'page') {
251
+				// some other page is set as the homepage
252
+				$page_on_front = get_option('page_on_front');
253
+				if ($page_on_front) {
254
+					// k now we need to find the post_name for this page
255
+					global $wpdb;
256
+					$page_on_front = $wpdb->get_var(
257
+						$wpdb->prepare(
258
+							"SELECT post_name from {$wpdb->posts} WHERE post_type='page' AND post_status NOT IN ('auto-draft', 'inherit', 'trash') AND ID=%d",
259
+							$page_on_front
260
+						)
261
+					);
262
+					// set the current post slug to what it actually is
263
+					$current_post = $page_on_front ?: $current_post;
264
+				}
265
+			}
266
+		}
267
+		// in case $current_post is hierarchical like: /parent-page/current-page
268
+		$current_post = basename($current_post);
269
+		if (
270
+			// is current page/post the "blog" page ?
271
+			$current_post === EE_Config::get_page_for_posts()
272
+			// or are we on a category page?
273
+			|| (
274
+				is_array(term_exists($current_post, 'category'))
275
+				|| array_key_exists('category_name', $wp->query_vars)
276
+			)
277
+		) {
278
+			// initialize all legacy shortcodes
279
+			$load_assets = $this->parseContentForShortcodes('', true);
280
+		} else {
281
+			global $post;
282
+			if ($post instanceof WP_Post) {
283
+				$post_content = $post->post_content;
284
+			} else {
285
+				global $wpdb;
286
+				$post_content = $wpdb->get_var(
287
+					$wpdb->prepare(
288
+						"SELECT post_content from {$wpdb->posts} WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash') AND post_name=%s",
289
+						$current_post
290
+					)
291
+				);
292
+			}
293
+			$load_assets = $this->parseContentForShortcodes($post_content);
294
+		}
295
+		if ($load_assets) {
296
+			$this->current_page->setEspressoPage(true);
297
+			add_filter('FHEE_load_css', '__return_true');
298
+			add_filter('FHEE_load_js', '__return_true');
299
+		}
300
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $Front_Controller);
301
+	}
302
+
303
+
304
+	/**
305
+	 * checks supplied content against list of legacy shortcodes,
306
+	 * then initializes any found shortcodes, and returns true.
307
+	 * returns false if no shortcodes found.
308
+	 *
309
+	 * @param string $content
310
+	 * @param bool   $load_all if true, then ALL active legacy shortcodes will be initialized
311
+	 * @return bool
312
+	 * @throws ReflectionException
313
+	 */
314
+	public function parseContentForShortcodes($content = '', $load_all = false)
315
+	{
316
+		$has_shortcode = false;
317
+		foreach ($this->registry->shortcodes as $shortcode_class => $shortcode) {
318
+			if ($load_all || has_shortcode($content, $shortcode_class)) {
319
+				// load up the shortcode
320
+				$this->initializeShortcode($shortcode_class);
321
+				$has_shortcode = true;
322
+			}
323
+		}
324
+		// one last test for an [espresso_*] shortcode
325
+		if (! $has_shortcode) {
326
+			$has_shortcode = strpos($content, '[espresso_') !== false;
327
+		}
328
+		return $has_shortcode;
329
+	}
330
+
331
+
332
+	/**
333
+	 * given a shortcode name, will instantiate the shortcode and call it's run() method
334
+	 *
335
+	 * @param string $shortcode_class
336
+	 * @param WP     $wp
337
+	 * @throws ReflectionException
338
+	 */
339
+	public function initializeShortcode($shortcode_class = '', WP $wp = null)
340
+	{
341
+		// don't do anything if shortcode is already initialized
342
+		if (
343
+			empty($this->registry->shortcodes->{$shortcode_class})
344
+			|| ! is_string($this->registry->shortcodes->{$shortcode_class})
345
+		) {
346
+			return;
347
+		}
348
+		// let's pause to reflect on this...
349
+		$sc_reflector = new ReflectionClass(LegacyShortcodesManager::addShortcodeClassPrefix($shortcode_class));
350
+		// ensure that class is actually a shortcode
351
+		if (
352
+			defined('WP_DEBUG')
353
+			&& WP_DEBUG === true
354
+			&& ! $sc_reflector->isSubclassOf('EES_Shortcode')
355
+		) {
356
+			EE_Error::add_error(
357
+				sprintf(
358
+					esc_html__(
359
+						'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.',
360
+						'event_espresso'
361
+					),
362
+					$shortcode_class
363
+				),
364
+				__FILE__,
365
+				__FUNCTION__,
366
+				__LINE__
367
+			);
368
+			add_filter('FHEE_run_EE_the_content', '__return_true');
369
+			return;
370
+		}
371
+		global $wp;
372
+		// and pass the request object to the run method
373
+		$this->registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
374
+		// fire the shortcode class's run method, so that it can activate resources
375
+		$this->registry->shortcodes->{$shortcode_class}->run($wp);
376
+	}
377
+
378
+
379
+	/**
380
+	 * get classname, remove EES_prefix, and convert to UPPERCASE
381
+	 *
382
+	 * @param string $class_name
383
+	 * @return string
384
+	 */
385
+	public static function generateShortcodeTagFromClassName($class_name)
386
+	{
387
+		return strtoupper(str_replace('EES_', '', $class_name));
388
+	}
389
+
390
+
391
+	/**
392
+	 * add EES_prefix and Capitalize words
393
+	 *
394
+	 * @param string $tag
395
+	 * @return string
396
+	 */
397
+	public static function generateShortcodeClassNameFromTag($tag)
398
+	{
399
+		// order of operation runs from inside to out
400
+		// 5) maybe add prefix
401
+		return LegacyShortcodesManager::addShortcodeClassPrefix(
402
+			// 4) find spaces, replace with underscores
403
+			str_replace(
404
+				' ',
405
+				'_',
406
+				// 3) capitalize first letter of each word
407
+				ucwords(
408
+					// 2) also change to lowercase so ucwords() will work
409
+					strtolower(
410
+						// 1) find underscores, replace with spaces so ucwords() will work
411
+						str_replace(
412
+							'_',
413
+							' ',
414
+							$tag
415
+						)
416
+					)
417
+				)
418
+			)
419
+		);
420
+	}
421
+
422
+
423
+	/**
424
+	 * maybe add EES_prefix
425
+	 *
426
+	 * @param string $class_name
427
+	 * @return string
428
+	 */
429
+	public static function addShortcodeClassPrefix($class_name)
430
+	{
431
+		return strpos($class_name, 'EES_') === 0 ? $class_name : 'EES_' . $class_name;
432
+	}
433
+
434
+
435
+	/**
436
+	 * @return array
437
+	 */
438
+	public function getEspressoShortcodeTags()
439
+	{
440
+		static $shortcode_tags = array();
441
+		if (empty($shortcode_tags)) {
442
+			$shortcode_tags = array_keys((array) $this->registry->shortcodes);
443
+		}
444
+		return $shortcode_tags;
445
+	}
446
+
447
+
448
+	/**
449
+	 * @param string $content
450
+	 * @return string
451
+	 * @throws ReflectionException
452
+	 */
453
+	public function doShortcode($content)
454
+	{
455
+		foreach ($this->getEspressoShortcodeTags() as $shortcode_tag) {
456
+			if (strpos($content, $shortcode_tag) !== false) {
457
+				$shortcode_class = LegacyShortcodesManager::generateShortcodeClassNameFromTag($shortcode_tag);
458
+				$this->initializeShortcode($shortcode_class);
459
+			}
460
+		}
461
+		return do_shortcode($content);
462
+	}
463 463
 }
Please login to merge, or discard this patch.
core/services/request/CurrentPage.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             return;
86 86
         }
87 87
         // if somebody forgot to provide us with WP, that's ok because its global
88
-        if (! $WP instanceof WP) {
88
+        if ( ! $WP instanceof WP) {
89 89
             global $WP;
90 90
         }
91 91
         $this->post_id   = $this->getPostId($WP);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         if ($post_id) {
111 111
             return get_permalink($post_id);
112 112
         }
113
-        if (! $WP instanceof WP) {
113
+        if ( ! $WP instanceof WP) {
114 114
             global $WP;
115 115
         }
116 116
         if ($WP instanceof WP && $WP->request) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     {
128 128
         return array_filter(
129 129
             $this->post_type,
130
-            function ($post_type) {
130
+            function($post_type) {
131 131
                 return strpos($post_type, 'espresso_') === 0;
132 132
             }
133 133
         );
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
                 $post_id = $WP->query_vars['p'];
150 150
             }
151 151
             // not a post? what about a page?
152
-            if (! $post_id && isset($WP->query_vars['page_id'])) {
152
+            if ( ! $post_id && isset($WP->query_vars['page_id'])) {
153 153
                 $post_id = $WP->query_vars['page_id'];
154 154
             }
155 155
             // ok... maybe pretty permalinks are off and the ID is set in the raw request...
156 156
             // but hasn't been processed yet ie: this method is being called too early :\
157
-            if (! $post_id && $WP->request !== null && is_numeric(basename($WP->request))) {
157
+            if ( ! $post_id && $WP->request !== null && is_numeric(basename($WP->request))) {
158 158
                 $post_id = basename($WP->request);
159 159
             }
160 160
         }
161 161
         // none of the above? ok what about an explicit "post_id" URL parameter?
162
-        if (! $post_id && $this->request->requestParamIsSet('post_id')) {
162
+        if ( ! $post_id && $this->request->requestParamIsSet('post_id')) {
163 163
             $post_id = $this->request->getRequestParam('post_id');
164 164
         }
165 165
         return $post_id;
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
                 $post_name = $WP->query_vars['name'];
183 183
             }
184 184
             // what about the page name?
185
-            if (! $post_name && isset($WP->query_vars['pagename']) && ! empty($WP->query_vars['pagename'])) {
185
+            if ( ! $post_name && isset($WP->query_vars['pagename']) && ! empty($WP->query_vars['pagename'])) {
186 186
                 $post_name = $WP->query_vars['pagename'];
187 187
             }
188 188
             // this stinks but let's run a query to try and get the post name from the URL
189 189
             // (assuming pretty permalinks are on)
190
-            if (! $post_name && ! empty($WP->request)) {
190
+            if ( ! $post_name && ! empty($WP->request)) {
191 191
                 $possible_post_name = basename($WP->request);
192
-                if (! is_numeric($possible_post_name)) {
192
+                if ( ! is_numeric($possible_post_name)) {
193 193
                     $SQL                = "SELECT ID from {$wpdb->posts}";
194 194
                     $SQL                .= " WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash')";
195 195
                     $SQL                .= ' AND post_name=%s';
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         }
203 203
         // ug... ok... nothing yet... but do we have a post ID?
204 204
         // if so then... sigh... run a query to get the post name :\
205
-        if (! $post_name && $this->post_id) {
205
+        if ( ! $post_name && $this->post_id) {
206 206
             $SQL                = "SELECT post_name from {$wpdb->posts}";
207 207
             $SQL                .= " WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash')";
208 208
             $SQL                .= ' AND ID=%d';
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             }
213 213
         }
214 214
         // still nothing? ok what about an explicit 'post_name' URL parameter?
215
-        if (! $post_name && $this->request->requestParamIsSet('post_name')) {
215
+        if ( ! $post_name && $this->request->requestParamIsSet('post_name')) {
216 216
             $post_name = $this->request->getRequestParam('post_name');
217 217
         }
218 218
         return $post_name;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         $espresso_CPT_taxonomies = $this->cpt_strategy->get_CPT_taxonomies();
312 312
         if (is_array($espresso_CPT_taxonomies)) {
313 313
             foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy => $details) {
314
-                if (isset($WP->query_vars, $WP->query_vars[ $espresso_CPT_taxonomy ])) {
314
+                if (isset($WP->query_vars, $WP->query_vars[$espresso_CPT_taxonomy])) {
315 315
                     return true;
316 316
                 }
317 317
             }
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
         $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints);
322 322
         foreach ($this->post_type as $post_type) {
323 323
             // was a post name passed ?
324
-            if (isset($post_type_CPT_endpoints[ $post_type ])) {
324
+            if (isset($post_type_CPT_endpoints[$post_type])) {
325 325
                 // kk we know this is an espresso page, but is it a specific post ?
326
-                if (! $this->post_name) {
326
+                if ( ! $this->post_name) {
327 327
                     $espresso_post_type = $this->request->getRequestParam('post_type');
328 328
                     // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events
329 329
                     // this essentially sets the post_name to "events" (or whatever EE CPT)
330
-                    $post_name = isset($post_type_CPT_endpoints[ $espresso_post_type ])
331
-                        ? $post_type_CPT_endpoints[ $espresso_post_type ]
330
+                    $post_name = isset($post_type_CPT_endpoints[$espresso_post_type])
331
+                        ? $post_type_CPT_endpoints[$espresso_post_type]
332 332
                         : '';
333 333
                     // if the post type matches one of ours then set the post name to the endpoint
334 334
                     if ($post_name) {
Please login to merge, or discard this patch.
Indentation   +317 added lines, -317 removed lines patch added patch discarded remove patch
@@ -23,321 +23,321 @@
 block discarded – undo
23 23
  */
24 24
 class CurrentPage
25 25
 {
26
-    /**
27
-     * @var EE_CPT_Strategy
28
-     */
29
-    private $cpt_strategy;
30
-
31
-    /**
32
-     * @var bool
33
-     */
34
-    private $initialized;
35
-
36
-    /**
37
-     * @var bool
38
-     */
39
-    private $is_espresso_page;
40
-
41
-    /**
42
-     * @var int
43
-     */
44
-    private $post_id = 0;
45
-
46
-    /**
47
-     * @var string
48
-     */
49
-    private $post_name = '';
50
-
51
-    /**
52
-     * @var array
53
-     */
54
-    private $post_type = [];
55
-
56
-    /**
57
-     * @var RequestInterface $request
58
-     */
59
-    private $request;
60
-
61
-
62
-    /**
63
-     * CurrentPage constructor.
64
-     *
65
-     * @param EE_CPT_Strategy  $cpt_strategy
66
-     * @param RequestInterface $request
67
-     */
68
-    public function __construct(EE_CPT_Strategy $cpt_strategy, RequestInterface $request)
69
-    {
70
-        $this->cpt_strategy = $cpt_strategy;
71
-        $this->request      = $request;
72
-        $this->initialized  = is_admin();
73
-        // analyse the incoming WP request
74
-        add_action('parse_request', [$this, 'parseQueryVars'], 2, 1);
75
-    }
76
-
77
-
78
-    /**
79
-     * @param WP $WP
80
-     * @return void
81
-     */
82
-    public function parseQueryVars(WP $WP = null)
83
-    {
84
-        if ($this->initialized) {
85
-            return;
86
-        }
87
-        // if somebody forgot to provide us with WP, that's ok because its global
88
-        if (! $WP instanceof WP) {
89
-            global $WP;
90
-        }
91
-        $this->post_id   = $this->getPostId($WP);
92
-        $this->post_name = $this->getPostName($WP);
93
-        $this->post_type = $this->getPostType($WP);
94
-        // true or false ? is this page being used by EE ?
95
-        $this->setEspressoPage();
96
-        remove_action('parse_request', [$this, 'parseRequest'], 2);
97
-        $this->initialized = true;
98
-    }
99
-
100
-
101
-    /**
102
-     * Just a helper method for getting the url for the displayed page.
103
-     *
104
-     * @param WP|null $WP
105
-     * @return string
106
-     */
107
-    public function getPermalink(WP $WP = null)
108
-    {
109
-        $post_id = $this->post_id ?: $this->getPostId($WP);
110
-        if ($post_id) {
111
-            return get_permalink($post_id);
112
-        }
113
-        if (! $WP instanceof WP) {
114
-            global $WP;
115
-        }
116
-        if ($WP instanceof WP && $WP->request) {
117
-            return site_url($WP->request);
118
-        }
119
-        return esc_url_raw(site_url($_SERVER['REQUEST_URI']));
120
-    }
121
-
122
-
123
-    /**
124
-     * @return array
125
-     */
126
-    public function espressoPostType()
127
-    {
128
-        return array_filter(
129
-            $this->post_type,
130
-            function ($post_type) {
131
-                return strpos($post_type, 'espresso_') === 0;
132
-            }
133
-        );
134
-    }
135
-
136
-
137
-    /**
138
-     * pokes and prods the WP object query_vars in an attempt to shake out a page/post ID
139
-     *
140
-     * @param WP $WP
141
-     * @return int
142
-     */
143
-    private function getPostId(WP $WP = null)
144
-    {
145
-        $post_id = null;
146
-        if ($WP instanceof WP) {
147
-            // look for the post ID in the aptly named 'p' query var
148
-            if (isset($WP->query_vars['p'])) {
149
-                $post_id = $WP->query_vars['p'];
150
-            }
151
-            // not a post? what about a page?
152
-            if (! $post_id && isset($WP->query_vars['page_id'])) {
153
-                $post_id = $WP->query_vars['page_id'];
154
-            }
155
-            // ok... maybe pretty permalinks are off and the ID is set in the raw request...
156
-            // but hasn't been processed yet ie: this method is being called too early :\
157
-            if (! $post_id && $WP->request !== null && is_numeric(basename($WP->request))) {
158
-                $post_id = basename($WP->request);
159
-            }
160
-        }
161
-        // none of the above? ok what about an explicit "post_id" URL parameter?
162
-        if (! $post_id && $this->request->requestParamIsSet('post_id')) {
163
-            $post_id = $this->request->getRequestParam('post_id');
164
-        }
165
-        return $post_id;
166
-    }
167
-
168
-
169
-    /**
170
-     * similar to getPostId() above but attempts to obtain the "name" for the current page/post
171
-     *
172
-     * @param WP $WP
173
-     * @return string
174
-     */
175
-    private function getPostName(WP $WP = null)
176
-    {
177
-        global $wpdb;
178
-        $post_name = null;
179
-        if ($WP instanceof WP) {
180
-            // if this is a post, then is the post name set?
181
-            if (isset($WP->query_vars['name']) && ! empty($WP->query_vars['name'])) {
182
-                $post_name = $WP->query_vars['name'];
183
-            }
184
-            // what about the page name?
185
-            if (! $post_name && isset($WP->query_vars['pagename']) && ! empty($WP->query_vars['pagename'])) {
186
-                $post_name = $WP->query_vars['pagename'];
187
-            }
188
-            // this stinks but let's run a query to try and get the post name from the URL
189
-            // (assuming pretty permalinks are on)
190
-            if (! $post_name && ! empty($WP->request)) {
191
-                $possible_post_name = basename($WP->request);
192
-                if (! is_numeric($possible_post_name)) {
193
-                    $SQL                = "SELECT ID from {$wpdb->posts}";
194
-                    $SQL                .= " WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash')";
195
-                    $SQL                .= ' AND post_name=%s';
196
-                    $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name));
197
-                    if ($possible_post_name) {
198
-                        $post_name = $possible_post_name;
199
-                    }
200
-                }
201
-            }
202
-        }
203
-        // ug... ok... nothing yet... but do we have a post ID?
204
-        // if so then... sigh... run a query to get the post name :\
205
-        if (! $post_name && $this->post_id) {
206
-            $SQL                = "SELECT post_name from {$wpdb->posts}";
207
-            $SQL                .= " WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash')";
208
-            $SQL                .= ' AND ID=%d';
209
-            $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->post_id));
210
-            if ($possible_post_name) {
211
-                $post_name = $possible_post_name;
212
-            }
213
-        }
214
-        // still nothing? ok what about an explicit 'post_name' URL parameter?
215
-        if (! $post_name && $this->request->requestParamIsSet('post_name')) {
216
-            $post_name = $this->request->getRequestParam('post_name');
217
-        }
218
-        return $post_name;
219
-    }
220
-
221
-
222
-    /**
223
-     * also similar to getPostId() and getPostName() above but not as insane
224
-     *
225
-     * @param WP $WP
226
-     * @return array
227
-     */
228
-    private function getPostType(WP $WP = null)
229
-    {
230
-        $post_types = [];
231
-        if ($WP instanceof WP) {
232
-            $post_types = isset($WP->query_vars['post_type'])
233
-                ? (array) $WP->query_vars['post_type']
234
-                : [];
235
-        }
236
-        if (empty($post_types) && $this->request->requestParamIsSet('post_type')) {
237
-            $post_types = $this->request->getRequestParam('post_type', [], DataType::STRING, true);
238
-        }
239
-        return (array) $post_types;
240
-    }
241
-
242
-
243
-    /**
244
-     * if TRUE, then the current page is somehow utilizing EE logic
245
-     *
246
-     * @return bool
247
-     */
248
-    public function isEspressoPage()
249
-    {
250
-        if ($this->is_espresso_page === null) {
251
-            $this->setEspressoPage();
252
-        }
253
-        return $this->is_espresso_page;
254
-    }
255
-
256
-
257
-    /**
258
-     * @return int
259
-     */
260
-    public function postId()
261
-    {
262
-        return $this->post_id;
263
-    }
264
-
265
-
266
-    /**
267
-     * @return string
268
-     */
269
-    public function postName()
270
-    {
271
-        return $this->post_name;
272
-    }
273
-
274
-
275
-    /**
276
-     * @return array
277
-     */
278
-    public function postType()
279
-    {
280
-        return $this->post_type;
281
-    }
282
-
283
-
284
-    /**
285
-     * for manually indicating the current page will utilize EE logic
286
-     *
287
-     * @param null|bool $value
288
-     * @return void
289
-     */
290
-    public function setEspressoPage($value = null)
291
-    {
292
-        $this->is_espresso_page = $value !== null
293
-            ? filter_var($value, FILTER_VALIDATE_BOOLEAN)
294
-            : $this->testForEspressoPage();
295
-    }
296
-
297
-
298
-    /**
299
-     * attempts to determine if the current page/post is an EE related page/post
300
-     * because it utilizes one of our CPT taxonomies, endpoints, or post types
301
-     *
302
-     * @return bool
303
-     */
304
-    private function testForEspressoPage()
305
-    {
306
-        // in case it has already been set
307
-        if ($this->is_espresso_page) {
308
-            return true;
309
-        }
310
-        global $WP;
311
-        $espresso_CPT_taxonomies = $this->cpt_strategy->get_CPT_taxonomies();
312
-        if (is_array($espresso_CPT_taxonomies)) {
313
-            foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy => $details) {
314
-                if (isset($WP->query_vars, $WP->query_vars[ $espresso_CPT_taxonomy ])) {
315
-                    return true;
316
-                }
317
-            }
318
-        }
319
-        // load espresso CPT endpoints
320
-        $espresso_CPT_endpoints  = $this->cpt_strategy->get_CPT_endpoints();
321
-        $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints);
322
-        foreach ($this->post_type as $post_type) {
323
-            // was a post name passed ?
324
-            if (isset($post_type_CPT_endpoints[ $post_type ])) {
325
-                // kk we know this is an espresso page, but is it a specific post ?
326
-                if (! $this->post_name) {
327
-                    $espresso_post_type = $this->request->getRequestParam('post_type');
328
-                    // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events
329
-                    // this essentially sets the post_name to "events" (or whatever EE CPT)
330
-                    $post_name = isset($post_type_CPT_endpoints[ $espresso_post_type ])
331
-                        ? $post_type_CPT_endpoints[ $espresso_post_type ]
332
-                        : '';
333
-                    // if the post type matches one of ours then set the post name to the endpoint
334
-                    if ($post_name) {
335
-                        $this->post_name = $post_name;
336
-                    }
337
-                }
338
-                return true;
339
-            }
340
-        }
341
-        return false;
342
-    }
26
+	/**
27
+	 * @var EE_CPT_Strategy
28
+	 */
29
+	private $cpt_strategy;
30
+
31
+	/**
32
+	 * @var bool
33
+	 */
34
+	private $initialized;
35
+
36
+	/**
37
+	 * @var bool
38
+	 */
39
+	private $is_espresso_page;
40
+
41
+	/**
42
+	 * @var int
43
+	 */
44
+	private $post_id = 0;
45
+
46
+	/**
47
+	 * @var string
48
+	 */
49
+	private $post_name = '';
50
+
51
+	/**
52
+	 * @var array
53
+	 */
54
+	private $post_type = [];
55
+
56
+	/**
57
+	 * @var RequestInterface $request
58
+	 */
59
+	private $request;
60
+
61
+
62
+	/**
63
+	 * CurrentPage constructor.
64
+	 *
65
+	 * @param EE_CPT_Strategy  $cpt_strategy
66
+	 * @param RequestInterface $request
67
+	 */
68
+	public function __construct(EE_CPT_Strategy $cpt_strategy, RequestInterface $request)
69
+	{
70
+		$this->cpt_strategy = $cpt_strategy;
71
+		$this->request      = $request;
72
+		$this->initialized  = is_admin();
73
+		// analyse the incoming WP request
74
+		add_action('parse_request', [$this, 'parseQueryVars'], 2, 1);
75
+	}
76
+
77
+
78
+	/**
79
+	 * @param WP $WP
80
+	 * @return void
81
+	 */
82
+	public function parseQueryVars(WP $WP = null)
83
+	{
84
+		if ($this->initialized) {
85
+			return;
86
+		}
87
+		// if somebody forgot to provide us with WP, that's ok because its global
88
+		if (! $WP instanceof WP) {
89
+			global $WP;
90
+		}
91
+		$this->post_id   = $this->getPostId($WP);
92
+		$this->post_name = $this->getPostName($WP);
93
+		$this->post_type = $this->getPostType($WP);
94
+		// true or false ? is this page being used by EE ?
95
+		$this->setEspressoPage();
96
+		remove_action('parse_request', [$this, 'parseRequest'], 2);
97
+		$this->initialized = true;
98
+	}
99
+
100
+
101
+	/**
102
+	 * Just a helper method for getting the url for the displayed page.
103
+	 *
104
+	 * @param WP|null $WP
105
+	 * @return string
106
+	 */
107
+	public function getPermalink(WP $WP = null)
108
+	{
109
+		$post_id = $this->post_id ?: $this->getPostId($WP);
110
+		if ($post_id) {
111
+			return get_permalink($post_id);
112
+		}
113
+		if (! $WP instanceof WP) {
114
+			global $WP;
115
+		}
116
+		if ($WP instanceof WP && $WP->request) {
117
+			return site_url($WP->request);
118
+		}
119
+		return esc_url_raw(site_url($_SERVER['REQUEST_URI']));
120
+	}
121
+
122
+
123
+	/**
124
+	 * @return array
125
+	 */
126
+	public function espressoPostType()
127
+	{
128
+		return array_filter(
129
+			$this->post_type,
130
+			function ($post_type) {
131
+				return strpos($post_type, 'espresso_') === 0;
132
+			}
133
+		);
134
+	}
135
+
136
+
137
+	/**
138
+	 * pokes and prods the WP object query_vars in an attempt to shake out a page/post ID
139
+	 *
140
+	 * @param WP $WP
141
+	 * @return int
142
+	 */
143
+	private function getPostId(WP $WP = null)
144
+	{
145
+		$post_id = null;
146
+		if ($WP instanceof WP) {
147
+			// look for the post ID in the aptly named 'p' query var
148
+			if (isset($WP->query_vars['p'])) {
149
+				$post_id = $WP->query_vars['p'];
150
+			}
151
+			// not a post? what about a page?
152
+			if (! $post_id && isset($WP->query_vars['page_id'])) {
153
+				$post_id = $WP->query_vars['page_id'];
154
+			}
155
+			// ok... maybe pretty permalinks are off and the ID is set in the raw request...
156
+			// but hasn't been processed yet ie: this method is being called too early :\
157
+			if (! $post_id && $WP->request !== null && is_numeric(basename($WP->request))) {
158
+				$post_id = basename($WP->request);
159
+			}
160
+		}
161
+		// none of the above? ok what about an explicit "post_id" URL parameter?
162
+		if (! $post_id && $this->request->requestParamIsSet('post_id')) {
163
+			$post_id = $this->request->getRequestParam('post_id');
164
+		}
165
+		return $post_id;
166
+	}
167
+
168
+
169
+	/**
170
+	 * similar to getPostId() above but attempts to obtain the "name" for the current page/post
171
+	 *
172
+	 * @param WP $WP
173
+	 * @return string
174
+	 */
175
+	private function getPostName(WP $WP = null)
176
+	{
177
+		global $wpdb;
178
+		$post_name = null;
179
+		if ($WP instanceof WP) {
180
+			// if this is a post, then is the post name set?
181
+			if (isset($WP->query_vars['name']) && ! empty($WP->query_vars['name'])) {
182
+				$post_name = $WP->query_vars['name'];
183
+			}
184
+			// what about the page name?
185
+			if (! $post_name && isset($WP->query_vars['pagename']) && ! empty($WP->query_vars['pagename'])) {
186
+				$post_name = $WP->query_vars['pagename'];
187
+			}
188
+			// this stinks but let's run a query to try and get the post name from the URL
189
+			// (assuming pretty permalinks are on)
190
+			if (! $post_name && ! empty($WP->request)) {
191
+				$possible_post_name = basename($WP->request);
192
+				if (! is_numeric($possible_post_name)) {
193
+					$SQL                = "SELECT ID from {$wpdb->posts}";
194
+					$SQL                .= " WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash')";
195
+					$SQL                .= ' AND post_name=%s';
196
+					$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name));
197
+					if ($possible_post_name) {
198
+						$post_name = $possible_post_name;
199
+					}
200
+				}
201
+			}
202
+		}
203
+		// ug... ok... nothing yet... but do we have a post ID?
204
+		// if so then... sigh... run a query to get the post name :\
205
+		if (! $post_name && $this->post_id) {
206
+			$SQL                = "SELECT post_name from {$wpdb->posts}";
207
+			$SQL                .= " WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash')";
208
+			$SQL                .= ' AND ID=%d';
209
+			$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->post_id));
210
+			if ($possible_post_name) {
211
+				$post_name = $possible_post_name;
212
+			}
213
+		}
214
+		// still nothing? ok what about an explicit 'post_name' URL parameter?
215
+		if (! $post_name && $this->request->requestParamIsSet('post_name')) {
216
+			$post_name = $this->request->getRequestParam('post_name');
217
+		}
218
+		return $post_name;
219
+	}
220
+
221
+
222
+	/**
223
+	 * also similar to getPostId() and getPostName() above but not as insane
224
+	 *
225
+	 * @param WP $WP
226
+	 * @return array
227
+	 */
228
+	private function getPostType(WP $WP = null)
229
+	{
230
+		$post_types = [];
231
+		if ($WP instanceof WP) {
232
+			$post_types = isset($WP->query_vars['post_type'])
233
+				? (array) $WP->query_vars['post_type']
234
+				: [];
235
+		}
236
+		if (empty($post_types) && $this->request->requestParamIsSet('post_type')) {
237
+			$post_types = $this->request->getRequestParam('post_type', [], DataType::STRING, true);
238
+		}
239
+		return (array) $post_types;
240
+	}
241
+
242
+
243
+	/**
244
+	 * if TRUE, then the current page is somehow utilizing EE logic
245
+	 *
246
+	 * @return bool
247
+	 */
248
+	public function isEspressoPage()
249
+	{
250
+		if ($this->is_espresso_page === null) {
251
+			$this->setEspressoPage();
252
+		}
253
+		return $this->is_espresso_page;
254
+	}
255
+
256
+
257
+	/**
258
+	 * @return int
259
+	 */
260
+	public function postId()
261
+	{
262
+		return $this->post_id;
263
+	}
264
+
265
+
266
+	/**
267
+	 * @return string
268
+	 */
269
+	public function postName()
270
+	{
271
+		return $this->post_name;
272
+	}
273
+
274
+
275
+	/**
276
+	 * @return array
277
+	 */
278
+	public function postType()
279
+	{
280
+		return $this->post_type;
281
+	}
282
+
283
+
284
+	/**
285
+	 * for manually indicating the current page will utilize EE logic
286
+	 *
287
+	 * @param null|bool $value
288
+	 * @return void
289
+	 */
290
+	public function setEspressoPage($value = null)
291
+	{
292
+		$this->is_espresso_page = $value !== null
293
+			? filter_var($value, FILTER_VALIDATE_BOOLEAN)
294
+			: $this->testForEspressoPage();
295
+	}
296
+
297
+
298
+	/**
299
+	 * attempts to determine if the current page/post is an EE related page/post
300
+	 * because it utilizes one of our CPT taxonomies, endpoints, or post types
301
+	 *
302
+	 * @return bool
303
+	 */
304
+	private function testForEspressoPage()
305
+	{
306
+		// in case it has already been set
307
+		if ($this->is_espresso_page) {
308
+			return true;
309
+		}
310
+		global $WP;
311
+		$espresso_CPT_taxonomies = $this->cpt_strategy->get_CPT_taxonomies();
312
+		if (is_array($espresso_CPT_taxonomies)) {
313
+			foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy => $details) {
314
+				if (isset($WP->query_vars, $WP->query_vars[ $espresso_CPT_taxonomy ])) {
315
+					return true;
316
+				}
317
+			}
318
+		}
319
+		// load espresso CPT endpoints
320
+		$espresso_CPT_endpoints  = $this->cpt_strategy->get_CPT_endpoints();
321
+		$post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints);
322
+		foreach ($this->post_type as $post_type) {
323
+			// was a post name passed ?
324
+			if (isset($post_type_CPT_endpoints[ $post_type ])) {
325
+				// kk we know this is an espresso page, but is it a specific post ?
326
+				if (! $this->post_name) {
327
+					$espresso_post_type = $this->request->getRequestParam('post_type');
328
+					// there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events
329
+					// this essentially sets the post_name to "events" (or whatever EE CPT)
330
+					$post_name = isset($post_type_CPT_endpoints[ $espresso_post_type ])
331
+						? $post_type_CPT_endpoints[ $espresso_post_type ]
332
+						: '';
333
+					// if the post type matches one of ours then set the post name to the endpoint
334
+					if ($post_name) {
335
+						$this->post_name = $post_name;
336
+					}
337
+				}
338
+				return true;
339
+			}
340
+		}
341
+		return false;
342
+	}
343 343
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorStandard.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $this->ticket_selector_config->getShowDatetimeSelector()
93 93
             !== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
94 94
         ) {
95
-            $datetime_selector                        = new DatetimeSelector(
95
+            $datetime_selector = new DatetimeSelector(
96 96
                 $this->event,
97 97
                 $this->tickets,
98 98
                 $this->ticket_selector_config,
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
                         ? $datetime_selector->getTicketDatetimeClasses($ticket)
122 122
                         : ''
123 123
                 );
124
-                $ticket_row_html     = $ticket_selector_row->getHtml();
124
+                $ticket_row_html = $ticket_selector_row->getHtml();
125 125
                 // check if something was actually returned
126
-                if (! empty($ticket_row_html)) {
126
+                if ( ! empty($ticket_row_html)) {
127 127
                     // add any output to the cumulative HTML
128 128
                     $all_ticket_rows_html .= $ticket_row_html;
129 129
                 }
Please login to merge, or discard this patch.
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -20,127 +20,127 @@
 block discarded – undo
20 20
  */
21 21
 class TicketSelectorStandard extends TicketSelector
22 22
 {
23
-    /**
24
-     * @var string $date_format
25
-     */
26
-    protected $date_format;
23
+	/**
24
+	 * @var string $date_format
25
+	 */
26
+	protected $date_format;
27 27
 
28
-    /**
29
-     * @var string $time_format
30
-     */
31
-    protected $time_format;
28
+	/**
29
+	 * @var string $time_format
30
+	 */
31
+	protected $time_format;
32 32
 
33
-    /**
34
-     * @var EE_Ticket_Selector_Config $ticket_selector_config
35
-     */
36
-    protected $ticket_selector_config;
33
+	/**
34
+	 * @var EE_Ticket_Selector_Config $ticket_selector_config
35
+	 */
36
+	protected $ticket_selector_config;
37 37
 
38
-    /**
39
-     * @var EE_Tax_Config $tax_config
40
-     */
41
-    protected $tax_config;
38
+	/**
39
+	 * @var EE_Tax_Config $tax_config
40
+	 */
41
+	protected $tax_config;
42 42
 
43 43
 
44
-    /**
45
-     * TicketSelectorSimple constructor.
46
-     *
47
-     * @param EE_Ticket_Selector_Config $ticket_selector_config
48
-     * @param EE_Tax_Config             $tax_config
49
-     * @param EE_Event                  $event
50
-     * @param EE_Ticket[]               $tickets
51
-     * @param int                       $max_attendees
52
-     * @param array                     $template_args
53
-     * @param string                    $date_format
54
-     * @param string                    $time_format
55
-     */
56
-    public function __construct(
57
-        EE_Ticket_Selector_Config $ticket_selector_config,
58
-        EE_Tax_Config $tax_config,
59
-        EE_Event $event,
60
-        array $tickets,
61
-        $max_attendees,
62
-        array $template_args,
63
-        $date_format = 'Y-m-d',
64
-        $time_format = 'g:i a'
65
-    ) {
66
-        $this->ticket_selector_config = $ticket_selector_config;
67
-        $this->tax_config             = $tax_config;
68
-        $this->date_format            = $date_format;
69
-        $this->time_format            = $time_format;
70
-        parent::__construct($event, $tickets, $max_attendees, $template_args);
71
-    }
44
+	/**
45
+	 * TicketSelectorSimple constructor.
46
+	 *
47
+	 * @param EE_Ticket_Selector_Config $ticket_selector_config
48
+	 * @param EE_Tax_Config             $tax_config
49
+	 * @param EE_Event                  $event
50
+	 * @param EE_Ticket[]               $tickets
51
+	 * @param int                       $max_attendees
52
+	 * @param array                     $template_args
53
+	 * @param string                    $date_format
54
+	 * @param string                    $time_format
55
+	 */
56
+	public function __construct(
57
+		EE_Ticket_Selector_Config $ticket_selector_config,
58
+		EE_Tax_Config $tax_config,
59
+		EE_Event $event,
60
+		array $tickets,
61
+		$max_attendees,
62
+		array $template_args,
63
+		$date_format = 'Y-m-d',
64
+		$time_format = 'g:i a'
65
+	) {
66
+		$this->ticket_selector_config = $ticket_selector_config;
67
+		$this->tax_config             = $tax_config;
68
+		$this->date_format            = $date_format;
69
+		$this->time_format            = $time_format;
70
+		parent::__construct($event, $tickets, $max_attendees, $template_args);
71
+	}
72 72
 
73 73
 
74
-    /**
75
-     * sets any and all template args that are required for this Ticket Selector
76
-     *
77
-     * @return void
78
-     * @throws EE_Error
79
-     * @throws ReflectionException
80
-     */
81
-    protected function addTemplateArgs()
82
-    {
83
-        $this->ticket_rows        = 0;
84
-        $all_ticket_rows_html     = '';
85
-        $required_ticket_sold_out = false;
86
-        // flag to indicate that at least one taxable ticket has been encountered
87
-        $taxable_tickets                          = false;
88
-        $datetime_selector                        = null;
89
-        $this->template_args['datetime_selector'] = '';
90
-        if (
91
-            $this->ticket_selector_config->getShowDatetimeSelector()
92
-            !== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
93
-        ) {
94
-            $datetime_selector                        = new DatetimeSelector(
95
-                $this->event,
96
-                $this->tickets,
97
-                $this->ticket_selector_config,
98
-                $this->date_format,
99
-                $this->time_format
100
-            );
101
-            $this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector();
102
-        }
103
-        $total_tickets = count($this->tickets);
104
-        // loop through tickets
105
-        foreach ($this->tickets as $ticket) {
106
-            if ($ticket instanceof EE_Ticket) {
107
-                $this->ticket_rows++;
108
-                $cols                = 2;
109
-                $taxable_tickets     = $ticket->taxable() ? true : $taxable_tickets;
110
-                $ticket_selector_row = new TicketSelectorRowStandard(
111
-                    new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args),
112
-                    $this->tax_config,
113
-                    $total_tickets,
114
-                    $this->max_attendees,
115
-                    $this->ticket_rows,
116
-                    $cols,
117
-                    $required_ticket_sold_out,
118
-                    $this->template_args['event_status'],
119
-                    $datetime_selector instanceof DatetimeSelector
120
-                        ? $datetime_selector->getTicketDatetimeClasses($ticket)
121
-                        : ''
122
-                );
123
-                $ticket_row_html     = $ticket_selector_row->getHtml();
124
-                // check if something was actually returned
125
-                if (! empty($ticket_row_html)) {
126
-                    // add any output to the cumulative HTML
127
-                    $all_ticket_rows_html .= $ticket_row_html;
128
-                }
129
-                if (empty($ticket_row_html) || ! $ticket_selector_row->isOnSale()) {
130
-                    // decrement the ticket row count since it looks like one has been removed
131
-                    $this->ticket_rows--;
132
-                }
74
+	/**
75
+	 * sets any and all template args that are required for this Ticket Selector
76
+	 *
77
+	 * @return void
78
+	 * @throws EE_Error
79
+	 * @throws ReflectionException
80
+	 */
81
+	protected function addTemplateArgs()
82
+	{
83
+		$this->ticket_rows        = 0;
84
+		$all_ticket_rows_html     = '';
85
+		$required_ticket_sold_out = false;
86
+		// flag to indicate that at least one taxable ticket has been encountered
87
+		$taxable_tickets                          = false;
88
+		$datetime_selector                        = null;
89
+		$this->template_args['datetime_selector'] = '';
90
+		if (
91
+			$this->ticket_selector_config->getShowDatetimeSelector()
92
+			!== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
93
+		) {
94
+			$datetime_selector                        = new DatetimeSelector(
95
+				$this->event,
96
+				$this->tickets,
97
+				$this->ticket_selector_config,
98
+				$this->date_format,
99
+				$this->time_format
100
+			);
101
+			$this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector();
102
+		}
103
+		$total_tickets = count($this->tickets);
104
+		// loop through tickets
105
+		foreach ($this->tickets as $ticket) {
106
+			if ($ticket instanceof EE_Ticket) {
107
+				$this->ticket_rows++;
108
+				$cols                = 2;
109
+				$taxable_tickets     = $ticket->taxable() ? true : $taxable_tickets;
110
+				$ticket_selector_row = new TicketSelectorRowStandard(
111
+					new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args),
112
+					$this->tax_config,
113
+					$total_tickets,
114
+					$this->max_attendees,
115
+					$this->ticket_rows,
116
+					$cols,
117
+					$required_ticket_sold_out,
118
+					$this->template_args['event_status'],
119
+					$datetime_selector instanceof DatetimeSelector
120
+						? $datetime_selector->getTicketDatetimeClasses($ticket)
121
+						: ''
122
+				);
123
+				$ticket_row_html     = $ticket_selector_row->getHtml();
124
+				// check if something was actually returned
125
+				if (! empty($ticket_row_html)) {
126
+					// add any output to the cumulative HTML
127
+					$all_ticket_rows_html .= $ticket_row_html;
128
+				}
129
+				if (empty($ticket_row_html) || ! $ticket_selector_row->isOnSale()) {
130
+					// decrement the ticket row count since it looks like one has been removed
131
+					$this->ticket_rows--;
132
+				}
133 133
 
134
-                $required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut();
135
-            }
136
-        }
137
-        $this->template_args['row']                              = $this->ticket_rows;
138
-        $this->template_args['ticket_row_html']                  = $all_ticket_rows_html;
139
-        $this->template_args['taxable_tickets']                  = $taxable_tickets;
140
-        $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
141
-        // now load template
142
-        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH
143
-                                                . 'standard_ticket_selector.template.php';
144
-        remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
145
-    }
134
+				$required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut();
135
+			}
136
+		}
137
+		$this->template_args['row']                              = $this->ticket_rows;
138
+		$this->template_args['ticket_row_html']                  = $all_ticket_rows_html;
139
+		$this->template_args['taxable_tickets']                  = $taxable_tickets;
140
+		$this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
141
+		// now load template
142
+		$this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH
143
+												. 'standard_ticket_selector.template.php';
144
+		remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
145
+	}
146 146
 }
Please login to merge, or discard this patch.