@@ -19,259 +19,259 @@ |
||
19 | 19 | */ |
20 | 20 | class ProcessTicketSelectorPostData |
21 | 21 | { |
22 | - const DATA_KEY_EVENT_ID = 'id'; |
|
23 | - |
|
24 | - const DATA_KEY_MAX_ATNDZ = 'max_atndz'; |
|
25 | - |
|
26 | - const DATA_KEY_QUANTITY = 'ticket-selections'; |
|
27 | - |
|
28 | - const DATA_KEY_RETURN_URL = 'return_url'; |
|
29 | - |
|
30 | - const DATA_KEY_ROWS = 'rows'; |
|
31 | - |
|
32 | - const DATA_KEY_TICKET_ID = 'ticket_id'; |
|
33 | - |
|
34 | - const DATA_KEY_TOTAL_TICKETS = 'total_tickets'; |
|
35 | - |
|
36 | - const INPUT_KEY_EVENT_ID = 'tkt-slctr-event-id'; |
|
37 | - |
|
38 | - const INPUT_KEY_MAX_ATNDZ = 'tkt-slctr-max-atndz-'; |
|
39 | - |
|
40 | - const INPUT_KEY_ROWS = 'tkt-slctr-rows-'; |
|
41 | - |
|
42 | - const INPUT_KEY_QTY = 'tkt-slctr-qty-'; |
|
43 | - |
|
44 | - const INPUT_KEY_TICKET_ID = 'tkt-slctr-ticket-id-'; |
|
45 | - |
|
46 | - const INPUT_KEY_RETURN_URL = 'tkt-slctr-return-url-'; |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * @var int |
|
51 | - */ |
|
52 | - protected $event_id; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var EEM_Event |
|
56 | - */ |
|
57 | - protected $event_model; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var array |
|
61 | - */ |
|
62 | - protected $inputs_to_clean = []; |
|
63 | - |
|
64 | - /** |
|
65 | - * @var array |
|
66 | - */ |
|
67 | - protected $valid_data = []; |
|
68 | - |
|
69 | - /** |
|
70 | - * @var RequestInterface |
|
71 | - */ |
|
72 | - protected $request; |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * @param RequestInterface $request |
|
77 | - * @param EEM_Event $event_model |
|
78 | - */ |
|
79 | - public function __construct(RequestInterface $request, EEM_Event $event_model) |
|
80 | - { |
|
81 | - $this->request = $request; |
|
82 | - $this->event_model = $event_model; |
|
83 | - $this->inputs_to_clean = [ |
|
84 | - self::DATA_KEY_MAX_ATNDZ => self::INPUT_KEY_MAX_ATNDZ, |
|
85 | - self::DATA_KEY_RETURN_URL => self::INPUT_KEY_RETURN_URL, |
|
86 | - self::DATA_KEY_ROWS => self::INPUT_KEY_ROWS, |
|
87 | - self::DATA_KEY_TOTAL_TICKETS => self::INPUT_KEY_TICKET_ID, |
|
88 | - self::DATA_KEY_QUANTITY => self::INPUT_KEY_QTY, |
|
89 | - ]; |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @return int |
|
95 | - * @throws DomainException |
|
96 | - * @throws EE_Error |
|
97 | - * @throws ReflectionException |
|
98 | - */ |
|
99 | - public function getEventId(): int |
|
100 | - { |
|
101 | - // do we have an event id? |
|
102 | - if ($this->event_id === null) { |
|
103 | - $this->event_id = $this->request->getRequestParam(self::INPUT_KEY_EVENT_ID, 0, 'int'); |
|
104 | - if (! $this->event_id) { |
|
105 | - // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
|
106 | - throw new DomainException( |
|
107 | - sprintf( |
|
108 | - esc_html__( |
|
109 | - 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', |
|
110 | - 'event_espresso' |
|
111 | - ), |
|
112 | - '<br/>' |
|
113 | - ) |
|
114 | - ); |
|
115 | - } |
|
116 | - } |
|
117 | - // let's pull the event so we can get the REAL max attendees per order value |
|
118 | - /** @var EE_Event $event */ |
|
119 | - $event = $this->event_model->get_one_by_ID($this->event_id); |
|
120 | - if (! $event instanceof EE_Event) { |
|
121 | - throw new DomainException( |
|
122 | - sprintf( |
|
123 | - esc_html__( |
|
124 | - 'A valid event could not be retrieved for the supplied event id (%1$s).%2$sPlease click the back button on your browser and try again.', |
|
125 | - 'event_espresso' |
|
126 | - ), |
|
127 | - $this->event_id, |
|
128 | - '<br/>' |
|
129 | - ) |
|
130 | - ); |
|
131 | - } |
|
132 | - $this->valid_data[ self::DATA_KEY_MAX_ATNDZ ] = $event->additional_limit(); |
|
133 | - // event id is valid |
|
134 | - return $this->event_id; |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * @return array |
|
140 | - * @throws EE_Error |
|
141 | - * @throws ReflectionException |
|
142 | - */ |
|
143 | - public function validatePostData(): array |
|
144 | - { |
|
145 | - // grab valid id |
|
146 | - $this->valid_data[ self::DATA_KEY_EVENT_ID ] = $this->getEventId(); |
|
147 | - // let's track the total number of tickets ordered.' |
|
148 | - $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] = 0; |
|
149 | - // cycle through $inputs_to_clean array |
|
150 | - foreach ($this->inputs_to_clean as $what => $input_to_clean) { |
|
151 | - $input_key = "$input_to_clean$this->event_id"; |
|
152 | - // check for POST data |
|
153 | - if ($this->request->requestParamIsSet($input_key)) { |
|
154 | - switch ($what) { |
|
155 | - // integers |
|
156 | - case self::DATA_KEY_ROWS: |
|
157 | - case self::DATA_KEY_MAX_ATNDZ: |
|
158 | - $this->processInteger($what, $input_key); |
|
159 | - break; |
|
160 | - // arrays of integers |
|
161 | - case self::DATA_KEY_QUANTITY: |
|
162 | - $this->processQuantity($input_key); |
|
163 | - break; |
|
164 | - // array of integers |
|
165 | - case self::DATA_KEY_TOTAL_TICKETS: |
|
166 | - $this->processTicketIDs($input_key); |
|
167 | - break; |
|
168 | - case self::DATA_KEY_RETURN_URL: |
|
169 | - $this->processReturnURL($input_key); |
|
170 | - break; |
|
171 | - } |
|
172 | - } |
|
173 | - } |
|
174 | - return $this->valid_data; |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - /** |
|
179 | - * @param string $what |
|
180 | - * @param string $input_key |
|
181 | - */ |
|
182 | - protected function processInteger(string $what, string $input_key) |
|
183 | - { |
|
184 | - $this->valid_data[ $what ] = $this->valid_data[ $what ] ?? $this->request->getRequestParam($input_key, 0, 'int'); |
|
185 | - } |
|
186 | - |
|
187 | - |
|
188 | - /** |
|
189 | - * @param string $input_key |
|
190 | - * @throws DomainException |
|
191 | - */ |
|
192 | - protected function processQuantity(string $input_key) |
|
193 | - { |
|
194 | - /** @var array $row_qty */ |
|
195 | - $row_qty = $this->request->getRequestParam($input_key, [], 'int', true); |
|
196 | - if (empty($row_qty) || ! is_array($row_qty)) { |
|
197 | - throw new DomainException( |
|
198 | - sprintf( |
|
199 | - esc_html__( |
|
200 | - 'An error occurred while trying to retrieve the ticket selections for the event.%sPlease click the back button on your browser and try again.', |
|
201 | - 'event_espresso' |
|
202 | - ), |
|
203 | - '<br/>' |
|
204 | - ) |
|
205 | - ); |
|
206 | - } |
|
207 | - $max_atndz = $this->valid_data[ self::DATA_KEY_MAX_ATNDZ ]; |
|
208 | - // if max attendees is 1 then the incoming row qty array |
|
209 | - // will only have one element and the value will be the ticket ID |
|
210 | - // ex: row qty = [ 0 => TKT_ID ] |
|
211 | - if ($max_atndz === 1 && count($row_qty) === 1) { |
|
212 | - // if the TS used radio buttons, then the ticket ID is stored differently in the request data |
|
213 | - $raw_qty = $this->request->getRequestParam($input_key); |
|
214 | - // explode integers by the dash if qty is a string |
|
215 | - $delimiter = is_string($raw_qty) && strpos($raw_qty, '-') ? '-' : ''; |
|
216 | - if ($delimiter !== '') { |
|
217 | - $row_qty = explode($delimiter, $raw_qty); |
|
218 | - } |
|
219 | - // grab that ticket ID regardless of where it is |
|
220 | - $ticket_id = $row_qty[0] ?? key($row_qty); |
|
221 | - // use it as the key, and set the value to 1 |
|
222 | - // ex: row qty = [ TKT_ID => 1 ] |
|
223 | - $row_qty = [$ticket_id => 1]; |
|
224 | - } |
|
225 | - foreach ($this->valid_data[ self::DATA_KEY_TICKET_ID ] as $ticket_id) { |
|
226 | - $qty = $row_qty[ $ticket_id ] ?? 0; |
|
227 | - $this->valid_data[ self::DATA_KEY_QUANTITY ][ $ticket_id ] = $qty; |
|
228 | - $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] += $qty; |
|
229 | - } |
|
230 | - } |
|
231 | - |
|
232 | - |
|
233 | - /** |
|
234 | - * @param string $input_key |
|
235 | - */ |
|
236 | - protected function processReturnURL(string $input_key) |
|
237 | - { |
|
238 | - // grab and sanitize return-url |
|
239 | - $input_value = $this->request->getRequestParam($input_key, '', 'url'); |
|
240 | - // was the request coming from an iframe ? if so, then: |
|
241 | - if (strpos($input_value, 'event_list=iframe')) { |
|
242 | - // get anchor fragment |
|
243 | - $input_value = explode('#', $input_value); |
|
244 | - $input_value = end($input_value); |
|
245 | - // use event list url instead, but append anchor |
|
246 | - $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value; |
|
247 | - } |
|
248 | - $this->valid_data[ self::DATA_KEY_RETURN_URL ] = $input_value; |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - /** |
|
253 | - * @param string $input_key |
|
254 | - * @throws DomainException |
|
255 | - */ |
|
256 | - protected function processTicketIDs(string $input_key) |
|
257 | - { |
|
258 | - $ticket_ids = (array) $this->request->getRequestParam($input_key, [], 'int', true); |
|
259 | - $filtered_ticket_ids = array_filter($ticket_ids); |
|
260 | - if (empty($filtered_ticket_ids)) { |
|
261 | - throw new DomainException( |
|
262 | - sprintf( |
|
263 | - esc_html__( |
|
264 | - 'An error occurred while trying to retrieve the ticket IDs for the event.%sPlease click the back button on your browser and try again.', |
|
265 | - 'event_espresso' |
|
266 | - ), |
|
267 | - '<br/>' |
|
268 | - ) |
|
269 | - ); |
|
270 | - } |
|
271 | - // cycle thru values |
|
272 | - foreach ($ticket_ids as $key => $value) { |
|
273 | - // allow only integers |
|
274 | - $this->valid_data[ self::DATA_KEY_TICKET_ID ][ $key ] = absint($value); |
|
275 | - } |
|
276 | - } |
|
22 | + const DATA_KEY_EVENT_ID = 'id'; |
|
23 | + |
|
24 | + const DATA_KEY_MAX_ATNDZ = 'max_atndz'; |
|
25 | + |
|
26 | + const DATA_KEY_QUANTITY = 'ticket-selections'; |
|
27 | + |
|
28 | + const DATA_KEY_RETURN_URL = 'return_url'; |
|
29 | + |
|
30 | + const DATA_KEY_ROWS = 'rows'; |
|
31 | + |
|
32 | + const DATA_KEY_TICKET_ID = 'ticket_id'; |
|
33 | + |
|
34 | + const DATA_KEY_TOTAL_TICKETS = 'total_tickets'; |
|
35 | + |
|
36 | + const INPUT_KEY_EVENT_ID = 'tkt-slctr-event-id'; |
|
37 | + |
|
38 | + const INPUT_KEY_MAX_ATNDZ = 'tkt-slctr-max-atndz-'; |
|
39 | + |
|
40 | + const INPUT_KEY_ROWS = 'tkt-slctr-rows-'; |
|
41 | + |
|
42 | + const INPUT_KEY_QTY = 'tkt-slctr-qty-'; |
|
43 | + |
|
44 | + const INPUT_KEY_TICKET_ID = 'tkt-slctr-ticket-id-'; |
|
45 | + |
|
46 | + const INPUT_KEY_RETURN_URL = 'tkt-slctr-return-url-'; |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * @var int |
|
51 | + */ |
|
52 | + protected $event_id; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var EEM_Event |
|
56 | + */ |
|
57 | + protected $event_model; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var array |
|
61 | + */ |
|
62 | + protected $inputs_to_clean = []; |
|
63 | + |
|
64 | + /** |
|
65 | + * @var array |
|
66 | + */ |
|
67 | + protected $valid_data = []; |
|
68 | + |
|
69 | + /** |
|
70 | + * @var RequestInterface |
|
71 | + */ |
|
72 | + protected $request; |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * @param RequestInterface $request |
|
77 | + * @param EEM_Event $event_model |
|
78 | + */ |
|
79 | + public function __construct(RequestInterface $request, EEM_Event $event_model) |
|
80 | + { |
|
81 | + $this->request = $request; |
|
82 | + $this->event_model = $event_model; |
|
83 | + $this->inputs_to_clean = [ |
|
84 | + self::DATA_KEY_MAX_ATNDZ => self::INPUT_KEY_MAX_ATNDZ, |
|
85 | + self::DATA_KEY_RETURN_URL => self::INPUT_KEY_RETURN_URL, |
|
86 | + self::DATA_KEY_ROWS => self::INPUT_KEY_ROWS, |
|
87 | + self::DATA_KEY_TOTAL_TICKETS => self::INPUT_KEY_TICKET_ID, |
|
88 | + self::DATA_KEY_QUANTITY => self::INPUT_KEY_QTY, |
|
89 | + ]; |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @return int |
|
95 | + * @throws DomainException |
|
96 | + * @throws EE_Error |
|
97 | + * @throws ReflectionException |
|
98 | + */ |
|
99 | + public function getEventId(): int |
|
100 | + { |
|
101 | + // do we have an event id? |
|
102 | + if ($this->event_id === null) { |
|
103 | + $this->event_id = $this->request->getRequestParam(self::INPUT_KEY_EVENT_ID, 0, 'int'); |
|
104 | + if (! $this->event_id) { |
|
105 | + // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
|
106 | + throw new DomainException( |
|
107 | + sprintf( |
|
108 | + esc_html__( |
|
109 | + 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', |
|
110 | + 'event_espresso' |
|
111 | + ), |
|
112 | + '<br/>' |
|
113 | + ) |
|
114 | + ); |
|
115 | + } |
|
116 | + } |
|
117 | + // let's pull the event so we can get the REAL max attendees per order value |
|
118 | + /** @var EE_Event $event */ |
|
119 | + $event = $this->event_model->get_one_by_ID($this->event_id); |
|
120 | + if (! $event instanceof EE_Event) { |
|
121 | + throw new DomainException( |
|
122 | + sprintf( |
|
123 | + esc_html__( |
|
124 | + 'A valid event could not be retrieved for the supplied event id (%1$s).%2$sPlease click the back button on your browser and try again.', |
|
125 | + 'event_espresso' |
|
126 | + ), |
|
127 | + $this->event_id, |
|
128 | + '<br/>' |
|
129 | + ) |
|
130 | + ); |
|
131 | + } |
|
132 | + $this->valid_data[ self::DATA_KEY_MAX_ATNDZ ] = $event->additional_limit(); |
|
133 | + // event id is valid |
|
134 | + return $this->event_id; |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * @return array |
|
140 | + * @throws EE_Error |
|
141 | + * @throws ReflectionException |
|
142 | + */ |
|
143 | + public function validatePostData(): array |
|
144 | + { |
|
145 | + // grab valid id |
|
146 | + $this->valid_data[ self::DATA_KEY_EVENT_ID ] = $this->getEventId(); |
|
147 | + // let's track the total number of tickets ordered.' |
|
148 | + $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] = 0; |
|
149 | + // cycle through $inputs_to_clean array |
|
150 | + foreach ($this->inputs_to_clean as $what => $input_to_clean) { |
|
151 | + $input_key = "$input_to_clean$this->event_id"; |
|
152 | + // check for POST data |
|
153 | + if ($this->request->requestParamIsSet($input_key)) { |
|
154 | + switch ($what) { |
|
155 | + // integers |
|
156 | + case self::DATA_KEY_ROWS: |
|
157 | + case self::DATA_KEY_MAX_ATNDZ: |
|
158 | + $this->processInteger($what, $input_key); |
|
159 | + break; |
|
160 | + // arrays of integers |
|
161 | + case self::DATA_KEY_QUANTITY: |
|
162 | + $this->processQuantity($input_key); |
|
163 | + break; |
|
164 | + // array of integers |
|
165 | + case self::DATA_KEY_TOTAL_TICKETS: |
|
166 | + $this->processTicketIDs($input_key); |
|
167 | + break; |
|
168 | + case self::DATA_KEY_RETURN_URL: |
|
169 | + $this->processReturnURL($input_key); |
|
170 | + break; |
|
171 | + } |
|
172 | + } |
|
173 | + } |
|
174 | + return $this->valid_data; |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + /** |
|
179 | + * @param string $what |
|
180 | + * @param string $input_key |
|
181 | + */ |
|
182 | + protected function processInteger(string $what, string $input_key) |
|
183 | + { |
|
184 | + $this->valid_data[ $what ] = $this->valid_data[ $what ] ?? $this->request->getRequestParam($input_key, 0, 'int'); |
|
185 | + } |
|
186 | + |
|
187 | + |
|
188 | + /** |
|
189 | + * @param string $input_key |
|
190 | + * @throws DomainException |
|
191 | + */ |
|
192 | + protected function processQuantity(string $input_key) |
|
193 | + { |
|
194 | + /** @var array $row_qty */ |
|
195 | + $row_qty = $this->request->getRequestParam($input_key, [], 'int', true); |
|
196 | + if (empty($row_qty) || ! is_array($row_qty)) { |
|
197 | + throw new DomainException( |
|
198 | + sprintf( |
|
199 | + esc_html__( |
|
200 | + 'An error occurred while trying to retrieve the ticket selections for the event.%sPlease click the back button on your browser and try again.', |
|
201 | + 'event_espresso' |
|
202 | + ), |
|
203 | + '<br/>' |
|
204 | + ) |
|
205 | + ); |
|
206 | + } |
|
207 | + $max_atndz = $this->valid_data[ self::DATA_KEY_MAX_ATNDZ ]; |
|
208 | + // if max attendees is 1 then the incoming row qty array |
|
209 | + // will only have one element and the value will be the ticket ID |
|
210 | + // ex: row qty = [ 0 => TKT_ID ] |
|
211 | + if ($max_atndz === 1 && count($row_qty) === 1) { |
|
212 | + // if the TS used radio buttons, then the ticket ID is stored differently in the request data |
|
213 | + $raw_qty = $this->request->getRequestParam($input_key); |
|
214 | + // explode integers by the dash if qty is a string |
|
215 | + $delimiter = is_string($raw_qty) && strpos($raw_qty, '-') ? '-' : ''; |
|
216 | + if ($delimiter !== '') { |
|
217 | + $row_qty = explode($delimiter, $raw_qty); |
|
218 | + } |
|
219 | + // grab that ticket ID regardless of where it is |
|
220 | + $ticket_id = $row_qty[0] ?? key($row_qty); |
|
221 | + // use it as the key, and set the value to 1 |
|
222 | + // ex: row qty = [ TKT_ID => 1 ] |
|
223 | + $row_qty = [$ticket_id => 1]; |
|
224 | + } |
|
225 | + foreach ($this->valid_data[ self::DATA_KEY_TICKET_ID ] as $ticket_id) { |
|
226 | + $qty = $row_qty[ $ticket_id ] ?? 0; |
|
227 | + $this->valid_data[ self::DATA_KEY_QUANTITY ][ $ticket_id ] = $qty; |
|
228 | + $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] += $qty; |
|
229 | + } |
|
230 | + } |
|
231 | + |
|
232 | + |
|
233 | + /** |
|
234 | + * @param string $input_key |
|
235 | + */ |
|
236 | + protected function processReturnURL(string $input_key) |
|
237 | + { |
|
238 | + // grab and sanitize return-url |
|
239 | + $input_value = $this->request->getRequestParam($input_key, '', 'url'); |
|
240 | + // was the request coming from an iframe ? if so, then: |
|
241 | + if (strpos($input_value, 'event_list=iframe')) { |
|
242 | + // get anchor fragment |
|
243 | + $input_value = explode('#', $input_value); |
|
244 | + $input_value = end($input_value); |
|
245 | + // use event list url instead, but append anchor |
|
246 | + $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value; |
|
247 | + } |
|
248 | + $this->valid_data[ self::DATA_KEY_RETURN_URL ] = $input_value; |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * @param string $input_key |
|
254 | + * @throws DomainException |
|
255 | + */ |
|
256 | + protected function processTicketIDs(string $input_key) |
|
257 | + { |
|
258 | + $ticket_ids = (array) $this->request->getRequestParam($input_key, [], 'int', true); |
|
259 | + $filtered_ticket_ids = array_filter($ticket_ids); |
|
260 | + if (empty($filtered_ticket_ids)) { |
|
261 | + throw new DomainException( |
|
262 | + sprintf( |
|
263 | + esc_html__( |
|
264 | + 'An error occurred while trying to retrieve the ticket IDs for the event.%sPlease click the back button on your browser and try again.', |
|
265 | + 'event_espresso' |
|
266 | + ), |
|
267 | + '<br/>' |
|
268 | + ) |
|
269 | + ); |
|
270 | + } |
|
271 | + // cycle thru values |
|
272 | + foreach ($ticket_ids as $key => $value) { |
|
273 | + // allow only integers |
|
274 | + $this->valid_data[ self::DATA_KEY_TICKET_ID ][ $key ] = absint($value); |
|
275 | + } |
|
276 | + } |
|
277 | 277 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // do we have an event id? |
102 | 102 | if ($this->event_id === null) { |
103 | 103 | $this->event_id = $this->request->getRequestParam(self::INPUT_KEY_EVENT_ID, 0, 'int'); |
104 | - if (! $this->event_id) { |
|
104 | + if ( ! $this->event_id) { |
|
105 | 105 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
106 | 106 | throw new DomainException( |
107 | 107 | sprintf( |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // let's pull the event so we can get the REAL max attendees per order value |
118 | 118 | /** @var EE_Event $event */ |
119 | 119 | $event = $this->event_model->get_one_by_ID($this->event_id); |
120 | - if (! $event instanceof EE_Event) { |
|
120 | + if ( ! $event instanceof EE_Event) { |
|
121 | 121 | throw new DomainException( |
122 | 122 | sprintf( |
123 | 123 | esc_html__( |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | ) |
130 | 130 | ); |
131 | 131 | } |
132 | - $this->valid_data[ self::DATA_KEY_MAX_ATNDZ ] = $event->additional_limit(); |
|
132 | + $this->valid_data[self::DATA_KEY_MAX_ATNDZ] = $event->additional_limit(); |
|
133 | 133 | // event id is valid |
134 | 134 | return $this->event_id; |
135 | 135 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | public function validatePostData(): array |
144 | 144 | { |
145 | 145 | // grab valid id |
146 | - $this->valid_data[ self::DATA_KEY_EVENT_ID ] = $this->getEventId(); |
|
146 | + $this->valid_data[self::DATA_KEY_EVENT_ID] = $this->getEventId(); |
|
147 | 147 | // let's track the total number of tickets ordered.' |
148 | - $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] = 0; |
|
148 | + $this->valid_data[self:: DATA_KEY_TOTAL_TICKETS] = 0; |
|
149 | 149 | // cycle through $inputs_to_clean array |
150 | 150 | foreach ($this->inputs_to_clean as $what => $input_to_clean) { |
151 | 151 | $input_key = "$input_to_clean$this->event_id"; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function processInteger(string $what, string $input_key) |
183 | 183 | { |
184 | - $this->valid_data[ $what ] = $this->valid_data[ $what ] ?? $this->request->getRequestParam($input_key, 0, 'int'); |
|
184 | + $this->valid_data[$what] = $this->valid_data[$what] ?? $this->request->getRequestParam($input_key, 0, 'int'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | ) |
205 | 205 | ); |
206 | 206 | } |
207 | - $max_atndz = $this->valid_data[ self::DATA_KEY_MAX_ATNDZ ]; |
|
207 | + $max_atndz = $this->valid_data[self::DATA_KEY_MAX_ATNDZ]; |
|
208 | 208 | // if max attendees is 1 then the incoming row qty array |
209 | 209 | // will only have one element and the value will be the ticket ID |
210 | 210 | // ex: row qty = [ 0 => TKT_ID ] |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | // ex: row qty = [ TKT_ID => 1 ] |
223 | 223 | $row_qty = [$ticket_id => 1]; |
224 | 224 | } |
225 | - foreach ($this->valid_data[ self::DATA_KEY_TICKET_ID ] as $ticket_id) { |
|
226 | - $qty = $row_qty[ $ticket_id ] ?? 0; |
|
227 | - $this->valid_data[ self::DATA_KEY_QUANTITY ][ $ticket_id ] = $qty; |
|
228 | - $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] += $qty; |
|
225 | + foreach ($this->valid_data[self::DATA_KEY_TICKET_ID] as $ticket_id) { |
|
226 | + $qty = $row_qty[$ticket_id] ?? 0; |
|
227 | + $this->valid_data[self::DATA_KEY_QUANTITY][$ticket_id] = $qty; |
|
228 | + $this->valid_data[self:: DATA_KEY_TOTAL_TICKETS] += $qty; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | $input_value = explode('#', $input_value); |
244 | 244 | $input_value = end($input_value); |
245 | 245 | // use event list url instead, but append anchor |
246 | - $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value; |
|
246 | + $input_value = EEH_Event_View::event_archive_url().'#'.$input_value; |
|
247 | 247 | } |
248 | - $this->valid_data[ self::DATA_KEY_RETURN_URL ] = $input_value; |
|
248 | + $this->valid_data[self::DATA_KEY_RETURN_URL] = $input_value; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | // cycle thru values |
272 | 272 | foreach ($ticket_ids as $key => $value) { |
273 | 273 | // allow only integers |
274 | - $this->valid_data[ self::DATA_KEY_TICKET_ID ][ $key ] = absint($value); |
|
274 | + $this->valid_data[self::DATA_KEY_TICKET_ID][$key] = absint($value); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | } |
@@ -33,394 +33,394 @@ |
||
33 | 33 | */ |
34 | 34 | class ProcessTicketSelector |
35 | 35 | { |
36 | - /** |
|
37 | - * @var EE_Cart $cart |
|
38 | - */ |
|
39 | - private $cart; |
|
36 | + /** |
|
37 | + * @var EE_Cart $cart |
|
38 | + */ |
|
39 | + private $cart; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var EE_Core_Config $core_config |
|
43 | - */ |
|
44 | - private $core_config; |
|
41 | + /** |
|
42 | + * @var EE_Core_Config $core_config |
|
43 | + */ |
|
44 | + private $core_config; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var RequestInterface $request |
|
48 | - */ |
|
49 | - private $request; |
|
46 | + /** |
|
47 | + * @var RequestInterface $request |
|
48 | + */ |
|
49 | + private $request; |
|
50 | 50 | |
51 | - /** |
|
52 | - * @var EE_Session $session |
|
53 | - */ |
|
54 | - private $session; |
|
51 | + /** |
|
52 | + * @var EE_Session $session |
|
53 | + */ |
|
54 | + private $session; |
|
55 | 55 | |
56 | - /** |
|
57 | - * @var EEM_Ticket $ticket_model |
|
58 | - */ |
|
59 | - private $ticket_model; |
|
56 | + /** |
|
57 | + * @var EEM_Ticket $ticket_model |
|
58 | + */ |
|
59 | + private $ticket_model; |
|
60 | 60 | |
61 | - /** |
|
62 | - * @var TicketDatetimeAvailabilityTracker $tracker |
|
63 | - */ |
|
64 | - private $tracker; |
|
61 | + /** |
|
62 | + * @var TicketDatetimeAvailabilityTracker $tracker |
|
63 | + */ |
|
64 | + private $tracker; |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * ProcessTicketSelector constructor. |
|
69 | - * NOTE: PLZ use the Loader to instantiate this class if need be |
|
70 | - * so that all dependencies get injected correctly (which will happen automatically) |
|
71 | - * Null values for parameters are only for backwards compatibility but will be removed later on. |
|
72 | - * |
|
73 | - * @param EE_Core_Config $core_config |
|
74 | - * @param RequestInterface $request |
|
75 | - * @param EE_Session $session |
|
76 | - * @param EEM_Ticket $ticket_model |
|
77 | - * @param TicketDatetimeAvailabilityTracker $tracker |
|
78 | - * @throws InvalidArgumentException |
|
79 | - * @throws InvalidDataTypeException |
|
80 | - * @throws InvalidInterfaceException |
|
81 | - */ |
|
82 | - public function __construct( |
|
83 | - EE_Core_Config $core_config = null, |
|
84 | - RequestInterface $request = null, |
|
85 | - EE_Session $session = null, |
|
86 | - EEM_Ticket $ticket_model = null, |
|
87 | - TicketDatetimeAvailabilityTracker $tracker = null |
|
88 | - ) { |
|
89 | - $loader = LoaderFactory::getLoader(); |
|
90 | - $this->core_config = $core_config instanceof EE_Core_Config |
|
91 | - ? $core_config |
|
92 | - : $loader->getShared('EE_Core_Config'); |
|
93 | - $this->request = $request instanceof RequestInterface |
|
94 | - ? $request |
|
95 | - : $loader->getShared('EventEspresso\core\services\request\Request'); |
|
96 | - $this->session = $session instanceof EE_Session |
|
97 | - ? $session |
|
98 | - : $loader->getShared('EE_Session'); |
|
99 | - $this->ticket_model = $ticket_model instanceof EEM_Ticket |
|
100 | - ? $ticket_model |
|
101 | - : $loader->getShared('EEM_Ticket'); |
|
102 | - $this->tracker = $tracker instanceof TicketDatetimeAvailabilityTracker |
|
103 | - ? $tracker |
|
104 | - : $loader->getShared('EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'); |
|
105 | - } |
|
67 | + /** |
|
68 | + * ProcessTicketSelector constructor. |
|
69 | + * NOTE: PLZ use the Loader to instantiate this class if need be |
|
70 | + * so that all dependencies get injected correctly (which will happen automatically) |
|
71 | + * Null values for parameters are only for backwards compatibility but will be removed later on. |
|
72 | + * |
|
73 | + * @param EE_Core_Config $core_config |
|
74 | + * @param RequestInterface $request |
|
75 | + * @param EE_Session $session |
|
76 | + * @param EEM_Ticket $ticket_model |
|
77 | + * @param TicketDatetimeAvailabilityTracker $tracker |
|
78 | + * @throws InvalidArgumentException |
|
79 | + * @throws InvalidDataTypeException |
|
80 | + * @throws InvalidInterfaceException |
|
81 | + */ |
|
82 | + public function __construct( |
|
83 | + EE_Core_Config $core_config = null, |
|
84 | + RequestInterface $request = null, |
|
85 | + EE_Session $session = null, |
|
86 | + EEM_Ticket $ticket_model = null, |
|
87 | + TicketDatetimeAvailabilityTracker $tracker = null |
|
88 | + ) { |
|
89 | + $loader = LoaderFactory::getLoader(); |
|
90 | + $this->core_config = $core_config instanceof EE_Core_Config |
|
91 | + ? $core_config |
|
92 | + : $loader->getShared('EE_Core_Config'); |
|
93 | + $this->request = $request instanceof RequestInterface |
|
94 | + ? $request |
|
95 | + : $loader->getShared('EventEspresso\core\services\request\Request'); |
|
96 | + $this->session = $session instanceof EE_Session |
|
97 | + ? $session |
|
98 | + : $loader->getShared('EE_Session'); |
|
99 | + $this->ticket_model = $ticket_model instanceof EEM_Ticket |
|
100 | + ? $ticket_model |
|
101 | + : $loader->getShared('EEM_Ticket'); |
|
102 | + $this->tracker = $tracker instanceof TicketDatetimeAvailabilityTracker |
|
103 | + ? $tracker |
|
104 | + : $loader->getShared('EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | |
108 | - /** |
|
109 | - * cancelTicketSelections |
|
110 | - * |
|
111 | - * @return bool |
|
112 | - * @throws EE_Error |
|
113 | - * @throws InvalidArgumentException |
|
114 | - * @throws InvalidInterfaceException |
|
115 | - * @throws InvalidDataTypeException |
|
116 | - * @throws ReflectionException |
|
117 | - */ |
|
118 | - public function cancelTicketSelections() |
|
119 | - { |
|
120 | - // check nonce |
|
121 | - if (! $this->processTicketSelectorNonce()) { |
|
122 | - return false; |
|
123 | - } |
|
124 | - $this->session->clear_session(__CLASS__, __FUNCTION__); |
|
125 | - if ($this->request->requestParamIsSet('event_id')) { |
|
126 | - EEH_URL::safeRedirectAndExit( |
|
127 | - EEH_Event_View::event_link_url( |
|
128 | - $this->request->getRequestParam('event_id', 0, 'int') |
|
129 | - ) |
|
130 | - ); |
|
131 | - } |
|
132 | - EEH_URL::safeRedirectAndExit( |
|
133 | - site_url('/' . $this->core_config->event_cpt_slug . '/') |
|
134 | - ); |
|
135 | - return true; |
|
136 | - } |
|
108 | + /** |
|
109 | + * cancelTicketSelections |
|
110 | + * |
|
111 | + * @return bool |
|
112 | + * @throws EE_Error |
|
113 | + * @throws InvalidArgumentException |
|
114 | + * @throws InvalidInterfaceException |
|
115 | + * @throws InvalidDataTypeException |
|
116 | + * @throws ReflectionException |
|
117 | + */ |
|
118 | + public function cancelTicketSelections() |
|
119 | + { |
|
120 | + // check nonce |
|
121 | + if (! $this->processTicketSelectorNonce()) { |
|
122 | + return false; |
|
123 | + } |
|
124 | + $this->session->clear_session(__CLASS__, __FUNCTION__); |
|
125 | + if ($this->request->requestParamIsSet('event_id')) { |
|
126 | + EEH_URL::safeRedirectAndExit( |
|
127 | + EEH_Event_View::event_link_url( |
|
128 | + $this->request->getRequestParam('event_id', 0, 'int') |
|
129 | + ) |
|
130 | + ); |
|
131 | + } |
|
132 | + EEH_URL::safeRedirectAndExit( |
|
133 | + site_url('/' . $this->core_config->event_cpt_slug . '/') |
|
134 | + ); |
|
135 | + return true; |
|
136 | + } |
|
137 | 137 | |
138 | 138 | |
139 | - /** |
|
140 | - * processTicketSelectorNonce |
|
141 | - * |
|
142 | - * @return bool |
|
143 | - */ |
|
144 | - private function processTicketSelectorNonce() |
|
145 | - { |
|
146 | - if ( |
|
147 | - ! $this->request->isAdmin() |
|
148 | - && ( |
|
149 | - ! $this->request->requestParamIsSet('cancel_ticket_selections_nonce') |
|
150 | - || ! wp_verify_nonce( |
|
151 | - $this->request->getRequestParam('cancel_ticket_selections_nonce'), |
|
152 | - 'cancel_ticket_selections' |
|
153 | - ) |
|
154 | - ) |
|
155 | - ) { |
|
156 | - EE_Error::add_error( |
|
157 | - sprintf( |
|
158 | - esc_html__( |
|
159 | - 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', |
|
160 | - 'event_espresso' |
|
161 | - ), |
|
162 | - '<br/>' |
|
163 | - ), |
|
164 | - __FILE__, |
|
165 | - __FUNCTION__, |
|
166 | - __LINE__ |
|
167 | - ); |
|
168 | - return false; |
|
169 | - } |
|
170 | - return true; |
|
171 | - } |
|
139 | + /** |
|
140 | + * processTicketSelectorNonce |
|
141 | + * |
|
142 | + * @return bool |
|
143 | + */ |
|
144 | + private function processTicketSelectorNonce() |
|
145 | + { |
|
146 | + if ( |
|
147 | + ! $this->request->isAdmin() |
|
148 | + && ( |
|
149 | + ! $this->request->requestParamIsSet('cancel_ticket_selections_nonce') |
|
150 | + || ! wp_verify_nonce( |
|
151 | + $this->request->getRequestParam('cancel_ticket_selections_nonce'), |
|
152 | + 'cancel_ticket_selections' |
|
153 | + ) |
|
154 | + ) |
|
155 | + ) { |
|
156 | + EE_Error::add_error( |
|
157 | + sprintf( |
|
158 | + esc_html__( |
|
159 | + 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', |
|
160 | + 'event_espresso' |
|
161 | + ), |
|
162 | + '<br/>' |
|
163 | + ), |
|
164 | + __FILE__, |
|
165 | + __FUNCTION__, |
|
166 | + __LINE__ |
|
167 | + ); |
|
168 | + return false; |
|
169 | + } |
|
170 | + return true; |
|
171 | + } |
|
172 | 172 | |
173 | 173 | |
174 | - /** |
|
175 | - * process_ticket_selections |
|
176 | - * |
|
177 | - * @return bool |
|
178 | - * @throws EE_Error |
|
179 | - * @throws InvalidArgumentException |
|
180 | - * @throws InvalidDataTypeException |
|
181 | - * @throws InvalidInterfaceException |
|
182 | - * @throws ReflectionException |
|
183 | - */ |
|
184 | - public function processTicketSelections() |
|
185 | - { |
|
186 | - do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
187 | - if ($this->request->isBot()) { |
|
188 | - EEH_URL::safeRedirectAndExit( |
|
189 | - apply_filters( |
|
190 | - 'FHEE__EE_Ticket_Selector__process_ticket_selections__bot_redirect_url', |
|
191 | - site_url() |
|
192 | - ) |
|
193 | - ); |
|
194 | - } |
|
195 | - // we should really only have 1 registration in the works now |
|
196 | - // (ie, no MER) so unless otherwise requested, clear the session |
|
197 | - if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) { |
|
198 | - $this->session->clear_session(__CLASS__, __FUNCTION__); |
|
199 | - } |
|
200 | - // validate/sanitize/filter data |
|
201 | - $id = null; |
|
202 | - $valid = []; |
|
203 | - try { |
|
204 | - /** @var ProcessTicketSelectorPostData $post_data_validator */ |
|
205 | - $post_data_validator = LoaderFactory::getNew(ProcessTicketSelectorPostData::class); |
|
206 | - $id = $post_data_validator->getEventId(); |
|
207 | - $valid = apply_filters( |
|
208 | - 'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', |
|
209 | - $post_data_validator->validatePostData() |
|
210 | - ); |
|
211 | - } catch (Exception $exception) { |
|
212 | - EE_Error::add_error($exception->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
213 | - } |
|
214 | - // check total tickets ordered vs max number of attendees that can register |
|
215 | - if (! empty($valid) && $valid['total_tickets'] > $valid['max_atndz']) { |
|
216 | - $this->maxAttendeesViolation($valid); |
|
217 | - } else { |
|
218 | - // all data appears to be valid |
|
219 | - if ($this->processSuccessfulCart($this->addTicketsToCart($valid))) { |
|
220 | - return true; |
|
221 | - } |
|
222 | - } |
|
223 | - // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
|
224 | - // at this point, just return if registration is being made from admin |
|
225 | - if ($this->request->isAdmin() || $this->request->isFrontAjax()) { |
|
226 | - return false; |
|
227 | - } |
|
228 | - if (! empty($valid['return_url'])) { |
|
229 | - EEH_URL::safeRedirectAndExit($valid['return_url']); |
|
230 | - } |
|
231 | - // do we have an event id? |
|
232 | - if ($id) { |
|
233 | - EEH_URL::safeRedirectAndExit(get_permalink($id)); |
|
234 | - } |
|
235 | - echo EE_Error::get_notices(); // already escaped |
|
236 | - return false; |
|
237 | - } |
|
174 | + /** |
|
175 | + * process_ticket_selections |
|
176 | + * |
|
177 | + * @return bool |
|
178 | + * @throws EE_Error |
|
179 | + * @throws InvalidArgumentException |
|
180 | + * @throws InvalidDataTypeException |
|
181 | + * @throws InvalidInterfaceException |
|
182 | + * @throws ReflectionException |
|
183 | + */ |
|
184 | + public function processTicketSelections() |
|
185 | + { |
|
186 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
187 | + if ($this->request->isBot()) { |
|
188 | + EEH_URL::safeRedirectAndExit( |
|
189 | + apply_filters( |
|
190 | + 'FHEE__EE_Ticket_Selector__process_ticket_selections__bot_redirect_url', |
|
191 | + site_url() |
|
192 | + ) |
|
193 | + ); |
|
194 | + } |
|
195 | + // we should really only have 1 registration in the works now |
|
196 | + // (ie, no MER) so unless otherwise requested, clear the session |
|
197 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) { |
|
198 | + $this->session->clear_session(__CLASS__, __FUNCTION__); |
|
199 | + } |
|
200 | + // validate/sanitize/filter data |
|
201 | + $id = null; |
|
202 | + $valid = []; |
|
203 | + try { |
|
204 | + /** @var ProcessTicketSelectorPostData $post_data_validator */ |
|
205 | + $post_data_validator = LoaderFactory::getNew(ProcessTicketSelectorPostData::class); |
|
206 | + $id = $post_data_validator->getEventId(); |
|
207 | + $valid = apply_filters( |
|
208 | + 'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', |
|
209 | + $post_data_validator->validatePostData() |
|
210 | + ); |
|
211 | + } catch (Exception $exception) { |
|
212 | + EE_Error::add_error($exception->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
213 | + } |
|
214 | + // check total tickets ordered vs max number of attendees that can register |
|
215 | + if (! empty($valid) && $valid['total_tickets'] > $valid['max_atndz']) { |
|
216 | + $this->maxAttendeesViolation($valid); |
|
217 | + } else { |
|
218 | + // all data appears to be valid |
|
219 | + if ($this->processSuccessfulCart($this->addTicketsToCart($valid))) { |
|
220 | + return true; |
|
221 | + } |
|
222 | + } |
|
223 | + // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
|
224 | + // at this point, just return if registration is being made from admin |
|
225 | + if ($this->request->isAdmin() || $this->request->isFrontAjax()) { |
|
226 | + return false; |
|
227 | + } |
|
228 | + if (! empty($valid['return_url'])) { |
|
229 | + EEH_URL::safeRedirectAndExit($valid['return_url']); |
|
230 | + } |
|
231 | + // do we have an event id? |
|
232 | + if ($id) { |
|
233 | + EEH_URL::safeRedirectAndExit(get_permalink($id)); |
|
234 | + } |
|
235 | + echo EE_Error::get_notices(); // already escaped |
|
236 | + return false; |
|
237 | + } |
|
238 | 238 | |
239 | 239 | |
240 | - /** |
|
241 | - * @param array $valid |
|
242 | - */ |
|
243 | - private function maxAttendeesViolation(array $valid) |
|
244 | - { |
|
245 | - // ordering too many tickets !!! |
|
246 | - $total_tickets_string = esc_html( |
|
247 | - _n( |
|
248 | - 'You have attempted to purchase %s ticket.', |
|
249 | - 'You have attempted to purchase %s tickets.', |
|
250 | - $valid['total_tickets'], |
|
251 | - 'event_espresso' |
|
252 | - ) |
|
253 | - ); |
|
254 | - $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
255 | - // dev only message |
|
256 | - $max_attendees_string = esc_html( |
|
257 | - _n( |
|
258 | - 'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', |
|
259 | - 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', |
|
260 | - $valid['max_atndz'], |
|
261 | - 'event_espresso' |
|
262 | - ) |
|
263 | - ); |
|
264 | - $limit_error_2 = sprintf($max_attendees_string, $valid['max_atndz'], $valid['max_atndz']); |
|
265 | - EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
266 | - } |
|
240 | + /** |
|
241 | + * @param array $valid |
|
242 | + */ |
|
243 | + private function maxAttendeesViolation(array $valid) |
|
244 | + { |
|
245 | + // ordering too many tickets !!! |
|
246 | + $total_tickets_string = esc_html( |
|
247 | + _n( |
|
248 | + 'You have attempted to purchase %s ticket.', |
|
249 | + 'You have attempted to purchase %s tickets.', |
|
250 | + $valid['total_tickets'], |
|
251 | + 'event_espresso' |
|
252 | + ) |
|
253 | + ); |
|
254 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
255 | + // dev only message |
|
256 | + $max_attendees_string = esc_html( |
|
257 | + _n( |
|
258 | + 'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', |
|
259 | + 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', |
|
260 | + $valid['max_atndz'], |
|
261 | + 'event_espresso' |
|
262 | + ) |
|
263 | + ); |
|
264 | + $limit_error_2 = sprintf($max_attendees_string, $valid['max_atndz'], $valid['max_atndz']); |
|
265 | + EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
266 | + } |
|
267 | 267 | |
268 | 268 | |
269 | - /** |
|
270 | - * @param array $valid |
|
271 | - * @return int |
|
272 | - * @throws EE_Error |
|
273 | - * @throws InvalidArgumentException |
|
274 | - * @throws InvalidDataTypeException |
|
275 | - * @throws InvalidInterfaceException |
|
276 | - */ |
|
277 | - private function addTicketsToCart(array $valid) |
|
278 | - { |
|
279 | - $tickets_added = 0; |
|
280 | - $tickets_selected = false; |
|
281 | - if (! empty($valid['ticket-selections']) && $valid['total_tickets'] > 0) { |
|
282 | - // load cart using factory because we don't want to do so until actually needed |
|
283 | - $this->cart = CartFactory::getCart(); |
|
284 | - // if the user is an admin that can edit registrations, |
|
285 | - // then we'll also allow them to add any tickets, even if they are expired |
|
286 | - $current_user_is_admin = current_user_can('ee_edit_registrations'); |
|
287 | - // cycle thru the number of data rows sent from the event listing |
|
288 | - foreach ($valid['ticket-selections'] as $ticket_id => $qty) { |
|
289 | - if ($qty) { |
|
290 | - // YES we have a ticket quantity |
|
291 | - $tickets_selected = true; |
|
292 | - $valid_ticket = false; |
|
293 | - // get ticket via the ticket id we put in the form |
|
294 | - $ticket = $this->ticket_model->get_one_by_ID($ticket_id); |
|
295 | - if ($ticket instanceof EE_Ticket && ($ticket->is_on_sale() || $current_user_is_admin)) { |
|
296 | - $valid_ticket = true; |
|
297 | - $tickets_added += $this->addTicketToCart($ticket, $qty); |
|
298 | - } |
|
299 | - if ($valid_ticket !== true) { |
|
300 | - // nothing added to cart retrieved |
|
301 | - EE_Error::add_error( |
|
302 | - sprintf( |
|
303 | - esc_html__( |
|
304 | - 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', |
|
305 | - 'event_espresso' |
|
306 | - ), |
|
307 | - '<br/>' |
|
308 | - ), |
|
309 | - __FILE__, |
|
310 | - __FUNCTION__, |
|
311 | - __LINE__ |
|
312 | - ); |
|
313 | - } |
|
314 | - if (EE_Error::has_error()) { |
|
315 | - break; |
|
316 | - } |
|
317 | - } |
|
318 | - } |
|
319 | - } |
|
320 | - do_action( |
|
321 | - 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', |
|
322 | - $this->cart, |
|
323 | - $this |
|
324 | - ); |
|
325 | - if (! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) { |
|
326 | - // no ticket quantities were selected |
|
327 | - EE_Error::add_error( |
|
328 | - esc_html__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), |
|
329 | - __FILE__, |
|
330 | - __FUNCTION__, |
|
331 | - __LINE__ |
|
332 | - ); |
|
333 | - } |
|
334 | - return $tickets_added; |
|
335 | - } |
|
269 | + /** |
|
270 | + * @param array $valid |
|
271 | + * @return int |
|
272 | + * @throws EE_Error |
|
273 | + * @throws InvalidArgumentException |
|
274 | + * @throws InvalidDataTypeException |
|
275 | + * @throws InvalidInterfaceException |
|
276 | + */ |
|
277 | + private function addTicketsToCart(array $valid) |
|
278 | + { |
|
279 | + $tickets_added = 0; |
|
280 | + $tickets_selected = false; |
|
281 | + if (! empty($valid['ticket-selections']) && $valid['total_tickets'] > 0) { |
|
282 | + // load cart using factory because we don't want to do so until actually needed |
|
283 | + $this->cart = CartFactory::getCart(); |
|
284 | + // if the user is an admin that can edit registrations, |
|
285 | + // then we'll also allow them to add any tickets, even if they are expired |
|
286 | + $current_user_is_admin = current_user_can('ee_edit_registrations'); |
|
287 | + // cycle thru the number of data rows sent from the event listing |
|
288 | + foreach ($valid['ticket-selections'] as $ticket_id => $qty) { |
|
289 | + if ($qty) { |
|
290 | + // YES we have a ticket quantity |
|
291 | + $tickets_selected = true; |
|
292 | + $valid_ticket = false; |
|
293 | + // get ticket via the ticket id we put in the form |
|
294 | + $ticket = $this->ticket_model->get_one_by_ID($ticket_id); |
|
295 | + if ($ticket instanceof EE_Ticket && ($ticket->is_on_sale() || $current_user_is_admin)) { |
|
296 | + $valid_ticket = true; |
|
297 | + $tickets_added += $this->addTicketToCart($ticket, $qty); |
|
298 | + } |
|
299 | + if ($valid_ticket !== true) { |
|
300 | + // nothing added to cart retrieved |
|
301 | + EE_Error::add_error( |
|
302 | + sprintf( |
|
303 | + esc_html__( |
|
304 | + 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', |
|
305 | + 'event_espresso' |
|
306 | + ), |
|
307 | + '<br/>' |
|
308 | + ), |
|
309 | + __FILE__, |
|
310 | + __FUNCTION__, |
|
311 | + __LINE__ |
|
312 | + ); |
|
313 | + } |
|
314 | + if (EE_Error::has_error()) { |
|
315 | + break; |
|
316 | + } |
|
317 | + } |
|
318 | + } |
|
319 | + } |
|
320 | + do_action( |
|
321 | + 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', |
|
322 | + $this->cart, |
|
323 | + $this |
|
324 | + ); |
|
325 | + if (! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) { |
|
326 | + // no ticket quantities were selected |
|
327 | + EE_Error::add_error( |
|
328 | + esc_html__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), |
|
329 | + __FILE__, |
|
330 | + __FUNCTION__, |
|
331 | + __LINE__ |
|
332 | + ); |
|
333 | + } |
|
334 | + return $tickets_added; |
|
335 | + } |
|
336 | 336 | |
337 | 337 | |
338 | - /** |
|
339 | - * adds a ticket to the cart |
|
340 | - * |
|
341 | - * @param EE_Ticket $ticket |
|
342 | - * @param int $qty |
|
343 | - * @return bool TRUE on success, FALSE on fail |
|
344 | - * @throws InvalidArgumentException |
|
345 | - * @throws InvalidInterfaceException |
|
346 | - * @throws InvalidDataTypeException |
|
347 | - * @throws EE_Error |
|
348 | - */ |
|
349 | - private function addTicketToCart(EE_Ticket $ticket, $qty = 1) |
|
350 | - { |
|
351 | - // get the number of spaces left for this datetime ticket |
|
352 | - $available_spaces = $this->tracker->ticketDatetimeAvailability($ticket); |
|
353 | - // compare available spaces against the number of tickets being purchased |
|
354 | - if ($available_spaces >= $qty) { |
|
355 | - // allow addons to prevent a ticket from being added to cart |
|
356 | - if ( |
|
357 | - ! apply_filters( |
|
358 | - 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', |
|
359 | - true, |
|
360 | - $ticket, |
|
361 | - $qty, |
|
362 | - $available_spaces |
|
363 | - ) |
|
364 | - ) { |
|
365 | - return false; |
|
366 | - } |
|
367 | - $qty = absint(apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket)); |
|
368 | - // add event to cart |
|
369 | - if ($this->cart->add_ticket_to_cart($ticket, $qty)) { |
|
370 | - $this->tracker->recalculateTicketDatetimeAvailability($ticket, $qty); |
|
371 | - return true; |
|
372 | - } |
|
373 | - return false; |
|
374 | - } |
|
375 | - $this->tracker->processAvailabilityError($ticket, $qty, $this->cart->all_ticket_quantity_count()); |
|
376 | - return false; |
|
377 | - } |
|
338 | + /** |
|
339 | + * adds a ticket to the cart |
|
340 | + * |
|
341 | + * @param EE_Ticket $ticket |
|
342 | + * @param int $qty |
|
343 | + * @return bool TRUE on success, FALSE on fail |
|
344 | + * @throws InvalidArgumentException |
|
345 | + * @throws InvalidInterfaceException |
|
346 | + * @throws InvalidDataTypeException |
|
347 | + * @throws EE_Error |
|
348 | + */ |
|
349 | + private function addTicketToCart(EE_Ticket $ticket, $qty = 1) |
|
350 | + { |
|
351 | + // get the number of spaces left for this datetime ticket |
|
352 | + $available_spaces = $this->tracker->ticketDatetimeAvailability($ticket); |
|
353 | + // compare available spaces against the number of tickets being purchased |
|
354 | + if ($available_spaces >= $qty) { |
|
355 | + // allow addons to prevent a ticket from being added to cart |
|
356 | + if ( |
|
357 | + ! apply_filters( |
|
358 | + 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', |
|
359 | + true, |
|
360 | + $ticket, |
|
361 | + $qty, |
|
362 | + $available_spaces |
|
363 | + ) |
|
364 | + ) { |
|
365 | + return false; |
|
366 | + } |
|
367 | + $qty = absint(apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket)); |
|
368 | + // add event to cart |
|
369 | + if ($this->cart->add_ticket_to_cart($ticket, $qty)) { |
|
370 | + $this->tracker->recalculateTicketDatetimeAvailability($ticket, $qty); |
|
371 | + return true; |
|
372 | + } |
|
373 | + return false; |
|
374 | + } |
|
375 | + $this->tracker->processAvailabilityError($ticket, $qty, $this->cart->all_ticket_quantity_count()); |
|
376 | + return false; |
|
377 | + } |
|
378 | 378 | |
379 | 379 | |
380 | - /** |
|
381 | - * @param $tickets_added |
|
382 | - * @return bool |
|
383 | - * @throws InvalidInterfaceException |
|
384 | - * @throws InvalidDataTypeException |
|
385 | - * @throws EE_Error |
|
386 | - * @throws InvalidArgumentException |
|
387 | - */ |
|
388 | - private function processSuccessfulCart($tickets_added) |
|
389 | - { |
|
390 | - // exit('KILL REDIRECT BEFORE CART UPDATE'); // <<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
|
391 | - if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) { |
|
392 | - // make sure cart is loaded |
|
393 | - if (! $this->cart instanceof EE_Cart) { |
|
394 | - $this->cart = CartFactory::getCart(); |
|
395 | - } |
|
396 | - do_action( |
|
397 | - 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', |
|
398 | - $this->cart, |
|
399 | - $this |
|
400 | - ); |
|
401 | - $this->cart->recalculate_all_cart_totals(); |
|
402 | - $this->cart->save_cart(false); |
|
403 | - // exit('KILL REDIRECT AFTER CART UPDATE'); // <<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
|
404 | - // just return TRUE for registrations being made from admin |
|
405 | - if ($this->request->isAdmin() || $this->request->isFrontAjax()) { |
|
406 | - return true; |
|
407 | - } |
|
408 | - EEH_URL::safeRedirectAndExit( |
|
409 | - apply_filters( |
|
410 | - 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', |
|
411 | - $this->core_config->reg_page_url() |
|
412 | - ) |
|
413 | - ); |
|
414 | - } |
|
415 | - if (! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) { |
|
416 | - // nothing added to cart |
|
417 | - EE_Error::add_attention( |
|
418 | - esc_html__('No tickets were added for the event', 'event_espresso'), |
|
419 | - __FILE__, |
|
420 | - __FUNCTION__, |
|
421 | - __LINE__ |
|
422 | - ); |
|
423 | - } |
|
424 | - return false; |
|
425 | - } |
|
380 | + /** |
|
381 | + * @param $tickets_added |
|
382 | + * @return bool |
|
383 | + * @throws InvalidInterfaceException |
|
384 | + * @throws InvalidDataTypeException |
|
385 | + * @throws EE_Error |
|
386 | + * @throws InvalidArgumentException |
|
387 | + */ |
|
388 | + private function processSuccessfulCart($tickets_added) |
|
389 | + { |
|
390 | + // exit('KILL REDIRECT BEFORE CART UPDATE'); // <<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
|
391 | + if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) { |
|
392 | + // make sure cart is loaded |
|
393 | + if (! $this->cart instanceof EE_Cart) { |
|
394 | + $this->cart = CartFactory::getCart(); |
|
395 | + } |
|
396 | + do_action( |
|
397 | + 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', |
|
398 | + $this->cart, |
|
399 | + $this |
|
400 | + ); |
|
401 | + $this->cart->recalculate_all_cart_totals(); |
|
402 | + $this->cart->save_cart(false); |
|
403 | + // exit('KILL REDIRECT AFTER CART UPDATE'); // <<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
|
404 | + // just return TRUE for registrations being made from admin |
|
405 | + if ($this->request->isAdmin() || $this->request->isFrontAjax()) { |
|
406 | + return true; |
|
407 | + } |
|
408 | + EEH_URL::safeRedirectAndExit( |
|
409 | + apply_filters( |
|
410 | + 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', |
|
411 | + $this->core_config->reg_page_url() |
|
412 | + ) |
|
413 | + ); |
|
414 | + } |
|
415 | + if (! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) { |
|
416 | + // nothing added to cart |
|
417 | + EE_Error::add_attention( |
|
418 | + esc_html__('No tickets were added for the event', 'event_espresso'), |
|
419 | + __FILE__, |
|
420 | + __FUNCTION__, |
|
421 | + __LINE__ |
|
422 | + ); |
|
423 | + } |
|
424 | + return false; |
|
425 | + } |
|
426 | 426 | } |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '7.2.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '7.2.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.45.rc.001'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.45.rc.001'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | \ No newline at end of file |
@@ -19,1160 +19,1160 @@ |
||
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 | - 'EE_Admin_Transactions_List_Table' => [ |
|
674 | - null, |
|
675 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
676 | - ], |
|
677 | - 'EventEspresso\core\domain\services\admin\ExitModal' => [ |
|
678 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
679 | - ], |
|
680 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => [ |
|
681 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
682 | - ], |
|
683 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
684 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
685 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
686 | - ], |
|
687 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => [ |
|
688 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
689 | - ], |
|
690 | - 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
691 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
692 | - 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
693 | - ], |
|
694 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
695 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
696 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
697 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
698 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
699 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
700 | - ], |
|
701 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelectorPostData' => [ |
|
702 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
703 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
704 | - ], |
|
705 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
706 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
707 | - ], |
|
708 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
709 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
710 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
711 | - ], |
|
712 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
713 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
714 | - ], |
|
715 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
716 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
717 | - ], |
|
718 | - 'EE_CPT_Strategy' => [ |
|
719 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
720 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
721 | - ], |
|
722 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
723 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
724 | - ], |
|
725 | - 'EventEspresso\core\domain\services\assets\CoreAssetManager' => [ |
|
726 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
727 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
728 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
729 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
730 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
731 | - ], |
|
732 | - 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => [ |
|
733 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
734 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
735 | - ], |
|
736 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => [ |
|
737 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
738 | - ], |
|
739 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => [ |
|
740 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
741 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
742 | - ], |
|
743 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => [ |
|
744 | - 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
745 | - ], |
|
746 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => [ |
|
747 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
748 | - ], |
|
749 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => [ |
|
750 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
751 | - ], |
|
752 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => [ |
|
753 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
754 | - ], |
|
755 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => [ |
|
756 | - 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
757 | - 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
758 | - ], |
|
759 | - 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
760 | - null, |
|
761 | - null, |
|
762 | - null, |
|
763 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
764 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
765 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
766 | - ], |
|
767 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => [ |
|
768 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
769 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
770 | - ], |
|
771 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' => [ |
|
772 | - 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
773 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
774 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
775 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
776 | - ], |
|
777 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => [ |
|
778 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
779 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
780 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
781 | - ], |
|
782 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => [ |
|
783 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
784 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
785 | - ], |
|
786 | - 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => [ |
|
787 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
788 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
789 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
790 | - ], |
|
791 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => [ |
|
792 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
793 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
794 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
795 | - ], |
|
796 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => [ |
|
797 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
798 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
799 | - ], |
|
800 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => [ |
|
801 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
802 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
803 | - ], |
|
804 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => [ |
|
805 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache, |
|
806 | - ], |
|
807 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => [ |
|
808 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
809 | - ], |
|
810 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => [ |
|
811 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache, |
|
812 | - ], |
|
813 | - 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => [ |
|
814 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
815 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
816 | - ], |
|
817 | - 'EventEspresso\core\libraries\rest_api\calculations\Event' => [ |
|
818 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
819 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
820 | - ], |
|
821 | - 'EventEspresso\core\libraries\rest_api\calculations\Registration' => [ |
|
822 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
823 | - ], |
|
824 | - 'EventEspresso\core\services\session\SessionStartHandler' => [ |
|
825 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
826 | - ], |
|
827 | - 'EE_URL_Validation_Strategy' => [ |
|
828 | - null, |
|
829 | - null, |
|
830 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
831 | - ], |
|
832 | - 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => [ |
|
833 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
834 | - 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
835 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
836 | - 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
837 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
838 | - ], |
|
839 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => [ |
|
840 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
841 | - 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache, |
|
842 | - ], |
|
843 | - 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => [ |
|
844 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
845 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
846 | - ], |
|
847 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => [ |
|
848 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
849 | - 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
850 | - ], |
|
851 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
852 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
853 | - ], |
|
854 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
855 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
856 | - ], |
|
857 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
858 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
859 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
860 | - null, |
|
861 | - ], |
|
862 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
863 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
864 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
865 | - ], |
|
866 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
867 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
868 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
869 | - ], |
|
870 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
871 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
872 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
873 | - ], |
|
874 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
875 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
876 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
877 | - ], |
|
878 | - 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
879 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
880 | - ], |
|
881 | - 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
882 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
883 | - ], |
|
884 | - 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
885 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
886 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
887 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
888 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
889 | - ], |
|
890 | - 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
891 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
892 | - ], |
|
893 | - 'EventEspresso\core\services\request\CurrentPage' => [ |
|
894 | - 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
895 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
896 | - ], |
|
897 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
898 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
899 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
900 | - ], |
|
901 | - 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
902 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
903 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
904 | - ], |
|
905 | - 'EE_Brewing_Regular' => [ |
|
906 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
907 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
908 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
909 | - ], |
|
910 | - ]; |
|
911 | - } |
|
912 | - |
|
913 | - |
|
914 | - /** |
|
915 | - * Registers how core classes are loaded. |
|
916 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
917 | - * 'EE_Request_Handler' => 'load_core' |
|
918 | - * 'EE_Messages_Queue' => 'load_lib' |
|
919 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
920 | - * or, if greater control is required, by providing a custom closure. For example: |
|
921 | - * 'Some_Class' => function () { |
|
922 | - * return new Some_Class(); |
|
923 | - * }, |
|
924 | - * This is required for instantiating dependencies |
|
925 | - * where an interface has been type hinted in a class constructor. For example: |
|
926 | - * 'Required_Interface' => function () { |
|
927 | - * return new A_Class_That_Implements_Required_Interface(); |
|
928 | - * }, |
|
929 | - */ |
|
930 | - protected function _register_core_class_loaders() |
|
931 | - { |
|
932 | - $this->_class_loaders = [ |
|
933 | - // load_core |
|
934 | - 'EE_Dependency_Map' => function () { |
|
935 | - return $this; |
|
936 | - }, |
|
937 | - 'EE_Capabilities' => 'load_core', |
|
938 | - 'EE_Encryption' => 'load_core', |
|
939 | - 'EE_Front_Controller' => 'load_core', |
|
940 | - 'EE_Module_Request_Router' => 'load_core', |
|
941 | - 'EE_Registry' => 'load_core', |
|
942 | - 'EE_Request' => function () { |
|
943 | - return $this->legacy_request; |
|
944 | - }, |
|
945 | - 'EventEspresso\core\services\request\Request' => function () { |
|
946 | - return $this->request; |
|
947 | - }, |
|
948 | - 'EventEspresso\core\services\request\Response' => function () { |
|
949 | - return $this->response; |
|
950 | - }, |
|
951 | - 'EE_Base' => 'load_core', |
|
952 | - 'EE_Request_Handler' => 'load_core', |
|
953 | - 'EE_Session' => 'load_core', |
|
954 | - 'EE_Cron_Tasks' => 'load_core', |
|
955 | - 'EE_System' => 'load_core', |
|
956 | - 'EE_Maintenance_Mode' => 'load_core', |
|
957 | - 'EE_Register_CPTs' => 'load_core', |
|
958 | - 'EE_Admin' => 'load_core', |
|
959 | - 'EE_CPT_Strategy' => 'load_core', |
|
960 | - // load_class |
|
961 | - 'EE_Registration_Processor' => 'load_class', |
|
962 | - // load_lib |
|
963 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
964 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
965 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
966 | - 'EE_Messenger_Collection' => 'load_lib', |
|
967 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
968 | - 'EE_Messages_Processor' => 'load_lib', |
|
969 | - 'EE_Message_Repository' => 'load_lib', |
|
970 | - 'EE_Messages_Queue' => 'load_lib', |
|
971 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
972 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
973 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
974 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
975 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
976 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
977 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
978 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
979 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
980 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
981 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
982 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
983 | - 'EE_Messages_Generator' => function () { |
|
984 | - return EE_Registry::instance()->load_lib( |
|
985 | - 'Messages_Generator', |
|
986 | - [], |
|
987 | - false, |
|
988 | - false |
|
989 | - ); |
|
990 | - }, |
|
991 | - 'EE_Messages_Template_Defaults' => function ($arguments = []) { |
|
992 | - return EE_Registry::instance()->load_lib( |
|
993 | - 'Messages_Template_Defaults', |
|
994 | - $arguments, |
|
995 | - false, |
|
996 | - false |
|
997 | - ); |
|
998 | - }, |
|
999 | - // load_helper |
|
1000 | - 'EEH_Parse_Shortcodes' => function () { |
|
1001 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
1002 | - return new EEH_Parse_Shortcodes(); |
|
1003 | - } |
|
1004 | - return null; |
|
1005 | - }, |
|
1006 | - 'EE_Template_Config' => function () { |
|
1007 | - return EE_Config::instance()->template_settings; |
|
1008 | - }, |
|
1009 | - 'EE_Currency_Config' => function () { |
|
1010 | - return EE_Config::instance()->currency; |
|
1011 | - }, |
|
1012 | - 'EE_Registration_Config' => function () { |
|
1013 | - return EE_Config::instance()->registration; |
|
1014 | - }, |
|
1015 | - 'EE_Core_Config' => function () { |
|
1016 | - return EE_Config::instance()->core; |
|
1017 | - }, |
|
1018 | - 'EventEspresso\core\services\loaders\Loader' => function () { |
|
1019 | - return LoaderFactory::getLoader(); |
|
1020 | - }, |
|
1021 | - 'EE_Network_Config' => function () { |
|
1022 | - return EE_Network_Config::instance(); |
|
1023 | - }, |
|
1024 | - 'EE_Config' => function () { |
|
1025 | - return EE_Config::instance(); |
|
1026 | - }, |
|
1027 | - 'EventEspresso\core\domain\Domain' => function () { |
|
1028 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
1029 | - }, |
|
1030 | - 'EE_Admin_Config' => function () { |
|
1031 | - return EE_Config::instance()->admin; |
|
1032 | - }, |
|
1033 | - 'EE_Organization_Config' => function () { |
|
1034 | - return EE_Config::instance()->organization; |
|
1035 | - }, |
|
1036 | - 'EE_Network_Core_Config' => function () { |
|
1037 | - return EE_Network_Config::instance()->core; |
|
1038 | - }, |
|
1039 | - 'EE_Environment_Config' => function () { |
|
1040 | - return EE_Config::instance()->environment; |
|
1041 | - }, |
|
1042 | - 'EE_Ticket_Selector_Config' => function () { |
|
1043 | - return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1044 | - }, |
|
1045 | - ]; |
|
1046 | - } |
|
1047 | - |
|
1048 | - |
|
1049 | - /** |
|
1050 | - * can be used for supplying alternate names for classes, |
|
1051 | - * or for connecting interface names to instantiable classes |
|
1052 | - */ |
|
1053 | - protected function _register_core_aliases() |
|
1054 | - { |
|
1055 | - $aliases = [ |
|
1056 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1057 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1058 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1059 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1060 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1061 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1062 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1063 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1064 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1065 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1066 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommand', |
|
1067 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1068 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1069 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1070 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1071 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommand', |
|
1072 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\domain\services\commands\transaction\CreateTransactionCommandHandler', |
|
1073 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1074 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1075 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1076 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1077 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1078 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1079 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1080 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1081 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1082 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1083 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1084 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1085 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1086 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1087 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1088 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1089 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1090 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1091 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1092 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1093 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
1094 | - ]; |
|
1095 | - foreach ($aliases as $alias => $fqn) { |
|
1096 | - if (is_array($fqn)) { |
|
1097 | - foreach ($fqn as $class => $for_class) { |
|
1098 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
1099 | - } |
|
1100 | - continue; |
|
1101 | - } |
|
1102 | - $this->class_cache->addAlias($fqn, $alias); |
|
1103 | - } |
|
1104 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1105 | - $this->class_cache->addAlias( |
|
1106 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1107 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1108 | - ); |
|
1109 | - } |
|
1110 | - } |
|
1111 | - |
|
1112 | - |
|
1113 | - public function debug($for_class = '') |
|
1114 | - { |
|
1115 | - $this->class_cache->debug($for_class); |
|
1116 | - } |
|
1117 | - |
|
1118 | - |
|
1119 | - /** |
|
1120 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1121 | - * request Primarily used by unit tests. |
|
1122 | - */ |
|
1123 | - public function reset() |
|
1124 | - { |
|
1125 | - $this->_register_core_class_loaders(); |
|
1126 | - $this->_register_core_dependencies(); |
|
1127 | - } |
|
1128 | - |
|
1129 | - |
|
1130 | - /** |
|
1131 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
1132 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
1133 | - * WHY? |
|
1134 | - * Because if a class is type hinting for a concretion, |
|
1135 | - * then why would we need to find another class to supply it? |
|
1136 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1137 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1138 | - * Don't go looking for some substitute. |
|
1139 | - * Whereas if a class is type hinting for an interface... |
|
1140 | - * then we need to find an actual class to use. |
|
1141 | - * So the interface IS the alias for some other FQN, |
|
1142 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1143 | - * represents some other class. |
|
1144 | - * |
|
1145 | - * @param string $fqn |
|
1146 | - * @param string $for_class |
|
1147 | - * @return bool |
|
1148 | - * @deprecated 4.9.62.p |
|
1149 | - */ |
|
1150 | - public function has_alias($fqn = '', $for_class = '') |
|
1151 | - { |
|
1152 | - return $this->isAlias($fqn, $for_class); |
|
1153 | - } |
|
1154 | - |
|
1155 | - |
|
1156 | - /** |
|
1157 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1158 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1159 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1160 | - * for example: |
|
1161 | - * if the following two entries were added to the _aliases array: |
|
1162 | - * array( |
|
1163 | - * 'interface_alias' => 'some\namespace\interface' |
|
1164 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
1165 | - * ) |
|
1166 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1167 | - * to load an instance of 'some\namespace\classname' |
|
1168 | - * |
|
1169 | - * @param string $alias |
|
1170 | - * @param string $for_class |
|
1171 | - * @return string |
|
1172 | - * @deprecated 4.9.62.p |
|
1173 | - */ |
|
1174 | - public function get_alias($alias = '', $for_class = '') |
|
1175 | - { |
|
1176 | - return $this->getFqnForAlias($alias, $for_class); |
|
1177 | - } |
|
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 | + 'EE_Admin_Transactions_List_Table' => [ |
|
674 | + null, |
|
675 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
676 | + ], |
|
677 | + 'EventEspresso\core\domain\services\admin\ExitModal' => [ |
|
678 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
679 | + ], |
|
680 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => [ |
|
681 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
682 | + ], |
|
683 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
684 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
685 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
686 | + ], |
|
687 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => [ |
|
688 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
689 | + ], |
|
690 | + 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
691 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
692 | + 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
693 | + ], |
|
694 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
695 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
696 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
697 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
698 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
699 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
700 | + ], |
|
701 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelectorPostData' => [ |
|
702 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
703 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
704 | + ], |
|
705 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
706 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
707 | + ], |
|
708 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
709 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
710 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
711 | + ], |
|
712 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
713 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
714 | + ], |
|
715 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
716 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
717 | + ], |
|
718 | + 'EE_CPT_Strategy' => [ |
|
719 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
720 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
721 | + ], |
|
722 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
723 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
724 | + ], |
|
725 | + 'EventEspresso\core\domain\services\assets\CoreAssetManager' => [ |
|
726 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
727 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
728 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
729 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
730 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
731 | + ], |
|
732 | + 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => [ |
|
733 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
734 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
735 | + ], |
|
736 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => [ |
|
737 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
738 | + ], |
|
739 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => [ |
|
740 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
741 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
742 | + ], |
|
743 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => [ |
|
744 | + 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
745 | + ], |
|
746 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => [ |
|
747 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
748 | + ], |
|
749 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => [ |
|
750 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
751 | + ], |
|
752 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => [ |
|
753 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
754 | + ], |
|
755 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => [ |
|
756 | + 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
757 | + 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
758 | + ], |
|
759 | + 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
760 | + null, |
|
761 | + null, |
|
762 | + null, |
|
763 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
764 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
765 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
766 | + ], |
|
767 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => [ |
|
768 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
769 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
770 | + ], |
|
771 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' => [ |
|
772 | + 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
773 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
774 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
775 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
776 | + ], |
|
777 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => [ |
|
778 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
779 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
780 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
781 | + ], |
|
782 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => [ |
|
783 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
784 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
785 | + ], |
|
786 | + 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => [ |
|
787 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
788 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
789 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
790 | + ], |
|
791 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => [ |
|
792 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
793 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
794 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
795 | + ], |
|
796 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => [ |
|
797 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
798 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
799 | + ], |
|
800 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => [ |
|
801 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
802 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
803 | + ], |
|
804 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => [ |
|
805 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache, |
|
806 | + ], |
|
807 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => [ |
|
808 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
809 | + ], |
|
810 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => [ |
|
811 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache, |
|
812 | + ], |
|
813 | + 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => [ |
|
814 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
815 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
816 | + ], |
|
817 | + 'EventEspresso\core\libraries\rest_api\calculations\Event' => [ |
|
818 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
819 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
820 | + ], |
|
821 | + 'EventEspresso\core\libraries\rest_api\calculations\Registration' => [ |
|
822 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
823 | + ], |
|
824 | + 'EventEspresso\core\services\session\SessionStartHandler' => [ |
|
825 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
826 | + ], |
|
827 | + 'EE_URL_Validation_Strategy' => [ |
|
828 | + null, |
|
829 | + null, |
|
830 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
831 | + ], |
|
832 | + 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => [ |
|
833 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
834 | + 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
835 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
836 | + 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
837 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
838 | + ], |
|
839 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => [ |
|
840 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
841 | + 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache, |
|
842 | + ], |
|
843 | + 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => [ |
|
844 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
845 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
846 | + ], |
|
847 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => [ |
|
848 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
849 | + 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
850 | + ], |
|
851 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
852 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
853 | + ], |
|
854 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
855 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
856 | + ], |
|
857 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
858 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
859 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
860 | + null, |
|
861 | + ], |
|
862 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
863 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
864 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
865 | + ], |
|
866 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
867 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
868 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
869 | + ], |
|
870 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
871 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
872 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
873 | + ], |
|
874 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
875 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
876 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
877 | + ], |
|
878 | + 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
879 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
880 | + ], |
|
881 | + 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
882 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
883 | + ], |
|
884 | + 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
885 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
886 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
887 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
888 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
889 | + ], |
|
890 | + 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
891 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
892 | + ], |
|
893 | + 'EventEspresso\core\services\request\CurrentPage' => [ |
|
894 | + 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
895 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
896 | + ], |
|
897 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
898 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
899 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
900 | + ], |
|
901 | + 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
902 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
903 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
904 | + ], |
|
905 | + 'EE_Brewing_Regular' => [ |
|
906 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
907 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
908 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
909 | + ], |
|
910 | + ]; |
|
911 | + } |
|
912 | + |
|
913 | + |
|
914 | + /** |
|
915 | + * Registers how core classes are loaded. |
|
916 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
917 | + * 'EE_Request_Handler' => 'load_core' |
|
918 | + * 'EE_Messages_Queue' => 'load_lib' |
|
919 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
920 | + * or, if greater control is required, by providing a custom closure. For example: |
|
921 | + * 'Some_Class' => function () { |
|
922 | + * return new Some_Class(); |
|
923 | + * }, |
|
924 | + * This is required for instantiating dependencies |
|
925 | + * where an interface has been type hinted in a class constructor. For example: |
|
926 | + * 'Required_Interface' => function () { |
|
927 | + * return new A_Class_That_Implements_Required_Interface(); |
|
928 | + * }, |
|
929 | + */ |
|
930 | + protected function _register_core_class_loaders() |
|
931 | + { |
|
932 | + $this->_class_loaders = [ |
|
933 | + // load_core |
|
934 | + 'EE_Dependency_Map' => function () { |
|
935 | + return $this; |
|
936 | + }, |
|
937 | + 'EE_Capabilities' => 'load_core', |
|
938 | + 'EE_Encryption' => 'load_core', |
|
939 | + 'EE_Front_Controller' => 'load_core', |
|
940 | + 'EE_Module_Request_Router' => 'load_core', |
|
941 | + 'EE_Registry' => 'load_core', |
|
942 | + 'EE_Request' => function () { |
|
943 | + return $this->legacy_request; |
|
944 | + }, |
|
945 | + 'EventEspresso\core\services\request\Request' => function () { |
|
946 | + return $this->request; |
|
947 | + }, |
|
948 | + 'EventEspresso\core\services\request\Response' => function () { |
|
949 | + return $this->response; |
|
950 | + }, |
|
951 | + 'EE_Base' => 'load_core', |
|
952 | + 'EE_Request_Handler' => 'load_core', |
|
953 | + 'EE_Session' => 'load_core', |
|
954 | + 'EE_Cron_Tasks' => 'load_core', |
|
955 | + 'EE_System' => 'load_core', |
|
956 | + 'EE_Maintenance_Mode' => 'load_core', |
|
957 | + 'EE_Register_CPTs' => 'load_core', |
|
958 | + 'EE_Admin' => 'load_core', |
|
959 | + 'EE_CPT_Strategy' => 'load_core', |
|
960 | + // load_class |
|
961 | + 'EE_Registration_Processor' => 'load_class', |
|
962 | + // load_lib |
|
963 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
964 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
965 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
966 | + 'EE_Messenger_Collection' => 'load_lib', |
|
967 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
968 | + 'EE_Messages_Processor' => 'load_lib', |
|
969 | + 'EE_Message_Repository' => 'load_lib', |
|
970 | + 'EE_Messages_Queue' => 'load_lib', |
|
971 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
972 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
973 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
974 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
975 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
976 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
977 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
978 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
979 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
980 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
981 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
982 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
983 | + 'EE_Messages_Generator' => function () { |
|
984 | + return EE_Registry::instance()->load_lib( |
|
985 | + 'Messages_Generator', |
|
986 | + [], |
|
987 | + false, |
|
988 | + false |
|
989 | + ); |
|
990 | + }, |
|
991 | + 'EE_Messages_Template_Defaults' => function ($arguments = []) { |
|
992 | + return EE_Registry::instance()->load_lib( |
|
993 | + 'Messages_Template_Defaults', |
|
994 | + $arguments, |
|
995 | + false, |
|
996 | + false |
|
997 | + ); |
|
998 | + }, |
|
999 | + // load_helper |
|
1000 | + 'EEH_Parse_Shortcodes' => function () { |
|
1001 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
1002 | + return new EEH_Parse_Shortcodes(); |
|
1003 | + } |
|
1004 | + return null; |
|
1005 | + }, |
|
1006 | + 'EE_Template_Config' => function () { |
|
1007 | + return EE_Config::instance()->template_settings; |
|
1008 | + }, |
|
1009 | + 'EE_Currency_Config' => function () { |
|
1010 | + return EE_Config::instance()->currency; |
|
1011 | + }, |
|
1012 | + 'EE_Registration_Config' => function () { |
|
1013 | + return EE_Config::instance()->registration; |
|
1014 | + }, |
|
1015 | + 'EE_Core_Config' => function () { |
|
1016 | + return EE_Config::instance()->core; |
|
1017 | + }, |
|
1018 | + 'EventEspresso\core\services\loaders\Loader' => function () { |
|
1019 | + return LoaderFactory::getLoader(); |
|
1020 | + }, |
|
1021 | + 'EE_Network_Config' => function () { |
|
1022 | + return EE_Network_Config::instance(); |
|
1023 | + }, |
|
1024 | + 'EE_Config' => function () { |
|
1025 | + return EE_Config::instance(); |
|
1026 | + }, |
|
1027 | + 'EventEspresso\core\domain\Domain' => function () { |
|
1028 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
1029 | + }, |
|
1030 | + 'EE_Admin_Config' => function () { |
|
1031 | + return EE_Config::instance()->admin; |
|
1032 | + }, |
|
1033 | + 'EE_Organization_Config' => function () { |
|
1034 | + return EE_Config::instance()->organization; |
|
1035 | + }, |
|
1036 | + 'EE_Network_Core_Config' => function () { |
|
1037 | + return EE_Network_Config::instance()->core; |
|
1038 | + }, |
|
1039 | + 'EE_Environment_Config' => function () { |
|
1040 | + return EE_Config::instance()->environment; |
|
1041 | + }, |
|
1042 | + 'EE_Ticket_Selector_Config' => function () { |
|
1043 | + return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1044 | + }, |
|
1045 | + ]; |
|
1046 | + } |
|
1047 | + |
|
1048 | + |
|
1049 | + /** |
|
1050 | + * can be used for supplying alternate names for classes, |
|
1051 | + * or for connecting interface names to instantiable classes |
|
1052 | + */ |
|
1053 | + protected function _register_core_aliases() |
|
1054 | + { |
|
1055 | + $aliases = [ |
|
1056 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1057 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1058 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1059 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1060 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1061 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1062 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1063 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1064 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1065 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1066 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommand', |
|
1067 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1068 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1069 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1070 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1071 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommand', |
|
1072 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\domain\services\commands\transaction\CreateTransactionCommandHandler', |
|
1073 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1074 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1075 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1076 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1077 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1078 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1079 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1080 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1081 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1082 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1083 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1084 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1085 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1086 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1087 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1088 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1089 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1090 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1091 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1092 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1093 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
1094 | + ]; |
|
1095 | + foreach ($aliases as $alias => $fqn) { |
|
1096 | + if (is_array($fqn)) { |
|
1097 | + foreach ($fqn as $class => $for_class) { |
|
1098 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
1099 | + } |
|
1100 | + continue; |
|
1101 | + } |
|
1102 | + $this->class_cache->addAlias($fqn, $alias); |
|
1103 | + } |
|
1104 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1105 | + $this->class_cache->addAlias( |
|
1106 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1107 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1108 | + ); |
|
1109 | + } |
|
1110 | + } |
|
1111 | + |
|
1112 | + |
|
1113 | + public function debug($for_class = '') |
|
1114 | + { |
|
1115 | + $this->class_cache->debug($for_class); |
|
1116 | + } |
|
1117 | + |
|
1118 | + |
|
1119 | + /** |
|
1120 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1121 | + * request Primarily used by unit tests. |
|
1122 | + */ |
|
1123 | + public function reset() |
|
1124 | + { |
|
1125 | + $this->_register_core_class_loaders(); |
|
1126 | + $this->_register_core_dependencies(); |
|
1127 | + } |
|
1128 | + |
|
1129 | + |
|
1130 | + /** |
|
1131 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
1132 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
1133 | + * WHY? |
|
1134 | + * Because if a class is type hinting for a concretion, |
|
1135 | + * then why would we need to find another class to supply it? |
|
1136 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1137 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1138 | + * Don't go looking for some substitute. |
|
1139 | + * Whereas if a class is type hinting for an interface... |
|
1140 | + * then we need to find an actual class to use. |
|
1141 | + * So the interface IS the alias for some other FQN, |
|
1142 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1143 | + * represents some other class. |
|
1144 | + * |
|
1145 | + * @param string $fqn |
|
1146 | + * @param string $for_class |
|
1147 | + * @return bool |
|
1148 | + * @deprecated 4.9.62.p |
|
1149 | + */ |
|
1150 | + public function has_alias($fqn = '', $for_class = '') |
|
1151 | + { |
|
1152 | + return $this->isAlias($fqn, $for_class); |
|
1153 | + } |
|
1154 | + |
|
1155 | + |
|
1156 | + /** |
|
1157 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1158 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1159 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1160 | + * for example: |
|
1161 | + * if the following two entries were added to the _aliases array: |
|
1162 | + * array( |
|
1163 | + * 'interface_alias' => 'some\namespace\interface' |
|
1164 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
1165 | + * ) |
|
1166 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1167 | + * to load an instance of 'some\namespace\classname' |
|
1168 | + * |
|
1169 | + * @param string $alias |
|
1170 | + * @param string $for_class |
|
1171 | + * @return string |
|
1172 | + * @deprecated 4.9.62.p |
|
1173 | + */ |
|
1174 | + public function get_alias($alias = '', $for_class = '') |
|
1175 | + { |
|
1176 | + return $this->getFqnForAlias($alias, $for_class); |
|
1177 | + } |
|
1178 | 1178 | } |