@@ -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 | } |
@@ -18,225 +18,225 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Recipient_List_Shortcodes extends EE_Shortcodes |
20 | 20 | { |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _init_props() |
|
28 | - { |
|
29 | - $this->label = esc_html__('Recipient List Shortcodes', 'event_espresso'); |
|
30 | - $this->description = esc_html__('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
31 | - $this->_shortcodes = array( |
|
32 | - '[RECIPIENT_TICKET_LIST]' => esc_html__( |
|
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]' => esc_html__( |
|
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 = esc_html__('Recipient List Shortcodes', 'event_espresso'); |
|
30 | + $this->description = esc_html__('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
31 | + $this->_shortcodes = array( |
|
32 | + '[RECIPIENT_TICKET_LIST]' => esc_html__( |
|
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]' => esc_html__( |
|
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 | } |
@@ -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 | } |
@@ -22,57 +22,57 @@ |
||
22 | 22 | */ |
23 | 23 | class DateFilterHeader extends AdminPageHeaderDecorator |
24 | 24 | { |
25 | - /** |
|
26 | - * @var EEM_Datetime $datetime_model |
|
27 | - */ |
|
28 | - private $datetime_model; |
|
25 | + /** |
|
26 | + * @var EEM_Datetime $datetime_model |
|
27 | + */ |
|
28 | + private $datetime_model; |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * DateFilterHeader constructor. |
|
33 | - * |
|
34 | - * @param RequestInterface $request |
|
35 | - * @param EEM_Datetime $datetime_model |
|
36 | - */ |
|
37 | - public function __construct(RequestInterface $request, EEM_Datetime $datetime_model) |
|
38 | - { |
|
39 | - parent::__construct($request); |
|
40 | - $this->datetime_model = $datetime_model; |
|
41 | - } |
|
31 | + /** |
|
32 | + * DateFilterHeader constructor. |
|
33 | + * |
|
34 | + * @param RequestInterface $request |
|
35 | + * @param EEM_Datetime $datetime_model |
|
36 | + */ |
|
37 | + public function __construct(RequestInterface $request, EEM_Datetime $datetime_model) |
|
38 | + { |
|
39 | + parent::__construct($request); |
|
40 | + $this->datetime_model = $datetime_model; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * @param string $text |
|
46 | - * @return string |
|
47 | - * @throws EE_Error |
|
48 | - * @throws InvalidDataTypeException |
|
49 | - * @throws InvalidInterfaceException |
|
50 | - * @throws InvalidArgumentException |
|
51 | - * @throws ReflectionException |
|
52 | - * @since 4.10.2.p |
|
53 | - */ |
|
54 | - public function getHeaderText($text = '') |
|
55 | - { |
|
56 | - $DTT_ID = $this->request->getRequestParam('DTT_ID'); |
|
57 | - $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID, 'int'); |
|
58 | - if ($DTT_ID) { |
|
59 | - $datetime = $this->datetime_model->get_one_by_ID($DTT_ID); |
|
60 | - if ($datetime instanceof EE_Datetime && $text !== '') { |
|
61 | - // remove the closing h3 heading tag if it exists |
|
62 | - $text = str_replace( |
|
63 | - '</h3>', |
|
64 | - '', |
|
65 | - $text |
|
66 | - ); |
|
67 | - $text .= ' '; |
|
68 | - $text .= '<span class="drk-grey-text">'; |
|
69 | - $text .= '<span class="dashicons dashicons-calendar"></span>'; |
|
70 | - $text .= $datetime->name(); |
|
71 | - $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
72 | - $text .= '</span></h3>'; |
|
73 | - } |
|
74 | - } |
|
44 | + /** |
|
45 | + * @param string $text |
|
46 | + * @return string |
|
47 | + * @throws EE_Error |
|
48 | + * @throws InvalidDataTypeException |
|
49 | + * @throws InvalidInterfaceException |
|
50 | + * @throws InvalidArgumentException |
|
51 | + * @throws ReflectionException |
|
52 | + * @since 4.10.2.p |
|
53 | + */ |
|
54 | + public function getHeaderText($text = '') |
|
55 | + { |
|
56 | + $DTT_ID = $this->request->getRequestParam('DTT_ID'); |
|
57 | + $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID, 'int'); |
|
58 | + if ($DTT_ID) { |
|
59 | + $datetime = $this->datetime_model->get_one_by_ID($DTT_ID); |
|
60 | + if ($datetime instanceof EE_Datetime && $text !== '') { |
|
61 | + // remove the closing h3 heading tag if it exists |
|
62 | + $text = str_replace( |
|
63 | + '</h3>', |
|
64 | + '', |
|
65 | + $text |
|
66 | + ); |
|
67 | + $text .= ' '; |
|
68 | + $text .= '<span class="drk-grey-text">'; |
|
69 | + $text .= '<span class="dashicons dashicons-calendar"></span>'; |
|
70 | + $text .= $datetime->name(); |
|
71 | + $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
72 | + $text .= '</span></h3>'; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - return $text; |
|
77 | - } |
|
76 | + return $text; |
|
77 | + } |
|
78 | 78 | } |
@@ -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 | } |
@@ -19,55 +19,55 @@ |
||
19 | 19 | */ |
20 | 20 | class AttendeeFilterHeader extends AdminPageHeaderDecorator |
21 | 21 | { |
22 | - /** |
|
23 | - * @var EEM_Attendee $attendee_model |
|
24 | - */ |
|
25 | - private $attendee_model; |
|
22 | + /** |
|
23 | + * @var EEM_Attendee $attendee_model |
|
24 | + */ |
|
25 | + private $attendee_model; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * AttendeeFilterHeader constructor. |
|
30 | - * |
|
31 | - * @param RequestInterface $request |
|
32 | - * @param EEM_Attendee $attendee_model |
|
33 | - */ |
|
34 | - public function __construct(RequestInterface $request, EEM_Attendee $attendee_model) |
|
35 | - { |
|
36 | - parent::__construct($request); |
|
37 | - $this->attendee_model = $attendee_model; |
|
38 | - } |
|
28 | + /** |
|
29 | + * AttendeeFilterHeader constructor. |
|
30 | + * |
|
31 | + * @param RequestInterface $request |
|
32 | + * @param EEM_Attendee $attendee_model |
|
33 | + */ |
|
34 | + public function __construct(RequestInterface $request, EEM_Attendee $attendee_model) |
|
35 | + { |
|
36 | + parent::__construct($request); |
|
37 | + $this->attendee_model = $attendee_model; |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @param string $text |
|
43 | - * @return string |
|
44 | - * @throws EE_Error |
|
45 | - * @since 4.10.2.p |
|
46 | - */ |
|
47 | - public function getHeaderText($text = '') |
|
48 | - { |
|
49 | - $ATT_ID = $this->request->getRequestParam('ATT_ID'); |
|
50 | - $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID, 'int'); |
|
51 | - if ($ATT_ID) { |
|
52 | - $attendee = $this->attendee_model->get_one_by_ID($ATT_ID); |
|
53 | - if ($attendee instanceof EE_Attendee) { |
|
54 | - $text .= sprintf( |
|
55 | - esc_html__( |
|
56 | - '%1$s Viewing registrations for %2$s%3$s', |
|
57 | - 'event_espresso' |
|
58 | - ), |
|
59 | - '<h3 style="line-height:1.5em;">', |
|
60 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
61 | - array( |
|
62 | - 'action' => 'edit_attendee', |
|
63 | - 'post' => $ATT_ID, |
|
64 | - ), |
|
65 | - REG_ADMIN_URL |
|
66 | - ) . '">' . $attendee->full_name() . '</a>', |
|
67 | - '</h3>' |
|
68 | - ); |
|
69 | - } |
|
70 | - } |
|
71 | - return $text; |
|
72 | - } |
|
41 | + /** |
|
42 | + * @param string $text |
|
43 | + * @return string |
|
44 | + * @throws EE_Error |
|
45 | + * @since 4.10.2.p |
|
46 | + */ |
|
47 | + public function getHeaderText($text = '') |
|
48 | + { |
|
49 | + $ATT_ID = $this->request->getRequestParam('ATT_ID'); |
|
50 | + $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID, 'int'); |
|
51 | + if ($ATT_ID) { |
|
52 | + $attendee = $this->attendee_model->get_one_by_ID($ATT_ID); |
|
53 | + if ($attendee instanceof EE_Attendee) { |
|
54 | + $text .= sprintf( |
|
55 | + esc_html__( |
|
56 | + '%1$s Viewing registrations for %2$s%3$s', |
|
57 | + 'event_espresso' |
|
58 | + ), |
|
59 | + '<h3 style="line-height:1.5em;">', |
|
60 | + '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
61 | + array( |
|
62 | + 'action' => 'edit_attendee', |
|
63 | + 'post' => $ATT_ID, |
|
64 | + ), |
|
65 | + REG_ADMIN_URL |
|
66 | + ) . '">' . $attendee->full_name() . '</a>', |
|
67 | + '</h3>' |
|
68 | + ); |
|
69 | + } |
|
70 | + } |
|
71 | + return $text; |
|
72 | + } |
|
73 | 73 | } |
@@ -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 |
@@ -11,136 +11,136 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base |
13 | 13 | { |
14 | - /** |
|
15 | - * opening div tag for a form |
|
16 | - * |
|
17 | - * @return string |
|
18 | - */ |
|
19 | - public function layout_form_begin() |
|
20 | - { |
|
21 | - return EEH_HTML::div( |
|
22 | - '', |
|
23 | - $this->_form_section->html_id(), |
|
24 | - $this->_form_section->html_class(), |
|
25 | - $this->_form_section->html_style() |
|
26 | - ); |
|
27 | - } |
|
14 | + /** |
|
15 | + * opening div tag for a form |
|
16 | + * |
|
17 | + * @return string |
|
18 | + */ |
|
19 | + public function layout_form_begin() |
|
20 | + { |
|
21 | + return EEH_HTML::div( |
|
22 | + '', |
|
23 | + $this->_form_section->html_id(), |
|
24 | + $this->_form_section->html_class(), |
|
25 | + $this->_form_section->html_style() |
|
26 | + ); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * Lays out the row for the input, including label and errors |
|
33 | - * |
|
34 | - * @param EE_Form_Input_Base $input |
|
35 | - * @return string |
|
36 | - * @throws \EE_Error |
|
37 | - */ |
|
38 | - public function layout_input($input) |
|
39 | - { |
|
40 | - $html = ''; |
|
41 | - // set something unique for the id |
|
42 | - $html_id = (string) $input->html_id() !== '' |
|
43 | - ? (string) $input->html_id() |
|
44 | - : spl_object_hash($input); |
|
45 | - // and add a generic input type class |
|
46 | - $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv'; |
|
47 | - if ($input instanceof EE_Hidden_Input) { |
|
48 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
49 | - } elseif ($input instanceof EE_Submit_Input) { |
|
50 | - $html .= EEH_HTML::div( |
|
51 | - $input->get_html_for_input(), |
|
52 | - $html_id . '-submit-dv', |
|
53 | - "{$input->html_class()}-submit-dv {$html_class}" |
|
54 | - ); |
|
55 | - } elseif ($input instanceof EE_Select_Input) { |
|
56 | - $html .= EEH_HTML::div( |
|
57 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
58 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
59 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
60 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
61 | - $html_id . '-input-dv', |
|
62 | - "{$input->html_class()}-input-dv {$html_class}" |
|
63 | - ); |
|
64 | - } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
|
65 | - $html .= EEH_HTML::div( |
|
66 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . |
|
67 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
68 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
69 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
70 | - $html_id . '-input-dv', |
|
71 | - "{$input->html_class()}-input-dv {$html_class}" |
|
72 | - ); |
|
73 | - } else { |
|
74 | - $html .= EEH_HTML::div( |
|
75 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
76 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
77 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
78 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
79 | - $html_id . '-input-dv', |
|
80 | - "{$input->html_class()}-input-dv {$html_class}" |
|
81 | - ); |
|
82 | - } |
|
83 | - return $html; |
|
84 | - } |
|
31 | + /** |
|
32 | + * Lays out the row for the input, including label and errors |
|
33 | + * |
|
34 | + * @param EE_Form_Input_Base $input |
|
35 | + * @return string |
|
36 | + * @throws \EE_Error |
|
37 | + */ |
|
38 | + public function layout_input($input) |
|
39 | + { |
|
40 | + $html = ''; |
|
41 | + // set something unique for the id |
|
42 | + $html_id = (string) $input->html_id() !== '' |
|
43 | + ? (string) $input->html_id() |
|
44 | + : spl_object_hash($input); |
|
45 | + // and add a generic input type class |
|
46 | + $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv'; |
|
47 | + if ($input instanceof EE_Hidden_Input) { |
|
48 | + $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
49 | + } elseif ($input instanceof EE_Submit_Input) { |
|
50 | + $html .= EEH_HTML::div( |
|
51 | + $input->get_html_for_input(), |
|
52 | + $html_id . '-submit-dv', |
|
53 | + "{$input->html_class()}-submit-dv {$html_class}" |
|
54 | + ); |
|
55 | + } elseif ($input instanceof EE_Select_Input) { |
|
56 | + $html .= EEH_HTML::div( |
|
57 | + EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
58 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
59 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
60 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
61 | + $html_id . '-input-dv', |
|
62 | + "{$input->html_class()}-input-dv {$html_class}" |
|
63 | + ); |
|
64 | + } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
|
65 | + $html .= EEH_HTML::div( |
|
66 | + EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . |
|
67 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
68 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
69 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
70 | + $html_id . '-input-dv', |
|
71 | + "{$input->html_class()}-input-dv {$html_class}" |
|
72 | + ); |
|
73 | + } else { |
|
74 | + $html .= EEH_HTML::div( |
|
75 | + EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
76 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
77 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
78 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
79 | + $html_id . '-input-dv', |
|
80 | + "{$input->html_class()}-input-dv {$html_class}" |
|
81 | + ); |
|
82 | + } |
|
83 | + return $html; |
|
84 | + } |
|
85 | 85 | |
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * |
|
90 | - * _display_label_for_option_type_question |
|
91 | - * Gets the HTML for the 'label', which is just text for this (because labels |
|
92 | - * should be for each input) |
|
93 | - * |
|
94 | - * @param EE_Form_Input_With_Options_Base $input |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) |
|
98 | - { |
|
99 | - if ($input->display_html_label_text()) { |
|
100 | - $html_label_text = $input->html_label_text(); |
|
101 | - $label_html = EEH_HTML::div( |
|
102 | - $input->required() |
|
103 | - ? $html_label_text . EEH_HTML::span('*', '', 'ee-asterisk') |
|
104 | - : $html_label_text, |
|
105 | - $input->html_label_id(), |
|
106 | - $input->required() |
|
107 | - ? 'ee-required-label ' . $input->html_label_class() |
|
108 | - : $input->html_label_class(), |
|
109 | - $input->html_label_style(), |
|
110 | - $input->other_html_attributes() |
|
111 | - ); |
|
112 | - // if no content was provided to EEH_HTML::div() above (ie: an empty label), |
|
113 | - // then we need to close the div manually |
|
114 | - if (empty($html_label_text)) { |
|
115 | - $label_html .= EEH_HTML::divx($input->html_label_id(), $input->html_label_class()); |
|
116 | - } |
|
117 | - return $label_html; |
|
118 | - } |
|
119 | - return ''; |
|
120 | - } |
|
88 | + /** |
|
89 | + * |
|
90 | + * _display_label_for_option_type_question |
|
91 | + * Gets the HTML for the 'label', which is just text for this (because labels |
|
92 | + * should be for each input) |
|
93 | + * |
|
94 | + * @param EE_Form_Input_With_Options_Base $input |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) |
|
98 | + { |
|
99 | + if ($input->display_html_label_text()) { |
|
100 | + $html_label_text = $input->html_label_text(); |
|
101 | + $label_html = EEH_HTML::div( |
|
102 | + $input->required() |
|
103 | + ? $html_label_text . EEH_HTML::span('*', '', 'ee-asterisk') |
|
104 | + : $html_label_text, |
|
105 | + $input->html_label_id(), |
|
106 | + $input->required() |
|
107 | + ? 'ee-required-label ' . $input->html_label_class() |
|
108 | + : $input->html_label_class(), |
|
109 | + $input->html_label_style(), |
|
110 | + $input->other_html_attributes() |
|
111 | + ); |
|
112 | + // if no content was provided to EEH_HTML::div() above (ie: an empty label), |
|
113 | + // then we need to close the div manually |
|
114 | + if (empty($html_label_text)) { |
|
115 | + $label_html .= EEH_HTML::divx($input->html_label_id(), $input->html_label_class()); |
|
116 | + } |
|
117 | + return $label_html; |
|
118 | + } |
|
119 | + return ''; |
|
120 | + } |
|
121 | 121 | |
122 | 122 | |
123 | 123 | |
124 | - /** |
|
125 | - * Lays out a row for the subsection |
|
126 | - * |
|
127 | - * @param EE_Form_Section_Proper $form_section |
|
128 | - * @return string |
|
129 | - */ |
|
130 | - public function layout_subsection($form_section) |
|
131 | - { |
|
132 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
133 | - } |
|
124 | + /** |
|
125 | + * Lays out a row for the subsection |
|
126 | + * |
|
127 | + * @param EE_Form_Section_Proper $form_section |
|
128 | + * @return string |
|
129 | + */ |
|
130 | + public function layout_subsection($form_section) |
|
131 | + { |
|
132 | + return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
133 | + } |
|
134 | 134 | |
135 | 135 | |
136 | 136 | |
137 | - /** |
|
138 | - * closing div tag for a form |
|
139 | - * |
|
140 | - * @return string |
|
141 | - */ |
|
142 | - public function layout_form_end() |
|
143 | - { |
|
144 | - return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
145 | - } |
|
137 | + /** |
|
138 | + * closing div tag for a form |
|
139 | + * |
|
140 | + * @return string |
|
141 | + */ |
|
142 | + public function layout_form_end() |
|
143 | + { |
|
144 | + return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
145 | + } |
|
146 | 146 | } |
@@ -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], |
@@ -20,382 +20,382 @@ |
||
20 | 20 | */ |
21 | 21 | class QueryBuilder |
22 | 22 | { |
23 | - /** |
|
24 | - * @var RequestInterface $request |
|
25 | - */ |
|
26 | - protected $request; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var EEM_Registration $registration_model |
|
30 | - */ |
|
31 | - protected $registration_model; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var string $view |
|
35 | - */ |
|
36 | - protected $view; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var array $where_params |
|
40 | - */ |
|
41 | - protected $where_params; |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * QueryBuilder constructor. |
|
46 | - * |
|
47 | - * @param RequestInterface $request |
|
48 | - * @param EEM_Registration $registration_model |
|
49 | - * @param array $extra_request_params |
|
50 | - */ |
|
51 | - public function __construct( |
|
52 | - RequestInterface $request, |
|
53 | - EEM_Registration $registration_model, |
|
54 | - array $extra_request_params = [] |
|
55 | - ) { |
|
56 | - $this->request = $request; |
|
57 | - $this->registration_model = $registration_model; |
|
58 | - foreach ($extra_request_params as $key => $value) { |
|
59 | - $this->request->setRequestParam($key, $value); |
|
60 | - } |
|
61 | - $this->view = $this->request->getRequestParam('status', ''); |
|
62 | - $this->where_params = []; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * Sets up the where conditions for the registrations query. |
|
68 | - * |
|
69 | - * @param int $per_page |
|
70 | - * @param bool $count_query |
|
71 | - * @return array |
|
72 | - * @throws EE_Error |
|
73 | - * @throws InvalidArgumentException |
|
74 | - * @throws InvalidDataTypeException |
|
75 | - * @throws InvalidInterfaceException |
|
76 | - */ |
|
77 | - public function getQueryParams($per_page = 10, $count_query = false) |
|
78 | - { |
|
79 | - $query_params = [ |
|
80 | - 0 => $this->getWhereClause(), |
|
81 | - 'caps' => EEM_Registration::caps_read_admin, |
|
82 | - 'default_where_conditions' => 'this_model_only', |
|
83 | - ]; |
|
84 | - if (! $count_query) { |
|
85 | - $query_params = array_merge( |
|
86 | - $query_params, |
|
87 | - $this->getOrderbyClause(), |
|
88 | - $this->getLimitClause($per_page) |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - return $query_params; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * Sets up the where conditions for the registrations query. |
|
98 | - * |
|
99 | - * @return array |
|
100 | - * @throws EE_Error |
|
101 | - * @throws InvalidArgumentException |
|
102 | - * @throws InvalidDataTypeException |
|
103 | - * @throws InvalidInterfaceException |
|
104 | - */ |
|
105 | - protected function getWhereClause() |
|
106 | - { |
|
107 | - $this->addAttendeeIdToWhereConditions(); |
|
108 | - $this->addEventIdToWhereConditions(); |
|
109 | - $this->addCategoryIdToWhereConditions(); |
|
110 | - $this->addDatetimeIdToWhereConditions(); |
|
111 | - $this->addTicketIdToWhereConditions(); |
|
112 | - $this->addRegistrationStatusToWhereConditions(); |
|
113 | - $this->addDateToWhereConditions(); |
|
114 | - $this->addSearchToWhereConditions(); |
|
115 | - return apply_filters( |
|
116 | - 'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query', |
|
117 | - $this->where_params, |
|
118 | - $this->request->requestParams() |
|
119 | - ); |
|
120 | - } |
|
121 | - |
|
122 | - |
|
123 | - /** |
|
124 | - * This will add ATT_ID to the provided $this->where_clause array for EE model query parameters. |
|
125 | - */ |
|
126 | - protected function addAttendeeIdToWhereConditions() |
|
127 | - { |
|
128 | - $ATT_ID = $this->request->getRequestParam('attendee_id'); |
|
129 | - $ATT_ID = $this->request->getRequestParam('ATT_ID', $ATT_ID, 'int'); |
|
130 | - if ($ATT_ID) { |
|
131 | - $this->where_params['ATT_ID'] = $ATT_ID; |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * This will add EVT_ID to the provided $this->where_clause array for EE model query parameters. |
|
138 | - */ |
|
139 | - protected function addEventIdToWhereConditions() |
|
140 | - { |
|
141 | - $EVT_ID = $this->request->getRequestParam('event_id'); |
|
142 | - $EVT_ID = $this->request->getRequestParam('EVT_ID', $EVT_ID, 'int'); |
|
143 | - if ($EVT_ID) { |
|
144 | - $this->where_params['EVT_ID'] = $EVT_ID; |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * Adds category ID if it exists in the request to the where conditions for the registrations query. |
|
151 | - */ |
|
152 | - protected function addCategoryIdToWhereConditions() |
|
153 | - { |
|
154 | - $EVT_CAT = (int) $this->request->getRequestParam('EVT_CAT', 0, 'int'); |
|
155 | - if ($EVT_CAT > 0) { |
|
156 | - $this->where_params['Event.Term_Taxonomy.term_id'] = $EVT_CAT; |
|
157 | - } |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * Adds the datetime ID if it exists in the request to the where conditions for the registrations query. |
|
163 | - */ |
|
164 | - protected function addDatetimeIdToWhereConditions() |
|
165 | - { |
|
166 | - // first look for 'datetime_id' then 'DTT_ID' using first result as fallback default value |
|
167 | - $DTT_ID = $this->request->getRequestParam('datetime_id'); |
|
168 | - $DTT_ID = $this->request->getRequestParam('DTT_ID', $DTT_ID, 'int'); |
|
169 | - if ($DTT_ID) { |
|
170 | - $this->where_params['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
|
171 | - } |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - /** |
|
176 | - * Adds the ticket ID if it exists in the request to the where conditions for the registrations query. |
|
177 | - */ |
|
178 | - protected function addTicketIdToWhereConditions() |
|
179 | - { |
|
180 | - // first look for 'ticket_id' then 'TKT_ID' using first result as fallback default value |
|
181 | - $TKT_ID = $this->request->getRequestParam('ticket_id'); |
|
182 | - $TKT_ID = $this->request->getRequestParam('TKT_ID', $TKT_ID, 'int'); |
|
183 | - if ($TKT_ID) { |
|
184 | - $this->where_params['TKT_ID'] = $TKT_ID; |
|
185 | - } |
|
186 | - } |
|
187 | - |
|
188 | - |
|
189 | - /** |
|
190 | - * Adds the correct registration status to the where conditions for the registrations query. |
|
191 | - * If filtering by registration status, then we show registrations matching that status. |
|
192 | - * If not filtering by specified status, then we show all registrations excluding incomplete registrations |
|
193 | - * UNLESS viewing trashed registrations. |
|
194 | - */ |
|
195 | - protected function addRegistrationStatusToWhereConditions() |
|
196 | - { |
|
197 | - $registration_status = $this->request->getRequestParam('_reg_status'); |
|
198 | - if ($registration_status) { |
|
199 | - $this->where_params['STS_ID'] = sanitize_text_field($registration_status); |
|
200 | - return; |
|
201 | - } |
|
202 | - // make sure we exclude incomplete registrations, but only if not trashed. |
|
203 | - if ($this->view === 'trash') { |
|
204 | - $this->where_params['REG_deleted'] = true; |
|
205 | - return; |
|
206 | - } |
|
207 | - $this->where_params['STS_ID'] = $this->view === 'incomplete' |
|
208 | - ? EEM_Registration::status_id_incomplete |
|
209 | - : ['!=', EEM_Registration::status_id_incomplete]; |
|
210 | - } |
|
211 | - |
|
212 | - |
|
213 | - /** |
|
214 | - * Adds any provided date restraints to the where conditions for the registrations query. |
|
215 | - * |
|
216 | - * @throws EE_Error |
|
217 | - * @throws InvalidArgumentException |
|
218 | - * @throws InvalidDataTypeException |
|
219 | - * @throws InvalidInterfaceException |
|
220 | - */ |
|
221 | - protected function addDateToWhereConditions() |
|
222 | - { |
|
223 | - if ($this->view === 'today') { |
|
224 | - $now = date('Y-m-d', current_time('timestamp')); |
|
225 | - $this->where_params['REG_date'] = [ |
|
226 | - 'BETWEEN', |
|
227 | - [ |
|
228 | - $this->registration_model->convert_datetime_for_query( |
|
229 | - 'REG_date', |
|
230 | - $now . ' 00:00:00', |
|
231 | - 'Y-m-d H:i:s' |
|
232 | - ), |
|
233 | - $this->registration_model->convert_datetime_for_query( |
|
234 | - 'REG_date', |
|
235 | - $now . ' 23:59:59', |
|
236 | - 'Y-m-d H:i:s' |
|
237 | - ), |
|
238 | - ], |
|
239 | - ]; |
|
240 | - return; |
|
241 | - } |
|
242 | - if ($this->view === 'month') { |
|
243 | - $current_year_and_month = date('Y-m', current_time('timestamp')); |
|
244 | - $days_this_month = date('t', current_time('timestamp')); |
|
245 | - $this->where_params['REG_date'] = [ |
|
246 | - 'BETWEEN', |
|
247 | - [ |
|
248 | - $this->registration_model->convert_datetime_for_query( |
|
249 | - 'REG_date', |
|
250 | - $current_year_and_month . '-01 00:00:00', |
|
251 | - 'Y-m-d H:i:s' |
|
252 | - ), |
|
253 | - $this->registration_model->convert_datetime_for_query( |
|
254 | - 'REG_date', |
|
255 | - $current_year_and_month . '-' . $days_this_month . ' 23:59:59', |
|
256 | - 'Y-m-d H:i:s' |
|
257 | - ), |
|
258 | - ], |
|
259 | - ]; |
|
260 | - return; |
|
261 | - } |
|
262 | - $month_range = $this->request->getRequestParam('month_range'); |
|
263 | - if ($month_range) { |
|
264 | - $month_range = sanitize_text_field($month_range); |
|
265 | - $pieces = explode(' ', $month_range, 3); |
|
266 | - $month_requested = ! empty($pieces[0]) |
|
267 | - ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) |
|
268 | - : ''; |
|
269 | - $year_requested = ! empty($pieces[1]) |
|
270 | - ? $pieces[1] |
|
271 | - : ''; |
|
272 | - // if there is not a month or year then we can't go further |
|
273 | - if ($month_requested && $year_requested) { |
|
274 | - $days_in_month = date('t', strtotime($year_requested . '-' . $month_requested . '-' . '01')); |
|
275 | - $this->where_params['REG_date'] = [ |
|
276 | - 'BETWEEN', |
|
277 | - [ |
|
278 | - $this->registration_model->convert_datetime_for_query( |
|
279 | - 'REG_date', |
|
280 | - $year_requested . '-' . $month_requested . '-01 00:00:00', |
|
281 | - 'Y-m-d H:i:s' |
|
282 | - ), |
|
283 | - $this->registration_model->convert_datetime_for_query( |
|
284 | - 'REG_date', |
|
285 | - $year_requested . '-' . $month_requested . '-' . $days_in_month . ' 23:59:59', |
|
286 | - 'Y-m-d H:i:s' |
|
287 | - ), |
|
288 | - ], |
|
289 | - ]; |
|
290 | - } |
|
291 | - } |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * Adds any provided search restraints to the where conditions for the registrations query |
|
297 | - */ |
|
298 | - protected function addSearchToWhereConditions() |
|
299 | - { |
|
300 | - $search = $this->request->getRequestParam('s'); |
|
301 | - if ($search) { |
|
302 | - $search_string = '%' . sanitize_text_field($search) . '%'; |
|
303 | - $this->where_params['OR*search_conditions'] = [ |
|
304 | - 'Event.EVT_name' => ['LIKE', $search_string], |
|
305 | - 'Event.EVT_desc' => ['LIKE', $search_string], |
|
306 | - 'Event.EVT_short_desc' => ['LIKE', $search_string], |
|
307 | - 'Attendee.ATT_full_name' => ['LIKE', $search_string], |
|
308 | - 'Attendee.ATT_fname' => ['LIKE', $search_string], |
|
309 | - 'Attendee.ATT_lname' => ['LIKE', $search_string], |
|
310 | - 'Attendee.ATT_short_bio' => ['LIKE', $search_string], |
|
311 | - 'Attendee.ATT_email' => ['LIKE', $search_string], |
|
312 | - 'Attendee.ATT_address' => ['LIKE', $search_string], |
|
313 | - 'Attendee.ATT_address2' => ['LIKE', $search_string], |
|
314 | - 'Attendee.ATT_city' => ['LIKE', $search_string], |
|
315 | - 'REG_final_price' => ['LIKE', $search_string], |
|
316 | - 'REG_code' => ['LIKE', $search_string], |
|
317 | - 'REG_count' => ['LIKE', $search_string], |
|
318 | - 'REG_group_size' => ['LIKE', $search_string], |
|
319 | - 'Ticket.TKT_name' => ['LIKE', $search_string], |
|
320 | - 'Ticket.TKT_description' => ['LIKE', $search_string], |
|
321 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => ['LIKE', $search_string], |
|
322 | - ]; |
|
323 | - } |
|
324 | - } |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * Sets up the orderby for the registrations query. |
|
329 | - * |
|
330 | - * @return array |
|
331 | - */ |
|
332 | - protected function getOrderbyClause() |
|
333 | - { |
|
334 | - $orderby_field = $this->request->getRequestParam('orderby'); |
|
335 | - $orderby_field = $orderby_field ? sanitize_text_field($orderby_field) : '_REG_date'; |
|
336 | - switch ($orderby_field) { |
|
337 | - case '_REG_ID': |
|
338 | - $orderby = ['REG_ID']; |
|
339 | - break; |
|
340 | - case '_Reg_status': |
|
341 | - $orderby = ['STS_ID']; |
|
342 | - break; |
|
343 | - case 'ATT_fname': |
|
344 | - $orderby = ['Attendee.ATT_fname', 'Attendee.ATT_lname']; |
|
345 | - break; |
|
346 | - case 'ATT_lname': |
|
347 | - $orderby = ['Attendee.ATT_lname', 'Attendee.ATT_fname']; |
|
348 | - break; |
|
349 | - case 'event_name': |
|
350 | - $orderby = ['Event.EVT_name']; |
|
351 | - break; |
|
352 | - case 'DTT_EVT_start': |
|
353 | - $orderby = ['Event.Datetime.DTT_EVT_start']; |
|
354 | - break; |
|
355 | - case '_REG_date': |
|
356 | - $orderby = ['REG_date']; |
|
357 | - break; |
|
358 | - default: |
|
359 | - $orderby = [$orderby_field]; |
|
360 | - break; |
|
361 | - } |
|
362 | - $order = $this->request->getRequestParam('order'); |
|
363 | - $order = $order ? sanitize_text_field($order) : 'DESC'; |
|
364 | - |
|
365 | - $orderby = array_combine( |
|
366 | - $orderby, |
|
367 | - array_fill(0, count($orderby), $order) |
|
368 | - ); |
|
369 | - // because there are many registrations with the same date, define |
|
370 | - // a secondary way to order them, otherwise MySQL seems to be a bit random |
|
371 | - if (empty($orderby['REG_ID'])) { |
|
372 | - $orderby['REG_ID'] = $order; |
|
373 | - } |
|
374 | - |
|
375 | - $orderby = apply_filters( |
|
376 | - 'FHEE__Registrations_Admin_Page___get_orderby_for_registrations_query', |
|
377 | - $orderby, |
|
378 | - $this->request->requestParams() |
|
379 | - ); |
|
380 | - return ['order_by' => $orderby]; |
|
381 | - } |
|
382 | - |
|
383 | - |
|
384 | - /** |
|
385 | - * Sets up the limit for the registrations query. |
|
386 | - * |
|
387 | - * @param $per_page |
|
388 | - * @return array |
|
389 | - */ |
|
390 | - protected function getLimitClause($per_page) |
|
391 | - { |
|
392 | - $current_page = $this->request->getRequestParam('paged', 1, 'int'); |
|
393 | - $per_page = $this->request->getRequestParam('perpage', $per_page, 'int'); |
|
394 | - // -1 means return all results so get out if that's set. |
|
395 | - if ($per_page === -1) { |
|
396 | - return []; |
|
397 | - } |
|
398 | - $offset = ($current_page - 1) * $per_page; |
|
399 | - return ['limit' => [$offset, $per_page]]; |
|
400 | - } |
|
23 | + /** |
|
24 | + * @var RequestInterface $request |
|
25 | + */ |
|
26 | + protected $request; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var EEM_Registration $registration_model |
|
30 | + */ |
|
31 | + protected $registration_model; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var string $view |
|
35 | + */ |
|
36 | + protected $view; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var array $where_params |
|
40 | + */ |
|
41 | + protected $where_params; |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * QueryBuilder constructor. |
|
46 | + * |
|
47 | + * @param RequestInterface $request |
|
48 | + * @param EEM_Registration $registration_model |
|
49 | + * @param array $extra_request_params |
|
50 | + */ |
|
51 | + public function __construct( |
|
52 | + RequestInterface $request, |
|
53 | + EEM_Registration $registration_model, |
|
54 | + array $extra_request_params = [] |
|
55 | + ) { |
|
56 | + $this->request = $request; |
|
57 | + $this->registration_model = $registration_model; |
|
58 | + foreach ($extra_request_params as $key => $value) { |
|
59 | + $this->request->setRequestParam($key, $value); |
|
60 | + } |
|
61 | + $this->view = $this->request->getRequestParam('status', ''); |
|
62 | + $this->where_params = []; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * Sets up the where conditions for the registrations query. |
|
68 | + * |
|
69 | + * @param int $per_page |
|
70 | + * @param bool $count_query |
|
71 | + * @return array |
|
72 | + * @throws EE_Error |
|
73 | + * @throws InvalidArgumentException |
|
74 | + * @throws InvalidDataTypeException |
|
75 | + * @throws InvalidInterfaceException |
|
76 | + */ |
|
77 | + public function getQueryParams($per_page = 10, $count_query = false) |
|
78 | + { |
|
79 | + $query_params = [ |
|
80 | + 0 => $this->getWhereClause(), |
|
81 | + 'caps' => EEM_Registration::caps_read_admin, |
|
82 | + 'default_where_conditions' => 'this_model_only', |
|
83 | + ]; |
|
84 | + if (! $count_query) { |
|
85 | + $query_params = array_merge( |
|
86 | + $query_params, |
|
87 | + $this->getOrderbyClause(), |
|
88 | + $this->getLimitClause($per_page) |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + return $query_params; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * Sets up the where conditions for the registrations query. |
|
98 | + * |
|
99 | + * @return array |
|
100 | + * @throws EE_Error |
|
101 | + * @throws InvalidArgumentException |
|
102 | + * @throws InvalidDataTypeException |
|
103 | + * @throws InvalidInterfaceException |
|
104 | + */ |
|
105 | + protected function getWhereClause() |
|
106 | + { |
|
107 | + $this->addAttendeeIdToWhereConditions(); |
|
108 | + $this->addEventIdToWhereConditions(); |
|
109 | + $this->addCategoryIdToWhereConditions(); |
|
110 | + $this->addDatetimeIdToWhereConditions(); |
|
111 | + $this->addTicketIdToWhereConditions(); |
|
112 | + $this->addRegistrationStatusToWhereConditions(); |
|
113 | + $this->addDateToWhereConditions(); |
|
114 | + $this->addSearchToWhereConditions(); |
|
115 | + return apply_filters( |
|
116 | + 'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query', |
|
117 | + $this->where_params, |
|
118 | + $this->request->requestParams() |
|
119 | + ); |
|
120 | + } |
|
121 | + |
|
122 | + |
|
123 | + /** |
|
124 | + * This will add ATT_ID to the provided $this->where_clause array for EE model query parameters. |
|
125 | + */ |
|
126 | + protected function addAttendeeIdToWhereConditions() |
|
127 | + { |
|
128 | + $ATT_ID = $this->request->getRequestParam('attendee_id'); |
|
129 | + $ATT_ID = $this->request->getRequestParam('ATT_ID', $ATT_ID, 'int'); |
|
130 | + if ($ATT_ID) { |
|
131 | + $this->where_params['ATT_ID'] = $ATT_ID; |
|
132 | + } |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * This will add EVT_ID to the provided $this->where_clause array for EE model query parameters. |
|
138 | + */ |
|
139 | + protected function addEventIdToWhereConditions() |
|
140 | + { |
|
141 | + $EVT_ID = $this->request->getRequestParam('event_id'); |
|
142 | + $EVT_ID = $this->request->getRequestParam('EVT_ID', $EVT_ID, 'int'); |
|
143 | + if ($EVT_ID) { |
|
144 | + $this->where_params['EVT_ID'] = $EVT_ID; |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * Adds category ID if it exists in the request to the where conditions for the registrations query. |
|
151 | + */ |
|
152 | + protected function addCategoryIdToWhereConditions() |
|
153 | + { |
|
154 | + $EVT_CAT = (int) $this->request->getRequestParam('EVT_CAT', 0, 'int'); |
|
155 | + if ($EVT_CAT > 0) { |
|
156 | + $this->where_params['Event.Term_Taxonomy.term_id'] = $EVT_CAT; |
|
157 | + } |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * Adds the datetime ID if it exists in the request to the where conditions for the registrations query. |
|
163 | + */ |
|
164 | + protected function addDatetimeIdToWhereConditions() |
|
165 | + { |
|
166 | + // first look for 'datetime_id' then 'DTT_ID' using first result as fallback default value |
|
167 | + $DTT_ID = $this->request->getRequestParam('datetime_id'); |
|
168 | + $DTT_ID = $this->request->getRequestParam('DTT_ID', $DTT_ID, 'int'); |
|
169 | + if ($DTT_ID) { |
|
170 | + $this->where_params['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
|
171 | + } |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + /** |
|
176 | + * Adds the ticket ID if it exists in the request to the where conditions for the registrations query. |
|
177 | + */ |
|
178 | + protected function addTicketIdToWhereConditions() |
|
179 | + { |
|
180 | + // first look for 'ticket_id' then 'TKT_ID' using first result as fallback default value |
|
181 | + $TKT_ID = $this->request->getRequestParam('ticket_id'); |
|
182 | + $TKT_ID = $this->request->getRequestParam('TKT_ID', $TKT_ID, 'int'); |
|
183 | + if ($TKT_ID) { |
|
184 | + $this->where_params['TKT_ID'] = $TKT_ID; |
|
185 | + } |
|
186 | + } |
|
187 | + |
|
188 | + |
|
189 | + /** |
|
190 | + * Adds the correct registration status to the where conditions for the registrations query. |
|
191 | + * If filtering by registration status, then we show registrations matching that status. |
|
192 | + * If not filtering by specified status, then we show all registrations excluding incomplete registrations |
|
193 | + * UNLESS viewing trashed registrations. |
|
194 | + */ |
|
195 | + protected function addRegistrationStatusToWhereConditions() |
|
196 | + { |
|
197 | + $registration_status = $this->request->getRequestParam('_reg_status'); |
|
198 | + if ($registration_status) { |
|
199 | + $this->where_params['STS_ID'] = sanitize_text_field($registration_status); |
|
200 | + return; |
|
201 | + } |
|
202 | + // make sure we exclude incomplete registrations, but only if not trashed. |
|
203 | + if ($this->view === 'trash') { |
|
204 | + $this->where_params['REG_deleted'] = true; |
|
205 | + return; |
|
206 | + } |
|
207 | + $this->where_params['STS_ID'] = $this->view === 'incomplete' |
|
208 | + ? EEM_Registration::status_id_incomplete |
|
209 | + : ['!=', EEM_Registration::status_id_incomplete]; |
|
210 | + } |
|
211 | + |
|
212 | + |
|
213 | + /** |
|
214 | + * Adds any provided date restraints to the where conditions for the registrations query. |
|
215 | + * |
|
216 | + * @throws EE_Error |
|
217 | + * @throws InvalidArgumentException |
|
218 | + * @throws InvalidDataTypeException |
|
219 | + * @throws InvalidInterfaceException |
|
220 | + */ |
|
221 | + protected function addDateToWhereConditions() |
|
222 | + { |
|
223 | + if ($this->view === 'today') { |
|
224 | + $now = date('Y-m-d', current_time('timestamp')); |
|
225 | + $this->where_params['REG_date'] = [ |
|
226 | + 'BETWEEN', |
|
227 | + [ |
|
228 | + $this->registration_model->convert_datetime_for_query( |
|
229 | + 'REG_date', |
|
230 | + $now . ' 00:00:00', |
|
231 | + 'Y-m-d H:i:s' |
|
232 | + ), |
|
233 | + $this->registration_model->convert_datetime_for_query( |
|
234 | + 'REG_date', |
|
235 | + $now . ' 23:59:59', |
|
236 | + 'Y-m-d H:i:s' |
|
237 | + ), |
|
238 | + ], |
|
239 | + ]; |
|
240 | + return; |
|
241 | + } |
|
242 | + if ($this->view === 'month') { |
|
243 | + $current_year_and_month = date('Y-m', current_time('timestamp')); |
|
244 | + $days_this_month = date('t', current_time('timestamp')); |
|
245 | + $this->where_params['REG_date'] = [ |
|
246 | + 'BETWEEN', |
|
247 | + [ |
|
248 | + $this->registration_model->convert_datetime_for_query( |
|
249 | + 'REG_date', |
|
250 | + $current_year_and_month . '-01 00:00:00', |
|
251 | + 'Y-m-d H:i:s' |
|
252 | + ), |
|
253 | + $this->registration_model->convert_datetime_for_query( |
|
254 | + 'REG_date', |
|
255 | + $current_year_and_month . '-' . $days_this_month . ' 23:59:59', |
|
256 | + 'Y-m-d H:i:s' |
|
257 | + ), |
|
258 | + ], |
|
259 | + ]; |
|
260 | + return; |
|
261 | + } |
|
262 | + $month_range = $this->request->getRequestParam('month_range'); |
|
263 | + if ($month_range) { |
|
264 | + $month_range = sanitize_text_field($month_range); |
|
265 | + $pieces = explode(' ', $month_range, 3); |
|
266 | + $month_requested = ! empty($pieces[0]) |
|
267 | + ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) |
|
268 | + : ''; |
|
269 | + $year_requested = ! empty($pieces[1]) |
|
270 | + ? $pieces[1] |
|
271 | + : ''; |
|
272 | + // if there is not a month or year then we can't go further |
|
273 | + if ($month_requested && $year_requested) { |
|
274 | + $days_in_month = date('t', strtotime($year_requested . '-' . $month_requested . '-' . '01')); |
|
275 | + $this->where_params['REG_date'] = [ |
|
276 | + 'BETWEEN', |
|
277 | + [ |
|
278 | + $this->registration_model->convert_datetime_for_query( |
|
279 | + 'REG_date', |
|
280 | + $year_requested . '-' . $month_requested . '-01 00:00:00', |
|
281 | + 'Y-m-d H:i:s' |
|
282 | + ), |
|
283 | + $this->registration_model->convert_datetime_for_query( |
|
284 | + 'REG_date', |
|
285 | + $year_requested . '-' . $month_requested . '-' . $days_in_month . ' 23:59:59', |
|
286 | + 'Y-m-d H:i:s' |
|
287 | + ), |
|
288 | + ], |
|
289 | + ]; |
|
290 | + } |
|
291 | + } |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * Adds any provided search restraints to the where conditions for the registrations query |
|
297 | + */ |
|
298 | + protected function addSearchToWhereConditions() |
|
299 | + { |
|
300 | + $search = $this->request->getRequestParam('s'); |
|
301 | + if ($search) { |
|
302 | + $search_string = '%' . sanitize_text_field($search) . '%'; |
|
303 | + $this->where_params['OR*search_conditions'] = [ |
|
304 | + 'Event.EVT_name' => ['LIKE', $search_string], |
|
305 | + 'Event.EVT_desc' => ['LIKE', $search_string], |
|
306 | + 'Event.EVT_short_desc' => ['LIKE', $search_string], |
|
307 | + 'Attendee.ATT_full_name' => ['LIKE', $search_string], |
|
308 | + 'Attendee.ATT_fname' => ['LIKE', $search_string], |
|
309 | + 'Attendee.ATT_lname' => ['LIKE', $search_string], |
|
310 | + 'Attendee.ATT_short_bio' => ['LIKE', $search_string], |
|
311 | + 'Attendee.ATT_email' => ['LIKE', $search_string], |
|
312 | + 'Attendee.ATT_address' => ['LIKE', $search_string], |
|
313 | + 'Attendee.ATT_address2' => ['LIKE', $search_string], |
|
314 | + 'Attendee.ATT_city' => ['LIKE', $search_string], |
|
315 | + 'REG_final_price' => ['LIKE', $search_string], |
|
316 | + 'REG_code' => ['LIKE', $search_string], |
|
317 | + 'REG_count' => ['LIKE', $search_string], |
|
318 | + 'REG_group_size' => ['LIKE', $search_string], |
|
319 | + 'Ticket.TKT_name' => ['LIKE', $search_string], |
|
320 | + 'Ticket.TKT_description' => ['LIKE', $search_string], |
|
321 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => ['LIKE', $search_string], |
|
322 | + ]; |
|
323 | + } |
|
324 | + } |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * Sets up the orderby for the registrations query. |
|
329 | + * |
|
330 | + * @return array |
|
331 | + */ |
|
332 | + protected function getOrderbyClause() |
|
333 | + { |
|
334 | + $orderby_field = $this->request->getRequestParam('orderby'); |
|
335 | + $orderby_field = $orderby_field ? sanitize_text_field($orderby_field) : '_REG_date'; |
|
336 | + switch ($orderby_field) { |
|
337 | + case '_REG_ID': |
|
338 | + $orderby = ['REG_ID']; |
|
339 | + break; |
|
340 | + case '_Reg_status': |
|
341 | + $orderby = ['STS_ID']; |
|
342 | + break; |
|
343 | + case 'ATT_fname': |
|
344 | + $orderby = ['Attendee.ATT_fname', 'Attendee.ATT_lname']; |
|
345 | + break; |
|
346 | + case 'ATT_lname': |
|
347 | + $orderby = ['Attendee.ATT_lname', 'Attendee.ATT_fname']; |
|
348 | + break; |
|
349 | + case 'event_name': |
|
350 | + $orderby = ['Event.EVT_name']; |
|
351 | + break; |
|
352 | + case 'DTT_EVT_start': |
|
353 | + $orderby = ['Event.Datetime.DTT_EVT_start']; |
|
354 | + break; |
|
355 | + case '_REG_date': |
|
356 | + $orderby = ['REG_date']; |
|
357 | + break; |
|
358 | + default: |
|
359 | + $orderby = [$orderby_field]; |
|
360 | + break; |
|
361 | + } |
|
362 | + $order = $this->request->getRequestParam('order'); |
|
363 | + $order = $order ? sanitize_text_field($order) : 'DESC'; |
|
364 | + |
|
365 | + $orderby = array_combine( |
|
366 | + $orderby, |
|
367 | + array_fill(0, count($orderby), $order) |
|
368 | + ); |
|
369 | + // because there are many registrations with the same date, define |
|
370 | + // a secondary way to order them, otherwise MySQL seems to be a bit random |
|
371 | + if (empty($orderby['REG_ID'])) { |
|
372 | + $orderby['REG_ID'] = $order; |
|
373 | + } |
|
374 | + |
|
375 | + $orderby = apply_filters( |
|
376 | + 'FHEE__Registrations_Admin_Page___get_orderby_for_registrations_query', |
|
377 | + $orderby, |
|
378 | + $this->request->requestParams() |
|
379 | + ); |
|
380 | + return ['order_by' => $orderby]; |
|
381 | + } |
|
382 | + |
|
383 | + |
|
384 | + /** |
|
385 | + * Sets up the limit for the registrations query. |
|
386 | + * |
|
387 | + * @param $per_page |
|
388 | + * @return array |
|
389 | + */ |
|
390 | + protected function getLimitClause($per_page) |
|
391 | + { |
|
392 | + $current_page = $this->request->getRequestParam('paged', 1, 'int'); |
|
393 | + $per_page = $this->request->getRequestParam('perpage', $per_page, 'int'); |
|
394 | + // -1 means return all results so get out if that's set. |
|
395 | + if ($per_page === -1) { |
|
396 | + return []; |
|
397 | + } |
|
398 | + $offset = ($current_page - 1) * $per_page; |
|
399 | + return ['limit' => [$offset, $per_page]]; |
|
400 | + } |
|
401 | 401 | } |
@@ -17,148 +17,148 @@ |
||
17 | 17 | abstract class BrowserAsset extends Asset |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var string $source |
|
22 | - */ |
|
23 | - private $source; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var array $dependencies |
|
27 | - */ |
|
28 | - private $dependencies; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string $version |
|
32 | - */ |
|
33 | - private $version; |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * Asset constructor. |
|
38 | - * |
|
39 | - * @param string $type |
|
40 | - * @param string $handle |
|
41 | - * @param string $source |
|
42 | - * @param array $dependencies |
|
43 | - * @param DomainInterface $domain |
|
44 | - * @param string $version |
|
45 | - * @throws DomainException |
|
46 | - * @throws InvalidDataTypeException |
|
47 | - */ |
|
48 | - public function __construct($type, $handle, $source, array $dependencies, DomainInterface $domain, $version = '') |
|
49 | - { |
|
50 | - parent::__construct($type, $handle, $domain); |
|
51 | - $this->setSource($source); |
|
52 | - $this->setDependencies($dependencies); |
|
53 | - $this->setVersion($version, false); |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * @since 4.9.62.p |
|
59 | - */ |
|
60 | - abstract public function enqueueAsset(); |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * @return array |
|
65 | - */ |
|
66 | - public function dependencies() |
|
67 | - { |
|
68 | - return $this->dependencies; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @param array $dependencies |
|
74 | - */ |
|
75 | - private function setDependencies(array $dependencies) |
|
76 | - { |
|
77 | - $this->dependencies = $dependencies; |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * @since 4.9.62.p |
|
83 | - * @return bool |
|
84 | - */ |
|
85 | - public function hasDependencies() |
|
86 | - { |
|
87 | - return count($this->dependencies) > 0; |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function source() |
|
95 | - { |
|
96 | - return $this->source; |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * @param string $source |
|
102 | - * @throws InvalidDataTypeException |
|
103 | - */ |
|
104 | - private function setSource($source) |
|
105 | - { |
|
106 | - if (! is_string($source)) { |
|
107 | - throw new InvalidDataTypeException( |
|
108 | - '$source', |
|
109 | - $source, |
|
110 | - 'string' |
|
111 | - ); |
|
112 | - } |
|
113 | - $this->source = $source; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @return string |
|
119 | - * @throws InvalidDataTypeException |
|
120 | - * @throws DomainException |
|
121 | - */ |
|
122 | - public function version() |
|
123 | - { |
|
124 | - return $this->version; |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * @param string $version |
|
130 | - * @param bool $fluent |
|
131 | - * @return BrowserAsset|null |
|
132 | - * @throws DomainException |
|
133 | - * @throws InvalidDataTypeException |
|
134 | - */ |
|
135 | - public function setVersion($version, $fluent = true) |
|
136 | - { |
|
137 | - // if version is NOT set and this asset was NOT built for distribution, |
|
138 | - // then set the version equal to the EE core plugin version |
|
139 | - if (empty($version) && ! $this->isBuiltDistributionSource()) { |
|
140 | - $version = $this->domain->version(); |
|
141 | - } |
|
142 | - if (! is_string($version)) { |
|
143 | - throw new InvalidDataTypeException( |
|
144 | - '$version', |
|
145 | - $version, |
|
146 | - 'string' |
|
147 | - ); |
|
148 | - } |
|
149 | - $this->version = $version; |
|
150 | - if ($fluent) { |
|
151 | - return $this; |
|
152 | - } |
|
153 | - return null; |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * @return bool |
|
159 | - */ |
|
160 | - public function isBuiltDistributionSource() { |
|
161 | - return substr($this->source, -8) === Asset::FILE_EXTENSION_DISTRIBUTION_JS |
|
162 | - || substr($this->source, -9) === Asset::FILE_EXTENSION_DISTRIBUTION_CSS; |
|
163 | - } |
|
20 | + /** |
|
21 | + * @var string $source |
|
22 | + */ |
|
23 | + private $source; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var array $dependencies |
|
27 | + */ |
|
28 | + private $dependencies; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string $version |
|
32 | + */ |
|
33 | + private $version; |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * Asset constructor. |
|
38 | + * |
|
39 | + * @param string $type |
|
40 | + * @param string $handle |
|
41 | + * @param string $source |
|
42 | + * @param array $dependencies |
|
43 | + * @param DomainInterface $domain |
|
44 | + * @param string $version |
|
45 | + * @throws DomainException |
|
46 | + * @throws InvalidDataTypeException |
|
47 | + */ |
|
48 | + public function __construct($type, $handle, $source, array $dependencies, DomainInterface $domain, $version = '') |
|
49 | + { |
|
50 | + parent::__construct($type, $handle, $domain); |
|
51 | + $this->setSource($source); |
|
52 | + $this->setDependencies($dependencies); |
|
53 | + $this->setVersion($version, false); |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * @since 4.9.62.p |
|
59 | + */ |
|
60 | + abstract public function enqueueAsset(); |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * @return array |
|
65 | + */ |
|
66 | + public function dependencies() |
|
67 | + { |
|
68 | + return $this->dependencies; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @param array $dependencies |
|
74 | + */ |
|
75 | + private function setDependencies(array $dependencies) |
|
76 | + { |
|
77 | + $this->dependencies = $dependencies; |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * @since 4.9.62.p |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | + public function hasDependencies() |
|
86 | + { |
|
87 | + return count($this->dependencies) > 0; |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function source() |
|
95 | + { |
|
96 | + return $this->source; |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * @param string $source |
|
102 | + * @throws InvalidDataTypeException |
|
103 | + */ |
|
104 | + private function setSource($source) |
|
105 | + { |
|
106 | + if (! is_string($source)) { |
|
107 | + throw new InvalidDataTypeException( |
|
108 | + '$source', |
|
109 | + $source, |
|
110 | + 'string' |
|
111 | + ); |
|
112 | + } |
|
113 | + $this->source = $source; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @return string |
|
119 | + * @throws InvalidDataTypeException |
|
120 | + * @throws DomainException |
|
121 | + */ |
|
122 | + public function version() |
|
123 | + { |
|
124 | + return $this->version; |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * @param string $version |
|
130 | + * @param bool $fluent |
|
131 | + * @return BrowserAsset|null |
|
132 | + * @throws DomainException |
|
133 | + * @throws InvalidDataTypeException |
|
134 | + */ |
|
135 | + public function setVersion($version, $fluent = true) |
|
136 | + { |
|
137 | + // if version is NOT set and this asset was NOT built for distribution, |
|
138 | + // then set the version equal to the EE core plugin version |
|
139 | + if (empty($version) && ! $this->isBuiltDistributionSource()) { |
|
140 | + $version = $this->domain->version(); |
|
141 | + } |
|
142 | + if (! is_string($version)) { |
|
143 | + throw new InvalidDataTypeException( |
|
144 | + '$version', |
|
145 | + $version, |
|
146 | + 'string' |
|
147 | + ); |
|
148 | + } |
|
149 | + $this->version = $version; |
|
150 | + if ($fluent) { |
|
151 | + return $this; |
|
152 | + } |
|
153 | + return null; |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * @return bool |
|
159 | + */ |
|
160 | + public function isBuiltDistributionSource() { |
|
161 | + return substr($this->source, -8) === Asset::FILE_EXTENSION_DISTRIBUTION_JS |
|
162 | + || substr($this->source, -9) === Asset::FILE_EXTENSION_DISTRIBUTION_CSS; |
|
163 | + } |
|
164 | 164 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | private function setSource($source) |
105 | 105 | { |
106 | - if (! is_string($source)) { |
|
106 | + if ( ! is_string($source)) { |
|
107 | 107 | throw new InvalidDataTypeException( |
108 | 108 | '$source', |
109 | 109 | $source, |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if (empty($version) && ! $this->isBuiltDistributionSource()) { |
140 | 140 | $version = $this->domain->version(); |
141 | 141 | } |
142 | - if (! is_string($version)) { |
|
142 | + if ( ! is_string($version)) { |
|
143 | 143 | throw new InvalidDataTypeException( |
144 | 144 | '$version', |
145 | 145 | $version, |
@@ -18,145 +18,145 @@ |
||
18 | 18 | class JavascriptAsset extends BrowserAsset |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var boolean $load_in_footer |
|
23 | - */ |
|
24 | - private $load_in_footer = false; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var boolean $requires_translation |
|
28 | - */ |
|
29 | - private $requires_translation = false; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var boolean $has_inline_data |
|
33 | - */ |
|
34 | - private $has_inline_data = false; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var Closure $inline_data_callback |
|
38 | - */ |
|
39 | - private $inline_data_callback; |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * Asset constructor. |
|
44 | - * |
|
45 | - * @param string $handle |
|
46 | - * @param string $source |
|
47 | - * @param array $dependencies |
|
48 | - * @param bool $load_in_footer |
|
49 | - * @param DomainInterface $domain |
|
50 | - * @param string $version |
|
51 | - * @throws InvalidDataTypeException |
|
52 | - * @throws DomainException |
|
53 | - */ |
|
54 | - public function __construct( |
|
55 | - $handle, |
|
56 | - $source, |
|
57 | - array $dependencies, |
|
58 | - $load_in_footer, |
|
59 | - DomainInterface $domain, |
|
60 | - $version = '' |
|
61 | - ) { |
|
62 | - parent::__construct(Asset::TYPE_JS, $handle, $source, $dependencies, $domain, $version); |
|
63 | - $this->setLoadInFooter($load_in_footer); |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * @return bool |
|
69 | - */ |
|
70 | - public function loadInFooter() |
|
71 | - { |
|
72 | - return $this->load_in_footer; |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * @param bool $load_in_footer |
|
78 | - */ |
|
79 | - private function setLoadInFooter($load_in_footer = true) |
|
80 | - { |
|
81 | - $this->load_in_footer = filter_var($load_in_footer, FILTER_VALIDATE_BOOLEAN); |
|
82 | - } |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * @return bool |
|
87 | - */ |
|
88 | - public function requiresTranslation() |
|
89 | - { |
|
90 | - return $this->requires_translation; |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * @param bool $requires_translation |
|
96 | - * @return JavascriptAsset |
|
97 | - */ |
|
98 | - public function setRequiresTranslation($requires_translation = true) |
|
99 | - { |
|
100 | - $this->requires_translation = filter_var($requires_translation, FILTER_VALIDATE_BOOLEAN); |
|
101 | - return $this; |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * @return bool |
|
107 | - */ |
|
108 | - public function hasInlineData() |
|
109 | - { |
|
110 | - return $this->has_inline_data; |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * @param bool $has_inline_data |
|
116 | - * @return JavascriptAsset |
|
117 | - */ |
|
118 | - public function setHasInlineData($has_inline_data = true) |
|
119 | - { |
|
120 | - $this->has_inline_data = filter_var($has_inline_data, FILTER_VALIDATE_BOOLEAN); |
|
121 | - return $this; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * @return Closure |
|
127 | - */ |
|
128 | - public function inlineDataCallback() |
|
129 | - { |
|
130 | - return $this->inline_data_callback; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * @return bool |
|
136 | - */ |
|
137 | - public function hasInlineDataCallback() |
|
138 | - { |
|
139 | - return $this->inline_data_callback instanceof Closure; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * @param Closure $inline_data_callback |
|
145 | - * @return JavascriptAsset |
|
146 | - */ |
|
147 | - public function setInlineDataCallback(Closure $inline_data_callback) |
|
148 | - { |
|
149 | - $this->inline_data_callback = $inline_data_callback; |
|
150 | - $this->setHasInlineData(); |
|
151 | - return $this; |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * @since 4.9.62.p |
|
157 | - */ |
|
158 | - public function enqueueAsset() |
|
159 | - { |
|
160 | - wp_enqueue_script($this->handle()); |
|
161 | - } |
|
21 | + /** |
|
22 | + * @var boolean $load_in_footer |
|
23 | + */ |
|
24 | + private $load_in_footer = false; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var boolean $requires_translation |
|
28 | + */ |
|
29 | + private $requires_translation = false; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var boolean $has_inline_data |
|
33 | + */ |
|
34 | + private $has_inline_data = false; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var Closure $inline_data_callback |
|
38 | + */ |
|
39 | + private $inline_data_callback; |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * Asset constructor. |
|
44 | + * |
|
45 | + * @param string $handle |
|
46 | + * @param string $source |
|
47 | + * @param array $dependencies |
|
48 | + * @param bool $load_in_footer |
|
49 | + * @param DomainInterface $domain |
|
50 | + * @param string $version |
|
51 | + * @throws InvalidDataTypeException |
|
52 | + * @throws DomainException |
|
53 | + */ |
|
54 | + public function __construct( |
|
55 | + $handle, |
|
56 | + $source, |
|
57 | + array $dependencies, |
|
58 | + $load_in_footer, |
|
59 | + DomainInterface $domain, |
|
60 | + $version = '' |
|
61 | + ) { |
|
62 | + parent::__construct(Asset::TYPE_JS, $handle, $source, $dependencies, $domain, $version); |
|
63 | + $this->setLoadInFooter($load_in_footer); |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * @return bool |
|
69 | + */ |
|
70 | + public function loadInFooter() |
|
71 | + { |
|
72 | + return $this->load_in_footer; |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * @param bool $load_in_footer |
|
78 | + */ |
|
79 | + private function setLoadInFooter($load_in_footer = true) |
|
80 | + { |
|
81 | + $this->load_in_footer = filter_var($load_in_footer, FILTER_VALIDATE_BOOLEAN); |
|
82 | + } |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * @return bool |
|
87 | + */ |
|
88 | + public function requiresTranslation() |
|
89 | + { |
|
90 | + return $this->requires_translation; |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * @param bool $requires_translation |
|
96 | + * @return JavascriptAsset |
|
97 | + */ |
|
98 | + public function setRequiresTranslation($requires_translation = true) |
|
99 | + { |
|
100 | + $this->requires_translation = filter_var($requires_translation, FILTER_VALIDATE_BOOLEAN); |
|
101 | + return $this; |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * @return bool |
|
107 | + */ |
|
108 | + public function hasInlineData() |
|
109 | + { |
|
110 | + return $this->has_inline_data; |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * @param bool $has_inline_data |
|
116 | + * @return JavascriptAsset |
|
117 | + */ |
|
118 | + public function setHasInlineData($has_inline_data = true) |
|
119 | + { |
|
120 | + $this->has_inline_data = filter_var($has_inline_data, FILTER_VALIDATE_BOOLEAN); |
|
121 | + return $this; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * @return Closure |
|
127 | + */ |
|
128 | + public function inlineDataCallback() |
|
129 | + { |
|
130 | + return $this->inline_data_callback; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * @return bool |
|
136 | + */ |
|
137 | + public function hasInlineDataCallback() |
|
138 | + { |
|
139 | + return $this->inline_data_callback instanceof Closure; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * @param Closure $inline_data_callback |
|
145 | + * @return JavascriptAsset |
|
146 | + */ |
|
147 | + public function setInlineDataCallback(Closure $inline_data_callback) |
|
148 | + { |
|
149 | + $this->inline_data_callback = $inline_data_callback; |
|
150 | + $this->setHasInlineData(); |
|
151 | + return $this; |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * @since 4.9.62.p |
|
157 | + */ |
|
158 | + public function enqueueAsset() |
|
159 | + { |
|
160 | + wp_enqueue_script($this->handle()); |
|
161 | + } |
|
162 | 162 | } |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | // unfortunately, this needs to be done upon INCLUSION of this file, |
13 | 13 | // instead of construction, because it only gets constructed on first page load |
14 | 14 | // (all other times it gets resurrected from a wordpress option) |
15 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_10_0_stages/*'); |
|
15 | +$stages = glob(EE_CORE.'data_migration_scripts/4_10_0_stages/*'); |
|
16 | 16 | $class_to_filepath = []; |
17 | 17 | foreach ($stages as $filepath) { |
18 | 18 | $matches = []; |
19 | 19 | preg_match('~4_10_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
20 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
20 | + $class_to_filepath[$matches[1]] = $filepath; |
|
21 | 21 | } |
22 | 22 | // give addons a chance to autoload their stages too |
23 | 23 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_10_0__autoloaded_stages', $class_to_filepath); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $version_string = $version_array['Core']; |
68 | 68 | if (version_compare($version_string, '4.10.0.decaf', '<') && version_compare($version_string, '4.9.0.decaf', '>=')) { |
69 | 69 | return true; |
70 | - } elseif (! $version_string) { |
|
70 | + } elseif ( ! $version_string) { |
|
71 | 71 | // echo "no version string provided: $version_string"; |
72 | 72 | // no version string provided... this must be pre 4.3 |
73 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
73 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
74 | 74 | } |
75 | 75 | return false; |
76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function schema_changes_before_migration() |
84 | 84 | { |
85 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
85 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
86 | 86 | $now_in_mysql = current_time('mysql', true); |
87 | 87 | $table_name = 'esp_answer'; |
88 | 88 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | { |
634 | 634 | global $wpdb; |
635 | 635 | $wpdb->update( |
636 | - $wpdb->prefix . 'esp_payment_method', |
|
636 | + $wpdb->prefix.'esp_payment_method', |
|
637 | 637 | [ |
638 | 638 | 'PMD_type' => 'Admin_Only', |
639 | 639 | 'PMD_scope' => serialize(array()) |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $stages = glob(EE_CORE . 'data_migration_scripts/4_10_0_stages/*'); |
16 | 16 | $class_to_filepath = []; |
17 | 17 | foreach ($stages as $filepath) { |
18 | - $matches = []; |
|
19 | - preg_match('~4_10_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
18 | + $matches = []; |
|
19 | + preg_match('~4_10_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
21 | 21 | } |
22 | 22 | // give addons a chance to autoload their stages too |
23 | 23 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_10_0__autoloaded_stages', $class_to_filepath); |
@@ -35,66 +35,66 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class EE_DMS_Core_4_10_0 extends EE_Data_Migration_Script_Base |
37 | 37 | { |
38 | - /** |
|
39 | - * |
|
40 | - * @param TableManager $table_manager |
|
41 | - * @param TableAnalysis $table_analysis |
|
42 | - */ |
|
43 | - public function __construct( |
|
44 | - TableManager $table_manager = null, |
|
45 | - TableAnalysis $table_analysis = null, |
|
46 | - EE_DMS_Core_4_9_0 $dms_4_9 |
|
47 | - ) { |
|
48 | - $this->previous_dms = $dms_4_9; |
|
49 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.10.0", "event_espresso"); |
|
50 | - $this->_priority = 10; |
|
51 | - $this->_migration_stages = array( |
|
52 | - new EE_DMS_4_10_0_Event_Question_Group(), |
|
53 | - ); |
|
54 | - parent::__construct($table_manager, $table_analysis); |
|
55 | - } |
|
38 | + /** |
|
39 | + * |
|
40 | + * @param TableManager $table_manager |
|
41 | + * @param TableAnalysis $table_analysis |
|
42 | + */ |
|
43 | + public function __construct( |
|
44 | + TableManager $table_manager = null, |
|
45 | + TableAnalysis $table_analysis = null, |
|
46 | + EE_DMS_Core_4_9_0 $dms_4_9 |
|
47 | + ) { |
|
48 | + $this->previous_dms = $dms_4_9; |
|
49 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.10.0", "event_espresso"); |
|
50 | + $this->_priority = 10; |
|
51 | + $this->_migration_stages = array( |
|
52 | + new EE_DMS_4_10_0_Event_Question_Group(), |
|
53 | + ); |
|
54 | + parent::__construct($table_manager, $table_analysis); |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Whether to migrate or not. |
|
61 | - * |
|
62 | - * @param array $version_array |
|
63 | - * @return bool |
|
64 | - */ |
|
65 | - public function can_migrate_from_version($version_array) |
|
66 | - { |
|
67 | - $version_string = $version_array['Core']; |
|
68 | - if (version_compare($version_string, '4.10.0.decaf', '<') && version_compare($version_string, '4.9.0.decaf', '>=')) { |
|
69 | - return true; |
|
70 | - } elseif (! $version_string) { |
|
71 | - // echo "no version string provided: $version_string"; |
|
72 | - // no version string provided... this must be pre 4.3 |
|
73 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
74 | - } |
|
75 | - return false; |
|
76 | - } |
|
59 | + /** |
|
60 | + * Whether to migrate or not. |
|
61 | + * |
|
62 | + * @param array $version_array |
|
63 | + * @return bool |
|
64 | + */ |
|
65 | + public function can_migrate_from_version($version_array) |
|
66 | + { |
|
67 | + $version_string = $version_array['Core']; |
|
68 | + if (version_compare($version_string, '4.10.0.decaf', '<') && version_compare($version_string, '4.9.0.decaf', '>=')) { |
|
69 | + return true; |
|
70 | + } elseif (! $version_string) { |
|
71 | + // echo "no version string provided: $version_string"; |
|
72 | + // no version string provided... this must be pre 4.3 |
|
73 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
74 | + } |
|
75 | + return false; |
|
76 | + } |
|
77 | 77 | |
78 | 78 | |
79 | 79 | |
80 | - /** |
|
81 | - * @return bool |
|
82 | - */ |
|
83 | - public function schema_changes_before_migration() |
|
84 | - { |
|
85 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
86 | - $now_in_mysql = current_time('mysql', true); |
|
87 | - $table_name = 'esp_answer'; |
|
88 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
80 | + /** |
|
81 | + * @return bool |
|
82 | + */ |
|
83 | + public function schema_changes_before_migration() |
|
84 | + { |
|
85 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
86 | + $now_in_mysql = current_time('mysql', true); |
|
87 | + $table_name = 'esp_answer'; |
|
88 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
89 | 89 | REG_ID int(10) unsigned NOT NULL, |
90 | 90 | QST_ID int(10) unsigned NOT NULL, |
91 | 91 | ANS_value text NOT NULL, |
92 | 92 | PRIMARY KEY (ANS_ID), |
93 | 93 | KEY REG_ID (REG_ID), |
94 | 94 | KEY QST_ID (QST_ID)"; |
95 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
96 | - $table_name = 'esp_attendee_meta'; |
|
97 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
95 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
96 | + $table_name = 'esp_attendee_meta'; |
|
97 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
98 | 98 | ATT_ID bigint(20) unsigned NOT NULL, |
99 | 99 | ATT_fname varchar(45) NOT NULL, |
100 | 100 | ATT_lname varchar(45) NOT NULL, |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | KEY ATT_email (ATT_email(191)), |
112 | 112 | KEY ATT_lname (ATT_lname), |
113 | 113 | KEY ATT_fname (ATT_fname)"; |
114 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
115 | - $table_name = 'esp_checkin'; |
|
116 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
114 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
115 | + $table_name = 'esp_checkin'; |
|
116 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
117 | 117 | REG_ID int(10) unsigned NOT NULL, |
118 | 118 | DTT_ID int(10) unsigned NOT NULL, |
119 | 119 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | PRIMARY KEY (CHK_ID), |
122 | 122 | KEY REG_ID (REG_ID), |
123 | 123 | KEY DTT_ID (DTT_ID)"; |
124 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
125 | - $table_name = 'esp_country'; |
|
126 | - $sql = "CNT_ISO varchar(2) NOT NULL, |
|
124 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
125 | + $table_name = 'esp_country'; |
|
126 | + $sql = "CNT_ISO varchar(2) NOT NULL, |
|
127 | 127 | CNT_ISO3 varchar(3) NOT NULL, |
128 | 128 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
129 | 129 | CNT_name varchar(45) NOT NULL, |
@@ -139,29 +139,29 @@ discard block |
||
139 | 139 | CNT_is_EU tinyint(1) DEFAULT '0', |
140 | 140 | CNT_active tinyint(1) DEFAULT '0', |
141 | 141 | PRIMARY KEY (CNT_ISO)"; |
142 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
143 | - $table_name = 'esp_currency'; |
|
144 | - $sql = "CUR_code varchar(6) NOT NULL, |
|
142 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
143 | + $table_name = 'esp_currency'; |
|
144 | + $sql = "CUR_code varchar(6) NOT NULL, |
|
145 | 145 | CUR_single varchar(45) DEFAULT 'dollar', |
146 | 146 | CUR_plural varchar(45) DEFAULT 'dollars', |
147 | 147 | CUR_sign varchar(45) DEFAULT '$', |
148 | 148 | CUR_dec_plc varchar(1) NOT NULL DEFAULT '2', |
149 | 149 | CUR_active tinyint(1) DEFAULT '0', |
150 | 150 | PRIMARY KEY (CUR_code)"; |
151 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | - // note: although this table is no longer in use, |
|
153 | - // it hasn't been removed because then queries to the model will have errors. |
|
154 | - // but you should expect this table and its corresponding model to be removed in |
|
155 | - // the next few months |
|
156 | - $table_name = 'esp_currency_payment_method'; |
|
157 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
151 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | + // note: although this table is no longer in use, |
|
153 | + // it hasn't been removed because then queries to the model will have errors. |
|
154 | + // but you should expect this table and its corresponding model to be removed in |
|
155 | + // the next few months |
|
156 | + $table_name = 'esp_currency_payment_method'; |
|
157 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
158 | 158 | CUR_code varchar(6) NOT NULL, |
159 | 159 | PMD_ID int(11) NOT NULL, |
160 | 160 | PRIMARY KEY (CPM_ID), |
161 | 161 | KEY PMD_ID (PMD_ID)"; |
162 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
163 | - $table_name = 'esp_datetime'; |
|
164 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
162 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
163 | + $table_name = 'esp_datetime'; |
|
164 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
165 | 165 | EVT_ID bigint(20) unsigned NOT NULL, |
166 | 166 | DTT_name varchar(255) NOT NULL DEFAULT '', |
167 | 167 | DTT_description text NOT NULL, |
@@ -178,25 +178,25 @@ discard block |
||
178 | 178 | KEY DTT_EVT_start (DTT_EVT_start), |
179 | 179 | KEY EVT_ID (EVT_ID), |
180 | 180 | KEY DTT_is_primary (DTT_is_primary)"; |
181 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
182 | - $table_name = "esp_datetime_ticket"; |
|
183 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
181 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
182 | + $table_name = "esp_datetime_ticket"; |
|
183 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
184 | 184 | DTT_ID int(10) unsigned NOT NULL, |
185 | 185 | TKT_ID int(10) unsigned NOT NULL, |
186 | 186 | PRIMARY KEY (DTK_ID), |
187 | 187 | KEY DTT_ID (DTT_ID), |
188 | 188 | KEY TKT_ID (TKT_ID)"; |
189 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
190 | - $table_name = 'esp_event_message_template'; |
|
191 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
189 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
190 | + $table_name = 'esp_event_message_template'; |
|
191 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
192 | 192 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
193 | 193 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
194 | 194 | PRIMARY KEY (EMT_ID), |
195 | 195 | KEY EVT_ID (EVT_ID), |
196 | 196 | KEY GRP_ID (GRP_ID)"; |
197 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | - $table_name = 'esp_event_meta'; |
|
199 | - $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
197 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | + $table_name = 'esp_event_meta'; |
|
199 | + $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
200 | 200 | EVT_ID bigint(20) unsigned NOT NULL, |
201 | 201 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
202 | 202 | EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | EVT_donations tinyint(1) NULL, |
212 | 212 | PRIMARY KEY (EVTM_ID), |
213 | 213 | KEY EVT_ID (EVT_ID)"; |
214 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
215 | - $table_name = 'esp_event_question_group'; |
|
216 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
214 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
215 | + $table_name = 'esp_event_question_group'; |
|
216 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
217 | 217 | EVT_ID bigint(20) unsigned NOT NULL, |
218 | 218 | QSG_ID int(10) unsigned NOT NULL, |
219 | 219 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
@@ -221,25 +221,25 @@ discard block |
||
221 | 221 | PRIMARY KEY (EQG_ID), |
222 | 222 | KEY EVT_ID (EVT_ID), |
223 | 223 | KEY QSG_ID (QSG_ID)"; |
224 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
225 | - $table_name = 'esp_event_venue'; |
|
226 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
224 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
225 | + $table_name = 'esp_event_venue'; |
|
226 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
227 | 227 | EVT_ID bigint(20) unsigned NOT NULL, |
228 | 228 | VNU_ID bigint(20) unsigned NOT NULL, |
229 | 229 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
230 | 230 | PRIMARY KEY (EVV_ID)"; |
231 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
232 | - $table_name = 'esp_extra_meta'; |
|
233 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
231 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
232 | + $table_name = 'esp_extra_meta'; |
|
233 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
234 | 234 | OBJ_ID int(11) DEFAULT NULL, |
235 | 235 | EXM_type varchar(45) DEFAULT NULL, |
236 | 236 | EXM_key varchar(45) DEFAULT NULL, |
237 | 237 | EXM_value text, |
238 | 238 | PRIMARY KEY (EXM_ID), |
239 | 239 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
240 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
241 | - $table_name = 'esp_extra_join'; |
|
242 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
240 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
241 | + $table_name = 'esp_extra_join'; |
|
242 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
243 | 243 | EXJ_first_model_id varchar(6) NOT NULL, |
244 | 244 | EXJ_first_model_name varchar(20) NOT NULL, |
245 | 245 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | PRIMARY KEY (EXJ_ID), |
248 | 248 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
249 | 249 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
250 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
251 | - $table_name = 'esp_line_item'; |
|
252 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
250 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
251 | + $table_name = 'esp_line_item'; |
|
252 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
253 | 253 | LIN_code varchar(245) NOT NULL DEFAULT '', |
254 | 254 | TXN_ID int(11) DEFAULT NULL, |
255 | 255 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | KEY txn_type_timestamp (TXN_ID,LIN_type,LIN_timestamp), |
271 | 271 | KEY txn_obj_id_obj_type (TXN_ID,OBJ_ID,OBJ_type), |
272 | 272 | KEY obj_id_obj_type (OBJ_ID,OBJ_type)"; |
273 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
274 | - $table_name = 'esp_log'; |
|
275 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
273 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
274 | + $table_name = 'esp_log'; |
|
275 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
276 | 276 | LOG_time datetime DEFAULT NULL, |
277 | 277 | OBJ_ID varchar(45) DEFAULT NULL, |
278 | 278 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | KEY LOG_time (LOG_time), |
284 | 284 | KEY OBJ (OBJ_type,OBJ_ID), |
285 | 285 | KEY LOG_type (LOG_type)"; |
286 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
287 | - $table_name = 'esp_message'; |
|
288 | - $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
286 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
287 | + $table_name = 'esp_message'; |
|
288 | + $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
289 | 289 | GRP_ID int(10) unsigned NULL, |
290 | 290 | MSG_token varchar(255) NULL, |
291 | 291 | TXN_ID int(10) unsigned NULL, |
@@ -317,18 +317,18 @@ discard block |
||
317 | 317 | KEY STS_ID (STS_ID), |
318 | 318 | KEY MSG_created (MSG_created), |
319 | 319 | KEY MSG_modified (MSG_modified)"; |
320 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
321 | - $table_name = 'esp_message_template'; |
|
322 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
320 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
321 | + $table_name = 'esp_message_template'; |
|
322 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
323 | 323 | GRP_ID int(10) unsigned NOT NULL, |
324 | 324 | MTP_context varchar(50) NOT NULL, |
325 | 325 | MTP_template_field varchar(30) NOT NULL, |
326 | 326 | MTP_content text NOT NULL, |
327 | 327 | PRIMARY KEY (MTP_ID), |
328 | 328 | KEY GRP_ID (GRP_ID)"; |
329 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
330 | - $table_name = 'esp_message_template_group'; |
|
331 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
329 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
330 | + $table_name = 'esp_message_template_group'; |
|
331 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
332 | 332 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
333 | 333 | MTP_name varchar(245) NOT NULL DEFAULT '', |
334 | 334 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
341 | 341 | PRIMARY KEY (GRP_ID), |
342 | 342 | KEY MTP_user_id (MTP_user_id)"; |
343 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
344 | - $table_name = 'esp_payment'; |
|
345 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
343 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
344 | + $table_name = 'esp_payment'; |
|
345 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
346 | 346 | TXN_ID int(10) unsigned DEFAULT NULL, |
347 | 347 | STS_ID varchar(3) DEFAULT NULL, |
348 | 348 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -359,9 +359,9 @@ discard block |
||
359 | 359 | PRIMARY KEY (PAY_ID), |
360 | 360 | KEY PAY_timestamp (PAY_timestamp), |
361 | 361 | KEY TXN_ID (TXN_ID)"; |
362 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
363 | - $table_name = 'esp_payment_method'; |
|
364 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
362 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
363 | + $table_name = 'esp_payment_method'; |
|
364 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
365 | 365 | PMD_type varchar(124) DEFAULT NULL, |
366 | 366 | PMD_name varchar(255) DEFAULT NULL, |
367 | 367 | PMD_desc text, |
@@ -377,24 +377,24 @@ discard block |
||
377 | 377 | PRIMARY KEY (PMD_ID), |
378 | 378 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
379 | 379 | KEY PMD_type (PMD_type)"; |
380 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
381 | - $table_name = "esp_ticket_price"; |
|
382 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
380 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
381 | + $table_name = "esp_ticket_price"; |
|
382 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
383 | 383 | TKT_ID int(10) unsigned NOT NULL, |
384 | 384 | PRC_ID int(10) unsigned NOT NULL, |
385 | 385 | PRIMARY KEY (TKP_ID), |
386 | 386 | KEY TKT_ID (TKT_ID), |
387 | 387 | KEY PRC_ID (PRC_ID)"; |
388 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
389 | - $table_name = "esp_ticket_template"; |
|
390 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
388 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
389 | + $table_name = "esp_ticket_template"; |
|
390 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
391 | 391 | TTM_name varchar(45) NOT NULL, |
392 | 392 | TTM_description text, |
393 | 393 | TTM_file varchar(45), |
394 | 394 | PRIMARY KEY (TTM_ID)"; |
395 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
396 | - $table_name = 'esp_question'; |
|
397 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
395 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
396 | + $table_name = 'esp_question'; |
|
397 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
398 | 398 | QST_display_text text NOT NULL, |
399 | 399 | QST_admin_label varchar(255) NOT NULL, |
400 | 400 | QST_system varchar(25) DEFAULT NULL, |
@@ -408,18 +408,18 @@ discard block |
||
408 | 408 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
409 | 409 | PRIMARY KEY (QST_ID), |
410 | 410 | KEY QST_order (QST_order)'; |
411 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
412 | - $table_name = 'esp_question_group_question'; |
|
413 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
411 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
412 | + $table_name = 'esp_question_group_question'; |
|
413 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
414 | 414 | QSG_ID int(10) unsigned NOT NULL, |
415 | 415 | QST_ID int(10) unsigned NOT NULL, |
416 | 416 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
417 | 417 | PRIMARY KEY (QGQ_ID), |
418 | 418 | KEY QST_ID (QST_ID), |
419 | 419 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
420 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
421 | - $table_name = 'esp_question_option'; |
|
422 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
420 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
421 | + $table_name = 'esp_question_option'; |
|
422 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
423 | 423 | QSO_value varchar(255) NOT NULL, |
424 | 424 | QSO_desc text NOT NULL, |
425 | 425 | QST_ID int(10) unsigned NOT NULL, |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | PRIMARY KEY (QSO_ID), |
430 | 430 | KEY QST_ID (QST_ID), |
431 | 431 | KEY QSO_order (QSO_order)"; |
432 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | - $table_name = 'esp_registration'; |
|
434 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
432 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | + $table_name = 'esp_registration'; |
|
434 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
435 | 435 | EVT_ID bigint(20) unsigned NOT NULL, |
436 | 436 | ATT_ID bigint(20) unsigned NOT NULL, |
437 | 437 | TXN_ID int(10) unsigned NOT NULL, |
@@ -455,18 +455,18 @@ discard block |
||
455 | 455 | KEY TKT_ID (TKT_ID), |
456 | 456 | KEY EVT_ID (EVT_ID), |
457 | 457 | KEY STS_ID (STS_ID)"; |
458 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
459 | - $table_name = 'esp_registration_payment'; |
|
460 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
458 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
459 | + $table_name = 'esp_registration_payment'; |
|
460 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
461 | 461 | REG_ID int(10) unsigned NOT NULL, |
462 | 462 | PAY_ID int(10) unsigned NULL, |
463 | 463 | RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
464 | 464 | PRIMARY KEY (RPY_ID), |
465 | 465 | KEY REG_ID (REG_ID), |
466 | 466 | KEY PAY_ID (PAY_ID)"; |
467 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
468 | - $table_name = 'esp_state'; |
|
469 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
467 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
468 | + $table_name = 'esp_state'; |
|
469 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
470 | 470 | CNT_ISO varchar(2) NOT NULL, |
471 | 471 | STA_abbrev varchar(24) NOT NULL, |
472 | 472 | STA_name varchar(100) NOT NULL, |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | PRIMARY KEY (STA_ID), |
475 | 475 | KEY STA_abbrev (STA_abbrev), |
476 | 476 | KEY CNT_ISO (CNT_ISO)"; |
477 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
478 | - $table_name = 'esp_status'; |
|
479 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
477 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
478 | + $table_name = 'esp_status'; |
|
479 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
480 | 480 | STS_code varchar(45) NOT NULL, |
481 | 481 | STS_type varchar(45) NOT NULL, |
482 | 482 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -484,9 +484,9 @@ discard block |
||
484 | 484 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
485 | 485 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
486 | 486 | KEY STS_type (STS_type)"; |
487 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
488 | - $table_name = 'esp_transaction'; |
|
489 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
487 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
488 | + $table_name = 'esp_transaction'; |
|
489 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
490 | 490 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
491 | 491 | TXN_total decimal(12,3) DEFAULT '0.00', |
492 | 492 | TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00', |
@@ -498,9 +498,9 @@ discard block |
||
498 | 498 | PRIMARY KEY (TXN_ID), |
499 | 499 | KEY TXN_timestamp (TXN_timestamp), |
500 | 500 | KEY STS_ID (STS_ID)"; |
501 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
502 | - $table_name = 'esp_venue_meta'; |
|
503 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
501 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
502 | + $table_name = 'esp_venue_meta'; |
|
503 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
504 | 504 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
505 | 505 | VNU_address varchar(255) DEFAULT NULL, |
506 | 506 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | KEY VNU_ID (VNU_ID), |
520 | 520 | KEY STA_ID (STA_ID), |
521 | 521 | KEY CNT_ISO (CNT_ISO)"; |
522 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
523 | - // modified tables |
|
524 | - $table_name = "esp_price"; |
|
525 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
522 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
523 | + // modified tables |
|
524 | + $table_name = "esp_price"; |
|
525 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
526 | 526 | PRT_ID tinyint(3) unsigned NOT NULL, |
527 | 527 | PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
528 | 528 | PRC_name varchar(245) NOT NULL, |
@@ -535,9 +535,9 @@ discard block |
||
535 | 535 | PRC_parent int(10) unsigned DEFAULT 0, |
536 | 536 | PRIMARY KEY (PRC_ID), |
537 | 537 | KEY PRT_ID (PRT_ID)"; |
538 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
539 | - $table_name = "esp_price_type"; |
|
540 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
538 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
539 | + $table_name = "esp_price_type"; |
|
540 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
541 | 541 | PRT_name varchar(45) NOT NULL, |
542 | 542 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
543 | 543 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -546,9 +546,9 @@ discard block |
||
546 | 546 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
547 | 547 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
548 | 548 | PRIMARY KEY (PRT_ID)"; |
549 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
550 | - $table_name = "esp_ticket"; |
|
551 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
549 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
550 | + $table_name = "esp_ticket"; |
|
551 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
552 | 552 | TTM_ID int(10) unsigned NOT NULL, |
553 | 553 | TKT_name varchar(245) NOT NULL DEFAULT '', |
554 | 554 | TKT_description text NOT NULL, |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
572 | 572 | PRIMARY KEY (TKT_ID), |
573 | 573 | KEY TKT_start_date (TKT_start_date)"; |
574 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
575 | - $table_name = 'esp_question_group'; |
|
576 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
574 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
575 | + $table_name = 'esp_question_group'; |
|
576 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
577 | 577 | QSG_name varchar(255) NOT NULL, |
578 | 578 | QSG_identifier varchar(100) NOT NULL, |
579 | 579 | QSG_desc text NULL, |
@@ -586,70 +586,70 @@ discard block |
||
586 | 586 | PRIMARY KEY (QSG_ID), |
587 | 587 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
588 | 588 | KEY QSG_order (QSG_order)'; |
589 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
590 | - $this->insert_default_data(); |
|
591 | - return true; |
|
592 | - } |
|
589 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
590 | + $this->insert_default_data(); |
|
591 | + return true; |
|
592 | + } |
|
593 | 593 | |
594 | - /** |
|
595 | - * Inserts default data on new installs |
|
596 | - * @since 4.10.0.p |
|
597 | - * @throws EE_Error |
|
598 | - * @throws InvalidArgumentException |
|
599 | - * @throws ReflectionException |
|
600 | - * @throws InvalidDataTypeException |
|
601 | - * @throws InvalidInterfaceException |
|
602 | - */ |
|
603 | - public function insert_default_data() |
|
604 | - { |
|
605 | - $this->previous_dms->insert_default_data(); |
|
606 | - $this->removeMijirehPM(); |
|
607 | - } |
|
594 | + /** |
|
595 | + * Inserts default data on new installs |
|
596 | + * @since 4.10.0.p |
|
597 | + * @throws EE_Error |
|
598 | + * @throws InvalidArgumentException |
|
599 | + * @throws ReflectionException |
|
600 | + * @throws InvalidDataTypeException |
|
601 | + * @throws InvalidInterfaceException |
|
602 | + */ |
|
603 | + public function insert_default_data() |
|
604 | + { |
|
605 | + $this->previous_dms->insert_default_data(); |
|
606 | + $this->removeMijirehPM(); |
|
607 | + } |
|
608 | 608 | |
609 | 609 | |
610 | 610 | |
611 | - /** |
|
612 | - * @return boolean |
|
613 | - */ |
|
614 | - public function schema_changes_after_migration() |
|
615 | - { |
|
616 | - return true; |
|
617 | - } |
|
611 | + /** |
|
612 | + * @return boolean |
|
613 | + */ |
|
614 | + public function schema_changes_after_migration() |
|
615 | + { |
|
616 | + return true; |
|
617 | + } |
|
618 | 618 | |
619 | 619 | |
620 | 620 | |
621 | - public function migration_page_hooks() |
|
622 | - { |
|
623 | - } |
|
621 | + public function migration_page_hooks() |
|
622 | + { |
|
623 | + } |
|
624 | 624 | |
625 | - /** |
|
626 | - * Mijireh was removed in 4.10.3.p, but let's avoid having an error message because its files were removed, and don't |
|
627 | - * show old payments made with it as being by "Unknown". The fix is to make it an "Admin_Only" payment method |
|
628 | - * (like Invoice or Check) but don't allow it to be used in the admin either... so it's usable nowhere from now on, |
|
629 | - * but it still exists so there's no problems. |
|
630 | - * @since 4.10.3.p |
|
631 | - */ |
|
632 | - protected function removeMijirehPM() |
|
633 | - { |
|
634 | - global $wpdb; |
|
635 | - $wpdb->update( |
|
636 | - $wpdb->prefix . 'esp_payment_method', |
|
637 | - [ |
|
638 | - 'PMD_type' => 'Admin_Only', |
|
639 | - 'PMD_scope' => serialize(array()) |
|
640 | - ], |
|
641 | - [ |
|
642 | - 'PMD_type' => 'Mijireh' |
|
643 | - ], |
|
644 | - [ |
|
645 | - // update formats |
|
646 | - '%s', // PMD_type |
|
647 | - '%s', // PMD_scope |
|
648 | - ], |
|
649 | - [ |
|
650 | - // where formats |
|
651 | - '%s' |
|
652 | - ] |
|
653 | - ); |
|
654 | - } |
|
625 | + /** |
|
626 | + * Mijireh was removed in 4.10.3.p, but let's avoid having an error message because its files were removed, and don't |
|
627 | + * show old payments made with it as being by "Unknown". The fix is to make it an "Admin_Only" payment method |
|
628 | + * (like Invoice or Check) but don't allow it to be used in the admin either... so it's usable nowhere from now on, |
|
629 | + * but it still exists so there's no problems. |
|
630 | + * @since 4.10.3.p |
|
631 | + */ |
|
632 | + protected function removeMijirehPM() |
|
633 | + { |
|
634 | + global $wpdb; |
|
635 | + $wpdb->update( |
|
636 | + $wpdb->prefix . 'esp_payment_method', |
|
637 | + [ |
|
638 | + 'PMD_type' => 'Admin_Only', |
|
639 | + 'PMD_scope' => serialize(array()) |
|
640 | + ], |
|
641 | + [ |
|
642 | + 'PMD_type' => 'Mijireh' |
|
643 | + ], |
|
644 | + [ |
|
645 | + // update formats |
|
646 | + '%s', // PMD_type |
|
647 | + '%s', // PMD_scope |
|
648 | + ], |
|
649 | + [ |
|
650 | + // where formats |
|
651 | + '%s' |
|
652 | + ] |
|
653 | + ); |
|
654 | + } |
|
655 | 655 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) { |
38 | 38 | add_action( |
39 | 39 | 'shutdown', |
40 | - static function () { |
|
40 | + static function() { |
|
41 | 41 | flush_rewrite_rules(); |
42 | 42 | update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false); |
43 | 43 | } |
@@ -12,35 +12,35 @@ |
||
12 | 12 | */ |
13 | 13 | class RewriteRules |
14 | 14 | { |
15 | - const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules'; |
|
15 | + const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules'; |
|
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
20 | - * |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function flush() |
|
24 | - { |
|
25 | - update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true); |
|
26 | - } |
|
18 | + /** |
|
19 | + * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
20 | + * |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function flush() |
|
24 | + { |
|
25 | + update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public function flushRewriteRules() |
|
35 | - { |
|
36 | - if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) { |
|
37 | - add_action( |
|
38 | - 'shutdown', |
|
39 | - static function () { |
|
40 | - flush_rewrite_rules(); |
|
41 | - update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false); |
|
42 | - } |
|
43 | - ); |
|
44 | - } |
|
45 | - } |
|
29 | + /** |
|
30 | + * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public function flushRewriteRules() |
|
35 | + { |
|
36 | + if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) { |
|
37 | + add_action( |
|
38 | + 'shutdown', |
|
39 | + static function () { |
|
40 | + flush_rewrite_rules(); |
|
41 | + update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false); |
|
42 | + } |
|
43 | + ); |
|
44 | + } |
|
45 | + } |
|
46 | 46 | } |