@@ -18,225 +18,225 @@ |
||
18 | 18 | class EE_Recipient_List_Shortcodes extends EE_Shortcodes |
19 | 19 | { |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _init_props() |
|
28 | - { |
|
29 | - $this->label = __('Recipient List Shortcodes', 'event_espresso'); |
|
30 | - $this->description = __('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
31 | - $this->_shortcodes = array( |
|
32 | - '[RECIPIENT_TICKET_LIST]' => __( |
|
33 | - 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
34 | - 'event_espresso' |
|
35 | - ), |
|
36 | - '[RECIPIENT_DATETIME_LIST]' => __( |
|
37 | - 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - ); |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - protected function _parser($shortcode) |
|
45 | - { |
|
46 | - switch ($shortcode) { |
|
47 | - case '[RECIPIENT_TICKET_LIST]': |
|
48 | - return $this->_get_recipient_ticket_list(); |
|
49 | - break; |
|
50 | - |
|
51 | - case '[RECIPIENT_DATETIME_LIST]': |
|
52 | - return $this->_get_recipient_datetime_list(); |
|
53 | - break; |
|
54 | - } |
|
55 | - return ''; |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
61 | - * |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - private function _get_recipient_ticket_list() |
|
65 | - { |
|
66 | - $this->_validate_list_requirements(); |
|
67 | - |
|
68 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
69 | - return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
70 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
71 | - return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
72 | - } else { |
|
73 | - return ''; |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
79 | - { |
|
80 | - // first get registrations just for this attendee. |
|
81 | - $att = $data->att_obj; |
|
82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
83 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
84 | - ? array($data->reg_obj) : $registrations_on_attendee; |
|
85 | - $tkts = array(); |
|
86 | - |
|
87 | - // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
88 | - // which means we want to get tickets for all events this addressee is a part of. |
|
89 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
90 | - $valid_shortcodes = array( |
|
91 | - 'ticket', |
|
92 | - 'event_list', |
|
93 | - 'attendee_list', |
|
94 | - 'datetime_list', |
|
95 | - 'registration_details', |
|
96 | - 'attendee', |
|
97 | - 'recipient_details', |
|
98 | - ); |
|
99 | - $template = $this->_data['template']; |
|
100 | - |
|
101 | - // tickets will be tickets for all registrations on this attendee. |
|
102 | - foreach ($registrations_on_attendee as $reg) { |
|
103 | - if ($reg instanceof EE_Registration) { |
|
104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | - $data->registrations[ $reg->ID() ] |
|
106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | - ) ]['tkt_obj'] : null; |
|
108 | - if ($ticket instanceof EE_Ticket) { |
|
109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
110 | - } |
|
111 | - } |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
116 | - $event = $this->_data['data']; |
|
117 | - if ($event instanceof EE_Event) { |
|
118 | - $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
119 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
120 | - ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
121 | - // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
122 | - $template = str_replace('[EVENT_LIST]', '', $template); |
|
123 | - // data will be tickets for this event for this recipient. |
|
124 | - foreach ($registrations_on_attendee as $reg) { |
|
125 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | - $data->registrations[ $reg->ID() ] |
|
128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | - ) ]['tkt_obj'] : null; |
|
130 | - if ($ticket instanceof EE_Ticket) { |
|
131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
132 | - } |
|
133 | - } |
|
134 | - } |
|
135 | - } |
|
136 | - |
|
137 | - $tkt_parsed = ''; |
|
138 | - foreach ($tkts as $ticket) { |
|
139 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
140 | - $template, |
|
141 | - $ticket, |
|
142 | - $valid_shortcodes, |
|
143 | - $this->_extra_data |
|
144 | - ); |
|
145 | - } |
|
146 | - return $tkt_parsed; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
152 | - * |
|
153 | - * @return string |
|
154 | - */ |
|
155 | - private function _get_recipient_datetime_list() |
|
156 | - { |
|
157 | - $this->_validate_list_requirements(); |
|
158 | - |
|
159 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
160 | - return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
161 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
162 | - return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
163 | - } else { |
|
164 | - return ''; |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - |
|
169 | - private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
170 | - { |
|
171 | - // first get registrations just for this attendee. |
|
172 | - $att = $data->att_obj; |
|
173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
174 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
175 | - ? array($data->reg_obj) |
|
176 | - : $registrations_on_attendee; |
|
177 | - $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
178 | - $template = ''; |
|
179 | - $dtts = array(); |
|
180 | - |
|
181 | - // setup valid shortcodes depending on what the status of the $this->_data property is |
|
182 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
183 | - $template = $this->_data['template']; |
|
184 | - |
|
185 | - // dtts will be datetimes for all registrations on this attendee |
|
186 | - foreach ($registrations_on_attendee as $reg) { |
|
187 | - if ($reg instanceof EE_Registration) { |
|
188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | - $data->registrations[ $reg->ID() ] |
|
190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | - ) ]['dtt_objs'] : array(); |
|
192 | - $dtt_objs = (array) $dtt_objs; |
|
193 | - foreach ($dtt_objs as $dtt_obj) { |
|
194 | - if ($dtt_obj instanceof EE_Datetime) { |
|
195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
196 | - } |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - } |
|
201 | - |
|
202 | - // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
203 | - $event = $this->_data['data']; |
|
204 | - if ($event instanceof EE_Event) { |
|
205 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
206 | - ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
207 | - |
|
208 | - // data will be datetimes for this event for this recipient |
|
209 | - foreach ($registrations_on_attendee as $reg) { |
|
210 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | - $data->registrations[ $reg->ID() ] |
|
213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | - ) ]['tkt_obj'] : null; |
|
215 | - if ($ticket instanceof EE_Ticket) { |
|
216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | - $data->tickets[ $ticket->ID() ] |
|
218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | - ) ]['dtt_objs'] : array(); |
|
220 | - $dtt_objs = (array) $dtt_objs; |
|
221 | - foreach ($dtt_objs as $dtt_obj) { |
|
222 | - if ($dtt_obj instanceof EE_Datetime) { |
|
223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
224 | - } |
|
225 | - } |
|
226 | - } |
|
227 | - } |
|
228 | - } |
|
229 | - } |
|
230 | - |
|
231 | - $dtt_parsed = ''; |
|
232 | - foreach ($dtts as $datetime) { |
|
233 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
234 | - $template, |
|
235 | - $datetime, |
|
236 | - $valid_shortcodes, |
|
237 | - $this->_extra_data |
|
238 | - ); |
|
239 | - } |
|
240 | - return $dtt_parsed; |
|
241 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _init_props() |
|
28 | + { |
|
29 | + $this->label = __('Recipient List Shortcodes', 'event_espresso'); |
|
30 | + $this->description = __('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
31 | + $this->_shortcodes = array( |
|
32 | + '[RECIPIENT_TICKET_LIST]' => __( |
|
33 | + 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
34 | + 'event_espresso' |
|
35 | + ), |
|
36 | + '[RECIPIENT_DATETIME_LIST]' => __( |
|
37 | + 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + ); |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + protected function _parser($shortcode) |
|
45 | + { |
|
46 | + switch ($shortcode) { |
|
47 | + case '[RECIPIENT_TICKET_LIST]': |
|
48 | + return $this->_get_recipient_ticket_list(); |
|
49 | + break; |
|
50 | + |
|
51 | + case '[RECIPIENT_DATETIME_LIST]': |
|
52 | + return $this->_get_recipient_datetime_list(); |
|
53 | + break; |
|
54 | + } |
|
55 | + return ''; |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
61 | + * |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + private function _get_recipient_ticket_list() |
|
65 | + { |
|
66 | + $this->_validate_list_requirements(); |
|
67 | + |
|
68 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
69 | + return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
70 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
71 | + return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
72 | + } else { |
|
73 | + return ''; |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
79 | + { |
|
80 | + // first get registrations just for this attendee. |
|
81 | + $att = $data->att_obj; |
|
82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
83 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
84 | + ? array($data->reg_obj) : $registrations_on_attendee; |
|
85 | + $tkts = array(); |
|
86 | + |
|
87 | + // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
88 | + // which means we want to get tickets for all events this addressee is a part of. |
|
89 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
90 | + $valid_shortcodes = array( |
|
91 | + 'ticket', |
|
92 | + 'event_list', |
|
93 | + 'attendee_list', |
|
94 | + 'datetime_list', |
|
95 | + 'registration_details', |
|
96 | + 'attendee', |
|
97 | + 'recipient_details', |
|
98 | + ); |
|
99 | + $template = $this->_data['template']; |
|
100 | + |
|
101 | + // tickets will be tickets for all registrations on this attendee. |
|
102 | + foreach ($registrations_on_attendee as $reg) { |
|
103 | + if ($reg instanceof EE_Registration) { |
|
104 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | + $data->registrations[ $reg->ID() ] |
|
106 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | + ) ]['tkt_obj'] : null; |
|
108 | + if ($ticket instanceof EE_Ticket) { |
|
109 | + $tkts[ $ticket->ID() ] = $ticket; |
|
110 | + } |
|
111 | + } |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
116 | + $event = $this->_data['data']; |
|
117 | + if ($event instanceof EE_Event) { |
|
118 | + $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
119 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
120 | + ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
121 | + // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
122 | + $template = str_replace('[EVENT_LIST]', '', $template); |
|
123 | + // data will be tickets for this event for this recipient. |
|
124 | + foreach ($registrations_on_attendee as $reg) { |
|
125 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
126 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | + $data->registrations[ $reg->ID() ] |
|
128 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | + ) ]['tkt_obj'] : null; |
|
130 | + if ($ticket instanceof EE_Ticket) { |
|
131 | + $tkts[ $ticket->ID() ] = $ticket; |
|
132 | + } |
|
133 | + } |
|
134 | + } |
|
135 | + } |
|
136 | + |
|
137 | + $tkt_parsed = ''; |
|
138 | + foreach ($tkts as $ticket) { |
|
139 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
140 | + $template, |
|
141 | + $ticket, |
|
142 | + $valid_shortcodes, |
|
143 | + $this->_extra_data |
|
144 | + ); |
|
145 | + } |
|
146 | + return $tkt_parsed; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
152 | + * |
|
153 | + * @return string |
|
154 | + */ |
|
155 | + private function _get_recipient_datetime_list() |
|
156 | + { |
|
157 | + $this->_validate_list_requirements(); |
|
158 | + |
|
159 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
160 | + return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
161 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
162 | + return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
163 | + } else { |
|
164 | + return ''; |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + |
|
169 | + private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
170 | + { |
|
171 | + // first get registrations just for this attendee. |
|
172 | + $att = $data->att_obj; |
|
173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
174 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
175 | + ? array($data->reg_obj) |
|
176 | + : $registrations_on_attendee; |
|
177 | + $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
178 | + $template = ''; |
|
179 | + $dtts = array(); |
|
180 | + |
|
181 | + // setup valid shortcodes depending on what the status of the $this->_data property is |
|
182 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
183 | + $template = $this->_data['template']; |
|
184 | + |
|
185 | + // dtts will be datetimes for all registrations on this attendee |
|
186 | + foreach ($registrations_on_attendee as $reg) { |
|
187 | + if ($reg instanceof EE_Registration) { |
|
188 | + $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | + $data->registrations[ $reg->ID() ] |
|
190 | + ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | + ) ]['dtt_objs'] : array(); |
|
192 | + $dtt_objs = (array) $dtt_objs; |
|
193 | + foreach ($dtt_objs as $dtt_obj) { |
|
194 | + if ($dtt_obj instanceof EE_Datetime) { |
|
195 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
196 | + } |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | + |
|
202 | + // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
203 | + $event = $this->_data['data']; |
|
204 | + if ($event instanceof EE_Event) { |
|
205 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
206 | + ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
207 | + |
|
208 | + // data will be datetimes for this event for this recipient |
|
209 | + foreach ($registrations_on_attendee as $reg) { |
|
210 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
211 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | + $data->registrations[ $reg->ID() ] |
|
213 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | + ) ]['tkt_obj'] : null; |
|
215 | + if ($ticket instanceof EE_Ticket) { |
|
216 | + $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | + $data->tickets[ $ticket->ID() ] |
|
218 | + ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | + ) ]['dtt_objs'] : array(); |
|
220 | + $dtt_objs = (array) $dtt_objs; |
|
221 | + foreach ($dtt_objs as $dtt_obj) { |
|
222 | + if ($dtt_obj instanceof EE_Datetime) { |
|
223 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
224 | + } |
|
225 | + } |
|
226 | + } |
|
227 | + } |
|
228 | + } |
|
229 | + } |
|
230 | + |
|
231 | + $dtt_parsed = ''; |
|
232 | + foreach ($dtts as $datetime) { |
|
233 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
234 | + $template, |
|
235 | + $datetime, |
|
236 | + $valid_shortcodes, |
|
237 | + $this->_extra_data |
|
238 | + ); |
|
239 | + } |
|
240 | + return $dtt_parsed; |
|
241 | + } |
|
242 | 242 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | // first get registrations just for this attendee. |
81 | 81 | $att = $data->att_obj; |
82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
83 | 83 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
84 | 84 | ? array($data->reg_obj) : $registrations_on_attendee; |
85 | 85 | $tkts = array(); |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | // tickets will be tickets for all registrations on this attendee. |
102 | 102 | foreach ($registrations_on_attendee as $reg) { |
103 | 103 | if ($reg instanceof EE_Registration) { |
104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | - $data->registrations[ $reg->ID() ] |
|
106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | - ) ]['tkt_obj'] : null; |
|
104 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
105 | + $data->registrations[$reg->ID()] |
|
106 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
107 | + )]['tkt_obj'] : null; |
|
108 | 108 | if ($ticket instanceof EE_Ticket) { |
109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
109 | + $tkts[$ticket->ID()] = $ticket; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | // data will be tickets for this event for this recipient. |
124 | 124 | foreach ($registrations_on_attendee as $reg) { |
125 | 125 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | - $data->registrations[ $reg->ID() ] |
|
128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | - ) ]['tkt_obj'] : null; |
|
126 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
127 | + $data->registrations[$reg->ID()] |
|
128 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
129 | + )]['tkt_obj'] : null; |
|
130 | 130 | if ($ticket instanceof EE_Ticket) { |
131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
131 | + $tkts[$ticket->ID()] = $ticket; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | // first get registrations just for this attendee. |
172 | 172 | $att = $data->att_obj; |
173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
174 | 174 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
175 | 175 | ? array($data->reg_obj) |
176 | 176 | : $registrations_on_attendee; |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | // dtts will be datetimes for all registrations on this attendee |
186 | 186 | foreach ($registrations_on_attendee as $reg) { |
187 | 187 | if ($reg instanceof EE_Registration) { |
188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | - $data->registrations[ $reg->ID() ] |
|
190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | - ) ]['dtt_objs'] : array(); |
|
188 | + $dtt_objs = isset($data->registrations[$reg->ID()]) && is_array( |
|
189 | + $data->registrations[$reg->ID()] |
|
190 | + ) && isset($data->registrations[$reg->ID()]['dtt_objs']) ? $data->registrations[$reg->ID( |
|
191 | + )]['dtt_objs'] : array(); |
|
192 | 192 | $dtt_objs = (array) $dtt_objs; |
193 | 193 | foreach ($dtt_objs as $dtt_obj) { |
194 | 194 | if ($dtt_obj instanceof EE_Datetime) { |
195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
195 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | // data will be datetimes for this event for this recipient |
209 | 209 | foreach ($registrations_on_attendee as $reg) { |
210 | 210 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | - $data->registrations[ $reg->ID() ] |
|
213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | - ) ]['tkt_obj'] : null; |
|
211 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
212 | + $data->registrations[$reg->ID()] |
|
213 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
214 | + )]['tkt_obj'] : null; |
|
215 | 215 | if ($ticket instanceof EE_Ticket) { |
216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | - $data->tickets[ $ticket->ID() ] |
|
218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | - ) ]['dtt_objs'] : array(); |
|
216 | + $dtt_objs = isset($data->tickets[$ticket->ID()]) && is_array( |
|
217 | + $data->tickets[$ticket->ID()] |
|
218 | + ) && isset($data->tickets[$ticket->ID()]['dtt_objs']) ? $data->tickets[$ticket->ID( |
|
219 | + )]['dtt_objs'] : array(); |
|
220 | 220 | $dtt_objs = (array) $dtt_objs; |
221 | 221 | foreach ($dtt_objs as $dtt_obj) { |
222 | 222 | if ($dtt_obj instanceof EE_Datetime) { |
223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
223 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $text .= '<span class="drk-grey-text">'; |
71 | 71 | $text .= '<span class="dashicons dashicons-calendar"></span>'; |
72 | 72 | $text .= $datetime->name(); |
73 | - $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
73 | + $text .= ' ( '.$datetime->start_date().' )'; |
|
74 | 74 | $text .= '</span></h3>'; |
75 | 75 | } |
76 | 76 | } |
@@ -23,58 +23,58 @@ |
||
23 | 23 | class DateFilterHeader extends AdminPageHeaderDecorator |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var EEM_Datetime $datetime_model |
|
28 | - */ |
|
29 | - private $datetime_model; |
|
26 | + /** |
|
27 | + * @var EEM_Datetime $datetime_model |
|
28 | + */ |
|
29 | + private $datetime_model; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * DateFilterHeader constructor. |
|
34 | - * |
|
35 | - * @param RequestInterface $request |
|
36 | - * @param EEM_Datetime $datetime_model |
|
37 | - */ |
|
38 | - public function __construct(RequestInterface $request, EEM_Datetime $datetime_model) |
|
39 | - { |
|
40 | - parent::__construct($request); |
|
41 | - $this->datetime_model = $datetime_model; |
|
42 | - } |
|
32 | + /** |
|
33 | + * DateFilterHeader constructor. |
|
34 | + * |
|
35 | + * @param RequestInterface $request |
|
36 | + * @param EEM_Datetime $datetime_model |
|
37 | + */ |
|
38 | + public function __construct(RequestInterface $request, EEM_Datetime $datetime_model) |
|
39 | + { |
|
40 | + parent::__construct($request); |
|
41 | + $this->datetime_model = $datetime_model; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @param string $text |
|
47 | - * @return string |
|
48 | - * @throws EE_Error |
|
49 | - * @throws InvalidDataTypeException |
|
50 | - * @throws InvalidInterfaceException |
|
51 | - * @throws InvalidArgumentException |
|
52 | - * @throws ReflectionException |
|
53 | - * @since 4.10.2.p |
|
54 | - */ |
|
55 | - public function getHeaderText($text = '') |
|
56 | - { |
|
57 | - $DTT_ID = $this->request->getRequestParam('DTT_ID'); |
|
58 | - $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID); |
|
59 | - $DTT_ID = absint($DTT_ID); |
|
60 | - if ($DTT_ID) { |
|
61 | - $datetime = $this->datetime_model->get_one_by_ID($DTT_ID); |
|
62 | - if ($datetime instanceof EE_Datetime && $text !== '') { |
|
63 | - // remove the closing h3 heading tag if it exists |
|
64 | - $text = str_replace( |
|
65 | - '</h3>', |
|
66 | - '', |
|
67 | - $text |
|
68 | - ); |
|
69 | - $text .= ' '; |
|
70 | - $text .= '<span class="drk-grey-text">'; |
|
71 | - $text .= '<span class="dashicons dashicons-calendar"></span>'; |
|
72 | - $text .= $datetime->name(); |
|
73 | - $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
74 | - $text .= '</span></h3>'; |
|
75 | - } |
|
76 | - } |
|
45 | + /** |
|
46 | + * @param string $text |
|
47 | + * @return string |
|
48 | + * @throws EE_Error |
|
49 | + * @throws InvalidDataTypeException |
|
50 | + * @throws InvalidInterfaceException |
|
51 | + * @throws InvalidArgumentException |
|
52 | + * @throws ReflectionException |
|
53 | + * @since 4.10.2.p |
|
54 | + */ |
|
55 | + public function getHeaderText($text = '') |
|
56 | + { |
|
57 | + $DTT_ID = $this->request->getRequestParam('DTT_ID'); |
|
58 | + $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID); |
|
59 | + $DTT_ID = absint($DTT_ID); |
|
60 | + if ($DTT_ID) { |
|
61 | + $datetime = $this->datetime_model->get_one_by_ID($DTT_ID); |
|
62 | + if ($datetime instanceof EE_Datetime && $text !== '') { |
|
63 | + // remove the closing h3 heading tag if it exists |
|
64 | + $text = str_replace( |
|
65 | + '</h3>', |
|
66 | + '', |
|
67 | + $text |
|
68 | + ); |
|
69 | + $text .= ' '; |
|
70 | + $text .= '<span class="drk-grey-text">'; |
|
71 | + $text .= '<span class="dashicons dashicons-calendar"></span>'; |
|
72 | + $text .= $datetime->name(); |
|
73 | + $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
74 | + $text .= '</span></h3>'; |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - return $text; |
|
79 | - } |
|
78 | + return $text; |
|
79 | + } |
|
80 | 80 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | if ($TKT_ID) { |
61 | 61 | $ticket = $this->ticket_model->get_one_by_ID($TKT_ID); |
62 | 62 | if ($ticket instanceof EE_Ticket) { |
63 | - $ticket_details = '<span class="ee-ticket-name">' . $ticket->name() . '</span> '; |
|
63 | + $ticket_details = '<span class="ee-ticket-name">'.$ticket->name().'</span> '; |
|
64 | 64 | $ticket_details .= ! $ticket->is_free() |
65 | - ? '<span class="ee-ticket-price">' . $ticket->pretty_price() . '</span>' |
|
65 | + ? '<span class="ee-ticket-price">'.$ticket->pretty_price().'</span>' |
|
66 | 66 | : '<span class="reg-overview-free-event-spn">' |
67 | 67 | . __('free', 'event_espresso') |
68 | 68 | . '</span>'; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $text .= ' '; |
81 | 81 | $text .= '<span class="drk-grey-text" style="font-size:.9em;">'; |
82 | 82 | $text .= '<span class="dashicons dashicons-tickets-alt"></span>'; |
83 | - $text .= $ticket_details . '</span></h3>'; |
|
83 | + $text .= $ticket_details.'</span></h3>'; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | return $text; |
@@ -23,65 +23,65 @@ |
||
23 | 23 | class TicketFilterHeader extends AdminPageHeaderDecorator |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var EEM_Ticket $ticket_model |
|
28 | - */ |
|
29 | - private $ticket_model; |
|
26 | + /** |
|
27 | + * @var EEM_Ticket $ticket_model |
|
28 | + */ |
|
29 | + private $ticket_model; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * TicketFilterHeader constructor. |
|
34 | - * |
|
35 | - * @param RequestInterface $request |
|
36 | - * @param EEM_Ticket $ticket_model |
|
37 | - */ |
|
38 | - public function __construct(RequestInterface $request, EEM_Ticket $ticket_model) |
|
39 | - { |
|
40 | - parent::__construct($request); |
|
41 | - $this->ticket_model = $ticket_model; |
|
42 | - } |
|
32 | + /** |
|
33 | + * TicketFilterHeader constructor. |
|
34 | + * |
|
35 | + * @param RequestInterface $request |
|
36 | + * @param EEM_Ticket $ticket_model |
|
37 | + */ |
|
38 | + public function __construct(RequestInterface $request, EEM_Ticket $ticket_model) |
|
39 | + { |
|
40 | + parent::__construct($request); |
|
41 | + $this->ticket_model = $ticket_model; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @param string $text |
|
47 | - * @return string |
|
48 | - * @throws EE_Error |
|
49 | - * @throws InvalidDataTypeException |
|
50 | - * @throws InvalidInterfaceException |
|
51 | - * @throws InvalidArgumentException |
|
52 | - * @throws ReflectionException |
|
53 | - * @since 4.10.2.p |
|
54 | - */ |
|
55 | - public function getHeaderText($text = '') |
|
56 | - { |
|
57 | - $TKT_ID = $this->request->getRequestParam('TKT_ID'); |
|
58 | - $TKT_ID = $this->request->getRequestParam('ticket_id', $TKT_ID); |
|
59 | - $TKT_ID = absint($TKT_ID); |
|
60 | - if ($TKT_ID) { |
|
61 | - $ticket = $this->ticket_model->get_one_by_ID($TKT_ID); |
|
62 | - if ($ticket instanceof EE_Ticket) { |
|
63 | - $ticket_details = '<span class="ee-ticket-name">' . $ticket->name() . '</span> '; |
|
64 | - $ticket_details .= ! $ticket->is_free() |
|
65 | - ? '<span class="ee-ticket-price">' . $ticket->pretty_price() . '</span>' |
|
66 | - : '<span class="reg-overview-free-event-spn">' |
|
67 | - . __('free', 'event_espresso') |
|
68 | - . '</span>'; |
|
69 | - // remove the closing h3 heading tag if it exists |
|
70 | - $text = str_replace( |
|
71 | - '</h3>', |
|
72 | - '', |
|
73 | - $text |
|
74 | - ); |
|
75 | - if (empty($text)) { |
|
76 | - $text = '<h3 style="line-height:1.5em;">'; |
|
77 | - $text .= esc_html__('Viewing registrations for ticket:', 'event_espresso'); |
|
78 | - } |
|
79 | - $text .= ' '; |
|
80 | - $text .= '<span class="drk-grey-text" style="font-size:.9em;">'; |
|
81 | - $text .= '<span class="dashicons dashicons-tickets-alt"></span>'; |
|
82 | - $text .= $ticket_details . '</span></h3>'; |
|
83 | - } |
|
84 | - } |
|
85 | - return $text; |
|
86 | - } |
|
45 | + /** |
|
46 | + * @param string $text |
|
47 | + * @return string |
|
48 | + * @throws EE_Error |
|
49 | + * @throws InvalidDataTypeException |
|
50 | + * @throws InvalidInterfaceException |
|
51 | + * @throws InvalidArgumentException |
|
52 | + * @throws ReflectionException |
|
53 | + * @since 4.10.2.p |
|
54 | + */ |
|
55 | + public function getHeaderText($text = '') |
|
56 | + { |
|
57 | + $TKT_ID = $this->request->getRequestParam('TKT_ID'); |
|
58 | + $TKT_ID = $this->request->getRequestParam('ticket_id', $TKT_ID); |
|
59 | + $TKT_ID = absint($TKT_ID); |
|
60 | + if ($TKT_ID) { |
|
61 | + $ticket = $this->ticket_model->get_one_by_ID($TKT_ID); |
|
62 | + if ($ticket instanceof EE_Ticket) { |
|
63 | + $ticket_details = '<span class="ee-ticket-name">' . $ticket->name() . '</span> '; |
|
64 | + $ticket_details .= ! $ticket->is_free() |
|
65 | + ? '<span class="ee-ticket-price">' . $ticket->pretty_price() . '</span>' |
|
66 | + : '<span class="reg-overview-free-event-spn">' |
|
67 | + . __('free', 'event_espresso') |
|
68 | + . '</span>'; |
|
69 | + // remove the closing h3 heading tag if it exists |
|
70 | + $text = str_replace( |
|
71 | + '</h3>', |
|
72 | + '', |
|
73 | + $text |
|
74 | + ); |
|
75 | + if (empty($text)) { |
|
76 | + $text = '<h3 style="line-height:1.5em;">'; |
|
77 | + $text .= esc_html__('Viewing registrations for ticket:', 'event_espresso'); |
|
78 | + } |
|
79 | + $text .= ' '; |
|
80 | + $text .= '<span class="drk-grey-text" style="font-size:.9em;">'; |
|
81 | + $text .= '<span class="dashicons dashicons-tickets-alt"></span>'; |
|
82 | + $text .= $ticket_details . '</span></h3>'; |
|
83 | + } |
|
84 | + } |
|
85 | + return $text; |
|
86 | + } |
|
87 | 87 | } |
@@ -59,13 +59,13 @@ |
||
59 | 59 | 'event_espresso' |
60 | 60 | ), |
61 | 61 | '<h3 style="line-height:1.5em;">', |
62 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
62 | + '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
63 | 63 | array( |
64 | 64 | 'action' => 'edit_attendee', |
65 | 65 | 'post' => $ATT_ID, |
66 | 66 | ), |
67 | 67 | REG_ADMIN_URL |
68 | - ) . '">' . $attendee->full_name() . '</a>', |
|
68 | + ).'">'.$attendee->full_name().'</a>', |
|
69 | 69 | '</h3>' |
70 | 70 | ); |
71 | 71 | } |
@@ -20,56 +20,56 @@ |
||
20 | 20 | class AttendeeFilterHeader extends AdminPageHeaderDecorator |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var EEM_Attendee $attendee_model |
|
25 | - */ |
|
26 | - private $attendee_model; |
|
23 | + /** |
|
24 | + * @var EEM_Attendee $attendee_model |
|
25 | + */ |
|
26 | + private $attendee_model; |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * AttendeeFilterHeader constructor. |
|
31 | - * |
|
32 | - * @param RequestInterface $request |
|
33 | - * @param EEM_Attendee $attendee_model |
|
34 | - */ |
|
35 | - public function __construct(RequestInterface $request, EEM_Attendee $attendee_model) |
|
36 | - { |
|
37 | - parent::__construct($request); |
|
38 | - $this->attendee_model = $attendee_model; |
|
39 | - } |
|
29 | + /** |
|
30 | + * AttendeeFilterHeader constructor. |
|
31 | + * |
|
32 | + * @param RequestInterface $request |
|
33 | + * @param EEM_Attendee $attendee_model |
|
34 | + */ |
|
35 | + public function __construct(RequestInterface $request, EEM_Attendee $attendee_model) |
|
36 | + { |
|
37 | + parent::__construct($request); |
|
38 | + $this->attendee_model = $attendee_model; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | - /** |
|
43 | - * @param string $text |
|
44 | - * @return string |
|
45 | - * @throws EE_Error |
|
46 | - * @since 4.10.2.p |
|
47 | - */ |
|
48 | - public function getHeaderText($text = '') |
|
49 | - { |
|
50 | - $ATT_ID = $this->request->getRequestParam('ATT_ID'); |
|
51 | - $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID); |
|
52 | - $ATT_ID = absint($ATT_ID); |
|
53 | - if ($ATT_ID) { |
|
54 | - $attendee = $this->attendee_model->get_one_by_ID($ATT_ID); |
|
55 | - if ($attendee instanceof EE_Attendee) { |
|
56 | - $text .= sprintf( |
|
57 | - esc_html__( |
|
58 | - '%1$s Viewing registrations for %2$s%3$s', |
|
59 | - 'event_espresso' |
|
60 | - ), |
|
61 | - '<h3 style="line-height:1.5em;">', |
|
62 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
63 | - array( |
|
64 | - 'action' => 'edit_attendee', |
|
65 | - 'post' => $ATT_ID, |
|
66 | - ), |
|
67 | - REG_ADMIN_URL |
|
68 | - ) . '">' . $attendee->full_name() . '</a>', |
|
69 | - '</h3>' |
|
70 | - ); |
|
71 | - } |
|
72 | - } |
|
73 | - return $text; |
|
74 | - } |
|
42 | + /** |
|
43 | + * @param string $text |
|
44 | + * @return string |
|
45 | + * @throws EE_Error |
|
46 | + * @since 4.10.2.p |
|
47 | + */ |
|
48 | + public function getHeaderText($text = '') |
|
49 | + { |
|
50 | + $ATT_ID = $this->request->getRequestParam('ATT_ID'); |
|
51 | + $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID); |
|
52 | + $ATT_ID = absint($ATT_ID); |
|
53 | + if ($ATT_ID) { |
|
54 | + $attendee = $this->attendee_model->get_one_by_ID($ATT_ID); |
|
55 | + if ($attendee instanceof EE_Attendee) { |
|
56 | + $text .= sprintf( |
|
57 | + esc_html__( |
|
58 | + '%1$s Viewing registrations for %2$s%3$s', |
|
59 | + 'event_espresso' |
|
60 | + ), |
|
61 | + '<h3 style="line-height:1.5em;">', |
|
62 | + '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
63 | + array( |
|
64 | + 'action' => 'edit_attendee', |
|
65 | + 'post' => $ATT_ID, |
|
66 | + ), |
|
67 | + REG_ADMIN_URL |
|
68 | + ) . '">' . $attendee->full_name() . '</a>', |
|
69 | + '</h3>' |
|
70 | + ); |
|
71 | + } |
|
72 | + } |
|
73 | + return $text; |
|
74 | + } |
|
75 | 75 | } |
@@ -46,40 +46,40 @@ discard block |
||
46 | 46 | ? (string) $input->html_id() |
47 | 47 | : spl_object_hash($input); |
48 | 48 | // and add a generic input type class |
49 | - $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv'; |
|
49 | + $html_class = sanitize_key(str_replace('_', '-', get_class($input))).'-dv'; |
|
50 | 50 | if ($input instanceof EE_Hidden_Input) { |
51 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
51 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
52 | 52 | } elseif ($input instanceof EE_Submit_Input) { |
53 | 53 | $html .= EEH_HTML::div( |
54 | 54 | $input->get_html_for_input(), |
55 | - $html_id . '-submit-dv', |
|
55 | + $html_id.'-submit-dv', |
|
56 | 56 | "{$input->html_class()}-submit-dv {$html_class}" |
57 | 57 | ); |
58 | 58 | } elseif ($input instanceof EE_Select_Input) { |
59 | 59 | $html .= EEH_HTML::div( |
60 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
61 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
62 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
63 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
64 | - $html_id . '-input-dv', |
|
60 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
61 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
62 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
63 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
64 | + $html_id.'-input-dv', |
|
65 | 65 | "{$input->html_class()}-input-dv {$html_class}" |
66 | 66 | ); |
67 | 67 | } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
68 | 68 | $html .= EEH_HTML::div( |
69 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . |
|
70 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
71 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
72 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
73 | - $html_id . '-input-dv', |
|
69 | + EEH_HTML::nl().$this->_display_label_for_option_type_question($input). |
|
70 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
71 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
72 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
73 | + $html_id.'-input-dv', |
|
74 | 74 | "{$input->html_class()}-input-dv {$html_class}" |
75 | 75 | ); |
76 | 76 | } else { |
77 | 77 | $html .= EEH_HTML::div( |
78 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
79 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
80 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
81 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
82 | - $html_id . '-input-dv', |
|
78 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
79 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
80 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
81 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
82 | + $html_id.'-input-dv', |
|
83 | 83 | "{$input->html_class()}-input-dv {$html_class}" |
84 | 84 | ); |
85 | 85 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | $html_label_text = $input->html_label_text(); |
104 | 104 | $label_html = EEH_HTML::div( |
105 | 105 | $input->required() |
106 | - ? $html_label_text . EEH_HTML::span('*', '', 'ee-asterisk') |
|
106 | + ? $html_label_text.EEH_HTML::span('*', '', 'ee-asterisk') |
|
107 | 107 | : $html_label_text, |
108 | 108 | $input->html_label_id(), |
109 | 109 | $input->required() |
110 | - ? 'ee-required-label ' . $input->html_label_class() |
|
110 | + ? 'ee-required-label '.$input->html_label_class() |
|
111 | 111 | : $input->html_label_class(), |
112 | 112 | $input->html_label_style(), |
113 | 113 | $input->other_html_attributes() |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function layout_subsection($form_section) |
134 | 134 | { |
135 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
135 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 |
@@ -12,136 +12,136 @@ |
||
12 | 12 | class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * opening div tag for a form |
|
17 | - * |
|
18 | - * @return string |
|
19 | - */ |
|
20 | - public function layout_form_begin() |
|
21 | - { |
|
22 | - return EEH_HTML::div( |
|
23 | - '', |
|
24 | - $this->_form_section->html_id(), |
|
25 | - $this->_form_section->html_class(), |
|
26 | - $this->_form_section->html_style() |
|
27 | - ); |
|
28 | - } |
|
15 | + /** |
|
16 | + * opening div tag for a form |
|
17 | + * |
|
18 | + * @return string |
|
19 | + */ |
|
20 | + public function layout_form_begin() |
|
21 | + { |
|
22 | + return EEH_HTML::div( |
|
23 | + '', |
|
24 | + $this->_form_section->html_id(), |
|
25 | + $this->_form_section->html_class(), |
|
26 | + $this->_form_section->html_style() |
|
27 | + ); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * Lays out the row for the input, including label and errors |
|
34 | - * |
|
35 | - * @param EE_Form_Input_Base $input |
|
36 | - * @return string |
|
37 | - * @throws \EE_Error |
|
38 | - */ |
|
39 | - public function layout_input($input) |
|
40 | - { |
|
41 | - $html = ''; |
|
42 | - // set something unique for the id |
|
43 | - $html_id = (string) $input->html_id() !== '' |
|
44 | - ? (string) $input->html_id() |
|
45 | - : spl_object_hash($input); |
|
46 | - // and add a generic input type class |
|
47 | - $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv'; |
|
48 | - if ($input instanceof EE_Hidden_Input) { |
|
49 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
50 | - } elseif ($input instanceof EE_Submit_Input) { |
|
51 | - $html .= EEH_HTML::div( |
|
52 | - $input->get_html_for_input(), |
|
53 | - $html_id . '-submit-dv', |
|
54 | - "{$input->html_class()}-submit-dv {$html_class}" |
|
55 | - ); |
|
56 | - } elseif ($input instanceof EE_Select_Input) { |
|
57 | - $html .= EEH_HTML::div( |
|
58 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
59 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
60 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
61 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
62 | - $html_id . '-input-dv', |
|
63 | - "{$input->html_class()}-input-dv {$html_class}" |
|
64 | - ); |
|
65 | - } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
|
66 | - $html .= EEH_HTML::div( |
|
67 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . |
|
68 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
69 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
70 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
71 | - $html_id . '-input-dv', |
|
72 | - "{$input->html_class()}-input-dv {$html_class}" |
|
73 | - ); |
|
74 | - } else { |
|
75 | - $html .= EEH_HTML::div( |
|
76 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
77 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
78 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
79 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
80 | - $html_id . '-input-dv', |
|
81 | - "{$input->html_class()}-input-dv {$html_class}" |
|
82 | - ); |
|
83 | - } |
|
84 | - return $html; |
|
85 | - } |
|
32 | + /** |
|
33 | + * Lays out the row for the input, including label and errors |
|
34 | + * |
|
35 | + * @param EE_Form_Input_Base $input |
|
36 | + * @return string |
|
37 | + * @throws \EE_Error |
|
38 | + */ |
|
39 | + public function layout_input($input) |
|
40 | + { |
|
41 | + $html = ''; |
|
42 | + // set something unique for the id |
|
43 | + $html_id = (string) $input->html_id() !== '' |
|
44 | + ? (string) $input->html_id() |
|
45 | + : spl_object_hash($input); |
|
46 | + // and add a generic input type class |
|
47 | + $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv'; |
|
48 | + if ($input instanceof EE_Hidden_Input) { |
|
49 | + $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
50 | + } elseif ($input instanceof EE_Submit_Input) { |
|
51 | + $html .= EEH_HTML::div( |
|
52 | + $input->get_html_for_input(), |
|
53 | + $html_id . '-submit-dv', |
|
54 | + "{$input->html_class()}-submit-dv {$html_class}" |
|
55 | + ); |
|
56 | + } elseif ($input instanceof EE_Select_Input) { |
|
57 | + $html .= EEH_HTML::div( |
|
58 | + EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
59 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
60 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
61 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
62 | + $html_id . '-input-dv', |
|
63 | + "{$input->html_class()}-input-dv {$html_class}" |
|
64 | + ); |
|
65 | + } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
|
66 | + $html .= EEH_HTML::div( |
|
67 | + EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . |
|
68 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
69 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
70 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
71 | + $html_id . '-input-dv', |
|
72 | + "{$input->html_class()}-input-dv {$html_class}" |
|
73 | + ); |
|
74 | + } else { |
|
75 | + $html .= EEH_HTML::div( |
|
76 | + EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
77 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
78 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
79 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
80 | + $html_id . '-input-dv', |
|
81 | + "{$input->html_class()}-input-dv {$html_class}" |
|
82 | + ); |
|
83 | + } |
|
84 | + return $html; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | 88 | |
89 | - /** |
|
90 | - * |
|
91 | - * _display_label_for_option_type_question |
|
92 | - * Gets the HTML for the 'label', which is just text for this (because labels |
|
93 | - * should be for each input) |
|
94 | - * |
|
95 | - * @param EE_Form_Input_With_Options_Base $input |
|
96 | - * @return string |
|
97 | - */ |
|
98 | - protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) |
|
99 | - { |
|
100 | - if ($input->display_html_label_text()) { |
|
101 | - $html_label_text = $input->html_label_text(); |
|
102 | - $label_html = EEH_HTML::div( |
|
103 | - $input->required() |
|
104 | - ? $html_label_text . EEH_HTML::span('*', '', 'ee-asterisk') |
|
105 | - : $html_label_text, |
|
106 | - $input->html_label_id(), |
|
107 | - $input->required() |
|
108 | - ? 'ee-required-label ' . $input->html_label_class() |
|
109 | - : $input->html_label_class(), |
|
110 | - $input->html_label_style(), |
|
111 | - $input->other_html_attributes() |
|
112 | - ); |
|
113 | - // if no content was provided to EEH_HTML::div() above (ie: an empty label), |
|
114 | - // then we need to close the div manually |
|
115 | - if (empty($html_label_text)) { |
|
116 | - $label_html .= EEH_HTML::divx($input->html_label_id(), $input->html_label_class()); |
|
117 | - } |
|
118 | - return $label_html; |
|
119 | - } |
|
120 | - return ''; |
|
121 | - } |
|
89 | + /** |
|
90 | + * |
|
91 | + * _display_label_for_option_type_question |
|
92 | + * Gets the HTML for the 'label', which is just text for this (because labels |
|
93 | + * should be for each input) |
|
94 | + * |
|
95 | + * @param EE_Form_Input_With_Options_Base $input |
|
96 | + * @return string |
|
97 | + */ |
|
98 | + protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) |
|
99 | + { |
|
100 | + if ($input->display_html_label_text()) { |
|
101 | + $html_label_text = $input->html_label_text(); |
|
102 | + $label_html = EEH_HTML::div( |
|
103 | + $input->required() |
|
104 | + ? $html_label_text . EEH_HTML::span('*', '', 'ee-asterisk') |
|
105 | + : $html_label_text, |
|
106 | + $input->html_label_id(), |
|
107 | + $input->required() |
|
108 | + ? 'ee-required-label ' . $input->html_label_class() |
|
109 | + : $input->html_label_class(), |
|
110 | + $input->html_label_style(), |
|
111 | + $input->other_html_attributes() |
|
112 | + ); |
|
113 | + // if no content was provided to EEH_HTML::div() above (ie: an empty label), |
|
114 | + // then we need to close the div manually |
|
115 | + if (empty($html_label_text)) { |
|
116 | + $label_html .= EEH_HTML::divx($input->html_label_id(), $input->html_label_class()); |
|
117 | + } |
|
118 | + return $label_html; |
|
119 | + } |
|
120 | + return ''; |
|
121 | + } |
|
122 | 122 | |
123 | 123 | |
124 | 124 | |
125 | - /** |
|
126 | - * Lays out a row for the subsection |
|
127 | - * |
|
128 | - * @param EE_Form_Section_Proper $form_section |
|
129 | - * @return string |
|
130 | - */ |
|
131 | - public function layout_subsection($form_section) |
|
132 | - { |
|
133 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
134 | - } |
|
125 | + /** |
|
126 | + * Lays out a row for the subsection |
|
127 | + * |
|
128 | + * @param EE_Form_Section_Proper $form_section |
|
129 | + * @return string |
|
130 | + */ |
|
131 | + public function layout_subsection($form_section) |
|
132 | + { |
|
133 | + return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
134 | + } |
|
135 | 135 | |
136 | 136 | |
137 | 137 | |
138 | - /** |
|
139 | - * closing div tag for a form |
|
140 | - * |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - public function layout_form_end() |
|
144 | - { |
|
145 | - return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
146 | - } |
|
138 | + /** |
|
139 | + * closing div tag for a form |
|
140 | + * |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + public function layout_form_end() |
|
144 | + { |
|
145 | + return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
146 | + } |
|
147 | 147 | } |
@@ -19,20 +19,20 @@ discard block |
||
19 | 19 | { |
20 | 20 | wp_register_style( |
21 | 21 | 'checkbox_dropdown_selector', |
22 | - EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
22 | + EE_GLOBAL_ASSETS_URL.'css/checkbox_dropdown_selector.css', |
|
23 | 23 | array('espresso_default'), |
24 | 24 | EVENT_ESPRESSO_VERSION |
25 | 25 | ); |
26 | 26 | wp_register_style( |
27 | 27 | 'espresso_default', |
28 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
28 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', |
|
29 | 29 | array('dashicons'), |
30 | 30 | EVENT_ESPRESSO_VERSION |
31 | 31 | ); |
32 | 32 | wp_enqueue_style('checkbox_dropdown_selector'); |
33 | 33 | wp_register_script( |
34 | 34 | 'checkbox_dropdown_selector', |
35 | - EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
35 | + EE_GLOBAL_ASSETS_URL.'scripts/checkbox_dropdown_selector.js', |
|
36 | 36 | array('jquery'), |
37 | 37 | EVENT_ESPRESSO_VERSION, |
38 | 38 | true |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function iframe_css(array $iframe_css) |
73 | 73 | { |
74 | - $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
74 | + $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL.'css/checkbox_dropdown_selector.css'; |
|
75 | 75 | return $iframe_css; |
76 | 76 | } |
77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function iframe_js(array $iframe_js) |
87 | 87 | { |
88 | - $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
88 | + $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL.'scripts/checkbox_dropdown_selector.js'; |
|
89 | 89 | return $iframe_js; |
90 | 90 | } |
91 | 91 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
102 | 102 | $input->set_label_sizes(); |
103 | 103 | $label_size_class = $input->get_label_size_class(); |
104 | - if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
104 | + if ( ! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
105 | 105 | EE_Error::doing_it_wrong( |
106 | 106 | 'EE_Checkbox_Display_Strategy::display()', |
107 | 107 | sprintf( |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ), |
112 | 112 | $input->html_id(), |
113 | 113 | var_export($input->raw_value(), true), |
114 | - $input->html_name() . '[]' |
|
114 | + $input->html_name().'[]' |
|
115 | 115 | ), |
116 | 116 | '4.8.1' |
117 | 117 | ); |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | |
120 | 120 | |
121 | 121 | $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
122 | - $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
122 | + $html .= '<button id="'.$input->html_id().'-btn"'; |
|
123 | 123 | // $html .= ' name="' . $input->html_name() . '"'; |
124 | - $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
125 | - $html .= ' style="' . $input->html_style() . '"'; |
|
126 | - $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
127 | - $html .= ' ' . $input->other_html_attributes() . '>'; |
|
124 | + $html .= ' class="'.$input->html_class().' checkbox-dropdown-selector-btn button-secondary button"'; |
|
125 | + $html .= ' style="'.$input->html_style().'"'; |
|
126 | + $html .= ' data-target="'.$input->html_id().'-options-dv"'; |
|
127 | + $html .= ' '.$input->other_html_attributes().'>'; |
|
128 | 128 | $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
129 | 129 | $html .= $select_button_text; |
130 | 130 | $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
131 | 131 | $html .= '</button>'; |
132 | 132 | $html .= EEH_HTML::div( |
133 | 133 | '', |
134 | - $input->html_id() . '-options-dv', |
|
134 | + $input->html_id().'-options-dv', |
|
135 | 135 | 'checkbox-dropdown-selector' |
136 | 136 | ); |
137 | 137 | $html .= EEH_HTML::link( |
@@ -157,18 +157,18 @@ discard block |
||
157 | 157 | . '">'; |
158 | 158 | $html .= EEH_HTML::nl(1, 'checkbox'); |
159 | 159 | $html .= '<input type="checkbox"'; |
160 | - $html .= ' name="' . $input->html_name() . '[]"'; |
|
161 | - $html .= ' id="' . $html_id . '"'; |
|
162 | - $html .= ' class="' . $input->html_class() . '-option"'; |
|
163 | - $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
164 | - $html .= ' value="' . esc_attr($value) . '"'; |
|
160 | + $html .= ' name="'.$input->html_name().'[]"'; |
|
161 | + $html .= ' id="'.$html_id.'"'; |
|
162 | + $html .= ' class="'.$input->html_class().'-option"'; |
|
163 | + $html .= $input->html_style() ? ' style="'.$input->html_style().'"' : ''; |
|
164 | + $html .= ' value="'.esc_attr($value).'"'; |
|
165 | 165 | $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
166 | 166 | ? ' checked="checked"' |
167 | 167 | : ''; |
168 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
168 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
169 | 169 | $html .= '>'; |
170 | - $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
171 | - $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
170 | + $html .= '<span class="datetime-selector-option-text-spn">'.$display_text.'</span>'; |
|
171 | + $html .= EEH_HTML::nl(-1, 'checkbox').'</label>'; |
|
172 | 172 | $html .= EEH_HTML::lix(); |
173 | 173 | } |
174 | 174 | $html .= EEH_HTML::ulx(); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 'event_espresso' |
183 | 183 | ) |
184 | 184 | ), |
185 | - $input->html_id() . '-date-time-filter-notice-pg', |
|
185 | + $input->html_id().'-date-time-filter-notice-pg', |
|
186 | 186 | 'date-time-filter-notice-pg small-text lt-grey-text' |
187 | 187 | ); |
188 | 188 | $html .= \EEH_HTML::br(); |
@@ -13,180 +13,180 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * enqueues css and js, so that this can be called statically |
|
18 | - */ |
|
19 | - public static function enqueue_styles_and_scripts() |
|
20 | - { |
|
21 | - wp_register_style( |
|
22 | - 'checkbox_dropdown_selector', |
|
23 | - EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
24 | - array('espresso_default'), |
|
25 | - EVENT_ESPRESSO_VERSION |
|
26 | - ); |
|
27 | - wp_register_style( |
|
28 | - 'espresso_default', |
|
29 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
30 | - array('dashicons'), |
|
31 | - EVENT_ESPRESSO_VERSION |
|
32 | - ); |
|
33 | - wp_enqueue_style('checkbox_dropdown_selector'); |
|
34 | - wp_register_script( |
|
35 | - 'checkbox_dropdown_selector', |
|
36 | - EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
37 | - array('jquery'), |
|
38 | - EVENT_ESPRESSO_VERSION, |
|
39 | - true |
|
40 | - ); |
|
41 | - wp_localize_script( |
|
42 | - 'ticket_selector', |
|
43 | - 'eeDTS', |
|
44 | - array( |
|
45 | - 'maxChecked' => EE_Registry::instance() |
|
46 | - ->CFG |
|
47 | - ->template_settings |
|
48 | - ->EED_Ticket_Selector |
|
49 | - ->getDatetimeSelectorMaxChecked() |
|
50 | - ) |
|
51 | - ); |
|
52 | - wp_enqueue_script('checkbox_dropdown_selector'); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
59 | - */ |
|
60 | - public function enqueue_js() |
|
61 | - { |
|
62 | - EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * callback for Iframe::addStylesheets() child class methods |
|
69 | - * |
|
70 | - * @param array $iframe_css |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function iframe_css(array $iframe_css) |
|
74 | - { |
|
75 | - $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
76 | - return $iframe_css; |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * callback for Iframe::addScripts() child class methods |
|
83 | - * |
|
84 | - * @param array $iframe_js |
|
85 | - * @return array |
|
86 | - */ |
|
87 | - public function iframe_js(array $iframe_js) |
|
88 | - { |
|
89 | - $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
90 | - return $iframe_js; |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * @throws EE_Error |
|
96 | - * @return string of html to display the field |
|
97 | - */ |
|
98 | - public function display() |
|
99 | - { |
|
100 | - $input = $this->get_input(); |
|
101 | - $select_button_text = $input instanceof EE_Checkbox_Dropdown_Selector_Input ? $input->select_button_text() : ''; |
|
102 | - // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
|
103 | - $input->set_label_sizes(); |
|
104 | - $label_size_class = $input->get_label_size_class(); |
|
105 | - if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
106 | - EE_Error::doing_it_wrong( |
|
107 | - 'EE_Checkbox_Display_Strategy::display()', |
|
108 | - sprintf( |
|
109 | - esc_html__( |
|
110 | - 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', |
|
111 | - 'event_espresso' |
|
112 | - ), |
|
113 | - $input->html_id(), |
|
114 | - var_export($input->raw_value(), true), |
|
115 | - $input->html_name() . '[]' |
|
116 | - ), |
|
117 | - '4.8.1' |
|
118 | - ); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
|
123 | - $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
124 | - // $html .= ' name="' . $input->html_name() . '"'; |
|
125 | - $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
126 | - $html .= ' style="' . $input->html_style() . '"'; |
|
127 | - $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
128 | - $html .= ' ' . $input->other_html_attributes() . '>'; |
|
129 | - $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
|
130 | - $html .= $select_button_text; |
|
131 | - $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
|
132 | - $html .= '</button>'; |
|
133 | - $html .= EEH_HTML::div( |
|
134 | - '', |
|
135 | - $input->html_id() . '-options-dv', |
|
136 | - 'checkbox-dropdown-selector' |
|
137 | - ); |
|
138 | - $html .= EEH_HTML::link( |
|
139 | - '', |
|
140 | - '<span class="dashicons dashicons-no"></span>', |
|
141 | - esc_html__('close datetime selector', 'event_espresso'), |
|
142 | - '', |
|
143 | - 'close-espresso-notice' |
|
144 | - ); |
|
145 | - $html .= EEH_HTML::ul(); |
|
146 | - $input_raw_value = (array) $input->raw_value(); |
|
147 | - foreach ($input->options() as $value => $display_text) { |
|
148 | - $html .= EEH_HTML::li(); |
|
149 | - $value = $input->get_normalization_strategy()->unnormalize_one($value); |
|
150 | - $html_id = $this->get_sub_input_id($value); |
|
151 | - $html .= EEH_HTML::nl(0, 'checkbox'); |
|
152 | - $html .= '<label for="' |
|
153 | - . $html_id |
|
154 | - . '" id="' |
|
155 | - . $html_id |
|
156 | - . '-lbl" class="ee-checkbox-label-after' |
|
157 | - . $label_size_class |
|
158 | - . '">'; |
|
159 | - $html .= EEH_HTML::nl(1, 'checkbox'); |
|
160 | - $html .= '<input type="checkbox"'; |
|
161 | - $html .= ' name="' . $input->html_name() . '[]"'; |
|
162 | - $html .= ' id="' . $html_id . '"'; |
|
163 | - $html .= ' class="' . $input->html_class() . '-option"'; |
|
164 | - $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
165 | - $html .= ' value="' . esc_attr($value) . '"'; |
|
166 | - $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
|
167 | - ? ' checked="checked"' |
|
168 | - : ''; |
|
169 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
170 | - $html .= '>'; |
|
171 | - $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
172 | - $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
173 | - $html .= EEH_HTML::lix(); |
|
174 | - } |
|
175 | - $html .= EEH_HTML::ulx(); |
|
176 | - $html .= EEH_HTML::divx(); |
|
177 | - $html .= EEH_HTML::divx(); |
|
178 | - $html .= EEH_HTML::p( |
|
179 | - apply_filters( |
|
180 | - 'FHEE__EE_Checkbox_Dropdown_Selector_Display_Strategy__display__html', |
|
181 | - esc_html__( |
|
182 | - 'To view additional ticket options, click the "Filter by Date" button and select more dates.', |
|
183 | - 'event_espresso' |
|
184 | - ) |
|
185 | - ), |
|
186 | - $input->html_id() . '-date-time-filter-notice-pg', |
|
187 | - 'date-time-filter-notice-pg small-text lt-grey-text' |
|
188 | - ); |
|
189 | - $html .= \EEH_HTML::br(); |
|
190 | - return $html; |
|
191 | - } |
|
16 | + /** |
|
17 | + * enqueues css and js, so that this can be called statically |
|
18 | + */ |
|
19 | + public static function enqueue_styles_and_scripts() |
|
20 | + { |
|
21 | + wp_register_style( |
|
22 | + 'checkbox_dropdown_selector', |
|
23 | + EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
24 | + array('espresso_default'), |
|
25 | + EVENT_ESPRESSO_VERSION |
|
26 | + ); |
|
27 | + wp_register_style( |
|
28 | + 'espresso_default', |
|
29 | + EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
30 | + array('dashicons'), |
|
31 | + EVENT_ESPRESSO_VERSION |
|
32 | + ); |
|
33 | + wp_enqueue_style('checkbox_dropdown_selector'); |
|
34 | + wp_register_script( |
|
35 | + 'checkbox_dropdown_selector', |
|
36 | + EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
37 | + array('jquery'), |
|
38 | + EVENT_ESPRESSO_VERSION, |
|
39 | + true |
|
40 | + ); |
|
41 | + wp_localize_script( |
|
42 | + 'ticket_selector', |
|
43 | + 'eeDTS', |
|
44 | + array( |
|
45 | + 'maxChecked' => EE_Registry::instance() |
|
46 | + ->CFG |
|
47 | + ->template_settings |
|
48 | + ->EED_Ticket_Selector |
|
49 | + ->getDatetimeSelectorMaxChecked() |
|
50 | + ) |
|
51 | + ); |
|
52 | + wp_enqueue_script('checkbox_dropdown_selector'); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
59 | + */ |
|
60 | + public function enqueue_js() |
|
61 | + { |
|
62 | + EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * callback for Iframe::addStylesheets() child class methods |
|
69 | + * |
|
70 | + * @param array $iframe_css |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function iframe_css(array $iframe_css) |
|
74 | + { |
|
75 | + $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
76 | + return $iframe_css; |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * callback for Iframe::addScripts() child class methods |
|
83 | + * |
|
84 | + * @param array $iframe_js |
|
85 | + * @return array |
|
86 | + */ |
|
87 | + public function iframe_js(array $iframe_js) |
|
88 | + { |
|
89 | + $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
90 | + return $iframe_js; |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * @throws EE_Error |
|
96 | + * @return string of html to display the field |
|
97 | + */ |
|
98 | + public function display() |
|
99 | + { |
|
100 | + $input = $this->get_input(); |
|
101 | + $select_button_text = $input instanceof EE_Checkbox_Dropdown_Selector_Input ? $input->select_button_text() : ''; |
|
102 | + // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
|
103 | + $input->set_label_sizes(); |
|
104 | + $label_size_class = $input->get_label_size_class(); |
|
105 | + if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
106 | + EE_Error::doing_it_wrong( |
|
107 | + 'EE_Checkbox_Display_Strategy::display()', |
|
108 | + sprintf( |
|
109 | + esc_html__( |
|
110 | + 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', |
|
111 | + 'event_espresso' |
|
112 | + ), |
|
113 | + $input->html_id(), |
|
114 | + var_export($input->raw_value(), true), |
|
115 | + $input->html_name() . '[]' |
|
116 | + ), |
|
117 | + '4.8.1' |
|
118 | + ); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
|
123 | + $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
124 | + // $html .= ' name="' . $input->html_name() . '"'; |
|
125 | + $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
126 | + $html .= ' style="' . $input->html_style() . '"'; |
|
127 | + $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
128 | + $html .= ' ' . $input->other_html_attributes() . '>'; |
|
129 | + $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
|
130 | + $html .= $select_button_text; |
|
131 | + $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
|
132 | + $html .= '</button>'; |
|
133 | + $html .= EEH_HTML::div( |
|
134 | + '', |
|
135 | + $input->html_id() . '-options-dv', |
|
136 | + 'checkbox-dropdown-selector' |
|
137 | + ); |
|
138 | + $html .= EEH_HTML::link( |
|
139 | + '', |
|
140 | + '<span class="dashicons dashicons-no"></span>', |
|
141 | + esc_html__('close datetime selector', 'event_espresso'), |
|
142 | + '', |
|
143 | + 'close-espresso-notice' |
|
144 | + ); |
|
145 | + $html .= EEH_HTML::ul(); |
|
146 | + $input_raw_value = (array) $input->raw_value(); |
|
147 | + foreach ($input->options() as $value => $display_text) { |
|
148 | + $html .= EEH_HTML::li(); |
|
149 | + $value = $input->get_normalization_strategy()->unnormalize_one($value); |
|
150 | + $html_id = $this->get_sub_input_id($value); |
|
151 | + $html .= EEH_HTML::nl(0, 'checkbox'); |
|
152 | + $html .= '<label for="' |
|
153 | + . $html_id |
|
154 | + . '" id="' |
|
155 | + . $html_id |
|
156 | + . '-lbl" class="ee-checkbox-label-after' |
|
157 | + . $label_size_class |
|
158 | + . '">'; |
|
159 | + $html .= EEH_HTML::nl(1, 'checkbox'); |
|
160 | + $html .= '<input type="checkbox"'; |
|
161 | + $html .= ' name="' . $input->html_name() . '[]"'; |
|
162 | + $html .= ' id="' . $html_id . '"'; |
|
163 | + $html .= ' class="' . $input->html_class() . '-option"'; |
|
164 | + $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
165 | + $html .= ' value="' . esc_attr($value) . '"'; |
|
166 | + $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
|
167 | + ? ' checked="checked"' |
|
168 | + : ''; |
|
169 | + $html .= ' ' . $this->_input->other_html_attributes(); |
|
170 | + $html .= '>'; |
|
171 | + $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
172 | + $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
173 | + $html .= EEH_HTML::lix(); |
|
174 | + } |
|
175 | + $html .= EEH_HTML::ulx(); |
|
176 | + $html .= EEH_HTML::divx(); |
|
177 | + $html .= EEH_HTML::divx(); |
|
178 | + $html .= EEH_HTML::p( |
|
179 | + apply_filters( |
|
180 | + 'FHEE__EE_Checkbox_Dropdown_Selector_Display_Strategy__display__html', |
|
181 | + esc_html__( |
|
182 | + 'To view additional ticket options, click the "Filter by Date" button and select more dates.', |
|
183 | + 'event_espresso' |
|
184 | + ) |
|
185 | + ), |
|
186 | + $input->html_id() . '-date-time-filter-notice-pg', |
|
187 | + 'date-time-filter-notice-pg small-text lt-grey-text' |
|
188 | + ); |
|
189 | + $html .= \EEH_HTML::br(); |
|
190 | + return $html; |
|
191 | + } |
|
192 | 192 | } |
@@ -16,19 +16,19 @@ |
||
16 | 16 | abstract class AdminPageHeaderDecorator implements AdminPageHeaderDecoratorInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var RequestInterface $request |
|
21 | - */ |
|
22 | - protected $request; |
|
19 | + /** |
|
20 | + * @var RequestInterface $request |
|
21 | + */ |
|
22 | + protected $request; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * AdminPageHeader constructor. |
|
27 | - * |
|
28 | - * @param RequestInterface $request |
|
29 | - */ |
|
30 | - public function __construct(RequestInterface $request) |
|
31 | - { |
|
32 | - $this->request = $request; |
|
33 | - } |
|
25 | + /** |
|
26 | + * AdminPageHeader constructor. |
|
27 | + * |
|
28 | + * @param RequestInterface $request |
|
29 | + */ |
|
30 | + public function __construct(RequestInterface $request) |
|
31 | + { |
|
32 | + $this->request = $request; |
|
33 | + } |
|
34 | 34 | } |
@@ -21,384 +21,384 @@ |
||
21 | 21 | class QueryBuilder |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var RequestInterface $request |
|
26 | - */ |
|
27 | - protected $request; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var EEM_Registration $registration_model |
|
31 | - */ |
|
32 | - protected $registration_model; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var string $view |
|
36 | - */ |
|
37 | - protected $view; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var array $where_params |
|
41 | - */ |
|
42 | - protected $where_params; |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * QueryBuilder constructor. |
|
47 | - * |
|
48 | - * @param array $extra_request_params |
|
49 | - * @param RequestInterface $request |
|
50 | - * @param EEM_Registration $registration_model |
|
51 | - */ |
|
52 | - public function __construct( |
|
53 | - array $extra_request_params, |
|
54 | - RequestInterface $request, |
|
55 | - EEM_Registration $registration_model |
|
56 | - ) { |
|
57 | - $this->request = $request; |
|
58 | - $this->registration_model = $registration_model; |
|
59 | - foreach ($extra_request_params as $key => $value) { |
|
60 | - $this->request->setRequestParam($key, $value); |
|
61 | - } |
|
62 | - $this->view = $this->request->getRequestParam('status', ''); |
|
63 | - $this->where_params = []; |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * Sets up the where conditions for the registrations query. |
|
69 | - * |
|
70 | - * @param int $per_page |
|
71 | - * @param bool $count_query |
|
72 | - * @return array |
|
73 | - * @throws EE_Error |
|
74 | - * @throws InvalidArgumentException |
|
75 | - * @throws InvalidDataTypeException |
|
76 | - * @throws InvalidInterfaceException |
|
77 | - */ |
|
78 | - public function getQueryParams($per_page = 10, $count_query = false) |
|
79 | - { |
|
80 | - $query_params = [ |
|
81 | - 0 => $this->getWhereClause(), |
|
82 | - 'caps' => EEM_Registration::caps_read_admin, |
|
83 | - 'default_where_conditions' => 'this_model_only', |
|
84 | - ]; |
|
85 | - if (! $count_query) { |
|
86 | - $query_params = array_merge( |
|
87 | - $query_params, |
|
88 | - $this->getOrderbyClause(), |
|
89 | - $this->getLimitClause($per_page) |
|
90 | - ); |
|
91 | - } |
|
92 | - |
|
93 | - return $query_params; |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * Sets up the where conditions for the registrations query. |
|
99 | - * |
|
100 | - * @return array |
|
101 | - * @throws EE_Error |
|
102 | - * @throws InvalidArgumentException |
|
103 | - * @throws InvalidDataTypeException |
|
104 | - * @throws InvalidInterfaceException |
|
105 | - */ |
|
106 | - protected function getWhereClause() |
|
107 | - { |
|
108 | - $this->addAttendeeIdToWhereConditions(); |
|
109 | - $this->addEventIdToWhereConditions(); |
|
110 | - $this->addCategoryIdToWhereConditions(); |
|
111 | - $this->addDatetimeIdToWhereConditions(); |
|
112 | - $this->addTicketIdToWhereConditions(); |
|
113 | - $this->addRegistrationStatusToWhereConditions(); |
|
114 | - $this->addDateToWhereConditions(); |
|
115 | - $this->addSearchToWhereConditions(); |
|
116 | - return apply_filters( |
|
117 | - 'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query', |
|
118 | - $this->where_params, |
|
119 | - $this->request->requestParams() |
|
120 | - ); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * This will add ATT_ID to the provided $this->where_clause array for EE model query parameters. |
|
126 | - */ |
|
127 | - protected function addAttendeeIdToWhereConditions() |
|
128 | - { |
|
129 | - $ATT_ID = $this->request->getRequestParam('attendee_id'); |
|
130 | - $ATT_ID = $this->request->getRequestParam('ATT_ID', $ATT_ID); |
|
131 | - if ($ATT_ID) { |
|
132 | - $this->where_params['ATT_ID'] = absint($ATT_ID); |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * This will add EVT_ID to the provided $this->where_clause array for EE model query parameters. |
|
139 | - */ |
|
140 | - protected function addEventIdToWhereConditions() |
|
141 | - { |
|
142 | - $EVT_ID = $this->request->getRequestParam('event_id'); |
|
143 | - $EVT_ID = $this->request->getRequestParam('EVT_ID', $EVT_ID); |
|
144 | - if ($EVT_ID) { |
|
145 | - $this->where_params['EVT_ID'] = absint($EVT_ID); |
|
146 | - } |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * Adds category ID if it exists in the request to the where conditions for the registrations query. |
|
152 | - */ |
|
153 | - protected function addCategoryIdToWhereConditions() |
|
154 | - { |
|
155 | - $EVT_CAT = (int) $this->request->getRequestParam('EVT_CAT'); |
|
156 | - if ($EVT_CAT > 0) { |
|
157 | - $this->where_params['Event.Term_Taxonomy.term_id'] = absint($EVT_CAT); |
|
158 | - } |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * Adds the datetime ID if it exists in the request to the where conditions for the registrations query. |
|
164 | - */ |
|
165 | - protected function addDatetimeIdToWhereConditions() |
|
166 | - { |
|
167 | - // first look for 'datetime_id' then 'DTT_ID' using first result as fallback default value |
|
168 | - $DTT_ID = $this->request->getRequestParam('datetime_id'); |
|
169 | - $DTT_ID = $this->request->getRequestParam('DTT_ID', $DTT_ID); |
|
170 | - if ($DTT_ID) { |
|
171 | - $this->where_params['Ticket.Datetime.DTT_ID'] = absint($DTT_ID); |
|
172 | - } |
|
173 | - } |
|
174 | - |
|
175 | - |
|
176 | - /** |
|
177 | - * Adds the ticket ID if it exists in the request to the where conditions for the registrations query. |
|
178 | - */ |
|
179 | - protected function addTicketIdToWhereConditions() |
|
180 | - { |
|
181 | - // first look for 'ticket_id' then 'TKT_ID' using first result as fallback default value |
|
182 | - $TKT_ID = $this->request->getRequestParam('ticket_id'); |
|
183 | - $TKT_ID = $this->request->getRequestParam('TKT_ID', $TKT_ID); |
|
184 | - if ($TKT_ID) { |
|
185 | - $this->where_params['TKT_ID'] = absint($TKT_ID); |
|
186 | - } |
|
187 | - } |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * Adds the correct registration status to the where conditions for the registrations query. |
|
192 | - * If filtering by registration status, then we show registrations matching that status. |
|
193 | - * If not filtering by specified status, then we show all registrations excluding incomplete registrations |
|
194 | - * UNLESS viewing trashed registrations. |
|
195 | - */ |
|
196 | - protected function addRegistrationStatusToWhereConditions() |
|
197 | - { |
|
198 | - $registration_status = $this->request->getRequestParam('_reg_status'); |
|
199 | - if ($registration_status) { |
|
200 | - $this->where_params['STS_ID'] = sanitize_text_field($registration_status); |
|
201 | - return; |
|
202 | - } |
|
203 | - // make sure we exclude incomplete registrations, but only if not trashed. |
|
204 | - if ($this->view === 'trash') { |
|
205 | - $this->where_params['REG_deleted'] = true; |
|
206 | - return; |
|
207 | - } |
|
208 | - $this->where_params['STS_ID'] = $this->view === 'incomplete' |
|
209 | - ? EEM_Registration::status_id_incomplete |
|
210 | - : ['!=', EEM_Registration::status_id_incomplete]; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * Adds any provided date restraints to the where conditions for the registrations query. |
|
216 | - * |
|
217 | - * @throws EE_Error |
|
218 | - * @throws InvalidArgumentException |
|
219 | - * @throws InvalidDataTypeException |
|
220 | - * @throws InvalidInterfaceException |
|
221 | - */ |
|
222 | - protected function addDateToWhereConditions() |
|
223 | - { |
|
224 | - if ($this->view === 'today') { |
|
225 | - $now = date('Y-m-d', current_time('timestamp')); |
|
226 | - $this->where_params['REG_date'] = [ |
|
227 | - 'BETWEEN', |
|
228 | - [ |
|
229 | - $this->registration_model->convert_datetime_for_query( |
|
230 | - 'REG_date', |
|
231 | - $now . ' 00:00:00', |
|
232 | - 'Y-m-d H:i:s' |
|
233 | - ), |
|
234 | - $this->registration_model->convert_datetime_for_query( |
|
235 | - 'REG_date', |
|
236 | - $now . ' 23:59:59', |
|
237 | - 'Y-m-d H:i:s' |
|
238 | - ), |
|
239 | - ], |
|
240 | - ]; |
|
241 | - return; |
|
242 | - } |
|
243 | - if ($this->view === 'month') { |
|
244 | - $current_year_and_month = date('Y-m', current_time('timestamp')); |
|
245 | - $days_this_month = date('t', current_time('timestamp')); |
|
246 | - $this->where_params['REG_date'] = [ |
|
247 | - 'BETWEEN', |
|
248 | - [ |
|
249 | - $this->registration_model->convert_datetime_for_query( |
|
250 | - 'REG_date', |
|
251 | - $current_year_and_month . '-01 00:00:00', |
|
252 | - 'Y-m-d H:i:s' |
|
253 | - ), |
|
254 | - $this->registration_model->convert_datetime_for_query( |
|
255 | - 'REG_date', |
|
256 | - $current_year_and_month . '-' . $days_this_month . ' 23:59:59', |
|
257 | - 'Y-m-d H:i:s' |
|
258 | - ), |
|
259 | - ], |
|
260 | - ]; |
|
261 | - return; |
|
262 | - } |
|
263 | - $month_range = $this->request->getRequestParam('month_range'); |
|
264 | - if ($month_range) { |
|
265 | - $month_range = sanitize_text_field($month_range); |
|
266 | - $pieces = explode(' ', $month_range, 3); |
|
267 | - $month_requested = ! empty($pieces[0]) |
|
268 | - ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) |
|
269 | - : ''; |
|
270 | - $year_requested = ! empty($pieces[1]) |
|
271 | - ? $pieces[1] |
|
272 | - : ''; |
|
273 | - // if there is not a month or year then we can't go further |
|
274 | - if ($month_requested && $year_requested) { |
|
275 | - $days_in_month = date('t', strtotime($year_requested . '-' . $month_requested . '-' . '01')); |
|
276 | - $this->where_params['REG_date'] = [ |
|
277 | - 'BETWEEN', |
|
278 | - [ |
|
279 | - $this->registration_model->convert_datetime_for_query( |
|
280 | - 'REG_date', |
|
281 | - $year_requested . '-' . $month_requested . '-01 00:00:00', |
|
282 | - 'Y-m-d H:i:s' |
|
283 | - ), |
|
284 | - $this->registration_model->convert_datetime_for_query( |
|
285 | - 'REG_date', |
|
286 | - $year_requested . '-' . $month_requested . '-' . $days_in_month . ' 23:59:59', |
|
287 | - 'Y-m-d H:i:s' |
|
288 | - ), |
|
289 | - ], |
|
290 | - ]; |
|
291 | - } |
|
292 | - } |
|
293 | - } |
|
294 | - |
|
295 | - |
|
296 | - /** |
|
297 | - * Adds any provided search restraints to the where conditions for the registrations query |
|
298 | - */ |
|
299 | - protected function addSearchToWhereConditions() |
|
300 | - { |
|
301 | - $search = $this->request->getRequestParam('s'); |
|
302 | - if ($search) { |
|
303 | - $search_string = '%' . sanitize_text_field($search) . '%'; |
|
304 | - $this->where_params['OR*search_conditions'] = [ |
|
305 | - 'Event.EVT_name' => ['LIKE', $search_string], |
|
306 | - 'Event.EVT_desc' => ['LIKE', $search_string], |
|
307 | - 'Event.EVT_short_desc' => ['LIKE', $search_string], |
|
308 | - 'Attendee.ATT_full_name' => ['LIKE', $search_string], |
|
309 | - 'Attendee.ATT_fname' => ['LIKE', $search_string], |
|
310 | - 'Attendee.ATT_lname' => ['LIKE', $search_string], |
|
311 | - 'Attendee.ATT_short_bio' => ['LIKE', $search_string], |
|
312 | - 'Attendee.ATT_email' => ['LIKE', $search_string], |
|
313 | - 'Attendee.ATT_address' => ['LIKE', $search_string], |
|
314 | - 'Attendee.ATT_address2' => ['LIKE', $search_string], |
|
315 | - 'Attendee.ATT_city' => ['LIKE', $search_string], |
|
316 | - 'REG_final_price' => ['LIKE', $search_string], |
|
317 | - 'REG_code' => ['LIKE', $search_string], |
|
318 | - 'REG_count' => ['LIKE', $search_string], |
|
319 | - 'REG_group_size' => ['LIKE', $search_string], |
|
320 | - 'Ticket.TKT_name' => ['LIKE', $search_string], |
|
321 | - 'Ticket.TKT_description' => ['LIKE', $search_string], |
|
322 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => ['LIKE', $search_string], |
|
323 | - ]; |
|
324 | - } |
|
325 | - } |
|
326 | - |
|
327 | - |
|
328 | - /** |
|
329 | - * Sets up the orderby for the registrations query. |
|
330 | - * |
|
331 | - * @return array |
|
332 | - */ |
|
333 | - protected function getOrderbyClause() |
|
334 | - { |
|
335 | - $orderby_field = $this->request->getRequestParam('orderby'); |
|
336 | - $orderby_field = $orderby_field ? sanitize_text_field($orderby_field) : '_REG_date'; |
|
337 | - switch ($orderby_field) { |
|
338 | - case '_REG_ID': |
|
339 | - $orderby = ['REG_ID']; |
|
340 | - break; |
|
341 | - case '_Reg_status': |
|
342 | - $orderby = ['STS_ID']; |
|
343 | - break; |
|
344 | - case 'ATT_fname': |
|
345 | - $orderby = ['Attendee.ATT_fname', 'Attendee.ATT_lname']; |
|
346 | - break; |
|
347 | - case 'ATT_lname': |
|
348 | - $orderby = ['Attendee.ATT_lname', 'Attendee.ATT_fname']; |
|
349 | - break; |
|
350 | - case 'event_name': |
|
351 | - $orderby = ['Event.EVT_name']; |
|
352 | - break; |
|
353 | - case 'DTT_EVT_start': |
|
354 | - $orderby = ['Event.Datetime.DTT_EVT_start']; |
|
355 | - break; |
|
356 | - case '_REG_date': |
|
357 | - $orderby = ['REG_date']; |
|
358 | - break; |
|
359 | - default: |
|
360 | - $orderby = [$orderby_field]; |
|
361 | - break; |
|
362 | - } |
|
363 | - $order = $this->request->getRequestParam('order'); |
|
364 | - $order = $order ? sanitize_text_field($order) : 'DESC'; |
|
365 | - |
|
366 | - $orderby = array_combine( |
|
367 | - $orderby, |
|
368 | - array_fill(0, count($orderby), $order) |
|
369 | - ); |
|
370 | - // because there are many registrations with the same date, define |
|
371 | - // a secondary way to order them, otherwise MySQL seems to be a bit random |
|
372 | - if (empty($orderby['REG_ID'])) { |
|
373 | - $orderby['REG_ID'] = $order; |
|
374 | - } |
|
375 | - |
|
376 | - $orderby = apply_filters( |
|
377 | - 'FHEE__Registrations_Admin_Page___get_orderby_for_registrations_query', |
|
378 | - $orderby, |
|
379 | - $this->request->requestParams() |
|
380 | - ); |
|
381 | - return ['order_by' => $orderby]; |
|
382 | - } |
|
383 | - |
|
384 | - |
|
385 | - /** |
|
386 | - * Sets up the limit for the registrations query. |
|
387 | - * |
|
388 | - * @param $per_page |
|
389 | - * @return array |
|
390 | - */ |
|
391 | - protected function getLimitClause($per_page) |
|
392 | - { |
|
393 | - $current_page = $this->request->getRequestParam('paged'); |
|
394 | - $current_page = $current_page ? absint($current_page) : 1; |
|
395 | - $per_page = (int) $this->request->getRequestParam('perpage', $per_page); |
|
396 | - // -1 means return all results so get out if that's set. |
|
397 | - if ($per_page === -1) { |
|
398 | - return []; |
|
399 | - } |
|
400 | - $per_page = absint($per_page); |
|
401 | - $offset = ($current_page - 1) * $per_page; |
|
402 | - return ['limit' => [$offset, $per_page]]; |
|
403 | - } |
|
24 | + /** |
|
25 | + * @var RequestInterface $request |
|
26 | + */ |
|
27 | + protected $request; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var EEM_Registration $registration_model |
|
31 | + */ |
|
32 | + protected $registration_model; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var string $view |
|
36 | + */ |
|
37 | + protected $view; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var array $where_params |
|
41 | + */ |
|
42 | + protected $where_params; |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * QueryBuilder constructor. |
|
47 | + * |
|
48 | + * @param array $extra_request_params |
|
49 | + * @param RequestInterface $request |
|
50 | + * @param EEM_Registration $registration_model |
|
51 | + */ |
|
52 | + public function __construct( |
|
53 | + array $extra_request_params, |
|
54 | + RequestInterface $request, |
|
55 | + EEM_Registration $registration_model |
|
56 | + ) { |
|
57 | + $this->request = $request; |
|
58 | + $this->registration_model = $registration_model; |
|
59 | + foreach ($extra_request_params as $key => $value) { |
|
60 | + $this->request->setRequestParam($key, $value); |
|
61 | + } |
|
62 | + $this->view = $this->request->getRequestParam('status', ''); |
|
63 | + $this->where_params = []; |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * Sets up the where conditions for the registrations query. |
|
69 | + * |
|
70 | + * @param int $per_page |
|
71 | + * @param bool $count_query |
|
72 | + * @return array |
|
73 | + * @throws EE_Error |
|
74 | + * @throws InvalidArgumentException |
|
75 | + * @throws InvalidDataTypeException |
|
76 | + * @throws InvalidInterfaceException |
|
77 | + */ |
|
78 | + public function getQueryParams($per_page = 10, $count_query = false) |
|
79 | + { |
|
80 | + $query_params = [ |
|
81 | + 0 => $this->getWhereClause(), |
|
82 | + 'caps' => EEM_Registration::caps_read_admin, |
|
83 | + 'default_where_conditions' => 'this_model_only', |
|
84 | + ]; |
|
85 | + if (! $count_query) { |
|
86 | + $query_params = array_merge( |
|
87 | + $query_params, |
|
88 | + $this->getOrderbyClause(), |
|
89 | + $this->getLimitClause($per_page) |
|
90 | + ); |
|
91 | + } |
|
92 | + |
|
93 | + return $query_params; |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * Sets up the where conditions for the registrations query. |
|
99 | + * |
|
100 | + * @return array |
|
101 | + * @throws EE_Error |
|
102 | + * @throws InvalidArgumentException |
|
103 | + * @throws InvalidDataTypeException |
|
104 | + * @throws InvalidInterfaceException |
|
105 | + */ |
|
106 | + protected function getWhereClause() |
|
107 | + { |
|
108 | + $this->addAttendeeIdToWhereConditions(); |
|
109 | + $this->addEventIdToWhereConditions(); |
|
110 | + $this->addCategoryIdToWhereConditions(); |
|
111 | + $this->addDatetimeIdToWhereConditions(); |
|
112 | + $this->addTicketIdToWhereConditions(); |
|
113 | + $this->addRegistrationStatusToWhereConditions(); |
|
114 | + $this->addDateToWhereConditions(); |
|
115 | + $this->addSearchToWhereConditions(); |
|
116 | + return apply_filters( |
|
117 | + 'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query', |
|
118 | + $this->where_params, |
|
119 | + $this->request->requestParams() |
|
120 | + ); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * This will add ATT_ID to the provided $this->where_clause array for EE model query parameters. |
|
126 | + */ |
|
127 | + protected function addAttendeeIdToWhereConditions() |
|
128 | + { |
|
129 | + $ATT_ID = $this->request->getRequestParam('attendee_id'); |
|
130 | + $ATT_ID = $this->request->getRequestParam('ATT_ID', $ATT_ID); |
|
131 | + if ($ATT_ID) { |
|
132 | + $this->where_params['ATT_ID'] = absint($ATT_ID); |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * This will add EVT_ID to the provided $this->where_clause array for EE model query parameters. |
|
139 | + */ |
|
140 | + protected function addEventIdToWhereConditions() |
|
141 | + { |
|
142 | + $EVT_ID = $this->request->getRequestParam('event_id'); |
|
143 | + $EVT_ID = $this->request->getRequestParam('EVT_ID', $EVT_ID); |
|
144 | + if ($EVT_ID) { |
|
145 | + $this->where_params['EVT_ID'] = absint($EVT_ID); |
|
146 | + } |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * Adds category ID if it exists in the request to the where conditions for the registrations query. |
|
152 | + */ |
|
153 | + protected function addCategoryIdToWhereConditions() |
|
154 | + { |
|
155 | + $EVT_CAT = (int) $this->request->getRequestParam('EVT_CAT'); |
|
156 | + if ($EVT_CAT > 0) { |
|
157 | + $this->where_params['Event.Term_Taxonomy.term_id'] = absint($EVT_CAT); |
|
158 | + } |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * Adds the datetime ID if it exists in the request to the where conditions for the registrations query. |
|
164 | + */ |
|
165 | + protected function addDatetimeIdToWhereConditions() |
|
166 | + { |
|
167 | + // first look for 'datetime_id' then 'DTT_ID' using first result as fallback default value |
|
168 | + $DTT_ID = $this->request->getRequestParam('datetime_id'); |
|
169 | + $DTT_ID = $this->request->getRequestParam('DTT_ID', $DTT_ID); |
|
170 | + if ($DTT_ID) { |
|
171 | + $this->where_params['Ticket.Datetime.DTT_ID'] = absint($DTT_ID); |
|
172 | + } |
|
173 | + } |
|
174 | + |
|
175 | + |
|
176 | + /** |
|
177 | + * Adds the ticket ID if it exists in the request to the where conditions for the registrations query. |
|
178 | + */ |
|
179 | + protected function addTicketIdToWhereConditions() |
|
180 | + { |
|
181 | + // first look for 'ticket_id' then 'TKT_ID' using first result as fallback default value |
|
182 | + $TKT_ID = $this->request->getRequestParam('ticket_id'); |
|
183 | + $TKT_ID = $this->request->getRequestParam('TKT_ID', $TKT_ID); |
|
184 | + if ($TKT_ID) { |
|
185 | + $this->where_params['TKT_ID'] = absint($TKT_ID); |
|
186 | + } |
|
187 | + } |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * Adds the correct registration status to the where conditions for the registrations query. |
|
192 | + * If filtering by registration status, then we show registrations matching that status. |
|
193 | + * If not filtering by specified status, then we show all registrations excluding incomplete registrations |
|
194 | + * UNLESS viewing trashed registrations. |
|
195 | + */ |
|
196 | + protected function addRegistrationStatusToWhereConditions() |
|
197 | + { |
|
198 | + $registration_status = $this->request->getRequestParam('_reg_status'); |
|
199 | + if ($registration_status) { |
|
200 | + $this->where_params['STS_ID'] = sanitize_text_field($registration_status); |
|
201 | + return; |
|
202 | + } |
|
203 | + // make sure we exclude incomplete registrations, but only if not trashed. |
|
204 | + if ($this->view === 'trash') { |
|
205 | + $this->where_params['REG_deleted'] = true; |
|
206 | + return; |
|
207 | + } |
|
208 | + $this->where_params['STS_ID'] = $this->view === 'incomplete' |
|
209 | + ? EEM_Registration::status_id_incomplete |
|
210 | + : ['!=', EEM_Registration::status_id_incomplete]; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * Adds any provided date restraints to the where conditions for the registrations query. |
|
216 | + * |
|
217 | + * @throws EE_Error |
|
218 | + * @throws InvalidArgumentException |
|
219 | + * @throws InvalidDataTypeException |
|
220 | + * @throws InvalidInterfaceException |
|
221 | + */ |
|
222 | + protected function addDateToWhereConditions() |
|
223 | + { |
|
224 | + if ($this->view === 'today') { |
|
225 | + $now = date('Y-m-d', current_time('timestamp')); |
|
226 | + $this->where_params['REG_date'] = [ |
|
227 | + 'BETWEEN', |
|
228 | + [ |
|
229 | + $this->registration_model->convert_datetime_for_query( |
|
230 | + 'REG_date', |
|
231 | + $now . ' 00:00:00', |
|
232 | + 'Y-m-d H:i:s' |
|
233 | + ), |
|
234 | + $this->registration_model->convert_datetime_for_query( |
|
235 | + 'REG_date', |
|
236 | + $now . ' 23:59:59', |
|
237 | + 'Y-m-d H:i:s' |
|
238 | + ), |
|
239 | + ], |
|
240 | + ]; |
|
241 | + return; |
|
242 | + } |
|
243 | + if ($this->view === 'month') { |
|
244 | + $current_year_and_month = date('Y-m', current_time('timestamp')); |
|
245 | + $days_this_month = date('t', current_time('timestamp')); |
|
246 | + $this->where_params['REG_date'] = [ |
|
247 | + 'BETWEEN', |
|
248 | + [ |
|
249 | + $this->registration_model->convert_datetime_for_query( |
|
250 | + 'REG_date', |
|
251 | + $current_year_and_month . '-01 00:00:00', |
|
252 | + 'Y-m-d H:i:s' |
|
253 | + ), |
|
254 | + $this->registration_model->convert_datetime_for_query( |
|
255 | + 'REG_date', |
|
256 | + $current_year_and_month . '-' . $days_this_month . ' 23:59:59', |
|
257 | + 'Y-m-d H:i:s' |
|
258 | + ), |
|
259 | + ], |
|
260 | + ]; |
|
261 | + return; |
|
262 | + } |
|
263 | + $month_range = $this->request->getRequestParam('month_range'); |
|
264 | + if ($month_range) { |
|
265 | + $month_range = sanitize_text_field($month_range); |
|
266 | + $pieces = explode(' ', $month_range, 3); |
|
267 | + $month_requested = ! empty($pieces[0]) |
|
268 | + ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) |
|
269 | + : ''; |
|
270 | + $year_requested = ! empty($pieces[1]) |
|
271 | + ? $pieces[1] |
|
272 | + : ''; |
|
273 | + // if there is not a month or year then we can't go further |
|
274 | + if ($month_requested && $year_requested) { |
|
275 | + $days_in_month = date('t', strtotime($year_requested . '-' . $month_requested . '-' . '01')); |
|
276 | + $this->where_params['REG_date'] = [ |
|
277 | + 'BETWEEN', |
|
278 | + [ |
|
279 | + $this->registration_model->convert_datetime_for_query( |
|
280 | + 'REG_date', |
|
281 | + $year_requested . '-' . $month_requested . '-01 00:00:00', |
|
282 | + 'Y-m-d H:i:s' |
|
283 | + ), |
|
284 | + $this->registration_model->convert_datetime_for_query( |
|
285 | + 'REG_date', |
|
286 | + $year_requested . '-' . $month_requested . '-' . $days_in_month . ' 23:59:59', |
|
287 | + 'Y-m-d H:i:s' |
|
288 | + ), |
|
289 | + ], |
|
290 | + ]; |
|
291 | + } |
|
292 | + } |
|
293 | + } |
|
294 | + |
|
295 | + |
|
296 | + /** |
|
297 | + * Adds any provided search restraints to the where conditions for the registrations query |
|
298 | + */ |
|
299 | + protected function addSearchToWhereConditions() |
|
300 | + { |
|
301 | + $search = $this->request->getRequestParam('s'); |
|
302 | + if ($search) { |
|
303 | + $search_string = '%' . sanitize_text_field($search) . '%'; |
|
304 | + $this->where_params['OR*search_conditions'] = [ |
|
305 | + 'Event.EVT_name' => ['LIKE', $search_string], |
|
306 | + 'Event.EVT_desc' => ['LIKE', $search_string], |
|
307 | + 'Event.EVT_short_desc' => ['LIKE', $search_string], |
|
308 | + 'Attendee.ATT_full_name' => ['LIKE', $search_string], |
|
309 | + 'Attendee.ATT_fname' => ['LIKE', $search_string], |
|
310 | + 'Attendee.ATT_lname' => ['LIKE', $search_string], |
|
311 | + 'Attendee.ATT_short_bio' => ['LIKE', $search_string], |
|
312 | + 'Attendee.ATT_email' => ['LIKE', $search_string], |
|
313 | + 'Attendee.ATT_address' => ['LIKE', $search_string], |
|
314 | + 'Attendee.ATT_address2' => ['LIKE', $search_string], |
|
315 | + 'Attendee.ATT_city' => ['LIKE', $search_string], |
|
316 | + 'REG_final_price' => ['LIKE', $search_string], |
|
317 | + 'REG_code' => ['LIKE', $search_string], |
|
318 | + 'REG_count' => ['LIKE', $search_string], |
|
319 | + 'REG_group_size' => ['LIKE', $search_string], |
|
320 | + 'Ticket.TKT_name' => ['LIKE', $search_string], |
|
321 | + 'Ticket.TKT_description' => ['LIKE', $search_string], |
|
322 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => ['LIKE', $search_string], |
|
323 | + ]; |
|
324 | + } |
|
325 | + } |
|
326 | + |
|
327 | + |
|
328 | + /** |
|
329 | + * Sets up the orderby for the registrations query. |
|
330 | + * |
|
331 | + * @return array |
|
332 | + */ |
|
333 | + protected function getOrderbyClause() |
|
334 | + { |
|
335 | + $orderby_field = $this->request->getRequestParam('orderby'); |
|
336 | + $orderby_field = $orderby_field ? sanitize_text_field($orderby_field) : '_REG_date'; |
|
337 | + switch ($orderby_field) { |
|
338 | + case '_REG_ID': |
|
339 | + $orderby = ['REG_ID']; |
|
340 | + break; |
|
341 | + case '_Reg_status': |
|
342 | + $orderby = ['STS_ID']; |
|
343 | + break; |
|
344 | + case 'ATT_fname': |
|
345 | + $orderby = ['Attendee.ATT_fname', 'Attendee.ATT_lname']; |
|
346 | + break; |
|
347 | + case 'ATT_lname': |
|
348 | + $orderby = ['Attendee.ATT_lname', 'Attendee.ATT_fname']; |
|
349 | + break; |
|
350 | + case 'event_name': |
|
351 | + $orderby = ['Event.EVT_name']; |
|
352 | + break; |
|
353 | + case 'DTT_EVT_start': |
|
354 | + $orderby = ['Event.Datetime.DTT_EVT_start']; |
|
355 | + break; |
|
356 | + case '_REG_date': |
|
357 | + $orderby = ['REG_date']; |
|
358 | + break; |
|
359 | + default: |
|
360 | + $orderby = [$orderby_field]; |
|
361 | + break; |
|
362 | + } |
|
363 | + $order = $this->request->getRequestParam('order'); |
|
364 | + $order = $order ? sanitize_text_field($order) : 'DESC'; |
|
365 | + |
|
366 | + $orderby = array_combine( |
|
367 | + $orderby, |
|
368 | + array_fill(0, count($orderby), $order) |
|
369 | + ); |
|
370 | + // because there are many registrations with the same date, define |
|
371 | + // a secondary way to order them, otherwise MySQL seems to be a bit random |
|
372 | + if (empty($orderby['REG_ID'])) { |
|
373 | + $orderby['REG_ID'] = $order; |
|
374 | + } |
|
375 | + |
|
376 | + $orderby = apply_filters( |
|
377 | + 'FHEE__Registrations_Admin_Page___get_orderby_for_registrations_query', |
|
378 | + $orderby, |
|
379 | + $this->request->requestParams() |
|
380 | + ); |
|
381 | + return ['order_by' => $orderby]; |
|
382 | + } |
|
383 | + |
|
384 | + |
|
385 | + /** |
|
386 | + * Sets up the limit for the registrations query. |
|
387 | + * |
|
388 | + * @param $per_page |
|
389 | + * @return array |
|
390 | + */ |
|
391 | + protected function getLimitClause($per_page) |
|
392 | + { |
|
393 | + $current_page = $this->request->getRequestParam('paged'); |
|
394 | + $current_page = $current_page ? absint($current_page) : 1; |
|
395 | + $per_page = (int) $this->request->getRequestParam('perpage', $per_page); |
|
396 | + // -1 means return all results so get out if that's set. |
|
397 | + if ($per_page === -1) { |
|
398 | + return []; |
|
399 | + } |
|
400 | + $per_page = absint($per_page); |
|
401 | + $offset = ($current_page - 1) * $per_page; |
|
402 | + return ['limit' => [$offset, $per_page]]; |
|
403 | + } |
|
404 | 404 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'caps' => EEM_Registration::caps_read_admin, |
83 | 83 | 'default_where_conditions' => 'this_model_only', |
84 | 84 | ]; |
85 | - if (! $count_query) { |
|
85 | + if ( ! $count_query) { |
|
86 | 86 | $query_params = array_merge( |
87 | 87 | $query_params, |
88 | 88 | $this->getOrderbyClause(), |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | [ |
229 | 229 | $this->registration_model->convert_datetime_for_query( |
230 | 230 | 'REG_date', |
231 | - $now . ' 00:00:00', |
|
231 | + $now.' 00:00:00', |
|
232 | 232 | 'Y-m-d H:i:s' |
233 | 233 | ), |
234 | 234 | $this->registration_model->convert_datetime_for_query( |
235 | 235 | 'REG_date', |
236 | - $now . ' 23:59:59', |
|
236 | + $now.' 23:59:59', |
|
237 | 237 | 'Y-m-d H:i:s' |
238 | 238 | ), |
239 | 239 | ], |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | [ |
249 | 249 | $this->registration_model->convert_datetime_for_query( |
250 | 250 | 'REG_date', |
251 | - $current_year_and_month . '-01 00:00:00', |
|
251 | + $current_year_and_month.'-01 00:00:00', |
|
252 | 252 | 'Y-m-d H:i:s' |
253 | 253 | ), |
254 | 254 | $this->registration_model->convert_datetime_for_query( |
255 | 255 | 'REG_date', |
256 | - $current_year_and_month . '-' . $days_this_month . ' 23:59:59', |
|
256 | + $current_year_and_month.'-'.$days_this_month.' 23:59:59', |
|
257 | 257 | 'Y-m-d H:i:s' |
258 | 258 | ), |
259 | 259 | ], |
@@ -272,18 +272,18 @@ discard block |
||
272 | 272 | : ''; |
273 | 273 | // if there is not a month or year then we can't go further |
274 | 274 | if ($month_requested && $year_requested) { |
275 | - $days_in_month = date('t', strtotime($year_requested . '-' . $month_requested . '-' . '01')); |
|
275 | + $days_in_month = date('t', strtotime($year_requested.'-'.$month_requested.'-'.'01')); |
|
276 | 276 | $this->where_params['REG_date'] = [ |
277 | 277 | 'BETWEEN', |
278 | 278 | [ |
279 | 279 | $this->registration_model->convert_datetime_for_query( |
280 | 280 | 'REG_date', |
281 | - $year_requested . '-' . $month_requested . '-01 00:00:00', |
|
281 | + $year_requested.'-'.$month_requested.'-01 00:00:00', |
|
282 | 282 | 'Y-m-d H:i:s' |
283 | 283 | ), |
284 | 284 | $this->registration_model->convert_datetime_for_query( |
285 | 285 | 'REG_date', |
286 | - $year_requested . '-' . $month_requested . '-' . $days_in_month . ' 23:59:59', |
|
286 | + $year_requested.'-'.$month_requested.'-'.$days_in_month.' 23:59:59', |
|
287 | 287 | 'Y-m-d H:i:s' |
288 | 288 | ), |
289 | 289 | ], |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | { |
301 | 301 | $search = $this->request->getRequestParam('s'); |
302 | 302 | if ($search) { |
303 | - $search_string = '%' . sanitize_text_field($search) . '%'; |
|
303 | + $search_string = '%'.sanitize_text_field($search).'%'; |
|
304 | 304 | $this->where_params['OR*search_conditions'] = [ |
305 | 305 | 'Event.EVT_name' => ['LIKE', $search_string], |
306 | 306 | 'Event.EVT_desc' => ['LIKE', $search_string], |
@@ -17,128 +17,128 @@ |
||
17 | 17 | class RequestTypeContextFactory implements RequestTypeContextFactoryInterface |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var LoaderInterface $loader |
|
22 | - */ |
|
23 | - private $loader; |
|
20 | + /** |
|
21 | + * @var LoaderInterface $loader |
|
22 | + */ |
|
23 | + private $loader; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * RequestTypeContextFactory constructor. |
|
28 | - * |
|
29 | - * @param LoaderInterface $loader |
|
30 | - */ |
|
31 | - public function __construct(LoaderInterface $loader) |
|
32 | - { |
|
33 | - $this->loader = $loader; |
|
34 | - } |
|
26 | + /** |
|
27 | + * RequestTypeContextFactory constructor. |
|
28 | + * |
|
29 | + * @param LoaderInterface $loader |
|
30 | + */ |
|
31 | + public function __construct(LoaderInterface $loader) |
|
32 | + { |
|
33 | + $this->loader = $loader; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @param string $slug |
|
39 | - * @return RequestTypeContext |
|
40 | - */ |
|
41 | - public function create($slug) |
|
42 | - { |
|
43 | - switch ($slug) { |
|
44 | - case RequestTypeContext::ACTIVATION: |
|
45 | - $description = esc_html__( |
|
46 | - 'The current request is for some form of activation', |
|
47 | - 'event_espresso' |
|
48 | - ); |
|
49 | - break; |
|
50 | - case RequestTypeContext::API: |
|
51 | - $description = esc_html__( |
|
52 | - 'The current request is for the EE REST API', |
|
53 | - 'event_espresso' |
|
54 | - ); |
|
55 | - break; |
|
56 | - case RequestTypeContext::AJAX_FRONT: |
|
57 | - $description = esc_html__( |
|
58 | - 'The current request is for the frontend via AJAX', |
|
59 | - 'event_espresso' |
|
60 | - ); |
|
61 | - break; |
|
62 | - case RequestTypeContext::AJAX_ADMIN: |
|
63 | - $description = esc_html__( |
|
64 | - 'The current request is for the admin via AJAX', |
|
65 | - 'event_espresso' |
|
66 | - ); |
|
67 | - break; |
|
68 | - case RequestTypeContext::AJAX_HEARTBEAT: |
|
69 | - $description = esc_html__( |
|
70 | - 'The current request is for the WP Heartbeat', |
|
71 | - 'event_espresso' |
|
72 | - ); |
|
73 | - break; |
|
74 | - case RequestTypeContext::AJAX_OTHER: |
|
75 | - $description = esc_html__( |
|
76 | - 'The current request is for non-EE related code via AJAX', |
|
77 | - 'event_espresso' |
|
78 | - ); |
|
79 | - break; |
|
80 | - case RequestTypeContext::CRON: |
|
81 | - $description = esc_html__( |
|
82 | - 'The current request is for a WP_Cron', |
|
83 | - 'event_espresso' |
|
84 | - ); |
|
85 | - break; |
|
86 | - case RequestTypeContext::CLI: |
|
87 | - $description = esc_html__( |
|
88 | - 'The current request is from the command line', |
|
89 | - 'event_espresso' |
|
90 | - ); |
|
91 | - break; |
|
92 | - case RequestTypeContext::ADMIN: |
|
93 | - $description = esc_html__( |
|
94 | - 'The current request is for the admin', |
|
95 | - 'event_espresso' |
|
96 | - ); |
|
97 | - break; |
|
98 | - case RequestTypeContext::IFRAME: |
|
99 | - $description = esc_html__( |
|
100 | - 'The current request is for an iframe', |
|
101 | - 'event_espresso' |
|
102 | - ); |
|
103 | - break; |
|
104 | - case RequestTypeContext::FEED: |
|
105 | - $description = esc_html__( |
|
106 | - 'The current request is for a feed (ie: RSS)', |
|
107 | - 'event_espresso' |
|
108 | - ); |
|
109 | - break; |
|
110 | - case RequestTypeContext::GQL: |
|
111 | - $description = esc_html__( |
|
112 | - 'The current request is for the EE GraphQL Manager', |
|
113 | - 'event_espresso' |
|
114 | - ); |
|
115 | - break; |
|
116 | - case RequestTypeContext::WP_API: |
|
117 | - $description = esc_html__( |
|
118 | - 'The current request is for the WordPress REST API', |
|
119 | - 'event_espresso' |
|
120 | - ); |
|
121 | - break; |
|
122 | - case RequestTypeContext::WP_SCRAPE: |
|
123 | - $description = esc_html__( |
|
124 | - 'The current request is for a WordPress loopback scrape', |
|
125 | - 'event_espresso' |
|
126 | - ); |
|
127 | - break; |
|
128 | - case RequestTypeContext::FRONTEND: |
|
129 | - default: |
|
130 | - $description = esc_html__( |
|
131 | - 'The current request is for the frontend', |
|
132 | - 'event_espresso' |
|
133 | - ); |
|
134 | - break; |
|
135 | - } |
|
136 | - // we're using the Loader with sharing turned on, |
|
137 | - // so that the generated RequestTypeContext object is accessible anywhere |
|
138 | - // by simply requesting it again from the loader |
|
139 | - return $this->loader->getShared( |
|
140 | - 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
141 | - array($slug, $description) |
|
142 | - ); |
|
143 | - } |
|
37 | + /** |
|
38 | + * @param string $slug |
|
39 | + * @return RequestTypeContext |
|
40 | + */ |
|
41 | + public function create($slug) |
|
42 | + { |
|
43 | + switch ($slug) { |
|
44 | + case RequestTypeContext::ACTIVATION: |
|
45 | + $description = esc_html__( |
|
46 | + 'The current request is for some form of activation', |
|
47 | + 'event_espresso' |
|
48 | + ); |
|
49 | + break; |
|
50 | + case RequestTypeContext::API: |
|
51 | + $description = esc_html__( |
|
52 | + 'The current request is for the EE REST API', |
|
53 | + 'event_espresso' |
|
54 | + ); |
|
55 | + break; |
|
56 | + case RequestTypeContext::AJAX_FRONT: |
|
57 | + $description = esc_html__( |
|
58 | + 'The current request is for the frontend via AJAX', |
|
59 | + 'event_espresso' |
|
60 | + ); |
|
61 | + break; |
|
62 | + case RequestTypeContext::AJAX_ADMIN: |
|
63 | + $description = esc_html__( |
|
64 | + 'The current request is for the admin via AJAX', |
|
65 | + 'event_espresso' |
|
66 | + ); |
|
67 | + break; |
|
68 | + case RequestTypeContext::AJAX_HEARTBEAT: |
|
69 | + $description = esc_html__( |
|
70 | + 'The current request is for the WP Heartbeat', |
|
71 | + 'event_espresso' |
|
72 | + ); |
|
73 | + break; |
|
74 | + case RequestTypeContext::AJAX_OTHER: |
|
75 | + $description = esc_html__( |
|
76 | + 'The current request is for non-EE related code via AJAX', |
|
77 | + 'event_espresso' |
|
78 | + ); |
|
79 | + break; |
|
80 | + case RequestTypeContext::CRON: |
|
81 | + $description = esc_html__( |
|
82 | + 'The current request is for a WP_Cron', |
|
83 | + 'event_espresso' |
|
84 | + ); |
|
85 | + break; |
|
86 | + case RequestTypeContext::CLI: |
|
87 | + $description = esc_html__( |
|
88 | + 'The current request is from the command line', |
|
89 | + 'event_espresso' |
|
90 | + ); |
|
91 | + break; |
|
92 | + case RequestTypeContext::ADMIN: |
|
93 | + $description = esc_html__( |
|
94 | + 'The current request is for the admin', |
|
95 | + 'event_espresso' |
|
96 | + ); |
|
97 | + break; |
|
98 | + case RequestTypeContext::IFRAME: |
|
99 | + $description = esc_html__( |
|
100 | + 'The current request is for an iframe', |
|
101 | + 'event_espresso' |
|
102 | + ); |
|
103 | + break; |
|
104 | + case RequestTypeContext::FEED: |
|
105 | + $description = esc_html__( |
|
106 | + 'The current request is for a feed (ie: RSS)', |
|
107 | + 'event_espresso' |
|
108 | + ); |
|
109 | + break; |
|
110 | + case RequestTypeContext::GQL: |
|
111 | + $description = esc_html__( |
|
112 | + 'The current request is for the EE GraphQL Manager', |
|
113 | + 'event_espresso' |
|
114 | + ); |
|
115 | + break; |
|
116 | + case RequestTypeContext::WP_API: |
|
117 | + $description = esc_html__( |
|
118 | + 'The current request is for the WordPress REST API', |
|
119 | + 'event_espresso' |
|
120 | + ); |
|
121 | + break; |
|
122 | + case RequestTypeContext::WP_SCRAPE: |
|
123 | + $description = esc_html__( |
|
124 | + 'The current request is for a WordPress loopback scrape', |
|
125 | + 'event_espresso' |
|
126 | + ); |
|
127 | + break; |
|
128 | + case RequestTypeContext::FRONTEND: |
|
129 | + default: |
|
130 | + $description = esc_html__( |
|
131 | + 'The current request is for the frontend', |
|
132 | + 'event_espresso' |
|
133 | + ); |
|
134 | + break; |
|
135 | + } |
|
136 | + // we're using the Loader with sharing turned on, |
|
137 | + // so that the generated RequestTypeContext object is accessible anywhere |
|
138 | + // by simply requesting it again from the loader |
|
139 | + return $this->loader->getShared( |
|
140 | + 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
141 | + array($slug, $description) |
|
142 | + ); |
|
143 | + } |
|
144 | 144 | } |