@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('NO direct script access allowed'); |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -19,263 +19,263 @@ discard block |
||
19 | 19 | |
20 | 20 | |
21 | 21 | |
22 | - protected function _init_page_props() |
|
23 | - { |
|
24 | - $this->page_slug = EE_SUPPORT_PG_SLUG; |
|
25 | - $this->page_label = esc_html__('Help & Support', 'event_espresso'); |
|
26 | - $this->_admin_base_url = EE_SUPPORT_ADMIN_URL; |
|
27 | - $this->_admin_base_path = EE_SUPPORT_ADMIN; |
|
28 | - } |
|
22 | + protected function _init_page_props() |
|
23 | + { |
|
24 | + $this->page_slug = EE_SUPPORT_PG_SLUG; |
|
25 | + $this->page_label = esc_html__('Help & Support', 'event_espresso'); |
|
26 | + $this->_admin_base_url = EE_SUPPORT_ADMIN_URL; |
|
27 | + $this->_admin_base_path = EE_SUPPORT_ADMIN; |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - protected function _ajax_hooks() |
|
33 | - { |
|
34 | - } |
|
32 | + protected function _ajax_hooks() |
|
33 | + { |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | - protected function _define_page_props() |
|
39 | - { |
|
40 | - $this->_labels = array(); |
|
41 | - $this->_admin_page_title = $this->page_label; |
|
42 | - } |
|
38 | + protected function _define_page_props() |
|
39 | + { |
|
40 | + $this->_labels = array(); |
|
41 | + $this->_admin_page_title = $this->page_label; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | - protected function _set_page_routes() |
|
47 | - { |
|
48 | - $this->_page_routes = array( |
|
49 | - 'default' => array( |
|
50 | - 'func' => '_contact_support', |
|
51 | - 'capability' => 'ee_read_ee', |
|
52 | - ), |
|
53 | - 'developers' => array( |
|
54 | - 'func' => '_developers', |
|
55 | - 'capability' => 'ee_read_ee', |
|
56 | - ), |
|
57 | - 'shortcodes' => array( |
|
58 | - 'func' => '_shortcodes', |
|
59 | - 'capability' => 'ee_read_ee', |
|
60 | - ), |
|
61 | - ); |
|
62 | - } |
|
46 | + protected function _set_page_routes() |
|
47 | + { |
|
48 | + $this->_page_routes = array( |
|
49 | + 'default' => array( |
|
50 | + 'func' => '_contact_support', |
|
51 | + 'capability' => 'ee_read_ee', |
|
52 | + ), |
|
53 | + 'developers' => array( |
|
54 | + 'func' => '_developers', |
|
55 | + 'capability' => 'ee_read_ee', |
|
56 | + ), |
|
57 | + 'shortcodes' => array( |
|
58 | + 'func' => '_shortcodes', |
|
59 | + 'capability' => 'ee_read_ee', |
|
60 | + ), |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | - protected function _set_page_config() |
|
67 | - { |
|
68 | - $this->_page_config = array( |
|
69 | - 'default' => array( |
|
70 | - 'nav' => array( |
|
71 | - 'label' => esc_html__('Support', 'event_espresso'), |
|
72 | - 'order' => 30, |
|
73 | - ), |
|
74 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')), |
|
75 | - 'require_nonce' => false, |
|
76 | - ), |
|
77 | - 'developers' => array( |
|
78 | - 'nav' => array( |
|
79 | - 'label' => esc_html__('Developers', 'event_espresso'), |
|
80 | - 'order' => 50, |
|
81 | - ), |
|
82 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
83 | - 'require_nonce' => false, |
|
84 | - ), |
|
85 | - 'shortcodes' => array( |
|
86 | - 'nav' => array( |
|
87 | - 'label' => esc_html__('Shortcodes', 'event_espresso'), |
|
88 | - 'order' => 60, |
|
89 | - ), |
|
90 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')), |
|
91 | - 'require_nonce' => false, |
|
92 | - ), |
|
93 | - ); |
|
94 | - } |
|
66 | + protected function _set_page_config() |
|
67 | + { |
|
68 | + $this->_page_config = array( |
|
69 | + 'default' => array( |
|
70 | + 'nav' => array( |
|
71 | + 'label' => esc_html__('Support', 'event_espresso'), |
|
72 | + 'order' => 30, |
|
73 | + ), |
|
74 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')), |
|
75 | + 'require_nonce' => false, |
|
76 | + ), |
|
77 | + 'developers' => array( |
|
78 | + 'nav' => array( |
|
79 | + 'label' => esc_html__('Developers', 'event_espresso'), |
|
80 | + 'order' => 50, |
|
81 | + ), |
|
82 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
83 | + 'require_nonce' => false, |
|
84 | + ), |
|
85 | + 'shortcodes' => array( |
|
86 | + 'nav' => array( |
|
87 | + 'label' => esc_html__('Shortcodes', 'event_espresso'), |
|
88 | + 'order' => 60, |
|
89 | + ), |
|
90 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')), |
|
91 | + 'require_nonce' => false, |
|
92 | + ), |
|
93 | + ); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | - //none of the below group are currently used for Support pages |
|
99 | - protected function _add_screen_options() |
|
100 | - { |
|
101 | - } |
|
102 | - |
|
98 | + //none of the below group are currently used for Support pages |
|
99 | + protected function _add_screen_options() |
|
100 | + { |
|
101 | + } |
|
102 | + |
|
103 | 103 | |
104 | 104 | |
105 | - protected function _add_feature_pointers() |
|
106 | - { |
|
107 | - } |
|
105 | + protected function _add_feature_pointers() |
|
106 | + { |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | 110 | |
111 | - public function admin_init() |
|
112 | - { |
|
113 | - } |
|
111 | + public function admin_init() |
|
112 | + { |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | 116 | |
117 | - public function admin_notices() |
|
118 | - { |
|
119 | - } |
|
117 | + public function admin_notices() |
|
118 | + { |
|
119 | + } |
|
120 | 120 | |
121 | - |
|
122 | - |
|
123 | - public function admin_footer_scripts() |
|
124 | - { |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - |
|
129 | - public function load_scripts_styles() |
|
130 | - { |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - |
|
135 | - protected function _installation() |
|
136 | - { |
|
137 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
138 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
139 | - $template_path, |
|
140 | - '', |
|
141 | - true |
|
142 | - ); |
|
143 | - $this->display_admin_page_with_sidebar(); |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - |
|
148 | - protected function _resources() |
|
149 | - { |
|
150 | - $this->display_admin_page_with_sidebar(); |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - |
|
155 | - protected function _add_settings_metabox($box, $label, array $args) |
|
156 | - { |
|
157 | - add_meta_box( |
|
158 | - "espresso_{$box}_settings", |
|
159 | - $label, |
|
160 | - function ($post, $metabox) { |
|
161 | - echo EEH_Template::display_template( |
|
162 | - $metabox['args']['template_path'], |
|
163 | - $metabox['args']['template_args'], |
|
164 | - true |
|
165 | - ); |
|
166 | - }, |
|
167 | - $this->_current_screen->id, |
|
168 | - 'normal', |
|
169 | - 'high', |
|
170 | - apply_filters( |
|
171 | - "FHEE__Support_Admin_Page___add_settings_metabox__{$box}_args_array", |
|
172 | - $args |
|
173 | - ) |
|
174 | - ); |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - |
|
179 | - protected function _resources_boxes() |
|
180 | - { |
|
181 | - $boxes = apply_filters( |
|
182 | - 'FHEE__Support_Admin_Page___resources_boxes__boxes_array', |
|
183 | - array( |
|
184 | - 'favorite_theme_developers' => esc_html__('Favorite Theme Developers', 'event_espresso'), |
|
185 | - 'highly_recommended_themes' => esc_html__('Highly Recommended Themes', 'event_espresso'), |
|
186 | - 'hire_developer' => esc_html__('Hire a Developer', 'event_espresso'), |
|
187 | - 'partners' => esc_html__('Partners', 'event_espresso'), |
|
188 | - 'recommended_plugins' => esc_html__('Recommended Plugins', 'event_espresso'), |
|
189 | - 'other_resources' => esc_html__('Other Resources', 'event_espresso'), |
|
190 | - ) |
|
191 | - ); |
|
192 | - foreach ($boxes as $box => $label) { |
|
193 | - $this->_add_settings_metabox( |
|
194 | - $box, |
|
195 | - $label, |
|
196 | - array( |
|
197 | - 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
198 | - 'template_args' => $this->_template_args, |
|
199 | - ) |
|
200 | - ); |
|
201 | - } |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - |
|
206 | - protected function _shortcodes() |
|
207 | - { |
|
208 | - $this->display_admin_page_with_sidebar(); |
|
209 | - } |
|
210 | - |
|
211 | - |
|
212 | - |
|
213 | - protected function _shortcodes_boxes() |
|
214 | - { |
|
215 | - $boxes = apply_filters( |
|
216 | - 'FHEE__Support_Admin_Page___shortcodes_boxes__boxes_array', |
|
217 | - array( |
|
218 | - 'shortcodes_event_listings' => esc_html__('Event Listings', 'event_espresso'), |
|
219 | - 'shortcodes_ticket_selector' => esc_html__('Event Ticket Selector', 'event_espresso'), |
|
220 | - 'shortcodes_category' => esc_html__('Event Categories', 'event_espresso'), |
|
221 | - 'shortcodes_attendee' => esc_html__('Event Attendees', 'event_espresso') |
|
222 | - /*'shortcodes_single_events' => esc_html__('Single Events', 'event_espresso'),*/ |
|
223 | - /*'shortcodes_attendee_listings' => esc_html__('Attendee Listings', 'event_espresso'),*/ |
|
224 | - ) |
|
225 | - ); |
|
226 | - foreach ($boxes as $box => $label) { |
|
227 | - $this->_add_settings_metabox( |
|
228 | - $box, |
|
229 | - $label, |
|
230 | - array( |
|
231 | - 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
232 | - 'template_args' => $this->_template_args, |
|
233 | - ) |
|
234 | - ); |
|
235 | - } |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - |
|
240 | - protected function _contact_support() |
|
241 | - { |
|
242 | - $this->display_admin_page_with_sidebar(); |
|
243 | - } |
|
244 | - |
|
245 | - |
|
246 | - |
|
247 | - protected function _support_boxes() |
|
248 | - { |
|
249 | - $boxes = apply_filters( |
|
250 | - 'FHEE__Support_Admin_Page___support_boxes__boxes_array', |
|
251 | - array( |
|
252 | - 'contact_support' => esc_html__('Contact Support', 'event_espresso'), |
|
253 | - 'important_information' => esc_html__('Important Information', 'event_espresso'), |
|
254 | - ) |
|
255 | - ); |
|
256 | - foreach ($boxes as $box => $label) { |
|
257 | - $this->_add_settings_metabox( |
|
258 | - $box, |
|
259 | - $label, |
|
260 | - array( |
|
261 | - 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
262 | - 'template_args' => $this->_template_args, |
|
263 | - ) |
|
264 | - ); |
|
265 | - } |
|
266 | - } |
|
267 | - |
|
268 | - |
|
269 | - |
|
270 | - protected function _developers() |
|
271 | - { |
|
272 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
273 | - EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php', |
|
274 | - array(), |
|
275 | - true |
|
276 | - ); |
|
277 | - $this->display_admin_page_with_sidebar(); |
|
278 | - } |
|
121 | + |
|
122 | + |
|
123 | + public function admin_footer_scripts() |
|
124 | + { |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + |
|
129 | + public function load_scripts_styles() |
|
130 | + { |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + |
|
135 | + protected function _installation() |
|
136 | + { |
|
137 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
138 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
139 | + $template_path, |
|
140 | + '', |
|
141 | + true |
|
142 | + ); |
|
143 | + $this->display_admin_page_with_sidebar(); |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + |
|
148 | + protected function _resources() |
|
149 | + { |
|
150 | + $this->display_admin_page_with_sidebar(); |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + |
|
155 | + protected function _add_settings_metabox($box, $label, array $args) |
|
156 | + { |
|
157 | + add_meta_box( |
|
158 | + "espresso_{$box}_settings", |
|
159 | + $label, |
|
160 | + function ($post, $metabox) { |
|
161 | + echo EEH_Template::display_template( |
|
162 | + $metabox['args']['template_path'], |
|
163 | + $metabox['args']['template_args'], |
|
164 | + true |
|
165 | + ); |
|
166 | + }, |
|
167 | + $this->_current_screen->id, |
|
168 | + 'normal', |
|
169 | + 'high', |
|
170 | + apply_filters( |
|
171 | + "FHEE__Support_Admin_Page___add_settings_metabox__{$box}_args_array", |
|
172 | + $args |
|
173 | + ) |
|
174 | + ); |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + |
|
179 | + protected function _resources_boxes() |
|
180 | + { |
|
181 | + $boxes = apply_filters( |
|
182 | + 'FHEE__Support_Admin_Page___resources_boxes__boxes_array', |
|
183 | + array( |
|
184 | + 'favorite_theme_developers' => esc_html__('Favorite Theme Developers', 'event_espresso'), |
|
185 | + 'highly_recommended_themes' => esc_html__('Highly Recommended Themes', 'event_espresso'), |
|
186 | + 'hire_developer' => esc_html__('Hire a Developer', 'event_espresso'), |
|
187 | + 'partners' => esc_html__('Partners', 'event_espresso'), |
|
188 | + 'recommended_plugins' => esc_html__('Recommended Plugins', 'event_espresso'), |
|
189 | + 'other_resources' => esc_html__('Other Resources', 'event_espresso'), |
|
190 | + ) |
|
191 | + ); |
|
192 | + foreach ($boxes as $box => $label) { |
|
193 | + $this->_add_settings_metabox( |
|
194 | + $box, |
|
195 | + $label, |
|
196 | + array( |
|
197 | + 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
198 | + 'template_args' => $this->_template_args, |
|
199 | + ) |
|
200 | + ); |
|
201 | + } |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + |
|
206 | + protected function _shortcodes() |
|
207 | + { |
|
208 | + $this->display_admin_page_with_sidebar(); |
|
209 | + } |
|
210 | + |
|
211 | + |
|
212 | + |
|
213 | + protected function _shortcodes_boxes() |
|
214 | + { |
|
215 | + $boxes = apply_filters( |
|
216 | + 'FHEE__Support_Admin_Page___shortcodes_boxes__boxes_array', |
|
217 | + array( |
|
218 | + 'shortcodes_event_listings' => esc_html__('Event Listings', 'event_espresso'), |
|
219 | + 'shortcodes_ticket_selector' => esc_html__('Event Ticket Selector', 'event_espresso'), |
|
220 | + 'shortcodes_category' => esc_html__('Event Categories', 'event_espresso'), |
|
221 | + 'shortcodes_attendee' => esc_html__('Event Attendees', 'event_espresso') |
|
222 | + /*'shortcodes_single_events' => esc_html__('Single Events', 'event_espresso'),*/ |
|
223 | + /*'shortcodes_attendee_listings' => esc_html__('Attendee Listings', 'event_espresso'),*/ |
|
224 | + ) |
|
225 | + ); |
|
226 | + foreach ($boxes as $box => $label) { |
|
227 | + $this->_add_settings_metabox( |
|
228 | + $box, |
|
229 | + $label, |
|
230 | + array( |
|
231 | + 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
232 | + 'template_args' => $this->_template_args, |
|
233 | + ) |
|
234 | + ); |
|
235 | + } |
|
236 | + } |
|
237 | + |
|
238 | + |
|
239 | + |
|
240 | + protected function _contact_support() |
|
241 | + { |
|
242 | + $this->display_admin_page_with_sidebar(); |
|
243 | + } |
|
244 | + |
|
245 | + |
|
246 | + |
|
247 | + protected function _support_boxes() |
|
248 | + { |
|
249 | + $boxes = apply_filters( |
|
250 | + 'FHEE__Support_Admin_Page___support_boxes__boxes_array', |
|
251 | + array( |
|
252 | + 'contact_support' => esc_html__('Contact Support', 'event_espresso'), |
|
253 | + 'important_information' => esc_html__('Important Information', 'event_espresso'), |
|
254 | + ) |
|
255 | + ); |
|
256 | + foreach ($boxes as $box => $label) { |
|
257 | + $this->_add_settings_metabox( |
|
258 | + $box, |
|
259 | + $label, |
|
260 | + array( |
|
261 | + 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
262 | + 'template_args' => $this->_template_args, |
|
263 | + ) |
|
264 | + ); |
|
265 | + } |
|
266 | + } |
|
267 | + |
|
268 | + |
|
269 | + |
|
270 | + protected function _developers() |
|
271 | + { |
|
272 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
273 | + EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php', |
|
274 | + array(), |
|
275 | + true |
|
276 | + ); |
|
277 | + $this->display_admin_page_with_sidebar(); |
|
278 | + } |
|
279 | 279 | |
280 | 280 | |
281 | 281 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | protected function _installation() |
136 | 136 | { |
137 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
137 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php'; |
|
138 | 138 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
139 | 139 | $template_path, |
140 | 140 | '', |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | add_meta_box( |
158 | 158 | "espresso_{$box}_settings", |
159 | 159 | $label, |
160 | - function ($post, $metabox) { |
|
160 | + function($post, $metabox) { |
|
161 | 161 | echo EEH_Template::display_template( |
162 | 162 | $metabox['args']['template_path'], |
163 | 163 | $metabox['args']['template_args'], |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $box, |
195 | 195 | $label, |
196 | 196 | array( |
197 | - 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
197 | + 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH."support_admin_details_{$box}.template.php", |
|
198 | 198 | 'template_args' => $this->_template_args, |
199 | 199 | ) |
200 | 200 | ); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $box, |
229 | 229 | $label, |
230 | 230 | array( |
231 | - 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
231 | + 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH."support_admin_details_{$box}.template.php", |
|
232 | 232 | 'template_args' => $this->_template_args, |
233 | 233 | ) |
234 | 234 | ); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $box, |
259 | 259 | $label, |
260 | 260 | array( |
261 | - 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH . "support_admin_details_{$box}.template.php", |
|
261 | + 'template_path' => EE_SUPPORT_ADMIN_TEMPLATE_PATH."support_admin_details_{$box}.template.php", |
|
262 | 262 | 'template_args' => $this->_template_args, |
263 | 263 | ) |
264 | 264 | ); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | protected function _developers() |
271 | 271 | { |
272 | 272 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
273 | - EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php', |
|
273 | + EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php', |
|
274 | 274 | array(), |
275 | 275 | true |
276 | 276 | ); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @since $VID:$ |
14 | 14 | */ |
15 | 15 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
16 | - exit('No direct script access allowed'); |
|
16 | + exit('No direct script access allowed'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
@@ -21,58 +21,58 @@ discard block |
||
21 | 21 | class Registration extends Calculations_Base |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Calculates the checkin status for each datetime this registration has access to |
|
26 | - * |
|
27 | - * @param array $wpdb_row |
|
28 | - * @param \WP_REST_Request $request |
|
29 | - * @param Base $controller |
|
30 | - * @return int |
|
31 | - * @throws \EE_Error |
|
32 | - */ |
|
33 | - public static function datetime_checkin_stati($wpdb_row, $request, $controller) |
|
34 | - { |
|
35 | - if (is_array($wpdb_row) && isset($wpdb_row['Registration.REG_ID'])) { |
|
36 | - $reg = \EEM_Registration::instance()->get_one_by_ID($wpdb_row['Registration.REG_ID']); |
|
37 | - } else { |
|
38 | - $reg = null; |
|
39 | - } |
|
40 | - if (! $reg instanceof \EE_Registration |
|
41 | - ) { |
|
42 | - throw new \EE_Error( |
|
43 | - sprintf( |
|
44 | - __('Cannot calculate datetime_checkin_stati because the registration with ID %1$s (from database row %2$s) was not found', |
|
45 | - 'event_espresso'), |
|
46 | - $wpdb_row['Registration.REG_ID'], |
|
47 | - print_r($wpdb_row, true) |
|
48 | - ) |
|
49 | - ); |
|
50 | - } |
|
51 | - $datetime_ids = \EEM_Datetime::instance()->get_col( |
|
52 | - array( |
|
53 | - array( |
|
54 | - 'Ticket.TKT_ID' => $reg->ticket_ID(), |
|
55 | - ), |
|
56 | - 'default_where_conditions' => \EEM_Base::default_where_conditions_minimum_all |
|
57 | - ) |
|
58 | - ); |
|
59 | - $checkin_stati = array(); |
|
60 | - foreach ($datetime_ids as $datetime_id) { |
|
61 | - $status = $reg->check_in_status_for_datetime($datetime_id); |
|
62 | - switch ($status) { |
|
63 | - case \EE_Registration::checkin_status_out: |
|
64 | - $status_pretty = 'OUT'; |
|
65 | - break; |
|
66 | - case \EE_Registration::checkin_status_in: |
|
67 | - $status_pretty = 'IN'; |
|
68 | - break; |
|
69 | - case \EE_Registration::checkin_status_never: |
|
70 | - default: |
|
71 | - $status_pretty = 'NEVER'; |
|
72 | - break; |
|
73 | - } |
|
74 | - $checkin_stati[$datetime_id] = $status_pretty; |
|
75 | - } |
|
76 | - return $checkin_stati; |
|
77 | - } |
|
24 | + /** |
|
25 | + * Calculates the checkin status for each datetime this registration has access to |
|
26 | + * |
|
27 | + * @param array $wpdb_row |
|
28 | + * @param \WP_REST_Request $request |
|
29 | + * @param Base $controller |
|
30 | + * @return int |
|
31 | + * @throws \EE_Error |
|
32 | + */ |
|
33 | + public static function datetime_checkin_stati($wpdb_row, $request, $controller) |
|
34 | + { |
|
35 | + if (is_array($wpdb_row) && isset($wpdb_row['Registration.REG_ID'])) { |
|
36 | + $reg = \EEM_Registration::instance()->get_one_by_ID($wpdb_row['Registration.REG_ID']); |
|
37 | + } else { |
|
38 | + $reg = null; |
|
39 | + } |
|
40 | + if (! $reg instanceof \EE_Registration |
|
41 | + ) { |
|
42 | + throw new \EE_Error( |
|
43 | + sprintf( |
|
44 | + __('Cannot calculate datetime_checkin_stati because the registration with ID %1$s (from database row %2$s) was not found', |
|
45 | + 'event_espresso'), |
|
46 | + $wpdb_row['Registration.REG_ID'], |
|
47 | + print_r($wpdb_row, true) |
|
48 | + ) |
|
49 | + ); |
|
50 | + } |
|
51 | + $datetime_ids = \EEM_Datetime::instance()->get_col( |
|
52 | + array( |
|
53 | + array( |
|
54 | + 'Ticket.TKT_ID' => $reg->ticket_ID(), |
|
55 | + ), |
|
56 | + 'default_where_conditions' => \EEM_Base::default_where_conditions_minimum_all |
|
57 | + ) |
|
58 | + ); |
|
59 | + $checkin_stati = array(); |
|
60 | + foreach ($datetime_ids as $datetime_id) { |
|
61 | + $status = $reg->check_in_status_for_datetime($datetime_id); |
|
62 | + switch ($status) { |
|
63 | + case \EE_Registration::checkin_status_out: |
|
64 | + $status_pretty = 'OUT'; |
|
65 | + break; |
|
66 | + case \EE_Registration::checkin_status_in: |
|
67 | + $status_pretty = 'IN'; |
|
68 | + break; |
|
69 | + case \EE_Registration::checkin_status_never: |
|
70 | + default: |
|
71 | + $status_pretty = 'NEVER'; |
|
72 | + break; |
|
73 | + } |
|
74 | + $checkin_stati[$datetime_id] = $status_pretty; |
|
75 | + } |
|
76 | + return $checkin_stati; |
|
77 | + } |
|
78 | 78 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('ABSPATH')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -40,243 +40,243 @@ discard block |
||
40 | 40 | * @since 4.0 |
41 | 41 | */ |
42 | 42 | if (function_exists('espresso_version')) { |
43 | - /** |
|
44 | - * espresso_duplicate_plugin_error |
|
45 | - * displays if more than one version of EE is activated at the same time |
|
46 | - */ |
|
47 | - function espresso_duplicate_plugin_error() |
|
48 | - { |
|
49 | - ?> |
|
43 | + /** |
|
44 | + * espresso_duplicate_plugin_error |
|
45 | + * displays if more than one version of EE is activated at the same time |
|
46 | + */ |
|
47 | + function espresso_duplicate_plugin_error() |
|
48 | + { |
|
49 | + ?> |
|
50 | 50 | <div class="error"> |
51 | 51 | <p> |
52 | 52 | <?php echo esc_html__( |
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | 61 | |
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | - if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - /** |
|
97 | - * espresso_version |
|
98 | - * Returns the plugin version |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function espresso_version() |
|
103 | - { |
|
104 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.37.rc.006'); |
|
105 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + /** |
|
97 | + * espresso_version |
|
98 | + * Returns the plugin version |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function espresso_version() |
|
103 | + { |
|
104 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.37.rc.006'); |
|
105 | + } |
|
106 | 106 | |
107 | - // define versions |
|
108 | - define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | - define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | - define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | - define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | - //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | - if ( ! defined('DS')) { |
|
115 | - define('DS', '/'); |
|
116 | - } |
|
117 | - if ( ! defined('PS')) { |
|
118 | - define('PS', PATH_SEPARATOR); |
|
119 | - } |
|
120 | - if ( ! defined('SP')) { |
|
121 | - define('SP', ' '); |
|
122 | - } |
|
123 | - if ( ! defined('EENL')) { |
|
124 | - define('EENL', "\n"); |
|
125 | - } |
|
126 | - define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | - // define the plugin directory and URL |
|
128 | - define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | - define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | - define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | - // main root folder paths |
|
132 | - define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | - define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | - define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | - define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | - define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | - define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | - define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | - define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | - // core system paths |
|
141 | - define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | - define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | - define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | - define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | - define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | - define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | - define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | - define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | - define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | - define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | - define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | - define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | - // gateways |
|
154 | - define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | - define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | - // asset URL paths |
|
157 | - define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | - define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | - define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | - define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | - define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | - define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | - // define upload paths |
|
164 | - $uploads = wp_upload_dir(); |
|
165 | - // define the uploads directory and URL |
|
166 | - define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | - define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | - // define the templates directory and URL |
|
169 | - define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | - define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | - // define the gateway directory and URL |
|
172 | - define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | - define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | - // languages folder/path |
|
175 | - define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | - define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | - //check for dompdf fonts in uploads |
|
178 | - if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | - } |
|
181 | - //ajax constants |
|
182 | - define( |
|
183 | - 'EE_FRONT_AJAX', |
|
184 | - isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | - ); |
|
186 | - define( |
|
187 | - 'EE_ADMIN_AJAX', |
|
188 | - isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | - ); |
|
190 | - //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | - //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | - //want to change its default value! or find when -1 means infinity |
|
193 | - define('EE_INF_IN_DB', -1); |
|
194 | - define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | - define('EE_DEBUG', false); |
|
196 | - // for older WP versions |
|
197 | - if ( ! defined('MONTH_IN_SECONDS')) { |
|
198 | - define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
199 | - } |
|
200 | - /** |
|
201 | - * espresso_plugin_activation |
|
202 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
203 | - */ |
|
204 | - function espresso_plugin_activation() |
|
205 | - { |
|
206 | - update_option('ee_espresso_activation', true); |
|
207 | - } |
|
107 | + // define versions |
|
108 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | + //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | + if ( ! defined('DS')) { |
|
115 | + define('DS', '/'); |
|
116 | + } |
|
117 | + if ( ! defined('PS')) { |
|
118 | + define('PS', PATH_SEPARATOR); |
|
119 | + } |
|
120 | + if ( ! defined('SP')) { |
|
121 | + define('SP', ' '); |
|
122 | + } |
|
123 | + if ( ! defined('EENL')) { |
|
124 | + define('EENL', "\n"); |
|
125 | + } |
|
126 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | + // define the plugin directory and URL |
|
128 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | + // main root folder paths |
|
132 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | + define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | + // core system paths |
|
141 | + define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | + define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | + define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | + define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | + define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | + define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | + define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | + define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | + define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | + define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | + define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | + // gateways |
|
154 | + define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | + // asset URL paths |
|
157 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | + // define upload paths |
|
164 | + $uploads = wp_upload_dir(); |
|
165 | + // define the uploads directory and URL |
|
166 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | + // define the templates directory and URL |
|
169 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | + // define the gateway directory and URL |
|
172 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | + // languages folder/path |
|
175 | + define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | + //check for dompdf fonts in uploads |
|
178 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | + } |
|
181 | + //ajax constants |
|
182 | + define( |
|
183 | + 'EE_FRONT_AJAX', |
|
184 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | + ); |
|
186 | + define( |
|
187 | + 'EE_ADMIN_AJAX', |
|
188 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | + ); |
|
190 | + //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | + //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | + //want to change its default value! or find when -1 means infinity |
|
193 | + define('EE_INF_IN_DB', -1); |
|
194 | + define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | + define('EE_DEBUG', false); |
|
196 | + // for older WP versions |
|
197 | + if ( ! defined('MONTH_IN_SECONDS')) { |
|
198 | + define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
199 | + } |
|
200 | + /** |
|
201 | + * espresso_plugin_activation |
|
202 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
203 | + */ |
|
204 | + function espresso_plugin_activation() |
|
205 | + { |
|
206 | + update_option('ee_espresso_activation', true); |
|
207 | + } |
|
208 | 208 | |
209 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
210 | - /** |
|
211 | - * espresso_load_error_handling |
|
212 | - * this function loads EE's class for handling exceptions and errors |
|
213 | - */ |
|
214 | - function espresso_load_error_handling() |
|
215 | - { |
|
216 | - // load debugging tools |
|
217 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
218 | - require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
219 | - EEH_Debug_Tools::instance(); |
|
220 | - } |
|
221 | - // load error handling |
|
222 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
223 | - require_once(EE_CORE . 'EE_Error.core.php'); |
|
224 | - } else { |
|
225 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
226 | - } |
|
227 | - } |
|
209 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
210 | + /** |
|
211 | + * espresso_load_error_handling |
|
212 | + * this function loads EE's class for handling exceptions and errors |
|
213 | + */ |
|
214 | + function espresso_load_error_handling() |
|
215 | + { |
|
216 | + // load debugging tools |
|
217 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
218 | + require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
219 | + EEH_Debug_Tools::instance(); |
|
220 | + } |
|
221 | + // load error handling |
|
222 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
223 | + require_once(EE_CORE . 'EE_Error.core.php'); |
|
224 | + } else { |
|
225 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
226 | + } |
|
227 | + } |
|
228 | 228 | |
229 | - /** |
|
230 | - * espresso_load_required |
|
231 | - * given a class name and path, this function will load that file or throw an exception |
|
232 | - * |
|
233 | - * @param string $classname |
|
234 | - * @param string $full_path_to_file |
|
235 | - * @throws EE_Error |
|
236 | - */ |
|
237 | - function espresso_load_required($classname, $full_path_to_file) |
|
238 | - { |
|
239 | - static $error_handling_loaded = false; |
|
240 | - if ( ! $error_handling_loaded) { |
|
241 | - espresso_load_error_handling(); |
|
242 | - $error_handling_loaded = true; |
|
243 | - } |
|
244 | - if (is_readable($full_path_to_file)) { |
|
245 | - require_once($full_path_to_file); |
|
246 | - } else { |
|
247 | - throw new EE_Error ( |
|
248 | - sprintf( |
|
249 | - esc_html__( |
|
250 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
251 | - 'event_espresso' |
|
252 | - ), |
|
253 | - $classname |
|
254 | - ) |
|
255 | - ); |
|
256 | - } |
|
257 | - } |
|
229 | + /** |
|
230 | + * espresso_load_required |
|
231 | + * given a class name and path, this function will load that file or throw an exception |
|
232 | + * |
|
233 | + * @param string $classname |
|
234 | + * @param string $full_path_to_file |
|
235 | + * @throws EE_Error |
|
236 | + */ |
|
237 | + function espresso_load_required($classname, $full_path_to_file) |
|
238 | + { |
|
239 | + static $error_handling_loaded = false; |
|
240 | + if ( ! $error_handling_loaded) { |
|
241 | + espresso_load_error_handling(); |
|
242 | + $error_handling_loaded = true; |
|
243 | + } |
|
244 | + if (is_readable($full_path_to_file)) { |
|
245 | + require_once($full_path_to_file); |
|
246 | + } else { |
|
247 | + throw new EE_Error ( |
|
248 | + sprintf( |
|
249 | + esc_html__( |
|
250 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
251 | + 'event_espresso' |
|
252 | + ), |
|
253 | + $classname |
|
254 | + ) |
|
255 | + ); |
|
256 | + } |
|
257 | + } |
|
258 | 258 | |
259 | - espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
260 | - espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
261 | - espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
262 | - new EE_Bootstrap(); |
|
263 | - } |
|
259 | + espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
260 | + espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
261 | + espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
262 | + new EE_Bootstrap(); |
|
263 | + } |
|
264 | 264 | } |
265 | 265 | if ( ! function_exists('espresso_deactivate_plugin')) { |
266 | - /** |
|
267 | - * deactivate_plugin |
|
268 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
269 | - * |
|
270 | - * @access public |
|
271 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
272 | - * @return void |
|
273 | - */ |
|
274 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
275 | - { |
|
276 | - if ( ! function_exists('deactivate_plugins')) { |
|
277 | - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
278 | - } |
|
279 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
280 | - deactivate_plugins($plugin_basename); |
|
281 | - } |
|
266 | + /** |
|
267 | + * deactivate_plugin |
|
268 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
269 | + * |
|
270 | + * @access public |
|
271 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
272 | + * @return void |
|
273 | + */ |
|
274 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
275 | + { |
|
276 | + if ( ! function_exists('deactivate_plugins')) { |
|
277 | + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
278 | + } |
|
279 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
280 | + deactivate_plugins($plugin_basename); |
|
281 | + } |
|
282 | 282 | } |
283 | 283 | \ No newline at end of file |
@@ -8,62 +8,62 @@ discard block |
||
8 | 8 | */ |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
10 | 10 | /** |
11 | - * |
|
12 | - * Money helper class. |
|
13 | - * This class has helper methods that help with money related conversions and calculations. |
|
14 | - * |
|
15 | - * @since %VER% |
|
16 | - * |
|
17 | - * @package Event Espresso |
|
18 | - * @subpackage helpers |
|
19 | - * @author Darren Ethier |
|
20 | - * |
|
21 | - * ------------------------------------------------------------------------ |
|
22 | - */ |
|
11 | + * |
|
12 | + * Money helper class. |
|
13 | + * This class has helper methods that help with money related conversions and calculations. |
|
14 | + * |
|
15 | + * @since %VER% |
|
16 | + * |
|
17 | + * @package Event Espresso |
|
18 | + * @subpackage helpers |
|
19 | + * @author Darren Ethier |
|
20 | + * |
|
21 | + * ------------------------------------------------------------------------ |
|
22 | + */ |
|
23 | 23 | class EEH_Money extends EEH_Base { |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * This removes all localized money formatting from the incoming value |
|
28 | - * |
|
29 | - * @param int|float|string $money_value |
|
30 | - * @param string $CNT_ISO |
|
31 | - * @return float |
|
32 | - * @throws EE_Error |
|
33 | - */ |
|
26 | + /** |
|
27 | + * This removes all localized money formatting from the incoming value |
|
28 | + * |
|
29 | + * @param int|float|string $money_value |
|
30 | + * @param string $CNT_ISO |
|
31 | + * @return float |
|
32 | + * @throws EE_Error |
|
33 | + */ |
|
34 | 34 | public static function strip_localized_money_formatting($money_value, $CNT_ISO = '') { |
35 | - $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
|
36 | - $money_value = str_replace( |
|
37 | - array( |
|
38 | - $currency_config->thsnds, |
|
39 | - $currency_config->dec_mrk, |
|
40 | - ), |
|
41 | - array( |
|
42 | - '', // remove thousands separator |
|
43 | - '.', // convert decimal mark to what PHP expects |
|
44 | - ), |
|
45 | - $money_value |
|
46 | - ); |
|
47 | - $money_value = filter_var( |
|
48 | - $money_value, |
|
49 | - FILTER_SANITIZE_NUMBER_FLOAT, |
|
50 | - FILTER_FLAG_ALLOW_FRACTION |
|
51 | - ); |
|
52 | - return $money_value; |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * This converts an incoming localized money value into a standard float item (to three decimal places) |
|
59 | - * |
|
60 | - * @param int|string $money_value |
|
61 | - * @return float |
|
62 | - * @throws EE_Error |
|
63 | - */ |
|
35 | + $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
|
36 | + $money_value = str_replace( |
|
37 | + array( |
|
38 | + $currency_config->thsnds, |
|
39 | + $currency_config->dec_mrk, |
|
40 | + ), |
|
41 | + array( |
|
42 | + '', // remove thousands separator |
|
43 | + '.', // convert decimal mark to what PHP expects |
|
44 | + ), |
|
45 | + $money_value |
|
46 | + ); |
|
47 | + $money_value = filter_var( |
|
48 | + $money_value, |
|
49 | + FILTER_SANITIZE_NUMBER_FLOAT, |
|
50 | + FILTER_FLAG_ALLOW_FRACTION |
|
51 | + ); |
|
52 | + return $money_value; |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * This converts an incoming localized money value into a standard float item (to three decimal places) |
|
59 | + * |
|
60 | + * @param int|string $money_value |
|
61 | + * @return float |
|
62 | + * @throws EE_Error |
|
63 | + */ |
|
64 | 64 | public static function convert_to_float_from_localized_money($money_value ) { |
65 | 65 | //float it! and round to three decimal places |
66 | - return round ( (float) EEH_Money::strip_localized_money_formatting($money_value), 3 ); |
|
66 | + return round ( (float) EEH_Money::strip_localized_money_formatting($money_value), 3 ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | |
152 | 152 | |
153 | 153 | |
154 | - /** |
|
155 | - * This returns a localized format string suitable for jQplot. |
|
156 | - * |
|
157 | - * @param string $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
158 | - * Otherwise will use currency settings for current active country on site. |
|
159 | - * @return string |
|
160 | - * @throws EE_Error |
|
161 | - */ |
|
154 | + /** |
|
155 | + * This returns a localized format string suitable for jQplot. |
|
156 | + * |
|
157 | + * @param string $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
158 | + * Otherwise will use currency settings for current active country on site. |
|
159 | + * @return string |
|
160 | + * @throws EE_Error |
|
161 | + */ |
|
162 | 162 | public static function get_format_for_jqplot( $CNT_ISO = '') { |
163 | 163 | //default format |
164 | 164 | $format = 'f'; |
165 | 165 | $currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
166 | - //first get the decimal place and number of places |
|
166 | + //first get the decimal place and number of places |
|
167 | 167 | $format = "%'." . $currency_config->dec_plc . $format; |
168 | 168 | //currency symbol on right side. |
169 | 169 | $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
@@ -172,16 +172,16 @@ discard block |
||
172 | 172 | |
173 | 173 | |
174 | 174 | |
175 | - /** |
|
176 | - * This returns a localized format string suitable for usage with the Google Charts API format param. |
|
177 | - * |
|
178 | - * @param string $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
179 | - * Otherwise will use currency settings for current active country on site. |
|
180 | - * Note: GoogleCharts uses ICU pattern set |
|
181 | - * (@see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details) |
|
182 | - * @return string |
|
183 | - * @throws EE_Error |
|
184 | - */ |
|
175 | + /** |
|
176 | + * This returns a localized format string suitable for usage with the Google Charts API format param. |
|
177 | + * |
|
178 | + * @param string $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
179 | + * Otherwise will use currency settings for current active country on site. |
|
180 | + * Note: GoogleCharts uses ICU pattern set |
|
181 | + * (@see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details) |
|
182 | + * @return string |
|
183 | + * @throws EE_Error |
|
184 | + */ |
|
185 | 185 | public static function get_format_for_google_charts( $CNT_ISO = '' ) { |
186 | 186 | $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
187 | 187 | $decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' ); |
@@ -208,24 +208,24 @@ discard block |
||
208 | 208 | |
209 | 209 | |
210 | 210 | |
211 | - /** |
|
212 | - * @param string $CNT_ISO |
|
213 | - * @return EE_Currency_Config|null |
|
214 | - * @throws EE_Error |
|
215 | - */ |
|
216 | - public static function get_currency_config($CNT_ISO = '') |
|
217 | - { |
|
218 | - //if CNT_ISO passed lets try to get currency settings for it. |
|
219 | - $currency_config = $CNT_ISO !== '' |
|
220 | - ? new EE_Currency_Config($CNT_ISO) |
|
221 | - : null; |
|
222 | - //default currency settings for site if not set |
|
223 | - if (! $currency_config instanceof EE_Currency_Config) { |
|
224 | - $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config |
|
225 | - ? EE_Registry::instance()->CFG->currency |
|
226 | - : new EE_Currency_Config(); |
|
227 | - } |
|
228 | - return $currency_config; |
|
229 | - } |
|
211 | + /** |
|
212 | + * @param string $CNT_ISO |
|
213 | + * @return EE_Currency_Config|null |
|
214 | + * @throws EE_Error |
|
215 | + */ |
|
216 | + public static function get_currency_config($CNT_ISO = '') |
|
217 | + { |
|
218 | + //if CNT_ISO passed lets try to get currency settings for it. |
|
219 | + $currency_config = $CNT_ISO !== '' |
|
220 | + ? new EE_Currency_Config($CNT_ISO) |
|
221 | + : null; |
|
222 | + //default currency settings for site if not set |
|
223 | + if (! $currency_config instanceof EE_Currency_Config) { |
|
224 | + $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config |
|
225 | + ? EE_Registry::instance()->CFG->currency |
|
226 | + : new EE_Currency_Config(); |
|
227 | + } |
|
228 | + return $currency_config; |
|
229 | + } |
|
230 | 230 | |
231 | 231 | } //end class EEH_Money |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * ------------------------------------------------------------------------ |
22 | 22 | */ |
23 | -class EEH_Money extends EEH_Base { |
|
23 | +class EEH_Money extends EEH_Base { |
|
24 | 24 | |
25 | 25 | |
26 | 26 | /** |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | * @return float |
62 | 62 | * @throws EE_Error |
63 | 63 | */ |
64 | - public static function convert_to_float_from_localized_money($money_value ) { |
|
64 | + public static function convert_to_float_from_localized_money($money_value) { |
|
65 | 65 | //float it! and round to three decimal places |
66 | - return round ( (float) EEH_Money::strip_localized_money_formatting($money_value), 3 ); |
|
66 | + return round((float) EEH_Money::strip_localized_money_formatting($money_value), 3); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | * @throws EE_Error |
83 | 83 | */ |
84 | 84 | |
85 | - public static function compare_floats( $float1, $float2, $operator='=' ) { |
|
85 | + public static function compare_floats($float1, $float2, $operator = '=') { |
|
86 | 86 | // Check numbers to 5 digits of precision |
87 | 87 | $epsilon = 0.00001; |
88 | 88 | |
89 | - $float1 = (float)$float1; |
|
90 | - $float2 = (float)$float2; |
|
89 | + $float1 = (float) $float1; |
|
90 | + $float2 = (float) $float2; |
|
91 | 91 | |
92 | 92 | switch ($operator) { |
93 | 93 | // equal |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | break; |
145 | 145 | default: |
146 | - throw new EE_Error(__( "Unknown operator '" . $operator . "' in EEH_Money::compare_floats()", 'event_espresso' ) ); |
|
146 | + throw new EE_Error(__("Unknown operator '".$operator."' in EEH_Money::compare_floats()", 'event_espresso')); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | return false; |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | * @return string |
160 | 160 | * @throws EE_Error |
161 | 161 | */ |
162 | - public static function get_format_for_jqplot( $CNT_ISO = '') { |
|
162 | + public static function get_format_for_jqplot($CNT_ISO = '') { |
|
163 | 163 | //default format |
164 | 164 | $format = 'f'; |
165 | 165 | $currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
166 | 166 | //first get the decimal place and number of places |
167 | - $format = "%'." . $currency_config->dec_plc . $format; |
|
167 | + $format = "%'.".$currency_config->dec_plc.$format; |
|
168 | 168 | //currency symbol on right side. |
169 | - $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
169 | + $format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign; |
|
170 | 170 | return $format; |
171 | 171 | } |
172 | 172 | |
@@ -182,20 +182,20 @@ discard block |
||
182 | 182 | * @return string |
183 | 183 | * @throws EE_Error |
184 | 184 | */ |
185 | - public static function get_format_for_google_charts( $CNT_ISO = '' ) { |
|
185 | + public static function get_format_for_google_charts($CNT_ISO = '') { |
|
186 | 186 | $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
187 | - $decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' ); |
|
187 | + $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
|
188 | 188 | //first get the decimal place and number of places |
189 | - $format = '#,##0.' . $decimal_places_placeholder; |
|
189 | + $format = '#,##0.'.$decimal_places_placeholder; |
|
190 | 190 | |
191 | 191 | //currency symbol on right side. |
192 | - $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
192 | + $format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign; |
|
193 | 193 | $formatterObject = array( |
194 | 194 | 'decimalSymbol' => $currency_config->dec_mrk, |
195 | 195 | 'groupingSymbol' => $currency_config->thsnds, |
196 | 196 | 'fractionDigits' => $currency_config->dec_plc, |
197 | 197 | ); |
198 | - if ( $currency_config->sign_b4 ) { |
|
198 | + if ($currency_config->sign_b4) { |
|
199 | 199 | $formatterObject['prefix'] = $currency_config->sign; |
200 | 200 | } else { |
201 | 201 | $formatterObject['suffix'] = $currency_config->sign; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | ? new EE_Currency_Config($CNT_ISO) |
221 | 221 | : null; |
222 | 222 | //default currency settings for site if not set |
223 | - if (! $currency_config instanceof EE_Currency_Config) { |
|
223 | + if ( ! $currency_config instanceof EE_Currency_Config) { |
|
224 | 224 | $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config |
225 | 225 | ? EE_Registry::instance()->CFG->currency |
226 | 226 | : new EE_Currency_Config(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -15,85 +15,85 @@ discard block |
||
15 | 15 | class EE_Float_Normalization extends EE_Normalization_Strategy_Base |
16 | 16 | { |
17 | 17 | |
18 | - /* |
|
18 | + /* |
|
19 | 19 | * regex pattern that matches for the following: |
20 | 20 | * * optional negative sign |
21 | 21 | * * one or more digits or decimals |
22 | 22 | */ |
23 | - const REGEX = '/^(-?)([\d.]+)$/'; |
|
23 | + const REGEX = '/^(-?)([\d.]+)$/'; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @param string $value_to_normalize |
|
28 | - * @return float |
|
29 | - * @throws \EE_Validation_Error |
|
30 | - */ |
|
31 | - public function normalize($value_to_normalize) |
|
32 | - { |
|
33 | - if ($value_to_normalize === null) { |
|
34 | - return null; |
|
35 | - } |
|
36 | - if (is_float($value_to_normalize) || is_int($value_to_normalize)) { |
|
37 | - return (float)$value_to_normalize; |
|
38 | - } |
|
39 | - if (! is_string($value_to_normalize)) { |
|
40 | - throw new EE_Validation_Error( |
|
41 | - sprintf( |
|
42 | - __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
|
43 | - print_r($value_to_normalize, true), |
|
44 | - gettype($value_to_normalize) |
|
45 | - ) |
|
46 | - ); |
|
47 | - } |
|
48 | - $normalized_value = filter_var( |
|
49 | - $value_to_normalize, |
|
50 | - FILTER_SANITIZE_NUMBER_FLOAT, |
|
51 | - FILTER_FLAG_ALLOW_FRACTION |
|
52 | - ); |
|
53 | - if($normalized_value === ''){ |
|
54 | - return null; |
|
55 | - } |
|
56 | - if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $matches)) { |
|
57 | - if (count($matches) === 3) { |
|
58 | - // if first match is the negative sign, |
|
59 | - // then the number needs to be multiplied by -1 to remain negative |
|
60 | - return $matches[1] === '-' |
|
61 | - ? (float)$matches[2] * -1 |
|
62 | - : (float)$matches[2]; |
|
63 | - } |
|
64 | - } |
|
65 | - //find if this input has a float validation strategy |
|
66 | - //in which case, use its message |
|
67 | - $validation_error_message = null; |
|
68 | - foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
69 | - if ($validation_strategy instanceof EE_Float_Validation_Strategy) { |
|
70 | - $validation_error_message = $validation_strategy->get_validation_error_message(); |
|
71 | - } |
|
72 | - } |
|
73 | - //this really shouldn't ever happen because fields with a float normalization strategy |
|
74 | - //should also have a float validation strategy, but in case it doesn't use the default |
|
75 | - if (! $validation_error_message) { |
|
76 | - $default_validation_strategy = new EE_Float_Validation_Strategy(); |
|
77 | - $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
|
78 | - } |
|
79 | - throw new EE_Validation_Error($validation_error_message, 'float_only'); |
|
80 | - } |
|
26 | + /** |
|
27 | + * @param string $value_to_normalize |
|
28 | + * @return float |
|
29 | + * @throws \EE_Validation_Error |
|
30 | + */ |
|
31 | + public function normalize($value_to_normalize) |
|
32 | + { |
|
33 | + if ($value_to_normalize === null) { |
|
34 | + return null; |
|
35 | + } |
|
36 | + if (is_float($value_to_normalize) || is_int($value_to_normalize)) { |
|
37 | + return (float)$value_to_normalize; |
|
38 | + } |
|
39 | + if (! is_string($value_to_normalize)) { |
|
40 | + throw new EE_Validation_Error( |
|
41 | + sprintf( |
|
42 | + __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
|
43 | + print_r($value_to_normalize, true), |
|
44 | + gettype($value_to_normalize) |
|
45 | + ) |
|
46 | + ); |
|
47 | + } |
|
48 | + $normalized_value = filter_var( |
|
49 | + $value_to_normalize, |
|
50 | + FILTER_SANITIZE_NUMBER_FLOAT, |
|
51 | + FILTER_FLAG_ALLOW_FRACTION |
|
52 | + ); |
|
53 | + if($normalized_value === ''){ |
|
54 | + return null; |
|
55 | + } |
|
56 | + if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $matches)) { |
|
57 | + if (count($matches) === 3) { |
|
58 | + // if first match is the negative sign, |
|
59 | + // then the number needs to be multiplied by -1 to remain negative |
|
60 | + return $matches[1] === '-' |
|
61 | + ? (float)$matches[2] * -1 |
|
62 | + : (float)$matches[2]; |
|
63 | + } |
|
64 | + } |
|
65 | + //find if this input has a float validation strategy |
|
66 | + //in which case, use its message |
|
67 | + $validation_error_message = null; |
|
68 | + foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
69 | + if ($validation_strategy instanceof EE_Float_Validation_Strategy) { |
|
70 | + $validation_error_message = $validation_strategy->get_validation_error_message(); |
|
71 | + } |
|
72 | + } |
|
73 | + //this really shouldn't ever happen because fields with a float normalization strategy |
|
74 | + //should also have a float validation strategy, but in case it doesn't use the default |
|
75 | + if (! $validation_error_message) { |
|
76 | + $default_validation_strategy = new EE_Float_Validation_Strategy(); |
|
77 | + $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
|
78 | + } |
|
79 | + throw new EE_Validation_Error($validation_error_message, 'float_only'); |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | 83 | |
84 | - /** |
|
85 | - * Converts a float into a string |
|
86 | - * |
|
87 | - * @param float $normalized_value |
|
88 | - * @return string |
|
89 | - */ |
|
90 | - public function unnormalize($normalized_value) |
|
91 | - { |
|
92 | - if (empty($normalized_value)) { |
|
93 | - return '0.00'; |
|
94 | - } |
|
95 | - return "{$normalized_value}"; |
|
96 | - } |
|
84 | + /** |
|
85 | + * Converts a float into a string |
|
86 | + * |
|
87 | + * @param float $normalized_value |
|
88 | + * @return string |
|
89 | + */ |
|
90 | + public function unnormalize($normalized_value) |
|
91 | + { |
|
92 | + if (empty($normalized_value)) { |
|
93 | + return '0.00'; |
|
94 | + } |
|
95 | + return "{$normalized_value}"; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // End of file EE_Float_Normalization.strategy.php |
100 | 100 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 | |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | return null; |
35 | 35 | } |
36 | 36 | if (is_float($value_to_normalize) || is_int($value_to_normalize)) { |
37 | - return (float)$value_to_normalize; |
|
37 | + return (float) $value_to_normalize; |
|
38 | 38 | } |
39 | - if (! is_string($value_to_normalize)) { |
|
39 | + if ( ! is_string($value_to_normalize)) { |
|
40 | 40 | throw new EE_Validation_Error( |
41 | 41 | sprintf( |
42 | 42 | __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | FILTER_SANITIZE_NUMBER_FLOAT, |
51 | 51 | FILTER_FLAG_ALLOW_FRACTION |
52 | 52 | ); |
53 | - if($normalized_value === ''){ |
|
53 | + if ($normalized_value === '') { |
|
54 | 54 | return null; |
55 | 55 | } |
56 | 56 | if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $matches)) { |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | // if first match is the negative sign, |
59 | 59 | // then the number needs to be multiplied by -1 to remain negative |
60 | 60 | return $matches[1] === '-' |
61 | - ? (float)$matches[2] * -1 |
|
62 | - : (float)$matches[2]; |
|
61 | + ? (float) $matches[2] * -1 |
|
62 | + : (float) $matches[2]; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | //find if this input has a float validation strategy |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | //this really shouldn't ever happen because fields with a float normalization strategy |
74 | 74 | //should also have a float validation strategy, but in case it doesn't use the default |
75 | - if (! $validation_error_message) { |
|
75 | + if ( ! $validation_error_message) { |
|
76 | 76 | $default_validation_strategy = new EE_Float_Validation_Strategy(); |
77 | 77 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
78 | 78 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -15,89 +15,89 @@ discard block |
||
15 | 15 | class EE_Int_Normalization extends EE_Normalization_Strategy_Base |
16 | 16 | { |
17 | 17 | |
18 | - /* |
|
18 | + /* |
|
19 | 19 | * regex pattern that matches for the following: |
20 | 20 | * * optional negative sign |
21 | 21 | * * one or more digits |
22 | 22 | */ |
23 | - const REGEX = '/^(-?)(\d+)$/'; |
|
23 | + const REGEX = '/^(-?)(\d+)$/'; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @param string $value_to_normalize |
|
28 | - * @return int|mixed|string |
|
29 | - * @throws \EE_Validation_Error |
|
30 | - */ |
|
31 | - public function normalize($value_to_normalize) |
|
32 | - { |
|
33 | - if ($value_to_normalize === null) { |
|
34 | - return null; |
|
35 | - } |
|
36 | - if (is_int($value_to_normalize) || is_float($value_to_normalize)) { |
|
37 | - return (int)$value_to_normalize; |
|
38 | - } |
|
39 | - if (! is_string($value_to_normalize)) { |
|
40 | - throw new EE_Validation_Error( |
|
41 | - sprintf( |
|
42 | - __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
|
43 | - print_r($value_to_normalize, true), |
|
44 | - gettype($value_to_normalize) |
|
45 | - ) |
|
46 | - ); |
|
47 | - } |
|
48 | - $value_to_normalize = (int)filter_var( |
|
49 | - $value_to_normalize, |
|
50 | - FILTER_SANITIZE_NUMBER_FLOAT, |
|
51 | - FILTER_FLAG_ALLOW_FRACTION |
|
52 | - ); |
|
53 | - if($value_to_normalize === ''){ |
|
54 | - return null; |
|
55 | - } |
|
56 | - $matches = array(); |
|
57 | - if (preg_match(EE_Int_Normalization::REGEX, $value_to_normalize, $matches)) { |
|
58 | - if (count($matches) === 3) { |
|
59 | - // if first match is the negative sign, |
|
60 | - // then the number needs to be multiplied by -1 to remain negative |
|
61 | - return $matches[1] === '-' |
|
62 | - ? (int)$matches[2] * -1 |
|
63 | - : (int)$matches[2]; |
|
64 | - } |
|
65 | - } |
|
66 | - //find if this input has a int validation strategy |
|
67 | - //in which case, use its message |
|
68 | - $validation_error_message = null; |
|
69 | - foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
70 | - if ($validation_strategy instanceof EE_Int_Validation_Strategy) { |
|
71 | - $validation_error_message = $validation_strategy->get_validation_error_message(); |
|
72 | - } |
|
73 | - } |
|
74 | - //this really shouldn't ever happen because fields with a int normalization strategy |
|
75 | - //should also have a int validation strategy, but in case it doesnt use the default |
|
76 | - if (! $validation_error_message) { |
|
77 | - $default_validation_strategy = new EE_Int_Validation_Strategy(); |
|
78 | - $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
|
79 | - } |
|
80 | - throw new EE_Validation_Error($validation_error_message, 'numeric_only'); |
|
81 | - } |
|
26 | + /** |
|
27 | + * @param string $value_to_normalize |
|
28 | + * @return int|mixed|string |
|
29 | + * @throws \EE_Validation_Error |
|
30 | + */ |
|
31 | + public function normalize($value_to_normalize) |
|
32 | + { |
|
33 | + if ($value_to_normalize === null) { |
|
34 | + return null; |
|
35 | + } |
|
36 | + if (is_int($value_to_normalize) || is_float($value_to_normalize)) { |
|
37 | + return (int)$value_to_normalize; |
|
38 | + } |
|
39 | + if (! is_string($value_to_normalize)) { |
|
40 | + throw new EE_Validation_Error( |
|
41 | + sprintf( |
|
42 | + __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
|
43 | + print_r($value_to_normalize, true), |
|
44 | + gettype($value_to_normalize) |
|
45 | + ) |
|
46 | + ); |
|
47 | + } |
|
48 | + $value_to_normalize = (int)filter_var( |
|
49 | + $value_to_normalize, |
|
50 | + FILTER_SANITIZE_NUMBER_FLOAT, |
|
51 | + FILTER_FLAG_ALLOW_FRACTION |
|
52 | + ); |
|
53 | + if($value_to_normalize === ''){ |
|
54 | + return null; |
|
55 | + } |
|
56 | + $matches = array(); |
|
57 | + if (preg_match(EE_Int_Normalization::REGEX, $value_to_normalize, $matches)) { |
|
58 | + if (count($matches) === 3) { |
|
59 | + // if first match is the negative sign, |
|
60 | + // then the number needs to be multiplied by -1 to remain negative |
|
61 | + return $matches[1] === '-' |
|
62 | + ? (int)$matches[2] * -1 |
|
63 | + : (int)$matches[2]; |
|
64 | + } |
|
65 | + } |
|
66 | + //find if this input has a int validation strategy |
|
67 | + //in which case, use its message |
|
68 | + $validation_error_message = null; |
|
69 | + foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
70 | + if ($validation_strategy instanceof EE_Int_Validation_Strategy) { |
|
71 | + $validation_error_message = $validation_strategy->get_validation_error_message(); |
|
72 | + } |
|
73 | + } |
|
74 | + //this really shouldn't ever happen because fields with a int normalization strategy |
|
75 | + //should also have a int validation strategy, but in case it doesnt use the default |
|
76 | + if (! $validation_error_message) { |
|
77 | + $default_validation_strategy = new EE_Int_Validation_Strategy(); |
|
78 | + $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
|
79 | + } |
|
80 | + throw new EE_Validation_Error($validation_error_message, 'numeric_only'); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * Converts the int into a string for use in teh html form |
|
87 | - * |
|
88 | - * @param int $normalized_value |
|
89 | - * @return string |
|
90 | - */ |
|
91 | - public function unnormalize($normalized_value) |
|
92 | - { |
|
93 | - if ($normalized_value === null || $normalized_value === '') { |
|
94 | - return ''; |
|
95 | - } |
|
96 | - if (empty($normalized_value)) { |
|
97 | - return '0'; |
|
98 | - } |
|
99 | - return "$normalized_value"; |
|
100 | - } |
|
85 | + /** |
|
86 | + * Converts the int into a string for use in teh html form |
|
87 | + * |
|
88 | + * @param int $normalized_value |
|
89 | + * @return string |
|
90 | + */ |
|
91 | + public function unnormalize($normalized_value) |
|
92 | + { |
|
93 | + if ($normalized_value === null || $normalized_value === '') { |
|
94 | + return ''; |
|
95 | + } |
|
96 | + if (empty($normalized_value)) { |
|
97 | + return '0'; |
|
98 | + } |
|
99 | + return "$normalized_value"; |
|
100 | + } |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // End of file EE_Int_Normalization.strategy.php |
104 | 104 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 | |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | return null; |
35 | 35 | } |
36 | 36 | if (is_int($value_to_normalize) || is_float($value_to_normalize)) { |
37 | - return (int)$value_to_normalize; |
|
37 | + return (int) $value_to_normalize; |
|
38 | 38 | } |
39 | - if (! is_string($value_to_normalize)) { |
|
39 | + if ( ! is_string($value_to_normalize)) { |
|
40 | 40 | throw new EE_Validation_Error( |
41 | 41 | sprintf( |
42 | 42 | __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | ) |
46 | 46 | ); |
47 | 47 | } |
48 | - $value_to_normalize = (int)filter_var( |
|
48 | + $value_to_normalize = (int) filter_var( |
|
49 | 49 | $value_to_normalize, |
50 | 50 | FILTER_SANITIZE_NUMBER_FLOAT, |
51 | 51 | FILTER_FLAG_ALLOW_FRACTION |
52 | 52 | ); |
53 | - if($value_to_normalize === ''){ |
|
53 | + if ($value_to_normalize === '') { |
|
54 | 54 | return null; |
55 | 55 | } |
56 | 56 | $matches = array(); |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | // if first match is the negative sign, |
60 | 60 | // then the number needs to be multiplied by -1 to remain negative |
61 | 61 | return $matches[1] === '-' |
62 | - ? (int)$matches[2] * -1 |
|
63 | - : (int)$matches[2]; |
|
62 | + ? (int) $matches[2] * -1 |
|
63 | + : (int) $matches[2]; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | //find if this input has a int validation strategy |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | //this really shouldn't ever happen because fields with a int normalization strategy |
75 | 75 | //should also have a int validation strategy, but in case it doesnt use the default |
76 | - if (! $validation_error_message) { |
|
76 | + if ( ! $validation_error_message) { |
|
77 | 77 | $default_validation_strategy = new EE_Int_Validation_Strategy(); |
78 | 78 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
79 | 79 | } |