@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | 'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'base', $this->_variation), |
260 | 260 | 'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'print', $this->_variation), |
261 | 261 | 'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'main', $this->_variation), |
262 | - 'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css', |
|
262 | + 'extra_css' => EE_LIBRARIES_URL.'messages/defaults/default/variations/pdf_base_default.css', |
|
263 | 263 | 'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop($this->_content), $this->_content) |
264 | 264 | ); |
265 | 265 | $this->_deregister_wp_hooks(); |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | $invoice_name = $this->_subject; |
324 | 324 | |
325 | 325 | // only load dompdf if nobody else has yet... |
326 | - if (! class_exists('Dompdf\Dompdf')) { |
|
327 | - require_once(EE_THIRD_PARTY . 'dompdf/src/Autoloader.php'); |
|
326 | + if ( ! class_exists('Dompdf\Dompdf')) { |
|
327 | + require_once(EE_THIRD_PARTY.'dompdf/src/Autoloader.php'); |
|
328 | 328 | Dompdf\Autoloader::register(); |
329 | 329 | } |
330 | 330 | $options = new Dompdf\Options(); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $dompdf->loadHtml($content); |
337 | 337 | $dompdf->render(); |
338 | 338 | // forcing the browser to open a download dialog. |
339 | - $dompdf->stream($invoice_name . ".pdf", array('Attachment' => true)); |
|
339 | + $dompdf->stream($invoice_name.".pdf", array('Attachment' => true)); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 |
@@ -15,349 +15,349 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * The following are the properties that this messenger requires for generating pdf |
|
20 | - */ |
|
21 | - |
|
22 | - /** |
|
23 | - * This is the pdf body generated by the template via the message type. |
|
24 | - * |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - protected $_content; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * This is for the page title that gets displayed. This will end up being the filename for the generated pdf. |
|
32 | - * |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - protected $_subject; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * @return EE_Pdf_messenger |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - // set properties |
|
44 | - $this->name = 'pdf'; |
|
45 | - $this->description = esc_html__('This messenger is used for generating a pdf version of the message.', 'event_espresso'); |
|
46 | - $this->label = array( |
|
47 | - 'singular' => esc_html__('PDF', 'event_espresso'), |
|
48 | - 'plural' => esc_html__('PDFs', 'event_espresso') |
|
49 | - ); |
|
50 | - $this->activate_on_install = true; |
|
51 | - |
|
52 | - parent::__construct(); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * PDF Messenger desires execution immediately. |
|
58 | - * @see parent::send_now() for documentation. |
|
59 | - * @since 4.9.0 |
|
60 | - * @return bool |
|
61 | - */ |
|
62 | - public function send_now() |
|
63 | - { |
|
64 | - return true; |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * HTML Messenger allows an empty to field. |
|
70 | - * @see parent::allow_empty_to_field() for documentation |
|
71 | - * @since 4.9.0 |
|
72 | - * @return bool |
|
73 | - */ |
|
74 | - public function allow_empty_to_field() |
|
75 | - { |
|
76 | - return true; |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * @see abstract declaration in EE_messenger for details. |
|
82 | - */ |
|
83 | - protected function _set_admin_pages() |
|
84 | - { |
|
85 | - $this->admin_registered_pages = array('events_edit' => false); |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @see abstract declaration in EE_messenger for details. |
|
91 | - */ |
|
92 | - protected function _set_valid_shortcodes() |
|
93 | - { |
|
94 | - $this->_valid_shortcodes = array(); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * @see abstract declaration in EE_messenger for details. |
|
100 | - */ |
|
101 | - protected function _set_validator_config() |
|
102 | - { |
|
103 | - $this->_validator_config = array( |
|
104 | - 'subject' => array( |
|
105 | - 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
106 | - ), |
|
107 | - 'content' => array( |
|
108 | - 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
109 | - ), |
|
110 | - 'attendee_list' => array( |
|
111 | - 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
|
112 | - 'required' => array('[ATTENDEE_LIST]') |
|
113 | - ), |
|
114 | - 'event_list' => array( |
|
115 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'venue', 'datetime_list', 'attendee', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list'), |
|
116 | - 'required' => array('[EVENT_LIST]') |
|
117 | - ), |
|
118 | - 'ticket_list' => array( |
|
119 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'), |
|
120 | - 'required' => array('[TICKET_LIST]') |
|
121 | - ), |
|
122 | - 'datetime_list' => array( |
|
123 | - 'shortcodes' => array('datetime'), |
|
124 | - 'required' => array('[DATETIME_LIST]') |
|
125 | - ), |
|
126 | - ); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * Takes care of enqueuing any necessary scripts or styles for the page. A do_action() so message types using this messenger can add their own js. |
|
132 | - * |
|
133 | - * @return void. |
|
134 | - */ |
|
135 | - public function enqueue_scripts_styles() |
|
136 | - { |
|
137 | - parent::enqueue_scripts_styles(); |
|
138 | - do_action('AHEE__EE_Pdf_messenger__enqueue_scripts_styles'); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * _set_template_fields |
|
144 | - * This sets up the fields that a messenger requires for the message to go out. |
|
145 | - * |
|
146 | - * @access protected |
|
147 | - * @return void |
|
148 | - */ |
|
149 | - protected function _set_template_fields() |
|
150 | - { |
|
151 | - // any extra template fields that are NOT used by the messenger but will get used by a messenger field for shortcode replacement get added to the 'extra' key in an associated array indexed by the messenger field they relate to. This is important for the Messages_admin to know what fields to display to the user. Also, notice that the "values" are equal to the field type that messages admin will use to know what kind of field to display. The values ALSO have one index labeled "shortcode". the values in that array indicate which ACTUAL SHORTCODE (i.e. [SHORTCODE]) is required in order for this extra field to be displayed. If the required shortcode isn't part of the shortcodes array then the field is not needed and will not be displayed/parsed. |
|
152 | - $this->_template_fields = array( |
|
153 | - 'subject' => array( |
|
154 | - 'input' => 'text', |
|
155 | - 'label' => esc_html__('Page Title', 'event_espresso'), |
|
156 | - 'type' => 'string', |
|
157 | - 'required' => true, |
|
158 | - 'validation' => true, |
|
159 | - 'css_class' => 'large-text', |
|
160 | - 'format' => '%s' |
|
161 | - ), |
|
162 | - 'content' => '', // left empty b/c it is in the "extra array" but messenger still needs needs to know this is a field. |
|
163 | - 'extra' => array( |
|
164 | - 'content' => array( |
|
165 | - 'main' => array( |
|
166 | - 'input' => 'wp_editor', |
|
167 | - 'label' => esc_html__('Main Content', 'event_espresso'), |
|
168 | - 'type' => 'string', |
|
169 | - 'required' => true, |
|
170 | - 'validation' => true, |
|
171 | - 'format' => '%s', |
|
172 | - 'rows' => '15' |
|
173 | - ), |
|
174 | - 'event_list' => array( |
|
175 | - 'input' => 'wp_editor', |
|
176 | - 'label' => '[EVENT_LIST]', |
|
177 | - 'type' => 'string', |
|
178 | - 'required' => true, |
|
179 | - 'validation' => true, |
|
180 | - 'format' => '%s', |
|
181 | - 'rows' => '15', |
|
182 | - 'shortcodes_required' => array('[EVENT_LIST]') |
|
183 | - ), |
|
184 | - 'attendee_list' => array( |
|
185 | - 'input' => 'textarea', |
|
186 | - 'label' => '[ATTENDEE_LIST]', |
|
187 | - 'type' => 'string', |
|
188 | - 'required' => true, |
|
189 | - 'validation' => true, |
|
190 | - 'format' => '%s', |
|
191 | - 'css_class' => 'large-text', |
|
192 | - 'rows' => '5', |
|
193 | - 'shortcodes_required' => array('[ATTENDEE_LIST]') |
|
194 | - ), |
|
195 | - 'ticket_list' => array( |
|
196 | - 'input' => 'textarea', |
|
197 | - 'label' => '[TICKET_LIST]', |
|
198 | - 'type' => 'string', |
|
199 | - 'required' => true, |
|
200 | - 'validation' => true, |
|
201 | - 'format' => '%s', |
|
202 | - 'css_class' => 'large-text', |
|
203 | - 'rows' => '10', |
|
204 | - 'shortcodes_required' => array('[TICKET_LIST]') |
|
205 | - ), |
|
206 | - 'datetime_list' => array( |
|
207 | - 'input' => 'textarea', |
|
208 | - 'label' => '[DATETIME_LIST]', |
|
209 | - 'type' => 'string', |
|
210 | - 'required' => true, |
|
211 | - 'validation' => true, |
|
212 | - 'format' => '%s', |
|
213 | - 'css_class' => 'large-text', |
|
214 | - 'rows' => '10', |
|
215 | - 'shortcodes_required' => array('[DATETIME_LIST]') |
|
216 | - ) |
|
217 | - ) |
|
218 | - ) |
|
219 | - ); |
|
220 | - } |
|
221 | - |
|
222 | - |
|
223 | - /** |
|
224 | - * @see definition of this method in parent |
|
225 | - * |
|
226 | - * @since 4.5.0 |
|
227 | - * |
|
228 | - */ |
|
229 | - protected function _set_default_message_types() |
|
230 | - { |
|
231 | - // note currently PDF is only a secondary messenger so it never has any associated message types. |
|
232 | - $this->_default_message_types = array(); |
|
233 | - } |
|
234 | - |
|
235 | - |
|
236 | - /** |
|
237 | - * @see definition of this method in parent |
|
238 | - * |
|
239 | - * @since 4.5.0 |
|
240 | - */ |
|
241 | - protected function _set_valid_message_types() |
|
242 | - { |
|
243 | - $this->_valid_message_types = array(); |
|
244 | - } |
|
245 | - |
|
246 | - |
|
247 | - /** |
|
248 | - * Generates html version of the message content and then sends it to the pdf generator. |
|
249 | - * |
|
250 | - * |
|
251 | - * @since 4.5.0 |
|
252 | - * |
|
253 | - * @return string. |
|
254 | - */ |
|
255 | - protected function _send_message() |
|
256 | - { |
|
257 | - $this->_template_args = array( |
|
258 | - 'page_title' => $this->_subject, |
|
259 | - 'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'base', $this->_variation), |
|
260 | - 'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'print', $this->_variation), |
|
261 | - 'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'main', $this->_variation), |
|
262 | - 'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css', |
|
263 | - 'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop($this->_content), $this->_content) |
|
264 | - ); |
|
265 | - $this->_deregister_wp_hooks(); |
|
266 | - add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
267 | - $content = $this->_get_main_template(); |
|
18 | + /** |
|
19 | + * The following are the properties that this messenger requires for generating pdf |
|
20 | + */ |
|
21 | + |
|
22 | + /** |
|
23 | + * This is the pdf body generated by the template via the message type. |
|
24 | + * |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + protected $_content; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * This is for the page title that gets displayed. This will end up being the filename for the generated pdf. |
|
32 | + * |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + protected $_subject; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * @return EE_Pdf_messenger |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + // set properties |
|
44 | + $this->name = 'pdf'; |
|
45 | + $this->description = esc_html__('This messenger is used for generating a pdf version of the message.', 'event_espresso'); |
|
46 | + $this->label = array( |
|
47 | + 'singular' => esc_html__('PDF', 'event_espresso'), |
|
48 | + 'plural' => esc_html__('PDFs', 'event_espresso') |
|
49 | + ); |
|
50 | + $this->activate_on_install = true; |
|
51 | + |
|
52 | + parent::__construct(); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * PDF Messenger desires execution immediately. |
|
58 | + * @see parent::send_now() for documentation. |
|
59 | + * @since 4.9.0 |
|
60 | + * @return bool |
|
61 | + */ |
|
62 | + public function send_now() |
|
63 | + { |
|
64 | + return true; |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * HTML Messenger allows an empty to field. |
|
70 | + * @see parent::allow_empty_to_field() for documentation |
|
71 | + * @since 4.9.0 |
|
72 | + * @return bool |
|
73 | + */ |
|
74 | + public function allow_empty_to_field() |
|
75 | + { |
|
76 | + return true; |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * @see abstract declaration in EE_messenger for details. |
|
82 | + */ |
|
83 | + protected function _set_admin_pages() |
|
84 | + { |
|
85 | + $this->admin_registered_pages = array('events_edit' => false); |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @see abstract declaration in EE_messenger for details. |
|
91 | + */ |
|
92 | + protected function _set_valid_shortcodes() |
|
93 | + { |
|
94 | + $this->_valid_shortcodes = array(); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * @see abstract declaration in EE_messenger for details. |
|
100 | + */ |
|
101 | + protected function _set_validator_config() |
|
102 | + { |
|
103 | + $this->_validator_config = array( |
|
104 | + 'subject' => array( |
|
105 | + 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
106 | + ), |
|
107 | + 'content' => array( |
|
108 | + 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
109 | + ), |
|
110 | + 'attendee_list' => array( |
|
111 | + 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
|
112 | + 'required' => array('[ATTENDEE_LIST]') |
|
113 | + ), |
|
114 | + 'event_list' => array( |
|
115 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'venue', 'datetime_list', 'attendee', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list'), |
|
116 | + 'required' => array('[EVENT_LIST]') |
|
117 | + ), |
|
118 | + 'ticket_list' => array( |
|
119 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'), |
|
120 | + 'required' => array('[TICKET_LIST]') |
|
121 | + ), |
|
122 | + 'datetime_list' => array( |
|
123 | + 'shortcodes' => array('datetime'), |
|
124 | + 'required' => array('[DATETIME_LIST]') |
|
125 | + ), |
|
126 | + ); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * Takes care of enqueuing any necessary scripts or styles for the page. A do_action() so message types using this messenger can add their own js. |
|
132 | + * |
|
133 | + * @return void. |
|
134 | + */ |
|
135 | + public function enqueue_scripts_styles() |
|
136 | + { |
|
137 | + parent::enqueue_scripts_styles(); |
|
138 | + do_action('AHEE__EE_Pdf_messenger__enqueue_scripts_styles'); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * _set_template_fields |
|
144 | + * This sets up the fields that a messenger requires for the message to go out. |
|
145 | + * |
|
146 | + * @access protected |
|
147 | + * @return void |
|
148 | + */ |
|
149 | + protected function _set_template_fields() |
|
150 | + { |
|
151 | + // any extra template fields that are NOT used by the messenger but will get used by a messenger field for shortcode replacement get added to the 'extra' key in an associated array indexed by the messenger field they relate to. This is important for the Messages_admin to know what fields to display to the user. Also, notice that the "values" are equal to the field type that messages admin will use to know what kind of field to display. The values ALSO have one index labeled "shortcode". the values in that array indicate which ACTUAL SHORTCODE (i.e. [SHORTCODE]) is required in order for this extra field to be displayed. If the required shortcode isn't part of the shortcodes array then the field is not needed and will not be displayed/parsed. |
|
152 | + $this->_template_fields = array( |
|
153 | + 'subject' => array( |
|
154 | + 'input' => 'text', |
|
155 | + 'label' => esc_html__('Page Title', 'event_espresso'), |
|
156 | + 'type' => 'string', |
|
157 | + 'required' => true, |
|
158 | + 'validation' => true, |
|
159 | + 'css_class' => 'large-text', |
|
160 | + 'format' => '%s' |
|
161 | + ), |
|
162 | + 'content' => '', // left empty b/c it is in the "extra array" but messenger still needs needs to know this is a field. |
|
163 | + 'extra' => array( |
|
164 | + 'content' => array( |
|
165 | + 'main' => array( |
|
166 | + 'input' => 'wp_editor', |
|
167 | + 'label' => esc_html__('Main Content', 'event_espresso'), |
|
168 | + 'type' => 'string', |
|
169 | + 'required' => true, |
|
170 | + 'validation' => true, |
|
171 | + 'format' => '%s', |
|
172 | + 'rows' => '15' |
|
173 | + ), |
|
174 | + 'event_list' => array( |
|
175 | + 'input' => 'wp_editor', |
|
176 | + 'label' => '[EVENT_LIST]', |
|
177 | + 'type' => 'string', |
|
178 | + 'required' => true, |
|
179 | + 'validation' => true, |
|
180 | + 'format' => '%s', |
|
181 | + 'rows' => '15', |
|
182 | + 'shortcodes_required' => array('[EVENT_LIST]') |
|
183 | + ), |
|
184 | + 'attendee_list' => array( |
|
185 | + 'input' => 'textarea', |
|
186 | + 'label' => '[ATTENDEE_LIST]', |
|
187 | + 'type' => 'string', |
|
188 | + 'required' => true, |
|
189 | + 'validation' => true, |
|
190 | + 'format' => '%s', |
|
191 | + 'css_class' => 'large-text', |
|
192 | + 'rows' => '5', |
|
193 | + 'shortcodes_required' => array('[ATTENDEE_LIST]') |
|
194 | + ), |
|
195 | + 'ticket_list' => array( |
|
196 | + 'input' => 'textarea', |
|
197 | + 'label' => '[TICKET_LIST]', |
|
198 | + 'type' => 'string', |
|
199 | + 'required' => true, |
|
200 | + 'validation' => true, |
|
201 | + 'format' => '%s', |
|
202 | + 'css_class' => 'large-text', |
|
203 | + 'rows' => '10', |
|
204 | + 'shortcodes_required' => array('[TICKET_LIST]') |
|
205 | + ), |
|
206 | + 'datetime_list' => array( |
|
207 | + 'input' => 'textarea', |
|
208 | + 'label' => '[DATETIME_LIST]', |
|
209 | + 'type' => 'string', |
|
210 | + 'required' => true, |
|
211 | + 'validation' => true, |
|
212 | + 'format' => '%s', |
|
213 | + 'css_class' => 'large-text', |
|
214 | + 'rows' => '10', |
|
215 | + 'shortcodes_required' => array('[DATETIME_LIST]') |
|
216 | + ) |
|
217 | + ) |
|
218 | + ) |
|
219 | + ); |
|
220 | + } |
|
221 | + |
|
222 | + |
|
223 | + /** |
|
224 | + * @see definition of this method in parent |
|
225 | + * |
|
226 | + * @since 4.5.0 |
|
227 | + * |
|
228 | + */ |
|
229 | + protected function _set_default_message_types() |
|
230 | + { |
|
231 | + // note currently PDF is only a secondary messenger so it never has any associated message types. |
|
232 | + $this->_default_message_types = array(); |
|
233 | + } |
|
234 | + |
|
235 | + |
|
236 | + /** |
|
237 | + * @see definition of this method in parent |
|
238 | + * |
|
239 | + * @since 4.5.0 |
|
240 | + */ |
|
241 | + protected function _set_valid_message_types() |
|
242 | + { |
|
243 | + $this->_valid_message_types = array(); |
|
244 | + } |
|
245 | + |
|
246 | + |
|
247 | + /** |
|
248 | + * Generates html version of the message content and then sends it to the pdf generator. |
|
249 | + * |
|
250 | + * |
|
251 | + * @since 4.5.0 |
|
252 | + * |
|
253 | + * @return string. |
|
254 | + */ |
|
255 | + protected function _send_message() |
|
256 | + { |
|
257 | + $this->_template_args = array( |
|
258 | + 'page_title' => $this->_subject, |
|
259 | + 'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'base', $this->_variation), |
|
260 | + 'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'print', $this->_variation), |
|
261 | + 'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'main', $this->_variation), |
|
262 | + 'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css', |
|
263 | + 'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop($this->_content), $this->_content) |
|
264 | + ); |
|
265 | + $this->_deregister_wp_hooks(); |
|
266 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
267 | + $content = $this->_get_main_template(); |
|
268 | 268 | // die( $content ); |
269 | - $this->_do_pdf($content); |
|
270 | - exit(0); |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - /** |
|
275 | - * The purpose of this function is to de register all actions hooked into wp_head and wp_footer so that it doesn't interfere with our templates. If users want to add any custom styles or scripts they must use the AHEE__EE_Pdf_messenger__enqueue_scripts_styles hook. |
|
276 | - * |
|
277 | - * @since 4.5.0 |
|
278 | - * |
|
279 | - * @return void |
|
280 | - */ |
|
281 | - protected function _deregister_wp_hooks() |
|
282 | - { |
|
283 | - remove_all_actions('wp_head'); |
|
284 | - remove_all_actions('wp_footer'); |
|
285 | - remove_all_actions('wp_print_footer_scripts'); |
|
286 | - remove_all_actions('wp_enqueue_scripts'); |
|
287 | - global $wp_scripts, $wp_styles; |
|
288 | - $wp_scripts = $wp_styles = array(); |
|
289 | - |
|
290 | - // just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load. |
|
291 | - add_action('wp_head', 'wp_enqueue_scripts'); |
|
292 | - add_action('wp_footer', 'wp_print_footer_scripts'); |
|
293 | - add_action('wp_print_footer_scripts', '_wp_footer_scripts'); |
|
294 | - } |
|
295 | - |
|
296 | - |
|
297 | - /** |
|
298 | - * Overwrite parent _get_main_template for pdf purposes. |
|
299 | - * |
|
300 | - * @since 4.5.0 |
|
301 | - * |
|
302 | - * @param bool $preview |
|
303 | - * @return string |
|
304 | - */ |
|
305 | - protected function _get_main_template($preview = false) |
|
306 | - { |
|
307 | - $wrapper_template = $this->_tmp_pack->get_wrapper('html', 'main'); |
|
308 | - // add message type to template_args |
|
309 | - $this->_template_args['message_type'] = $this->_incoming_message_type; |
|
310 | - return EEH_Template::display_template($wrapper_template, $this->_template_args, true); |
|
311 | - } |
|
312 | - |
|
313 | - |
|
314 | - /** |
|
315 | - * This takes care of loading the dompdf library and generating the actual pdf |
|
316 | - * |
|
317 | - * @param string $content This is the generated html content being converted into a pdf. |
|
318 | - * |
|
319 | - * @return void |
|
320 | - */ |
|
321 | - protected function _do_pdf($content = '') |
|
322 | - { |
|
323 | - $invoice_name = $this->_subject; |
|
324 | - |
|
325 | - // only load dompdf if nobody else has yet... |
|
326 | - if (! class_exists('Dompdf\Dompdf')) { |
|
327 | - require_once(EE_THIRD_PARTY . 'dompdf/src/Autoloader.php'); |
|
328 | - Dompdf\Autoloader::register(); |
|
329 | - } |
|
330 | - $options = new Dompdf\Options(); |
|
331 | - $options->set('isRemoteEnabled', true); |
|
332 | - $options->set('isJavascriptEnabled', false); |
|
333 | - if (defined('DOMPDF_FONT_DIR')) { |
|
334 | - $options->setFontDir(DOMPDF_FONT_DIR); |
|
335 | - $options->setFontCache(DOMPDF_FONT_DIR); |
|
336 | - } |
|
337 | - // Allow changing the paper size. |
|
338 | - if (defined('DOMPDF_DEFAULT_PAPER_SIZE')) { |
|
339 | - $options->set('defaultPaperSize', DOMPDF_DEFAULT_PAPER_SIZE); |
|
340 | - } |
|
341 | - $dompdf = new Dompdf\Dompdf($options); |
|
342 | - // Remove all spaces between HTML tags |
|
343 | - $content = preg_replace('/>\s+</', '><', $content); |
|
344 | - $dompdf->loadHtml($content); |
|
345 | - $dompdf->render(); |
|
346 | - // forcing the browser to open a download dialog. |
|
347 | - $dompdf->stream($invoice_name . ".pdf", array('Attachment' => true)); |
|
348 | - } |
|
349 | - |
|
350 | - |
|
351 | - /** |
|
352 | - * @return string |
|
353 | - */ |
|
354 | - protected function _preview() |
|
355 | - { |
|
356 | - return $this->_send_message(); |
|
357 | - } |
|
358 | - |
|
359 | - |
|
360 | - protected function _set_admin_settings_fields() |
|
361 | - { |
|
362 | - } |
|
269 | + $this->_do_pdf($content); |
|
270 | + exit(0); |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + /** |
|
275 | + * The purpose of this function is to de register all actions hooked into wp_head and wp_footer so that it doesn't interfere with our templates. If users want to add any custom styles or scripts they must use the AHEE__EE_Pdf_messenger__enqueue_scripts_styles hook. |
|
276 | + * |
|
277 | + * @since 4.5.0 |
|
278 | + * |
|
279 | + * @return void |
|
280 | + */ |
|
281 | + protected function _deregister_wp_hooks() |
|
282 | + { |
|
283 | + remove_all_actions('wp_head'); |
|
284 | + remove_all_actions('wp_footer'); |
|
285 | + remove_all_actions('wp_print_footer_scripts'); |
|
286 | + remove_all_actions('wp_enqueue_scripts'); |
|
287 | + global $wp_scripts, $wp_styles; |
|
288 | + $wp_scripts = $wp_styles = array(); |
|
289 | + |
|
290 | + // just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load. |
|
291 | + add_action('wp_head', 'wp_enqueue_scripts'); |
|
292 | + add_action('wp_footer', 'wp_print_footer_scripts'); |
|
293 | + add_action('wp_print_footer_scripts', '_wp_footer_scripts'); |
|
294 | + } |
|
295 | + |
|
296 | + |
|
297 | + /** |
|
298 | + * Overwrite parent _get_main_template for pdf purposes. |
|
299 | + * |
|
300 | + * @since 4.5.0 |
|
301 | + * |
|
302 | + * @param bool $preview |
|
303 | + * @return string |
|
304 | + */ |
|
305 | + protected function _get_main_template($preview = false) |
|
306 | + { |
|
307 | + $wrapper_template = $this->_tmp_pack->get_wrapper('html', 'main'); |
|
308 | + // add message type to template_args |
|
309 | + $this->_template_args['message_type'] = $this->_incoming_message_type; |
|
310 | + return EEH_Template::display_template($wrapper_template, $this->_template_args, true); |
|
311 | + } |
|
312 | + |
|
313 | + |
|
314 | + /** |
|
315 | + * This takes care of loading the dompdf library and generating the actual pdf |
|
316 | + * |
|
317 | + * @param string $content This is the generated html content being converted into a pdf. |
|
318 | + * |
|
319 | + * @return void |
|
320 | + */ |
|
321 | + protected function _do_pdf($content = '') |
|
322 | + { |
|
323 | + $invoice_name = $this->_subject; |
|
324 | + |
|
325 | + // only load dompdf if nobody else has yet... |
|
326 | + if (! class_exists('Dompdf\Dompdf')) { |
|
327 | + require_once(EE_THIRD_PARTY . 'dompdf/src/Autoloader.php'); |
|
328 | + Dompdf\Autoloader::register(); |
|
329 | + } |
|
330 | + $options = new Dompdf\Options(); |
|
331 | + $options->set('isRemoteEnabled', true); |
|
332 | + $options->set('isJavascriptEnabled', false); |
|
333 | + if (defined('DOMPDF_FONT_DIR')) { |
|
334 | + $options->setFontDir(DOMPDF_FONT_DIR); |
|
335 | + $options->setFontCache(DOMPDF_FONT_DIR); |
|
336 | + } |
|
337 | + // Allow changing the paper size. |
|
338 | + if (defined('DOMPDF_DEFAULT_PAPER_SIZE')) { |
|
339 | + $options->set('defaultPaperSize', DOMPDF_DEFAULT_PAPER_SIZE); |
|
340 | + } |
|
341 | + $dompdf = new Dompdf\Dompdf($options); |
|
342 | + // Remove all spaces between HTML tags |
|
343 | + $content = preg_replace('/>\s+</', '><', $content); |
|
344 | + $dompdf->loadHtml($content); |
|
345 | + $dompdf->render(); |
|
346 | + // forcing the browser to open a download dialog. |
|
347 | + $dompdf->stream($invoice_name . ".pdf", array('Attachment' => true)); |
|
348 | + } |
|
349 | + |
|
350 | + |
|
351 | + /** |
|
352 | + * @return string |
|
353 | + */ |
|
354 | + protected function _preview() |
|
355 | + { |
|
356 | + return $this->_send_message(); |
|
357 | + } |
|
358 | + |
|
359 | + |
|
360 | + protected function _set_admin_settings_fields() |
|
361 | + { |
|
362 | + } |
|
363 | 363 | } |
@@ -16,16 +16,16 @@ |
||
16 | 16 | */ |
17 | 17 | class URLValidator |
18 | 18 | { |
19 | - /** |
|
20 | - * Returns whether or not the URL is valid |
|
21 | - * @since 4.9.68.p |
|
22 | - * @param $url |
|
23 | - * @return boolean |
|
24 | - */ |
|
25 | - public function isValid($url) |
|
26 | - { |
|
27 | - return esc_url_raw($url) === $url; |
|
28 | - } |
|
19 | + /** |
|
20 | + * Returns whether or not the URL is valid |
|
21 | + * @since 4.9.68.p |
|
22 | + * @param $url |
|
23 | + * @return boolean |
|
24 | + */ |
|
25 | + public function isValid($url) |
|
26 | + { |
|
27 | + return esc_url_raw($url) === $url; |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | // End of file URLValidator.php |
31 | 31 | // Location: ${NAMESPACE}/URLValidator.php |
@@ -44,43 +44,43 @@ discard block |
||
44 | 44 | ); |
45 | 45 | $this->_wp_core_model = true; |
46 | 46 | $path_to_tax_model = 'Term_Taxonomy'; |
47 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
48 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( |
|
47 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
48 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected( |
|
49 | 49 | $path_to_tax_model |
50 | 50 | ); |
51 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false; |
|
52 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false; |
|
53 | - $path_to_tax_model = $path_to_tax_model . '.'; |
|
51 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = false; |
|
52 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = false; |
|
53 | + $path_to_tax_model = $path_to_tax_model.'.'; |
|
54 | 54 | // add cap restrictions for editing relating to the "ee_edit_*" |
55 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
55 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
56 | 56 | array( |
57 | - $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'), |
|
57 | + $path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'), |
|
58 | 58 | ) |
59 | 59 | ); |
60 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
60 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
61 | 61 | array( |
62 | - $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'), |
|
62 | + $path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'), |
|
63 | 63 | ) |
64 | 64 | ); |
65 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
65 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
66 | 66 | array( |
67 | - $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'), |
|
67 | + $path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'), |
|
68 | 68 | ) |
69 | 69 | ); |
70 | 70 | // add cap restrictions for deleting relating to the "ee_deleting_*" |
71 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
71 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
72 | 72 | array( |
73 | - $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'), |
|
73 | + $path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'), |
|
74 | 74 | ) |
75 | 75 | ); |
76 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
76 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
77 | 77 | array( |
78 | - $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'), |
|
78 | + $path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'), |
|
79 | 79 | ) |
80 | 80 | ); |
81 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
81 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
82 | 82 | array( |
83 | - $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'), |
|
83 | + $path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'), |
|
84 | 84 | ) |
85 | 85 | ); |
86 | 86 | parent::__construct($timezone); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | $post_tag_row = reset($post_tag_results); |
187 | 187 | $post_tag = $this->instantiate_class_from_array_or_object($post_tag_row); |
188 | - if (! $post_tag instanceof EE_Term) { |
|
188 | + if ( ! $post_tag instanceof EE_Term) { |
|
189 | 189 | return null; |
190 | 190 | } |
191 | 191 | |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | ) |
217 | 217 | ); |
218 | 218 | foreach ($post_tags as $key => $post_tag) { |
219 | - if (! isset($post_tags[ $key ]->post_type)) { |
|
220 | - $post_tags[ $key ]->post_type = array(); |
|
219 | + if ( ! isset($post_tags[$key]->post_type)) { |
|
220 | + $post_tags[$key]->post_type = array(); |
|
221 | 221 | } |
222 | - $post_tags[ $key ]->post_type[] = 'espresso_events'; |
|
222 | + $post_tags[$key]->post_type[] = 'espresso_events'; |
|
223 | 223 | } |
224 | 224 | return $post_tags; |
225 | 225 | } |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | ) |
245 | 245 | ); |
246 | 246 | foreach ($post_tags as $key => $post_tag) { |
247 | - if (! isset($post_tags[ $key ]->post_type)) { |
|
248 | - $post_tags[ $key ]->post_type = array(); |
|
247 | + if ( ! isset($post_tags[$key]->post_type)) { |
|
248 | + $post_tags[$key]->post_type = array(); |
|
249 | 249 | } |
250 | - $post_tags[ $key ]->post_type[] = 'espresso_venues'; |
|
250 | + $post_tags[$key]->post_type[] = 'espresso_venues'; |
|
251 | 251 | } |
252 | 252 | return $post_tags; |
253 | 253 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | { |
268 | 268 | if ($model === EEM_Term::instance()) { |
269 | 269 | $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
270 | - if (! empty($taxonomies)) { |
|
270 | + if ( ! empty($taxonomies)) { |
|
271 | 271 | $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies); |
272 | 272 | } |
273 | 273 | } |
@@ -14,263 +14,263 @@ |
||
14 | 14 | class EEM_Term extends EEM_Base |
15 | 15 | { |
16 | 16 | |
17 | - // private instance of the Attendee object |
|
18 | - protected static $_instance = null; |
|
17 | + // private instance of the Attendee object |
|
18 | + protected static $_instance = null; |
|
19 | 19 | |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - *__construct |
|
24 | - * |
|
25 | - * @param string $timezone |
|
26 | - */ |
|
27 | - protected function __construct($timezone = null) |
|
28 | - { |
|
29 | - $this->singular_item = esc_html__('Term', 'event_espresso'); |
|
30 | - $this->plural_item = esc_html__('Terms', 'event_espresso'); |
|
31 | - $this->_tables = array( |
|
32 | - 'Term' => new EE_Primary_Table('terms', 'term_id'), |
|
33 | - ); |
|
34 | - $this->_fields = array( |
|
35 | - 'Term' => array( |
|
36 | - 'term_id' => new EE_Primary_Key_Int_Field('term_id', esc_html__('Term ID', 'event_espresso')), |
|
37 | - 'name' => new EE_Plain_Text_Field('name', esc_html__('Term Name', 'event_espresso'), false, ''), |
|
38 | - 'slug' => new EE_Slug_Field('slug', esc_html__('Term Slug', 'event_espresso'), false), |
|
39 | - 'term_group' => new EE_Integer_Field('term_group', esc_html__("Term Group", "event_espresso"), false, 0), |
|
40 | - ), |
|
41 | - ); |
|
42 | - $this->_model_relations = array( |
|
43 | - 'Term_Taxonomy' => new EE_Has_Many_Relation(), |
|
44 | - ); |
|
45 | - $this->_wp_core_model = true; |
|
46 | - $path_to_tax_model = 'Term_Taxonomy'; |
|
47 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
48 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( |
|
49 | - $path_to_tax_model |
|
50 | - ); |
|
51 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false; |
|
52 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false; |
|
53 | - $path_to_tax_model = $path_to_tax_model . '.'; |
|
54 | - // add cap restrictions for editing relating to the "ee_edit_*" |
|
55 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
56 | - array( |
|
57 | - $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'), |
|
58 | - ) |
|
59 | - ); |
|
60 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
61 | - array( |
|
62 | - $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'), |
|
63 | - ) |
|
64 | - ); |
|
65 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
66 | - array( |
|
67 | - $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'), |
|
68 | - ) |
|
69 | - ); |
|
70 | - // add cap restrictions for deleting relating to the "ee_deleting_*" |
|
71 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
72 | - array( |
|
73 | - $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'), |
|
74 | - ) |
|
75 | - ); |
|
76 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
77 | - array( |
|
78 | - $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'), |
|
79 | - ) |
|
80 | - ); |
|
81 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
82 | - array( |
|
83 | - $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'), |
|
84 | - ) |
|
85 | - ); |
|
86 | - parent::__construct($timezone); |
|
87 | - add_filter('FHEE__Read__create_model_query_params', array('EEM_Term', 'rest_api_query_params'), 10, 3); |
|
88 | - } |
|
22 | + /** |
|
23 | + *__construct |
|
24 | + * |
|
25 | + * @param string $timezone |
|
26 | + */ |
|
27 | + protected function __construct($timezone = null) |
|
28 | + { |
|
29 | + $this->singular_item = esc_html__('Term', 'event_espresso'); |
|
30 | + $this->plural_item = esc_html__('Terms', 'event_espresso'); |
|
31 | + $this->_tables = array( |
|
32 | + 'Term' => new EE_Primary_Table('terms', 'term_id'), |
|
33 | + ); |
|
34 | + $this->_fields = array( |
|
35 | + 'Term' => array( |
|
36 | + 'term_id' => new EE_Primary_Key_Int_Field('term_id', esc_html__('Term ID', 'event_espresso')), |
|
37 | + 'name' => new EE_Plain_Text_Field('name', esc_html__('Term Name', 'event_espresso'), false, ''), |
|
38 | + 'slug' => new EE_Slug_Field('slug', esc_html__('Term Slug', 'event_espresso'), false), |
|
39 | + 'term_group' => new EE_Integer_Field('term_group', esc_html__("Term Group", "event_espresso"), false, 0), |
|
40 | + ), |
|
41 | + ); |
|
42 | + $this->_model_relations = array( |
|
43 | + 'Term_Taxonomy' => new EE_Has_Many_Relation(), |
|
44 | + ); |
|
45 | + $this->_wp_core_model = true; |
|
46 | + $path_to_tax_model = 'Term_Taxonomy'; |
|
47 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
48 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( |
|
49 | + $path_to_tax_model |
|
50 | + ); |
|
51 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false; |
|
52 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false; |
|
53 | + $path_to_tax_model = $path_to_tax_model . '.'; |
|
54 | + // add cap restrictions for editing relating to the "ee_edit_*" |
|
55 | + $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
56 | + array( |
|
57 | + $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'), |
|
58 | + ) |
|
59 | + ); |
|
60 | + $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
61 | + array( |
|
62 | + $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'), |
|
63 | + ) |
|
64 | + ); |
|
65 | + $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
66 | + array( |
|
67 | + $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'), |
|
68 | + ) |
|
69 | + ); |
|
70 | + // add cap restrictions for deleting relating to the "ee_deleting_*" |
|
71 | + $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
72 | + array( |
|
73 | + $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'), |
|
74 | + ) |
|
75 | + ); |
|
76 | + $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
77 | + array( |
|
78 | + $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'), |
|
79 | + ) |
|
80 | + ); |
|
81 | + $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
82 | + array( |
|
83 | + $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'), |
|
84 | + ) |
|
85 | + ); |
|
86 | + parent::__construct($timezone); |
|
87 | + add_filter('FHEE__Read__create_model_query_params', array('EEM_Term', 'rest_api_query_params'), 10, 3); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | 91 | |
92 | - /** |
|
93 | - * retrieves a list of all EE event categories |
|
94 | - * |
|
95 | - * @access public |
|
96 | - * @param bool $show_uncategorized |
|
97 | - * @return \EE_Base_Class[] |
|
98 | - */ |
|
99 | - public function get_all_ee_categories($show_uncategorized = false) |
|
100 | - { |
|
101 | - $where_params = array( |
|
102 | - 'Term_Taxonomy.taxonomy' => 'espresso_event_categories', |
|
103 | - 'NOT' => array('name' => esc_html__('Uncategorized', 'event_espresso')), |
|
104 | - ); |
|
105 | - if ($show_uncategorized) { |
|
106 | - unset($where_params['NOT']); |
|
107 | - } |
|
108 | - return EEM_Term::instance()->get_all( |
|
109 | - array( |
|
110 | - $where_params, |
|
111 | - 'order_by' => array('name' => 'ASC'), |
|
112 | - ) |
|
113 | - ); |
|
114 | - } |
|
92 | + /** |
|
93 | + * retrieves a list of all EE event categories |
|
94 | + * |
|
95 | + * @access public |
|
96 | + * @param bool $show_uncategorized |
|
97 | + * @return \EE_Base_Class[] |
|
98 | + */ |
|
99 | + public function get_all_ee_categories($show_uncategorized = false) |
|
100 | + { |
|
101 | + $where_params = array( |
|
102 | + 'Term_Taxonomy.taxonomy' => 'espresso_event_categories', |
|
103 | + 'NOT' => array('name' => esc_html__('Uncategorized', 'event_espresso')), |
|
104 | + ); |
|
105 | + if ($show_uncategorized) { |
|
106 | + unset($where_params['NOT']); |
|
107 | + } |
|
108 | + return EEM_Term::instance()->get_all( |
|
109 | + array( |
|
110 | + $where_params, |
|
111 | + 'order_by' => array('name' => 'ASC'), |
|
112 | + ) |
|
113 | + ); |
|
114 | + } |
|
115 | 115 | |
116 | 116 | |
117 | 117 | |
118 | - /** |
|
119 | - * retrieves a list of all post_tags associated with an EE CPT |
|
120 | - * |
|
121 | - * @access public |
|
122 | - * @param string $post_type |
|
123 | - * @return array |
|
124 | - */ |
|
125 | - public function get_all_CPT_post_tags($post_type = '') |
|
126 | - { |
|
127 | - switch ($post_type) { |
|
128 | - case 'espresso_events': |
|
129 | - return $this->get_all_event_post_tags(); |
|
130 | - break; |
|
131 | - case 'espresso_venues': |
|
132 | - return $this->get_all_venue_post_tags(); |
|
133 | - break; |
|
134 | - default: |
|
135 | - $event_tags = $this->get_all_event_post_tags(); |
|
136 | - $venue_tags = $this->get_all_venue_post_tags(); |
|
137 | - return array_merge($event_tags, $venue_tags); |
|
138 | - } |
|
139 | - } |
|
118 | + /** |
|
119 | + * retrieves a list of all post_tags associated with an EE CPT |
|
120 | + * |
|
121 | + * @access public |
|
122 | + * @param string $post_type |
|
123 | + * @return array |
|
124 | + */ |
|
125 | + public function get_all_CPT_post_tags($post_type = '') |
|
126 | + { |
|
127 | + switch ($post_type) { |
|
128 | + case 'espresso_events': |
|
129 | + return $this->get_all_event_post_tags(); |
|
130 | + break; |
|
131 | + case 'espresso_venues': |
|
132 | + return $this->get_all_venue_post_tags(); |
|
133 | + break; |
|
134 | + default: |
|
135 | + $event_tags = $this->get_all_event_post_tags(); |
|
136 | + $venue_tags = $this->get_all_venue_post_tags(); |
|
137 | + return array_merge($event_tags, $venue_tags); |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | |
142 | - /** |
|
143 | - * returns an EE_Term object for the given tag |
|
144 | - * if it has been utilized by any EE_Events or EE_Venues |
|
145 | - * |
|
146 | - * @param string $tag |
|
147 | - * @return EE_Term|null |
|
148 | - * @throws EE_Error |
|
149 | - * @throws InvalidArgumentException |
|
150 | - * @throws InvalidDataTypeException |
|
151 | - * @throws InvalidInterfaceException |
|
152 | - */ |
|
153 | - public function get_post_tag_for_event_or_venue($tag) |
|
154 | - { |
|
155 | - $post_tag_results = $this->get_all_wpdb_results( |
|
156 | - array( |
|
157 | - array( |
|
158 | - 'slug' => $tag, |
|
159 | - 'Term_Taxonomy.taxonomy' => 'post_tag', |
|
160 | - 'OR' => array( |
|
161 | - 'Term_Taxonomy.Venue.post_type' => 'espresso_venues', |
|
162 | - 'Term_Taxonomy.Event.post_type' => 'espresso_events', |
|
163 | - ), |
|
164 | - ), |
|
165 | - 'default_where_conditions' => 'none', |
|
166 | - 'extra_selects' => array( |
|
167 | - 'event_post_type' => array('Term_Taxonomy___Event_CPT.post_type', '%s'), |
|
168 | - 'venue_post_type' => array('Term_Taxonomy___Venue_CPT.post_type', '%s') |
|
169 | - ), |
|
170 | - 'group_by' => array( |
|
171 | - 'event_post_type', |
|
172 | - 'venue_post_type', |
|
173 | - ), |
|
174 | - 'limit' => 2 |
|
175 | - ) |
|
176 | - ); |
|
142 | + /** |
|
143 | + * returns an EE_Term object for the given tag |
|
144 | + * if it has been utilized by any EE_Events or EE_Venues |
|
145 | + * |
|
146 | + * @param string $tag |
|
147 | + * @return EE_Term|null |
|
148 | + * @throws EE_Error |
|
149 | + * @throws InvalidArgumentException |
|
150 | + * @throws InvalidDataTypeException |
|
151 | + * @throws InvalidInterfaceException |
|
152 | + */ |
|
153 | + public function get_post_tag_for_event_or_venue($tag) |
|
154 | + { |
|
155 | + $post_tag_results = $this->get_all_wpdb_results( |
|
156 | + array( |
|
157 | + array( |
|
158 | + 'slug' => $tag, |
|
159 | + 'Term_Taxonomy.taxonomy' => 'post_tag', |
|
160 | + 'OR' => array( |
|
161 | + 'Term_Taxonomy.Venue.post_type' => 'espresso_venues', |
|
162 | + 'Term_Taxonomy.Event.post_type' => 'espresso_events', |
|
163 | + ), |
|
164 | + ), |
|
165 | + 'default_where_conditions' => 'none', |
|
166 | + 'extra_selects' => array( |
|
167 | + 'event_post_type' => array('Term_Taxonomy___Event_CPT.post_type', '%s'), |
|
168 | + 'venue_post_type' => array('Term_Taxonomy___Venue_CPT.post_type', '%s') |
|
169 | + ), |
|
170 | + 'group_by' => array( |
|
171 | + 'event_post_type', |
|
172 | + 'venue_post_type', |
|
173 | + ), |
|
174 | + 'limit' => 2 |
|
175 | + ) |
|
176 | + ); |
|
177 | 177 | |
178 | - $post_types = array(); |
|
179 | - foreach ((array) $post_tag_results as $row) { |
|
180 | - if ($row['event_post_type'] === 'espresso_events') { |
|
181 | - $post_types[] = EEM_Event::instance()->post_type(); |
|
182 | - } elseif ($row['venue_post_type'] === 'espresso_venues') { |
|
183 | - $post_types[] = EEM_Venue::instance()->post_type(); |
|
184 | - } |
|
185 | - } |
|
186 | - $post_tag_row = reset($post_tag_results); |
|
187 | - $post_tag = $this->instantiate_class_from_array_or_object($post_tag_row); |
|
188 | - if (! $post_tag instanceof EE_Term) { |
|
189 | - return null; |
|
190 | - } |
|
178 | + $post_types = array(); |
|
179 | + foreach ((array) $post_tag_results as $row) { |
|
180 | + if ($row['event_post_type'] === 'espresso_events') { |
|
181 | + $post_types[] = EEM_Event::instance()->post_type(); |
|
182 | + } elseif ($row['venue_post_type'] === 'espresso_venues') { |
|
183 | + $post_types[] = EEM_Venue::instance()->post_type(); |
|
184 | + } |
|
185 | + } |
|
186 | + $post_tag_row = reset($post_tag_results); |
|
187 | + $post_tag = $this->instantiate_class_from_array_or_object($post_tag_row); |
|
188 | + if (! $post_tag instanceof EE_Term) { |
|
189 | + return null; |
|
190 | + } |
|
191 | 191 | |
192 | - if ($post_tag->post_type === null) { |
|
193 | - $post_tag->post_type = array(); |
|
194 | - } |
|
195 | - $post_tag->post_type = array_merge($post_tag->post_type, array_unique($post_types)); |
|
196 | - return $post_tag; |
|
197 | - } |
|
192 | + if ($post_tag->post_type === null) { |
|
193 | + $post_tag->post_type = array(); |
|
194 | + } |
|
195 | + $post_tag->post_type = array_merge($post_tag->post_type, array_unique($post_types)); |
|
196 | + return $post_tag; |
|
197 | + } |
|
198 | 198 | |
199 | 199 | |
200 | 200 | |
201 | - /** |
|
202 | - * get_all_event_post_tags |
|
203 | - * |
|
204 | - * @return EE_Base_Class[] |
|
205 | - */ |
|
206 | - public function get_all_event_post_tags() |
|
207 | - { |
|
208 | - $post_tags = EEM_Term::instance()->get_all( |
|
209 | - array( |
|
210 | - array( |
|
211 | - 'Term_Taxonomy.taxonomy' => 'post_tag', |
|
212 | - 'Term_Taxonomy.Event.post_type' => 'espresso_events', |
|
213 | - ), |
|
214 | - 'order_by' => array('name' => 'ASC'), |
|
215 | - 'force_join' => array('Term_Taxonomy.Event'), |
|
216 | - ) |
|
217 | - ); |
|
218 | - foreach ($post_tags as $key => $post_tag) { |
|
219 | - if (! isset($post_tags[ $key ]->post_type)) { |
|
220 | - $post_tags[ $key ]->post_type = array(); |
|
221 | - } |
|
222 | - $post_tags[ $key ]->post_type[] = 'espresso_events'; |
|
223 | - } |
|
224 | - return $post_tags; |
|
225 | - } |
|
201 | + /** |
|
202 | + * get_all_event_post_tags |
|
203 | + * |
|
204 | + * @return EE_Base_Class[] |
|
205 | + */ |
|
206 | + public function get_all_event_post_tags() |
|
207 | + { |
|
208 | + $post_tags = EEM_Term::instance()->get_all( |
|
209 | + array( |
|
210 | + array( |
|
211 | + 'Term_Taxonomy.taxonomy' => 'post_tag', |
|
212 | + 'Term_Taxonomy.Event.post_type' => 'espresso_events', |
|
213 | + ), |
|
214 | + 'order_by' => array('name' => 'ASC'), |
|
215 | + 'force_join' => array('Term_Taxonomy.Event'), |
|
216 | + ) |
|
217 | + ); |
|
218 | + foreach ($post_tags as $key => $post_tag) { |
|
219 | + if (! isset($post_tags[ $key ]->post_type)) { |
|
220 | + $post_tags[ $key ]->post_type = array(); |
|
221 | + } |
|
222 | + $post_tags[ $key ]->post_type[] = 'espresso_events'; |
|
223 | + } |
|
224 | + return $post_tags; |
|
225 | + } |
|
226 | 226 | |
227 | 227 | |
228 | 228 | |
229 | - /** |
|
230 | - * get_all_venue_post_tags |
|
231 | - * |
|
232 | - * @return EE_Base_Class[] |
|
233 | - */ |
|
234 | - public function get_all_venue_post_tags() |
|
235 | - { |
|
236 | - $post_tags = EEM_Term::instance()->get_all( |
|
237 | - array( |
|
238 | - array( |
|
239 | - 'Term_Taxonomy.taxonomy' => 'post_tag', |
|
240 | - 'Term_Taxonomy.Venue.post_type' => 'espresso_venues', |
|
241 | - ), |
|
242 | - 'order_by' => array('name' => 'ASC'), |
|
243 | - 'force_join' => array('Term_Taxonomy'), |
|
244 | - ) |
|
245 | - ); |
|
246 | - foreach ($post_tags as $key => $post_tag) { |
|
247 | - if (! isset($post_tags[ $key ]->post_type)) { |
|
248 | - $post_tags[ $key ]->post_type = array(); |
|
249 | - } |
|
250 | - $post_tags[ $key ]->post_type[] = 'espresso_venues'; |
|
251 | - } |
|
252 | - return $post_tags; |
|
253 | - } |
|
229 | + /** |
|
230 | + * get_all_venue_post_tags |
|
231 | + * |
|
232 | + * @return EE_Base_Class[] |
|
233 | + */ |
|
234 | + public function get_all_venue_post_tags() |
|
235 | + { |
|
236 | + $post_tags = EEM_Term::instance()->get_all( |
|
237 | + array( |
|
238 | + array( |
|
239 | + 'Term_Taxonomy.taxonomy' => 'post_tag', |
|
240 | + 'Term_Taxonomy.Venue.post_type' => 'espresso_venues', |
|
241 | + ), |
|
242 | + 'order_by' => array('name' => 'ASC'), |
|
243 | + 'force_join' => array('Term_Taxonomy'), |
|
244 | + ) |
|
245 | + ); |
|
246 | + foreach ($post_tags as $key => $post_tag) { |
|
247 | + if (! isset($post_tags[ $key ]->post_type)) { |
|
248 | + $post_tags[ $key ]->post_type = array(); |
|
249 | + } |
|
250 | + $post_tags[ $key ]->post_type[] = 'espresso_venues'; |
|
251 | + } |
|
252 | + return $post_tags; |
|
253 | + } |
|
254 | 254 | |
255 | 255 | |
256 | 256 | |
257 | - /** |
|
258 | - * Makes sure that during REST API queries, we only return terms |
|
259 | - * for term taxonomies which should be shown in the rest api |
|
260 | - * |
|
261 | - * @param array $model_query_params |
|
262 | - * @param array $querystring_query_params |
|
263 | - * @param EEM_Base $model |
|
264 | - * @return array |
|
265 | - */ |
|
266 | - public static function rest_api_query_params($model_query_params, $querystring_query_params, $model) |
|
267 | - { |
|
268 | - if ($model === EEM_Term::instance()) { |
|
269 | - $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
|
270 | - if (! empty($taxonomies)) { |
|
271 | - $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies); |
|
272 | - } |
|
273 | - } |
|
274 | - return $model_query_params; |
|
275 | - } |
|
257 | + /** |
|
258 | + * Makes sure that during REST API queries, we only return terms |
|
259 | + * for term taxonomies which should be shown in the rest api |
|
260 | + * |
|
261 | + * @param array $model_query_params |
|
262 | + * @param array $querystring_query_params |
|
263 | + * @param EEM_Base $model |
|
264 | + * @return array |
|
265 | + */ |
|
266 | + public static function rest_api_query_params($model_query_params, $querystring_query_params, $model) |
|
267 | + { |
|
268 | + if ($model === EEM_Term::instance()) { |
|
269 | + $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
|
270 | + if (! empty($taxonomies)) { |
|
271 | + $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies); |
|
272 | + } |
|
273 | + } |
|
274 | + return $model_query_params; |
|
275 | + } |
|
276 | 276 | } |
@@ -15,9 +15,9 @@ |
||
15 | 15 | interface RequestTypeContextFactoryInterface |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param string $slug |
|
20 | - * @return RequestTypeContext |
|
21 | - */ |
|
22 | - public function create($slug); |
|
18 | + /** |
|
19 | + * @param string $slug |
|
20 | + * @return RequestTypeContext |
|
21 | + */ |
|
22 | + public function create($slug); |
|
23 | 23 | } |
@@ -18,41 +18,41 @@ |
||
18 | 18 | class SetRequestTypeContextChecker extends Middleware |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * converts a Request to a Response |
|
23 | - * |
|
24 | - * @param RequestInterface $request |
|
25 | - * @param ResponseInterface $response |
|
26 | - * @return ResponseInterface |
|
27 | - * @throws InvalidArgumentException |
|
28 | - */ |
|
29 | - public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
30 | - { |
|
31 | - $this->request = $request; |
|
32 | - $this->response = $response; |
|
33 | - /** @var RequestTypeContextDetector $request_type_context_detector */ |
|
34 | - $request_type_context_detector = $this->loader->getShared( |
|
35 | - 'EventEspresso\core\domain\services\contexts\RequestTypeContextDetector', |
|
36 | - array( |
|
37 | - $this->request, |
|
38 | - $this->loader->getShared( |
|
39 | - 'EventEspresso\core\domain\services\contexts\RequestTypeContextFactory', |
|
40 | - array($this->loader) |
|
41 | - ), |
|
42 | - array( |
|
43 | - 'DOING_AJAX' => defined('DOING_AJAX') && DOING_AJAX, |
|
44 | - 'WP_CLI' => defined('WP_CLI') && WP_CLI, |
|
45 | - 'is_admin' => is_admin(), |
|
46 | - ) |
|
47 | - ) |
|
48 | - ); |
|
49 | - $request_type_context = $request_type_context_detector->detectRequestTypeContext(); |
|
50 | - $request_type_context_checker = $this->loader->getShared( |
|
51 | - 'EventEspresso\core\domain\services\contexts\RequestTypeContextChecker', |
|
52 | - array($request_type_context) |
|
53 | - ); |
|
54 | - $this->request->setRequestTypeContextChecker($request_type_context_checker); |
|
55 | - $this->response = $this->processRequestStack($this->request, $this->response); |
|
56 | - return $this->response; |
|
57 | - } |
|
21 | + /** |
|
22 | + * converts a Request to a Response |
|
23 | + * |
|
24 | + * @param RequestInterface $request |
|
25 | + * @param ResponseInterface $response |
|
26 | + * @return ResponseInterface |
|
27 | + * @throws InvalidArgumentException |
|
28 | + */ |
|
29 | + public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
30 | + { |
|
31 | + $this->request = $request; |
|
32 | + $this->response = $response; |
|
33 | + /** @var RequestTypeContextDetector $request_type_context_detector */ |
|
34 | + $request_type_context_detector = $this->loader->getShared( |
|
35 | + 'EventEspresso\core\domain\services\contexts\RequestTypeContextDetector', |
|
36 | + array( |
|
37 | + $this->request, |
|
38 | + $this->loader->getShared( |
|
39 | + 'EventEspresso\core\domain\services\contexts\RequestTypeContextFactory', |
|
40 | + array($this->loader) |
|
41 | + ), |
|
42 | + array( |
|
43 | + 'DOING_AJAX' => defined('DOING_AJAX') && DOING_AJAX, |
|
44 | + 'WP_CLI' => defined('WP_CLI') && WP_CLI, |
|
45 | + 'is_admin' => is_admin(), |
|
46 | + ) |
|
47 | + ) |
|
48 | + ); |
|
49 | + $request_type_context = $request_type_context_detector->detectRequestTypeContext(); |
|
50 | + $request_type_context_checker = $this->loader->getShared( |
|
51 | + 'EventEspresso\core\domain\services\contexts\RequestTypeContextChecker', |
|
52 | + array($request_type_context) |
|
53 | + ); |
|
54 | + $this->request->setRequestTypeContextChecker($request_type_context_checker); |
|
55 | + $this->response = $this->processRequestStack($this->request, $this->response); |
|
56 | + return $this->response; |
|
57 | + } |
|
58 | 58 | } |
@@ -14,80 +14,80 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_Country_Select_Input extends EE_Select_Input |
16 | 16 | { |
17 | - /** |
|
18 | - * $input_settings key used for detecting the "get" option |
|
19 | - */ |
|
20 | - const OPTION_GET_KEY = 'get'; |
|
17 | + /** |
|
18 | + * $input_settings key used for detecting the "get" option |
|
19 | + */ |
|
20 | + const OPTION_GET_KEY = 'get'; |
|
21 | 21 | |
22 | - /** |
|
23 | - * indicates that ALL countries should be retrieved from the db for the input |
|
24 | - */ |
|
25 | - const OPTION_GET_ALL = 'all'; |
|
22 | + /** |
|
23 | + * indicates that ALL countries should be retrieved from the db for the input |
|
24 | + */ |
|
25 | + const OPTION_GET_ALL = 'all'; |
|
26 | 26 | |
27 | - /** |
|
28 | - * indicates that only ACTIVE countries should be retrieved from the db for the input |
|
29 | - */ |
|
30 | - const OPTION_GET_ACTIVE = 'active'; |
|
27 | + /** |
|
28 | + * indicates that only ACTIVE countries should be retrieved from the db for the input |
|
29 | + */ |
|
30 | + const OPTION_GET_ACTIVE = 'active'; |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @param array $country_options |
|
35 | - * @param array $input_settings |
|
36 | - * @throws EE_Error |
|
37 | - * @throws InvalidArgumentException |
|
38 | - * @throws InvalidDataTypeException |
|
39 | - * @throws InvalidInterfaceException |
|
40 | - * @throws ReflectionException |
|
41 | - */ |
|
42 | - public function __construct($country_options = null, $input_settings = array()) |
|
43 | - { |
|
44 | - $get = isset($input_settings[ self::OPTION_GET_KEY ]) |
|
45 | - ? $input_settings[ self::OPTION_GET_KEY ] |
|
46 | - : self::OPTION_GET_ACTIVE; |
|
47 | - $country_options = apply_filters( |
|
48 | - 'FHEE__EE_Country_Select_Input____construct__country_options', |
|
49 | - $this->get_country_answer_options($country_options, $get), |
|
50 | - $this, |
|
51 | - $get |
|
52 | - ); |
|
53 | - $input_settings['html_class'] = isset($input_settings['html_class']) |
|
54 | - ? $input_settings['html_class'] . ' ee-country-select-js' |
|
55 | - : 'ee-country-select-js'; |
|
56 | - parent::__construct($country_options, $input_settings); |
|
57 | - } |
|
33 | + /** |
|
34 | + * @param array $country_options |
|
35 | + * @param array $input_settings |
|
36 | + * @throws EE_Error |
|
37 | + * @throws InvalidArgumentException |
|
38 | + * @throws InvalidDataTypeException |
|
39 | + * @throws InvalidInterfaceException |
|
40 | + * @throws ReflectionException |
|
41 | + */ |
|
42 | + public function __construct($country_options = null, $input_settings = array()) |
|
43 | + { |
|
44 | + $get = isset($input_settings[ self::OPTION_GET_KEY ]) |
|
45 | + ? $input_settings[ self::OPTION_GET_KEY ] |
|
46 | + : self::OPTION_GET_ACTIVE; |
|
47 | + $country_options = apply_filters( |
|
48 | + 'FHEE__EE_Country_Select_Input____construct__country_options', |
|
49 | + $this->get_country_answer_options($country_options, $get), |
|
50 | + $this, |
|
51 | + $get |
|
52 | + ); |
|
53 | + $input_settings['html_class'] = isset($input_settings['html_class']) |
|
54 | + ? $input_settings['html_class'] . ' ee-country-select-js' |
|
55 | + : 'ee-country-select-js'; |
|
56 | + parent::__construct($country_options, $input_settings); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * get_country_answer_options |
|
62 | - * |
|
63 | - * @param array $country_options |
|
64 | - * @param string $get |
|
65 | - * @return array |
|
66 | - * @throws EE_Error |
|
67 | - * @throws InvalidArgumentException |
|
68 | - * @throws ReflectionException |
|
69 | - * @throws InvalidDataTypeException |
|
70 | - * @throws InvalidInterfaceException |
|
71 | - */ |
|
72 | - public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE) |
|
73 | - { |
|
74 | - // if passed something that is NOT an array |
|
75 | - if (! is_array($country_options)) { |
|
76 | - // get possibly cached list of countries |
|
77 | - $countries = $get === self::OPTION_GET_ALL |
|
78 | - ? EEM_Country::instance()->get_all_countries() |
|
79 | - : EEM_Country::instance()->get_all_active_countries(); |
|
80 | - if (! empty($countries)) { |
|
81 | - $country_options[''] = ''; |
|
82 | - foreach ($countries as $country) { |
|
83 | - if ($country instanceof EE_Country) { |
|
84 | - $country_options[ $country->ID() ] = $country->name(); |
|
85 | - } |
|
86 | - } |
|
87 | - } else { |
|
88 | - $country_options = array(); |
|
89 | - } |
|
90 | - } |
|
91 | - return $country_options; |
|
92 | - } |
|
60 | + /** |
|
61 | + * get_country_answer_options |
|
62 | + * |
|
63 | + * @param array $country_options |
|
64 | + * @param string $get |
|
65 | + * @return array |
|
66 | + * @throws EE_Error |
|
67 | + * @throws InvalidArgumentException |
|
68 | + * @throws ReflectionException |
|
69 | + * @throws InvalidDataTypeException |
|
70 | + * @throws InvalidInterfaceException |
|
71 | + */ |
|
72 | + public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE) |
|
73 | + { |
|
74 | + // if passed something that is NOT an array |
|
75 | + if (! is_array($country_options)) { |
|
76 | + // get possibly cached list of countries |
|
77 | + $countries = $get === self::OPTION_GET_ALL |
|
78 | + ? EEM_Country::instance()->get_all_countries() |
|
79 | + : EEM_Country::instance()->get_all_active_countries(); |
|
80 | + if (! empty($countries)) { |
|
81 | + $country_options[''] = ''; |
|
82 | + foreach ($countries as $country) { |
|
83 | + if ($country instanceof EE_Country) { |
|
84 | + $country_options[ $country->ID() ] = $country->name(); |
|
85 | + } |
|
86 | + } |
|
87 | + } else { |
|
88 | + $country_options = array(); |
|
89 | + } |
|
90 | + } |
|
91 | + return $country_options; |
|
92 | + } |
|
93 | 93 | } |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function __construct($country_options = null, $input_settings = array()) |
43 | 43 | { |
44 | - $get = isset($input_settings[ self::OPTION_GET_KEY ]) |
|
45 | - ? $input_settings[ self::OPTION_GET_KEY ] |
|
44 | + $get = isset($input_settings[self::OPTION_GET_KEY]) |
|
45 | + ? $input_settings[self::OPTION_GET_KEY] |
|
46 | 46 | : self::OPTION_GET_ACTIVE; |
47 | 47 | $country_options = apply_filters( |
48 | 48 | 'FHEE__EE_Country_Select_Input____construct__country_options', |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $get |
52 | 52 | ); |
53 | 53 | $input_settings['html_class'] = isset($input_settings['html_class']) |
54 | - ? $input_settings['html_class'] . ' ee-country-select-js' |
|
54 | + ? $input_settings['html_class'].' ee-country-select-js' |
|
55 | 55 | : 'ee-country-select-js'; |
56 | 56 | parent::__construct($country_options, $input_settings); |
57 | 57 | } |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE) |
73 | 73 | { |
74 | 74 | // if passed something that is NOT an array |
75 | - if (! is_array($country_options)) { |
|
75 | + if ( ! is_array($country_options)) { |
|
76 | 76 | // get possibly cached list of countries |
77 | 77 | $countries = $get === self::OPTION_GET_ALL |
78 | 78 | ? EEM_Country::instance()->get_all_countries() |
79 | 79 | : EEM_Country::instance()->get_all_active_countries(); |
80 | - if (! empty($countries)) { |
|
80 | + if ( ! empty($countries)) { |
|
81 | 81 | $country_options[''] = ''; |
82 | 82 | foreach ($countries as $country) { |
83 | 83 | if ($country instanceof EE_Country) { |
84 | - $country_options[ $country->ID() ] = $country->name(); |
|
84 | + $country_options[$country->ID()] = $country->name(); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } else { |
@@ -14,8 +14,8 @@ |
||
14 | 14 | */ |
15 | 15 | class AnyFrontendRequest extends RouteMatchSpecification |
16 | 16 | { |
17 | - public function isMatchingRoute() |
|
18 | - { |
|
19 | - return $this->request->isFrontend(); |
|
20 | - } |
|
17 | + public function isMatchingRoute() |
|
18 | + { |
|
19 | + return $this->request->isFrontend(); |
|
20 | + } |
|
21 | 21 | } |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function isValid($file, $func, $line) |
34 | 34 | { |
35 | - if (! defined('JSON_ERROR_RECURSION')) { |
|
35 | + if ( ! defined('JSON_ERROR_RECURSION')) { |
|
36 | 36 | define('JSON_ERROR_RECURSION', 6); |
37 | 37 | } |
38 | - if (! defined('JSON_ERROR_INF_OR_NAN')) { |
|
38 | + if ( ! defined('JSON_ERROR_INF_OR_NAN')) { |
|
39 | 39 | define('JSON_ERROR_INF_OR_NAN', 7); |
40 | 40 | } |
41 | - if (! defined('JSON_ERROR_UNSUPPORTED_TYPE')) { |
|
41 | + if ( ! defined('JSON_ERROR_UNSUPPORTED_TYPE')) { |
|
42 | 42 | define('JSON_ERROR_UNSUPPORTED_TYPE', 8); |
43 | 43 | } |
44 | - if (! defined('JSON_ERROR_INVALID_PROPERTY_NAME')) { |
|
44 | + if ( ! defined('JSON_ERROR_INVALID_PROPERTY_NAME')) { |
|
45 | 45 | define('JSON_ERROR_INVALID_PROPERTY_NAME', 9); |
46 | 46 | } |
47 | - if (! defined('JSON_ERROR_UTF16')) { |
|
47 | + if ( ! defined('JSON_ERROR_UTF16')) { |
|
48 | 48 | define('JSON_ERROR_UTF16', 10); |
49 | 49 | } |
50 | 50 | switch (json_last_error()) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $error = ': Unknown error'; |
85 | 85 | break; |
86 | 86 | } |
87 | - EE_Error::add_error('JSON decoding failed' . $error, $file, $func, $line); |
|
87 | + EE_Error::add_error('JSON decoding failed'.$error, $file, $func, $line); |
|
88 | 88 | return false; |
89 | 89 | } |
90 | 90 | } |
@@ -18,76 +18,76 @@ |
||
18 | 18 | class JsonValidator |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * Call this method IMMEDIATELY after json_decode() and |
|
23 | - * it will will return true if the decoded JSON was valid, |
|
24 | - * or return false after adding an error if not valid. |
|
25 | - * The actual JSON file does not need to be supplied, |
|
26 | - * but details re: code execution location are required. |
|
27 | - * ex: |
|
28 | - * JsonValidator::isValid(__FILE__, __METHOD__, __LINE__) |
|
29 | - * |
|
30 | - * @param string $file |
|
31 | - * @param string $func |
|
32 | - * @param string $line |
|
33 | - * @return boolean |
|
34 | - * @since 4.9.70.p |
|
35 | - */ |
|
36 | - public function isValid($file, $func, $line) |
|
37 | - { |
|
38 | - if (! defined('JSON_ERROR_RECURSION')) { |
|
39 | - define('JSON_ERROR_RECURSION', 6); |
|
40 | - } |
|
41 | - if (! defined('JSON_ERROR_INF_OR_NAN')) { |
|
42 | - define('JSON_ERROR_INF_OR_NAN', 7); |
|
43 | - } |
|
44 | - if (! defined('JSON_ERROR_UNSUPPORTED_TYPE')) { |
|
45 | - define('JSON_ERROR_UNSUPPORTED_TYPE', 8); |
|
46 | - } |
|
47 | - if (! defined('JSON_ERROR_INVALID_PROPERTY_NAME')) { |
|
48 | - define('JSON_ERROR_INVALID_PROPERTY_NAME', 9); |
|
49 | - } |
|
50 | - if (! defined('JSON_ERROR_UTF16')) { |
|
51 | - define('JSON_ERROR_UTF16', 10); |
|
52 | - } |
|
53 | - switch (json_last_error()) { |
|
54 | - case JSON_ERROR_NONE: |
|
55 | - return true; |
|
56 | - case JSON_ERROR_DEPTH: |
|
57 | - $error = ': Maximum stack depth exceeded'; |
|
58 | - break; |
|
59 | - case JSON_ERROR_STATE_MISMATCH: |
|
60 | - $error = ': Invalid or malformed JSON'; |
|
61 | - break; |
|
62 | - case JSON_ERROR_CTRL_CHAR: |
|
63 | - $error = ': Control character error, possible malformed JSON'; |
|
64 | - break; |
|
65 | - case JSON_ERROR_SYNTAX: |
|
66 | - $error = ': Syntax error, malformed JSON'; |
|
67 | - break; |
|
68 | - case JSON_ERROR_UTF8: |
|
69 | - $error = ': Malformed UTF-8 characters, possible malformed JSON'; |
|
70 | - break; |
|
71 | - case JSON_ERROR_RECURSION: |
|
72 | - $error = ': One or more recursive references in the value to be encoded'; |
|
73 | - break; |
|
74 | - case JSON_ERROR_INF_OR_NAN: |
|
75 | - $error = ': One or more NAN or INF values in the value to be encoded'; |
|
76 | - break; |
|
77 | - case JSON_ERROR_UNSUPPORTED_TYPE: |
|
78 | - $error = ': A value of a type that cannot be encoded was given'; |
|
79 | - break; |
|
80 | - case JSON_ERROR_INVALID_PROPERTY_NAME: |
|
81 | - $error = ': A property name that cannot be encoded was given'; |
|
82 | - break; |
|
83 | - case JSON_ERROR_UTF16: |
|
84 | - $error = ': Malformed UTF-16 characters, possibly incorrectly encoded'; |
|
85 | - break; |
|
86 | - default: |
|
87 | - $error = ': Unknown error'; |
|
88 | - break; |
|
89 | - } |
|
90 | - EE_Error::add_error('JSON decoding failed' . $error, $file, $func, $line); |
|
91 | - return false; |
|
92 | - } |
|
21 | + /** |
|
22 | + * Call this method IMMEDIATELY after json_decode() and |
|
23 | + * it will will return true if the decoded JSON was valid, |
|
24 | + * or return false after adding an error if not valid. |
|
25 | + * The actual JSON file does not need to be supplied, |
|
26 | + * but details re: code execution location are required. |
|
27 | + * ex: |
|
28 | + * JsonValidator::isValid(__FILE__, __METHOD__, __LINE__) |
|
29 | + * |
|
30 | + * @param string $file |
|
31 | + * @param string $func |
|
32 | + * @param string $line |
|
33 | + * @return boolean |
|
34 | + * @since 4.9.70.p |
|
35 | + */ |
|
36 | + public function isValid($file, $func, $line) |
|
37 | + { |
|
38 | + if (! defined('JSON_ERROR_RECURSION')) { |
|
39 | + define('JSON_ERROR_RECURSION', 6); |
|
40 | + } |
|
41 | + if (! defined('JSON_ERROR_INF_OR_NAN')) { |
|
42 | + define('JSON_ERROR_INF_OR_NAN', 7); |
|
43 | + } |
|
44 | + if (! defined('JSON_ERROR_UNSUPPORTED_TYPE')) { |
|
45 | + define('JSON_ERROR_UNSUPPORTED_TYPE', 8); |
|
46 | + } |
|
47 | + if (! defined('JSON_ERROR_INVALID_PROPERTY_NAME')) { |
|
48 | + define('JSON_ERROR_INVALID_PROPERTY_NAME', 9); |
|
49 | + } |
|
50 | + if (! defined('JSON_ERROR_UTF16')) { |
|
51 | + define('JSON_ERROR_UTF16', 10); |
|
52 | + } |
|
53 | + switch (json_last_error()) { |
|
54 | + case JSON_ERROR_NONE: |
|
55 | + return true; |
|
56 | + case JSON_ERROR_DEPTH: |
|
57 | + $error = ': Maximum stack depth exceeded'; |
|
58 | + break; |
|
59 | + case JSON_ERROR_STATE_MISMATCH: |
|
60 | + $error = ': Invalid or malformed JSON'; |
|
61 | + break; |
|
62 | + case JSON_ERROR_CTRL_CHAR: |
|
63 | + $error = ': Control character error, possible malformed JSON'; |
|
64 | + break; |
|
65 | + case JSON_ERROR_SYNTAX: |
|
66 | + $error = ': Syntax error, malformed JSON'; |
|
67 | + break; |
|
68 | + case JSON_ERROR_UTF8: |
|
69 | + $error = ': Malformed UTF-8 characters, possible malformed JSON'; |
|
70 | + break; |
|
71 | + case JSON_ERROR_RECURSION: |
|
72 | + $error = ': One or more recursive references in the value to be encoded'; |
|
73 | + break; |
|
74 | + case JSON_ERROR_INF_OR_NAN: |
|
75 | + $error = ': One or more NAN or INF values in the value to be encoded'; |
|
76 | + break; |
|
77 | + case JSON_ERROR_UNSUPPORTED_TYPE: |
|
78 | + $error = ': A value of a type that cannot be encoded was given'; |
|
79 | + break; |
|
80 | + case JSON_ERROR_INVALID_PROPERTY_NAME: |
|
81 | + $error = ': A property name that cannot be encoded was given'; |
|
82 | + break; |
|
83 | + case JSON_ERROR_UTF16: |
|
84 | + $error = ': Malformed UTF-16 characters, possibly incorrectly encoded'; |
|
85 | + break; |
|
86 | + default: |
|
87 | + $error = ': Unknown error'; |
|
88 | + break; |
|
89 | + } |
|
90 | + EE_Error::add_error('JSON decoding failed' . $error, $file, $func, $line); |
|
91 | + return false; |
|
92 | + } |
|
93 | 93 | } |
@@ -20,104 +20,104 @@ |
||
20 | 20 | class EventAttendeesBlockRenderer extends BlockRenderer |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var EEM_Attendee |
|
25 | - */ |
|
26 | - private $attendee_model; |
|
23 | + /** |
|
24 | + * @var EEM_Attendee |
|
25 | + */ |
|
26 | + private $attendee_model; |
|
27 | 27 | |
28 | - public function __construct(DomainInterface $domain, EEM_Attendee $attendee_model) |
|
29 | - { |
|
30 | - $this->attendee_model = $attendee_model; |
|
31 | - parent::__construct($domain); |
|
32 | - } |
|
28 | + public function __construct(DomainInterface $domain, EEM_Attendee $attendee_model) |
|
29 | + { |
|
30 | + $this->attendee_model = $attendee_model; |
|
31 | + parent::__construct($domain); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Renders the block. |
|
37 | - * |
|
38 | - * @param array $attributes Expect already validated and sanitized array of attributes for use in generating the |
|
39 | - * query and the template output. |
|
40 | - * @return string |
|
41 | - * @throws DomainException |
|
42 | - * @throws EE_Error |
|
43 | - */ |
|
44 | - public function render(array $attributes) |
|
45 | - { |
|
46 | - $template_args['attributes'] = $attributes; |
|
47 | - $template_args['attendees'] = $this->attendee_model->get_all($this->getQueryParams($attributes)); |
|
48 | - return EEH_Template::display_template( |
|
49 | - $this->templateRootPath() . 'event-attendees.php', |
|
50 | - $template_args, |
|
51 | - true |
|
52 | - ); |
|
53 | - } |
|
35 | + /** |
|
36 | + * Renders the block. |
|
37 | + * |
|
38 | + * @param array $attributes Expect already validated and sanitized array of attributes for use in generating the |
|
39 | + * query and the template output. |
|
40 | + * @return string |
|
41 | + * @throws DomainException |
|
42 | + * @throws EE_Error |
|
43 | + */ |
|
44 | + public function render(array $attributes) |
|
45 | + { |
|
46 | + $template_args['attributes'] = $attributes; |
|
47 | + $template_args['attendees'] = $this->attendee_model->get_all($this->getQueryParams($attributes)); |
|
48 | + return EEH_Template::display_template( |
|
49 | + $this->templateRootPath() . 'event-attendees.php', |
|
50 | + $template_args, |
|
51 | + true |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Get query parameters for model query. |
|
58 | - * |
|
59 | - * @param array $attributes |
|
60 | - * @return array |
|
61 | - */ |
|
62 | - private function getQueryParams(array $attributes) |
|
63 | - { |
|
64 | - return array( |
|
65 | - 0 => $this->getWhereQueryPart($attributes), |
|
66 | - 'default_where_conditions' => 'this_model_only', |
|
67 | - 'limit' => $attributes['limit'], |
|
68 | - 'group_by' => array('ATT_ID'), |
|
69 | - 'order_by' => $this->getOrderByQueryPart($attributes) |
|
70 | - ); |
|
71 | - } |
|
56 | + /** |
|
57 | + * Get query parameters for model query. |
|
58 | + * |
|
59 | + * @param array $attributes |
|
60 | + * @return array |
|
61 | + */ |
|
62 | + private function getQueryParams(array $attributes) |
|
63 | + { |
|
64 | + return array( |
|
65 | + 0 => $this->getWhereQueryPart($attributes), |
|
66 | + 'default_where_conditions' => 'this_model_only', |
|
67 | + 'limit' => $attributes['limit'], |
|
68 | + 'group_by' => array('ATT_ID'), |
|
69 | + 'order_by' => $this->getOrderByQueryPart($attributes) |
|
70 | + ); |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | - /** |
|
75 | - * Get where query part for query parameters for model query. |
|
76 | - * |
|
77 | - * @param array $attributes |
|
78 | - * @return array |
|
79 | - */ |
|
80 | - private function getWhereQueryPart(array $attributes) |
|
81 | - { |
|
82 | - $where = array(); |
|
83 | - if ($attributes['ticketId'] > 0) { |
|
84 | - $where['Registration.TKT_ID'] = $attributes['ticketId']; |
|
85 | - } elseif ($attributes['datetimeId'] > 0) { |
|
86 | - $where['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetimeId']; |
|
87 | - } else { |
|
88 | - $where['Registration.EVT_ID'] = $attributes['eventId']; |
|
89 | - } |
|
90 | - $where['Registration.STS_ID'] = $attributes['status']; |
|
91 | - return $where; |
|
92 | - } |
|
74 | + /** |
|
75 | + * Get where query part for query parameters for model query. |
|
76 | + * |
|
77 | + * @param array $attributes |
|
78 | + * @return array |
|
79 | + */ |
|
80 | + private function getWhereQueryPart(array $attributes) |
|
81 | + { |
|
82 | + $where = array(); |
|
83 | + if ($attributes['ticketId'] > 0) { |
|
84 | + $where['Registration.TKT_ID'] = $attributes['ticketId']; |
|
85 | + } elseif ($attributes['datetimeId'] > 0) { |
|
86 | + $where['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetimeId']; |
|
87 | + } else { |
|
88 | + $where['Registration.EVT_ID'] = $attributes['eventId']; |
|
89 | + } |
|
90 | + $where['Registration.STS_ID'] = $attributes['status']; |
|
91 | + return $where; |
|
92 | + } |
|
93 | 93 | |
94 | 94 | |
95 | - /** |
|
96 | - * Get order by query part for query parameters for model query. |
|
97 | - * |
|
98 | - * @param array $attributes |
|
99 | - * @return array |
|
100 | - */ |
|
101 | - private function getOrderByQueryPart(array $attributes) |
|
102 | - { |
|
103 | - $order = $attributes['order']; |
|
104 | - switch ($attributes['orderBy']) { |
|
105 | - case 'id': |
|
106 | - $order_by = array('ATT_ID' => $order); |
|
107 | - break; |
|
108 | - case 'lastNameOnly': |
|
109 | - $order_by = array('ATT_lname' => $order); |
|
110 | - break; |
|
111 | - case 'firstNameOnly': |
|
112 | - $order_by = array('ATT_fname' => $order); |
|
113 | - break; |
|
114 | - case 'firstThenLastName': |
|
115 | - $order_by = array('ATT_fname' => $order, 'ATT_lname' => $order); |
|
116 | - break; |
|
117 | - default: |
|
118 | - $order_by = array('ATT_lname' => $order, 'ATT_fname' => $order); |
|
119 | - break; |
|
120 | - } |
|
121 | - return $order_by; |
|
122 | - } |
|
95 | + /** |
|
96 | + * Get order by query part for query parameters for model query. |
|
97 | + * |
|
98 | + * @param array $attributes |
|
99 | + * @return array |
|
100 | + */ |
|
101 | + private function getOrderByQueryPart(array $attributes) |
|
102 | + { |
|
103 | + $order = $attributes['order']; |
|
104 | + switch ($attributes['orderBy']) { |
|
105 | + case 'id': |
|
106 | + $order_by = array('ATT_ID' => $order); |
|
107 | + break; |
|
108 | + case 'lastNameOnly': |
|
109 | + $order_by = array('ATT_lname' => $order); |
|
110 | + break; |
|
111 | + case 'firstNameOnly': |
|
112 | + $order_by = array('ATT_fname' => $order); |
|
113 | + break; |
|
114 | + case 'firstThenLastName': |
|
115 | + $order_by = array('ATT_fname' => $order, 'ATT_lname' => $order); |
|
116 | + break; |
|
117 | + default: |
|
118 | + $order_by = array('ATT_lname' => $order, 'ATT_fname' => $order); |
|
119 | + break; |
|
120 | + } |
|
121 | + return $order_by; |
|
122 | + } |
|
123 | 123 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $template_args['attributes'] = $attributes; |
47 | 47 | $template_args['attendees'] = $this->attendee_model->get_all($this->getQueryParams($attributes)); |
48 | 48 | return EEH_Template::display_template( |
49 | - $this->templateRootPath() . 'event-attendees.php', |
|
49 | + $this->templateRootPath().'event-attendees.php', |
|
50 | 50 | $template_args, |
51 | 51 | true |
52 | 52 | ); |