@@ -23,58 +23,58 @@ |
||
23 | 23 | class CoreLoader implements LoaderDecoratorInterface |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var EE_Registry|CoffeeShop $generator |
|
28 | - */ |
|
29 | - private $generator; |
|
30 | - |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * CoreLoader constructor. |
|
35 | - * |
|
36 | - * @param EE_Registry|CoffeeShop $generator |
|
37 | - * @throws InvalidArgumentException |
|
38 | - */ |
|
39 | - public function __construct($generator) |
|
40 | - { |
|
41 | - if(!($generator instanceof EE_Registry || $generator instanceof CoffeeShop)) { |
|
42 | - throw new InvalidArgumentException( |
|
43 | - esc_html__( |
|
44 | - 'The CoreLoader class must receive an instance of EE_Registry or the CoffeeShop DI container.', |
|
45 | - 'event_espresso' |
|
46 | - ) |
|
47 | - ); |
|
48 | - } |
|
49 | - $this->generator = $generator; |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @param string $fqcn |
|
56 | - * @param array $arguments |
|
57 | - * @return mixed |
|
58 | - * @throws ServiceNotFoundException |
|
59 | - */ |
|
60 | - public function load($fqcn, $arguments = array()) |
|
61 | - { |
|
62 | - return $this->generator instanceof EE_Registry |
|
63 | - ? $this->generator->create($fqcn, $arguments) |
|
64 | - : $this->generator->brew($fqcn, $arguments); |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * calls reset() on generator if method exists |
|
71 | - */ |
|
72 | - public function reset() |
|
73 | - { |
|
74 | - if (method_exists($this->generator, 'reset')) { |
|
75 | - $this->generator->reset(); |
|
76 | - } |
|
77 | - } |
|
26 | + /** |
|
27 | + * @var EE_Registry|CoffeeShop $generator |
|
28 | + */ |
|
29 | + private $generator; |
|
30 | + |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * CoreLoader constructor. |
|
35 | + * |
|
36 | + * @param EE_Registry|CoffeeShop $generator |
|
37 | + * @throws InvalidArgumentException |
|
38 | + */ |
|
39 | + public function __construct($generator) |
|
40 | + { |
|
41 | + if(!($generator instanceof EE_Registry || $generator instanceof CoffeeShop)) { |
|
42 | + throw new InvalidArgumentException( |
|
43 | + esc_html__( |
|
44 | + 'The CoreLoader class must receive an instance of EE_Registry or the CoffeeShop DI container.', |
|
45 | + 'event_espresso' |
|
46 | + ) |
|
47 | + ); |
|
48 | + } |
|
49 | + $this->generator = $generator; |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @param string $fqcn |
|
56 | + * @param array $arguments |
|
57 | + * @return mixed |
|
58 | + * @throws ServiceNotFoundException |
|
59 | + */ |
|
60 | + public function load($fqcn, $arguments = array()) |
|
61 | + { |
|
62 | + return $this->generator instanceof EE_Registry |
|
63 | + ? $this->generator->create($fqcn, $arguments) |
|
64 | + : $this->generator->brew($fqcn, $arguments); |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * calls reset() on generator if method exists |
|
71 | + */ |
|
72 | + public function reset() |
|
73 | + { |
|
74 | + if (method_exists($this->generator, 'reset')) { |
|
75 | + $this->generator->reset(); |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | // End of file CoreLoader.php |
@@ -577,7 +577,7 @@ |
||
577 | 577 | |
578 | 578 | /** |
579 | 579 | * @param EE_State[] $state_options |
580 | - * @return array |
|
580 | + * @return EE_State[] |
|
581 | 581 | * @throws EE_Error |
582 | 582 | */ |
583 | 583 | public static function state_options($state_options = array()) |
@@ -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 | |
@@ -16,698 +16,698 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * @return EED_Module|EED_Add_New_State |
|
21 | - */ |
|
22 | - public static function instance() |
|
23 | - { |
|
24 | - return parent::get_instance(__CLASS__); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public static function set_hooks() |
|
35 | - { |
|
36 | - add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
37 | - add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); |
|
38 | - add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
39 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
|
40 | - array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
41 | - add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
|
42 | - array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
43 | - add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
|
44 | - array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
45 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', |
|
46 | - array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
47 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', |
|
48 | - array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
49 | - add_filter('FHEE__EE_State_Select_Input____construct__state_options', |
|
50 | - array('EED_Add_New_State', 'state_options'), 10, 1); |
|
51 | - add_filter('FHEE__EE_Country_Select_Input____construct__country_options', |
|
52 | - array('EED_Add_New_State', 'country_options'), 10, 1); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
59 | - * |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - public static function set_hooks_admin() |
|
63 | - { |
|
64 | - add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
65 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
|
66 | - array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
67 | - add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
|
68 | - array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
69 | - add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
70 | - add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
71 | - add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
|
72 | - array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
73 | - add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', |
|
74 | - array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
75 | - add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', |
|
76 | - array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
77 | - add_filter('FHEE__EE_State_Select_Input____construct__state_options', |
|
78 | - array('EED_Add_New_State', 'state_options'), 10, 1); |
|
79 | - add_filter('FHEE__EE_Country_Select_Input____construct__country_options', |
|
80 | - array('EED_Add_New_State', 'country_options'), 10, 1); |
|
81 | - add_filter('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', |
|
82 | - array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
83 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', |
|
84 | - array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
85 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', |
|
86 | - array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @return void |
|
93 | - */ |
|
94 | - public static function set_definitions() |
|
95 | - { |
|
96 | - define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
97 | - define('ANS_TEMPLATES_PATH', str_replace( |
|
98 | - '\\', |
|
99 | - DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
100 | - ); |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * @param WP $WP |
|
107 | - * @return void |
|
108 | - */ |
|
109 | - public function run($WP) |
|
110 | - { |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * @return void |
|
117 | - */ |
|
118 | - public static function translate_js_strings() |
|
119 | - { |
|
120 | - EE_Registry::$i18n_js_strings['ans_no_country'] = esc_html__( |
|
121 | - 'In order to proceed, you need to select the Country that your State/Province belongs to.', |
|
122 | - 'event_espresso' |
|
123 | - ); |
|
124 | - EE_Registry::$i18n_js_strings['ans_no_name'] = esc_html__( |
|
125 | - 'In order to proceed, you need to enter the name of your State/Province.', |
|
126 | - 'event_espresso' |
|
127 | - ); |
|
128 | - EE_Registry::$i18n_js_strings['ans_no_abbreviation'] = esc_html__( |
|
129 | - 'In order to proceed, you need to enter an abbreviation for the name of your State/Province.', |
|
130 | - 'event_espresso' |
|
131 | - ); |
|
132 | - EE_Registry::$i18n_js_strings['ans_save_success'] = esc_html__( |
|
133 | - 'The new state was successfully saved to the database.', |
|
134 | - 'event_espresso' |
|
135 | - ); |
|
136 | - EE_Registry::$i18n_js_strings['ans_server_save_error'] = esc_html__( |
|
137 | - 'An unknown error has occurred on the server while saving the new state to the database.', |
|
138 | - 'event_espresso' |
|
139 | - ); |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @return void |
|
146 | - */ |
|
147 | - public static function wp_enqueue_scripts() |
|
148 | - { |
|
149 | - if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
|
150 | - wp_register_script('add_new_state', ANS_ASSETS_URL . 'add_new_state.js', |
|
151 | - array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
|
152 | - wp_enqueue_script('add_new_state'); |
|
153 | - } |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * display_add_new_state_micro_form |
|
160 | - * |
|
161 | - * @param EE_Form_Section_Proper $question_group_reg_form |
|
162 | - * @return string |
|
163 | - * @throws EE_Error |
|
164 | - */ |
|
165 | - // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
|
166 | - public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) |
|
167 | - { |
|
168 | - // only add the 'new_state_micro_form' when displaying reg forms, |
|
169 | - // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
|
170 | - $action = EE_Registry::instance()->REQ->get('action', ''); |
|
171 | - // is the "state" question in this form section? |
|
172 | - $input = $question_group_reg_form->get_subsection('state'); |
|
173 | - if ($action === 'process_reg_step' || $action === 'update_reg_step') { |
|
174 | - //ok then all we need to do is make sure the input's HTML name is consistent |
|
175 | - //by forcing it to set it now, like it did while getting the form for display |
|
176 | - if ($input instanceof EE_State_Select_Input) { |
|
177 | - $input->html_name(); |
|
178 | - } |
|
179 | - return $question_group_reg_form; |
|
180 | - } |
|
181 | - // we're only doing this for state select inputs |
|
182 | - if ($input instanceof EE_State_Select_Input) { |
|
183 | - // grab any set values from the request |
|
184 | - $country_name = str_replace('state', 'nsmf_new_state_country', $input->html_name()); |
|
185 | - $state_name = str_replace('state', 'nsmf_new_state_name', $input->html_name()); |
|
186 | - $abbrv_name = str_replace('state', 'nsmf_new_state_abbrv', $input->html_name()); |
|
187 | - $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
188 | - $country_options = array(); |
|
189 | - $countries = EEM_Country::instance()->get_all_countries(); |
|
190 | - if (! empty($countries)) { |
|
191 | - foreach ($countries as $country) { |
|
192 | - if ($country instanceof EE_Country) { |
|
193 | - $country_options[$country->ID()] = $country->name(); |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
197 | - $new_state_micro_form = new EE_Form_Section_Proper( |
|
198 | - array( |
|
199 | - 'name' => 'new_state_micro_form', |
|
200 | - 'html_id' => 'new_state_micro_form', |
|
201 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
202 | - 'subsections' => array( |
|
203 | - // add hidden input to indicate that a new state is being added |
|
204 | - 'add_new_state' => new EE_Hidden_Input( |
|
205 | - array( |
|
206 | - 'html_name' => str_replace( |
|
207 | - 'state', |
|
208 | - 'nsmf_add_new_state', $input->html_name() |
|
209 | - ), |
|
210 | - 'html_id' => str_replace( |
|
211 | - 'state', |
|
212 | - 'nsmf_add_new_state', $input->html_id() |
|
213 | - ), |
|
214 | - 'default' => 0, |
|
215 | - ) |
|
216 | - ), |
|
217 | - // add link for displaying hidden container |
|
218 | - 'click_here_link' => new EE_Form_Section_HTML( |
|
219 | - apply_filters( |
|
220 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__click_here_link', |
|
221 | - EEH_HTML::link( |
|
222 | - '', |
|
223 | - esc_html__('click here to add a new state/province', 'event_espresso'), |
|
224 | - '', |
|
225 | - 'display-' . $input->html_id(), |
|
226 | - 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
|
227 | - '', |
|
228 | - 'data-target="' . $input->html_id() . '"' |
|
229 | - ) |
|
230 | - ) |
|
231 | - ), |
|
232 | - // add initial html for hidden container |
|
233 | - 'add_new_state_micro_form' => new EE_Form_Section_HTML( |
|
234 | - apply_filters( |
|
235 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
|
236 | - EEH_HTML::div('', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', |
|
237 | - 'display: none;') . |
|
238 | - EEH_HTML::h6( |
|
239 | - esc_html__( |
|
240 | - 'If your State/Province does not appear in the list above, you can easily add it by doing the following:', |
|
241 | - 'event_espresso' |
|
242 | - ) |
|
243 | - ) . |
|
244 | - EEH_HTML::ul() . |
|
245 | - EEH_HTML::li( |
|
246 | - esc_html__( |
|
247 | - 'first select the Country that your State/Province belongs to', |
|
248 | - 'event_espresso' |
|
249 | - ) |
|
250 | - ) . |
|
251 | - EEH_HTML::li( |
|
252 | - esc_html__('enter the name of your State/Province', 'event_espresso') |
|
253 | - ) . |
|
254 | - EEH_HTML::li( |
|
255 | - esc_html__( |
|
256 | - 'enter a two to six letter abbreviation for the name of your State/Province', |
|
257 | - 'event_espresso' |
|
258 | - ) |
|
259 | - ) . |
|
260 | - EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . |
|
261 | - EEH_HTML::ulx() |
|
262 | - ) |
|
263 | - ), |
|
264 | - // NEW STATE COUNTRY |
|
265 | - 'new_state_country' => new EE_Country_Select_Input( |
|
266 | - $country_options, |
|
267 | - array( |
|
268 | - 'html_name' => $country_name, |
|
269 | - 'html_id' => str_replace( |
|
270 | - 'state', |
|
271 | - 'nsmf_new_state_country', $input->html_id() |
|
272 | - ), |
|
273 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
274 | - 'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), |
|
275 | - 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
276 | - 'required' => false, |
|
277 | - ) |
|
278 | - ), |
|
279 | - // NEW STATE NAME |
|
280 | - 'new_state_name' => new EE_Text_Input( |
|
281 | - array( |
|
282 | - 'html_name' => $state_name, |
|
283 | - 'html_id' => str_replace( |
|
284 | - 'state', |
|
285 | - 'nsmf_new_state_name', $input->html_id() |
|
286 | - ), |
|
287 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
288 | - 'html_label_text' => esc_html__('New State/Province Name', |
|
289 | - 'event_espresso'), |
|
290 | - 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
291 | - 'required' => false, |
|
292 | - ) |
|
293 | - ), |
|
294 | - 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
295 | - // NEW STATE NAME |
|
296 | - 'new_state_abbrv' => new EE_Text_Input( |
|
297 | - array( |
|
298 | - 'html_name' => $abbrv_name, |
|
299 | - 'html_id' => str_replace('state', 'nsmf_new_state_abbrv', |
|
300 | - $input->html_id()), |
|
301 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
302 | - 'html_label_text' => esc_html__( |
|
303 | - 'New State/Province Abbreviation', |
|
304 | - 'event_espresso' |
|
305 | - ) . ' *', |
|
306 | - 'html_other_attributes' => 'size="24"', |
|
307 | - 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
308 | - 'required' => false, |
|
309 | - ) |
|
310 | - ), |
|
311 | - // "submit" button |
|
312 | - 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
|
313 | - apply_filters( |
|
314 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
|
315 | - EEH_HTML::nbsp(3) . |
|
316 | - EEH_HTML::link( |
|
317 | - '', |
|
318 | - esc_html__('ADD', 'event_espresso'), |
|
319 | - '', |
|
320 | - 'submit-' . $new_state_submit_id, |
|
321 | - 'ee-form-add-new-state-submit button button-secondary', |
|
322 | - '', |
|
323 | - 'data-target="' . $new_state_submit_id . '"' |
|
324 | - ) |
|
325 | - ) |
|
326 | - ), |
|
327 | - // extra info |
|
328 | - 'add_new_state_extra' => new EE_Form_Section_HTML( |
|
329 | - apply_filters( |
|
330 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
|
331 | - EEH_HTML::br(2) |
|
332 | - . |
|
333 | - EEH_HTML::div('', '', 'small-text') |
|
334 | - . |
|
335 | - EEH_HTML::strong( |
|
336 | - '* ' . |
|
337 | - esc_html__( |
|
338 | - 'Don\'t know your State/Province Abbreviation?', |
|
339 | - 'event_espresso' |
|
340 | - ) |
|
341 | - ) |
|
342 | - . |
|
343 | - EEH_HTML::br() |
|
344 | - . |
|
345 | - sprintf( |
|
346 | - esc_html__( |
|
347 | - 'You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', |
|
348 | - 'event_espresso' |
|
349 | - ), |
|
350 | - EEH_HTML::link( |
|
351 | - 'http://en.wikipedia.org/wiki/ISO_3166-2', |
|
352 | - 'http://en.wikipedia.org/wiki/ISO_3166-2', |
|
353 | - '', |
|
354 | - '', |
|
355 | - 'ee-form-add-new-state-wiki-lnk', |
|
356 | - '', |
|
357 | - 'target="_blank"' |
|
358 | - ) |
|
359 | - ) |
|
360 | - . |
|
361 | - EEH_HTML::divx() |
|
362 | - . |
|
363 | - EEH_HTML::br() |
|
364 | - . |
|
365 | - EEH_HTML::link( |
|
366 | - '', |
|
367 | - esc_html__('cancel new State/Province', 'event_espresso'), |
|
368 | - '', |
|
369 | - 'hide-' . $input->html_id(), |
|
370 | - 'ee-form-cancel-new-state-lnk smaller-text', |
|
371 | - '', |
|
372 | - 'data-target="' . $input->html_id() . '"' |
|
373 | - ) |
|
374 | - . |
|
375 | - EEH_HTML::divx() |
|
376 | - . |
|
377 | - EEH_HTML::br() |
|
378 | - ) |
|
379 | - ), |
|
380 | - ), |
|
381 | - ) |
|
382 | - ); |
|
383 | - $question_group_reg_form->add_subsections( |
|
384 | - array('new_state_micro_form' => $new_state_micro_form), |
|
385 | - 'state', |
|
386 | - false |
|
387 | - ); |
|
388 | - } |
|
389 | - return $question_group_reg_form; |
|
390 | - } |
|
391 | - |
|
392 | - |
|
393 | - |
|
394 | - /** |
|
395 | - * set_new_state_input_width |
|
396 | - * |
|
397 | - * @return int|string |
|
398 | - * @throws EE_Error |
|
399 | - */ |
|
400 | - public static function add_new_state() |
|
401 | - { |
|
402 | - $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
|
403 | - if (absint($REQ->get('nsmf_add_new_state')) === 1) { |
|
404 | - EE_Registry::instance()->load_model('State'); |
|
405 | - // grab country ISO code, new state name, and new state abbreviation |
|
406 | - $state_country = $REQ->is_set('nsmf_new_state_country') |
|
407 | - ? sanitize_text_field($REQ->get('nsmf_new_state_country')) |
|
408 | - : false; |
|
409 | - $state_name = $REQ->is_set('nsmf_new_state_name') |
|
410 | - ? sanitize_text_field($REQ->get('nsmf_new_state_name')) |
|
411 | - : false; |
|
412 | - $state_abbr = $REQ->is_set('nsmf_new_state_abbrv') |
|
413 | - ? sanitize_text_field($REQ->get('nsmf_new_state_abbrv')) |
|
414 | - : false; |
|
415 | - if ($state_country && $state_name && $state_abbr) { |
|
416 | - $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
417 | - 'CNT_ISO' => strtoupper($state_country), |
|
418 | - 'STA_abbrev' => strtoupper($state_abbr), |
|
419 | - 'STA_name' => ucwords($state_name), |
|
420 | - 'STA_active' => false, |
|
421 | - )); |
|
422 | - if ($new_state instanceof EE_State) { |
|
423 | - // clean house |
|
424 | - EE_Registry::instance()->REQ->un_set('nsmf_add_new_state'); |
|
425 | - EE_Registry::instance()->REQ->un_set('nsmf_new_state_country'); |
|
426 | - EE_Registry::instance()->REQ->un_set('nsmf_new_state_name'); |
|
427 | - EE_Registry::instance()->REQ->un_set('nsmf_new_state_abbrv'); |
|
428 | - // get any existing new states |
|
429 | - $new_states = EE_Registry::instance()->SSN->get_session_data( |
|
430 | - 'nsmf_new_states' |
|
431 | - ); |
|
432 | - $new_states[$new_state->ID()] = $new_state; |
|
433 | - EE_Registry::instance()->SSN->set_session_data( |
|
434 | - array('nsmf_new_states' => $new_states) |
|
435 | - ); |
|
436 | - if (EE_Registry::instance()->REQ->ajax) { |
|
437 | - echo wp_json_encode(array( |
|
438 | - 'success' => true, |
|
439 | - 'id' => $new_state->ID(), |
|
440 | - 'name' => $new_state->name(), |
|
441 | - 'abbrev' => $new_state->abbrev(), |
|
442 | - 'country_iso' => $new_state->country_iso(), |
|
443 | - 'country_name' => $new_state->country()->name(), |
|
444 | - )); |
|
445 | - exit(); |
|
446 | - } |
|
447 | - return $new_state->ID(); |
|
448 | - } |
|
449 | - } else { |
|
450 | - $error = esc_html__( |
|
451 | - 'A new State/Province could not be added because invalid or missing data was received.', |
|
452 | - 'event_espresso' |
|
453 | - ); |
|
454 | - if (EE_Registry::instance()->REQ->ajax) { |
|
455 | - echo wp_json_encode(array('error' => $error)); |
|
456 | - exit(); |
|
457 | - } |
|
458 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
459 | - } |
|
460 | - } |
|
461 | - return false; |
|
462 | - } |
|
463 | - |
|
464 | - |
|
465 | - |
|
466 | - /** |
|
467 | - * recursively drills down through request params to remove any that were added by this module |
|
468 | - * |
|
469 | - * @param array $request_params |
|
470 | - * @return array |
|
471 | - */ |
|
472 | - public static function filter_checkout_request_params($request_params) |
|
473 | - { |
|
474 | - foreach ($request_params as $form_section) { |
|
475 | - if (is_array($form_section)) { |
|
476 | - EED_Add_New_State::unset_new_state_request_params($form_section); |
|
477 | - EED_Add_New_State::filter_checkout_request_params($form_section); |
|
478 | - } |
|
479 | - } |
|
480 | - return $request_params; |
|
481 | - } |
|
482 | - |
|
483 | - |
|
484 | - |
|
485 | - /** |
|
486 | - * @param array $request_params |
|
487 | - * @return array |
|
488 | - */ |
|
489 | - public static function unset_new_state_request_params($request_params) |
|
490 | - { |
|
491 | - unset( |
|
492 | - $request_params['new_state_micro_form'], |
|
493 | - $request_params['new_state_micro_add_new_state'], |
|
494 | - $request_params['new_state_micro_new_state_country'], |
|
495 | - $request_params['new_state_micro_new_state_name'], |
|
496 | - $request_params['new_state_micro_new_state_abbrv'] |
|
497 | - ); |
|
498 | - return $request_params; |
|
499 | - } |
|
500 | - |
|
501 | - |
|
502 | - |
|
503 | - /** |
|
504 | - * @param array $props_n_values |
|
505 | - * @return bool |
|
506 | - * @throws EE_Error |
|
507 | - */ |
|
508 | - public static function save_new_state_to_db($props_n_values = array()) |
|
509 | - { |
|
510 | - $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
511 | - if (! empty($existing_state)) { |
|
512 | - return array_pop($existing_state); |
|
513 | - } |
|
514 | - $new_state = EE_State::new_instance($props_n_values); |
|
515 | - if ($new_state instanceof EE_State) { |
|
516 | - // if not non-ajax admin |
|
517 | - $new_state_key = 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
518 | - $new_state_notice = sprintf( |
|
519 | - esc_html__( |
|
520 | - 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', |
|
521 | - 'event_espresso' |
|
522 | - ), |
|
523 | - '<b>' . $new_state->name() . '</b>', |
|
524 | - '<b>' . $new_state->abbrev() . '</b>', |
|
525 | - '<b>' . $new_state->country()->name() . '</b>', |
|
526 | - '<a href="' . add_query_arg(array( |
|
527 | - 'page' => 'espresso_general_settings', |
|
528 | - 'action' => 'country_settings', |
|
529 | - 'country' => $new_state->country_iso(), |
|
530 | - ), admin_url('admin.php')) . '">' . esc_html__('Event Espresso - General Settings > Countries Tab', |
|
531 | - 'event_espresso') . '</a>', |
|
532 | - '<br />' |
|
533 | - ); |
|
534 | - EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
535 | - $new_state->save(); |
|
536 | - EEM_State::instance()->reset_cached_states(); |
|
537 | - return $new_state; |
|
538 | - } |
|
539 | - return false; |
|
540 | - } |
|
541 | - |
|
542 | - |
|
543 | - |
|
544 | - /** |
|
545 | - * @param string $CNT_ISO |
|
546 | - * @param string $STA_ID |
|
547 | - * @param array $cols_n_values |
|
548 | - * @return void |
|
549 | - */ |
|
550 | - public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) |
|
551 | - { |
|
552 | - $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : false; |
|
553 | - if (! $CNT_ISO) { |
|
554 | - EE_Error::add_error( |
|
555 | - esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), |
|
556 | - __FILE__, |
|
557 | - __FUNCTION__, |
|
558 | - __LINE__ |
|
559 | - ); |
|
560 | - } |
|
561 | - $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] |
|
562 | - : false; |
|
563 | - if (! $STA_abbrev && ! empty($STA_ID)) { |
|
564 | - $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
565 | - if ($state instanceof EE_State) { |
|
566 | - $STA_abbrev = $state->abbrev(); |
|
567 | - } |
|
568 | - } |
|
569 | - if (! $STA_abbrev) { |
|
570 | - EE_Error::add_error( |
|
571 | - esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), |
|
572 | - __FILE__, |
|
573 | - __FUNCTION__, |
|
574 | - __LINE__ |
|
575 | - ); |
|
576 | - } |
|
577 | - EE_Error::dismiss_persistent_admin_notice($CNT_ISO . '-' . $STA_abbrev, true, true); |
|
578 | - } |
|
579 | - |
|
580 | - |
|
581 | - |
|
582 | - /** |
|
583 | - * @param EE_State[] $state_options |
|
584 | - * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step |
|
585 | - * @param EE_Registration $registration |
|
586 | - * @param EE_Question $question |
|
587 | - * @param $answer |
|
588 | - * @return array |
|
589 | - */ |
|
590 | - public static function inject_new_reg_state_into_options( |
|
591 | - $state_options = array(), |
|
592 | - EE_SPCO_Reg_Step_Attendee_Information $reg_step, |
|
593 | - EE_Registration $registration, |
|
594 | - EE_Question $question, |
|
595 | - $answer |
|
596 | - ) { |
|
597 | - if ($answer instanceof EE_Answer && $question instanceof EE_Question |
|
598 | - && $question->type() |
|
599 | - === EEM_Question::QST_type_state |
|
600 | - ) { |
|
601 | - $STA_ID = $answer->value(); |
|
602 | - if (! empty($STA_ID)) { |
|
603 | - $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
604 | - if ($state instanceof EE_State) { |
|
605 | - $country = $state->country(); |
|
606 | - if ($country instanceof EE_Country) { |
|
607 | - if (! isset($state_options[$country->name()])) { |
|
608 | - $state_options[$country->name()] = array(); |
|
609 | - } |
|
610 | - if (! isset($state_options[$country->name()][$STA_ID])) { |
|
611 | - $state_options[$country->name()][$STA_ID] = $state->name(); |
|
612 | - } |
|
613 | - } |
|
614 | - } |
|
615 | - } |
|
616 | - } |
|
617 | - return $state_options; |
|
618 | - } |
|
619 | - |
|
620 | - |
|
621 | - |
|
622 | - /** |
|
623 | - * @param EE_Country[] $country_options |
|
624 | - * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step |
|
625 | - * @param EE_Registration $registration |
|
626 | - * @param EE_Question $question |
|
627 | - * @param $answer |
|
628 | - * @return array |
|
629 | - */ |
|
630 | - public static function inject_new_reg_country_into_options( |
|
631 | - $country_options = array(), |
|
632 | - EE_SPCO_Reg_Step_Attendee_Information $reg_step, |
|
633 | - EE_Registration $registration, |
|
634 | - EE_Question $question, |
|
635 | - $answer |
|
636 | - ) { |
|
637 | - if ($answer instanceof EE_Answer && $question instanceof EE_Question |
|
638 | - && $question->type() |
|
639 | - === EEM_Question::QST_type_country |
|
640 | - ) { |
|
641 | - $CNT_ISO = $answer->value(); |
|
642 | - if (! empty($CNT_ISO)) { |
|
643 | - $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
644 | - if ($country instanceof EE_Country) { |
|
645 | - if (! isset($country_options[$CNT_ISO])) { |
|
646 | - $country_options[$CNT_ISO] = $country->name(); |
|
647 | - } |
|
648 | - } |
|
649 | - } |
|
650 | - } |
|
651 | - return $country_options; |
|
652 | - } |
|
653 | - |
|
654 | - |
|
655 | - |
|
656 | - /** |
|
657 | - * @param EE_State[] $state_options |
|
658 | - * @return array |
|
659 | - * @throws EE_Error |
|
660 | - */ |
|
661 | - public static function state_options($state_options = array()) |
|
662 | - { |
|
663 | - $new_states = EED_Add_New_State::_get_new_states(); |
|
664 | - foreach ($new_states as $new_state) { |
|
665 | - if ( |
|
666 | - $new_state instanceof EE_State |
|
667 | - && $new_state->country() instanceof EE_Country |
|
668 | - ) { |
|
669 | - $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
670 | - } |
|
671 | - } |
|
672 | - return $state_options; |
|
673 | - } |
|
674 | - |
|
675 | - |
|
676 | - |
|
677 | - /** |
|
678 | - * @return array |
|
679 | - */ |
|
680 | - protected static function _get_new_states() |
|
681 | - { |
|
682 | - $new_states = array(); |
|
683 | - if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
684 | - $new_states = EE_Registry::instance()->SSN->get_session_data( |
|
685 | - 'nsmf_new_states' |
|
686 | - ); |
|
687 | - } |
|
688 | - return is_array($new_states) ? $new_states : array(); |
|
689 | - } |
|
690 | - |
|
691 | - |
|
692 | - |
|
693 | - /** |
|
694 | - * @param EE_Country[] $country_options |
|
695 | - * @return array |
|
696 | - * @throws EE_Error |
|
697 | - */ |
|
698 | - public static function country_options($country_options = array()) |
|
699 | - { |
|
700 | - $new_states = EED_Add_New_State::_get_new_states(); |
|
701 | - foreach ($new_states as $new_state) { |
|
702 | - if ( |
|
703 | - $new_state instanceof EE_State |
|
704 | - && $new_state->country() instanceof EE_Country |
|
705 | - ) { |
|
706 | - $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
707 | - } |
|
708 | - } |
|
709 | - return $country_options; |
|
710 | - } |
|
19 | + /** |
|
20 | + * @return EED_Module|EED_Add_New_State |
|
21 | + */ |
|
22 | + public static function instance() |
|
23 | + { |
|
24 | + return parent::get_instance(__CLASS__); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public static function set_hooks() |
|
35 | + { |
|
36 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
37 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); |
|
38 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
39 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
|
40 | + array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
41 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
|
42 | + array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
43 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
|
44 | + array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
45 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', |
|
46 | + array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
47 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', |
|
48 | + array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
49 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', |
|
50 | + array('EED_Add_New_State', 'state_options'), 10, 1); |
|
51 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', |
|
52 | + array('EED_Add_New_State', 'country_options'), 10, 1); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
59 | + * |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + public static function set_hooks_admin() |
|
63 | + { |
|
64 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
65 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
|
66 | + array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
67 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
|
68 | + array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
69 | + add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
70 | + add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
71 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
|
72 | + array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
73 | + add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', |
|
74 | + array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
75 | + add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', |
|
76 | + array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
77 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', |
|
78 | + array('EED_Add_New_State', 'state_options'), 10, 1); |
|
79 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', |
|
80 | + array('EED_Add_New_State', 'country_options'), 10, 1); |
|
81 | + add_filter('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', |
|
82 | + array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
83 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', |
|
84 | + array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
85 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', |
|
86 | + array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @return void |
|
93 | + */ |
|
94 | + public static function set_definitions() |
|
95 | + { |
|
96 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
97 | + define('ANS_TEMPLATES_PATH', str_replace( |
|
98 | + '\\', |
|
99 | + DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
100 | + ); |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * @param WP $WP |
|
107 | + * @return void |
|
108 | + */ |
|
109 | + public function run($WP) |
|
110 | + { |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * @return void |
|
117 | + */ |
|
118 | + public static function translate_js_strings() |
|
119 | + { |
|
120 | + EE_Registry::$i18n_js_strings['ans_no_country'] = esc_html__( |
|
121 | + 'In order to proceed, you need to select the Country that your State/Province belongs to.', |
|
122 | + 'event_espresso' |
|
123 | + ); |
|
124 | + EE_Registry::$i18n_js_strings['ans_no_name'] = esc_html__( |
|
125 | + 'In order to proceed, you need to enter the name of your State/Province.', |
|
126 | + 'event_espresso' |
|
127 | + ); |
|
128 | + EE_Registry::$i18n_js_strings['ans_no_abbreviation'] = esc_html__( |
|
129 | + 'In order to proceed, you need to enter an abbreviation for the name of your State/Province.', |
|
130 | + 'event_espresso' |
|
131 | + ); |
|
132 | + EE_Registry::$i18n_js_strings['ans_save_success'] = esc_html__( |
|
133 | + 'The new state was successfully saved to the database.', |
|
134 | + 'event_espresso' |
|
135 | + ); |
|
136 | + EE_Registry::$i18n_js_strings['ans_server_save_error'] = esc_html__( |
|
137 | + 'An unknown error has occurred on the server while saving the new state to the database.', |
|
138 | + 'event_espresso' |
|
139 | + ); |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @return void |
|
146 | + */ |
|
147 | + public static function wp_enqueue_scripts() |
|
148 | + { |
|
149 | + if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
|
150 | + wp_register_script('add_new_state', ANS_ASSETS_URL . 'add_new_state.js', |
|
151 | + array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
|
152 | + wp_enqueue_script('add_new_state'); |
|
153 | + } |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * display_add_new_state_micro_form |
|
160 | + * |
|
161 | + * @param EE_Form_Section_Proper $question_group_reg_form |
|
162 | + * @return string |
|
163 | + * @throws EE_Error |
|
164 | + */ |
|
165 | + // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
|
166 | + public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) |
|
167 | + { |
|
168 | + // only add the 'new_state_micro_form' when displaying reg forms, |
|
169 | + // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
|
170 | + $action = EE_Registry::instance()->REQ->get('action', ''); |
|
171 | + // is the "state" question in this form section? |
|
172 | + $input = $question_group_reg_form->get_subsection('state'); |
|
173 | + if ($action === 'process_reg_step' || $action === 'update_reg_step') { |
|
174 | + //ok then all we need to do is make sure the input's HTML name is consistent |
|
175 | + //by forcing it to set it now, like it did while getting the form for display |
|
176 | + if ($input instanceof EE_State_Select_Input) { |
|
177 | + $input->html_name(); |
|
178 | + } |
|
179 | + return $question_group_reg_form; |
|
180 | + } |
|
181 | + // we're only doing this for state select inputs |
|
182 | + if ($input instanceof EE_State_Select_Input) { |
|
183 | + // grab any set values from the request |
|
184 | + $country_name = str_replace('state', 'nsmf_new_state_country', $input->html_name()); |
|
185 | + $state_name = str_replace('state', 'nsmf_new_state_name', $input->html_name()); |
|
186 | + $abbrv_name = str_replace('state', 'nsmf_new_state_abbrv', $input->html_name()); |
|
187 | + $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
188 | + $country_options = array(); |
|
189 | + $countries = EEM_Country::instance()->get_all_countries(); |
|
190 | + if (! empty($countries)) { |
|
191 | + foreach ($countries as $country) { |
|
192 | + if ($country instanceof EE_Country) { |
|
193 | + $country_options[$country->ID()] = $country->name(); |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | + $new_state_micro_form = new EE_Form_Section_Proper( |
|
198 | + array( |
|
199 | + 'name' => 'new_state_micro_form', |
|
200 | + 'html_id' => 'new_state_micro_form', |
|
201 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
202 | + 'subsections' => array( |
|
203 | + // add hidden input to indicate that a new state is being added |
|
204 | + 'add_new_state' => new EE_Hidden_Input( |
|
205 | + array( |
|
206 | + 'html_name' => str_replace( |
|
207 | + 'state', |
|
208 | + 'nsmf_add_new_state', $input->html_name() |
|
209 | + ), |
|
210 | + 'html_id' => str_replace( |
|
211 | + 'state', |
|
212 | + 'nsmf_add_new_state', $input->html_id() |
|
213 | + ), |
|
214 | + 'default' => 0, |
|
215 | + ) |
|
216 | + ), |
|
217 | + // add link for displaying hidden container |
|
218 | + 'click_here_link' => new EE_Form_Section_HTML( |
|
219 | + apply_filters( |
|
220 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__click_here_link', |
|
221 | + EEH_HTML::link( |
|
222 | + '', |
|
223 | + esc_html__('click here to add a new state/province', 'event_espresso'), |
|
224 | + '', |
|
225 | + 'display-' . $input->html_id(), |
|
226 | + 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
|
227 | + '', |
|
228 | + 'data-target="' . $input->html_id() . '"' |
|
229 | + ) |
|
230 | + ) |
|
231 | + ), |
|
232 | + // add initial html for hidden container |
|
233 | + 'add_new_state_micro_form' => new EE_Form_Section_HTML( |
|
234 | + apply_filters( |
|
235 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
|
236 | + EEH_HTML::div('', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', |
|
237 | + 'display: none;') . |
|
238 | + EEH_HTML::h6( |
|
239 | + esc_html__( |
|
240 | + 'If your State/Province does not appear in the list above, you can easily add it by doing the following:', |
|
241 | + 'event_espresso' |
|
242 | + ) |
|
243 | + ) . |
|
244 | + EEH_HTML::ul() . |
|
245 | + EEH_HTML::li( |
|
246 | + esc_html__( |
|
247 | + 'first select the Country that your State/Province belongs to', |
|
248 | + 'event_espresso' |
|
249 | + ) |
|
250 | + ) . |
|
251 | + EEH_HTML::li( |
|
252 | + esc_html__('enter the name of your State/Province', 'event_espresso') |
|
253 | + ) . |
|
254 | + EEH_HTML::li( |
|
255 | + esc_html__( |
|
256 | + 'enter a two to six letter abbreviation for the name of your State/Province', |
|
257 | + 'event_espresso' |
|
258 | + ) |
|
259 | + ) . |
|
260 | + EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . |
|
261 | + EEH_HTML::ulx() |
|
262 | + ) |
|
263 | + ), |
|
264 | + // NEW STATE COUNTRY |
|
265 | + 'new_state_country' => new EE_Country_Select_Input( |
|
266 | + $country_options, |
|
267 | + array( |
|
268 | + 'html_name' => $country_name, |
|
269 | + 'html_id' => str_replace( |
|
270 | + 'state', |
|
271 | + 'nsmf_new_state_country', $input->html_id() |
|
272 | + ), |
|
273 | + 'html_class' => $input->html_class() . ' new-state-country', |
|
274 | + 'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), |
|
275 | + 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
276 | + 'required' => false, |
|
277 | + ) |
|
278 | + ), |
|
279 | + // NEW STATE NAME |
|
280 | + 'new_state_name' => new EE_Text_Input( |
|
281 | + array( |
|
282 | + 'html_name' => $state_name, |
|
283 | + 'html_id' => str_replace( |
|
284 | + 'state', |
|
285 | + 'nsmf_new_state_name', $input->html_id() |
|
286 | + ), |
|
287 | + 'html_class' => $input->html_class() . ' new-state-state', |
|
288 | + 'html_label_text' => esc_html__('New State/Province Name', |
|
289 | + 'event_espresso'), |
|
290 | + 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
291 | + 'required' => false, |
|
292 | + ) |
|
293 | + ), |
|
294 | + 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
295 | + // NEW STATE NAME |
|
296 | + 'new_state_abbrv' => new EE_Text_Input( |
|
297 | + array( |
|
298 | + 'html_name' => $abbrv_name, |
|
299 | + 'html_id' => str_replace('state', 'nsmf_new_state_abbrv', |
|
300 | + $input->html_id()), |
|
301 | + 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
302 | + 'html_label_text' => esc_html__( |
|
303 | + 'New State/Province Abbreviation', |
|
304 | + 'event_espresso' |
|
305 | + ) . ' *', |
|
306 | + 'html_other_attributes' => 'size="24"', |
|
307 | + 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
308 | + 'required' => false, |
|
309 | + ) |
|
310 | + ), |
|
311 | + // "submit" button |
|
312 | + 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
|
313 | + apply_filters( |
|
314 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
|
315 | + EEH_HTML::nbsp(3) . |
|
316 | + EEH_HTML::link( |
|
317 | + '', |
|
318 | + esc_html__('ADD', 'event_espresso'), |
|
319 | + '', |
|
320 | + 'submit-' . $new_state_submit_id, |
|
321 | + 'ee-form-add-new-state-submit button button-secondary', |
|
322 | + '', |
|
323 | + 'data-target="' . $new_state_submit_id . '"' |
|
324 | + ) |
|
325 | + ) |
|
326 | + ), |
|
327 | + // extra info |
|
328 | + 'add_new_state_extra' => new EE_Form_Section_HTML( |
|
329 | + apply_filters( |
|
330 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
|
331 | + EEH_HTML::br(2) |
|
332 | + . |
|
333 | + EEH_HTML::div('', '', 'small-text') |
|
334 | + . |
|
335 | + EEH_HTML::strong( |
|
336 | + '* ' . |
|
337 | + esc_html__( |
|
338 | + 'Don\'t know your State/Province Abbreviation?', |
|
339 | + 'event_espresso' |
|
340 | + ) |
|
341 | + ) |
|
342 | + . |
|
343 | + EEH_HTML::br() |
|
344 | + . |
|
345 | + sprintf( |
|
346 | + esc_html__( |
|
347 | + 'You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', |
|
348 | + 'event_espresso' |
|
349 | + ), |
|
350 | + EEH_HTML::link( |
|
351 | + 'http://en.wikipedia.org/wiki/ISO_3166-2', |
|
352 | + 'http://en.wikipedia.org/wiki/ISO_3166-2', |
|
353 | + '', |
|
354 | + '', |
|
355 | + 'ee-form-add-new-state-wiki-lnk', |
|
356 | + '', |
|
357 | + 'target="_blank"' |
|
358 | + ) |
|
359 | + ) |
|
360 | + . |
|
361 | + EEH_HTML::divx() |
|
362 | + . |
|
363 | + EEH_HTML::br() |
|
364 | + . |
|
365 | + EEH_HTML::link( |
|
366 | + '', |
|
367 | + esc_html__('cancel new State/Province', 'event_espresso'), |
|
368 | + '', |
|
369 | + 'hide-' . $input->html_id(), |
|
370 | + 'ee-form-cancel-new-state-lnk smaller-text', |
|
371 | + '', |
|
372 | + 'data-target="' . $input->html_id() . '"' |
|
373 | + ) |
|
374 | + . |
|
375 | + EEH_HTML::divx() |
|
376 | + . |
|
377 | + EEH_HTML::br() |
|
378 | + ) |
|
379 | + ), |
|
380 | + ), |
|
381 | + ) |
|
382 | + ); |
|
383 | + $question_group_reg_form->add_subsections( |
|
384 | + array('new_state_micro_form' => $new_state_micro_form), |
|
385 | + 'state', |
|
386 | + false |
|
387 | + ); |
|
388 | + } |
|
389 | + return $question_group_reg_form; |
|
390 | + } |
|
391 | + |
|
392 | + |
|
393 | + |
|
394 | + /** |
|
395 | + * set_new_state_input_width |
|
396 | + * |
|
397 | + * @return int|string |
|
398 | + * @throws EE_Error |
|
399 | + */ |
|
400 | + public static function add_new_state() |
|
401 | + { |
|
402 | + $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
|
403 | + if (absint($REQ->get('nsmf_add_new_state')) === 1) { |
|
404 | + EE_Registry::instance()->load_model('State'); |
|
405 | + // grab country ISO code, new state name, and new state abbreviation |
|
406 | + $state_country = $REQ->is_set('nsmf_new_state_country') |
|
407 | + ? sanitize_text_field($REQ->get('nsmf_new_state_country')) |
|
408 | + : false; |
|
409 | + $state_name = $REQ->is_set('nsmf_new_state_name') |
|
410 | + ? sanitize_text_field($REQ->get('nsmf_new_state_name')) |
|
411 | + : false; |
|
412 | + $state_abbr = $REQ->is_set('nsmf_new_state_abbrv') |
|
413 | + ? sanitize_text_field($REQ->get('nsmf_new_state_abbrv')) |
|
414 | + : false; |
|
415 | + if ($state_country && $state_name && $state_abbr) { |
|
416 | + $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
417 | + 'CNT_ISO' => strtoupper($state_country), |
|
418 | + 'STA_abbrev' => strtoupper($state_abbr), |
|
419 | + 'STA_name' => ucwords($state_name), |
|
420 | + 'STA_active' => false, |
|
421 | + )); |
|
422 | + if ($new_state instanceof EE_State) { |
|
423 | + // clean house |
|
424 | + EE_Registry::instance()->REQ->un_set('nsmf_add_new_state'); |
|
425 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_country'); |
|
426 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_name'); |
|
427 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_abbrv'); |
|
428 | + // get any existing new states |
|
429 | + $new_states = EE_Registry::instance()->SSN->get_session_data( |
|
430 | + 'nsmf_new_states' |
|
431 | + ); |
|
432 | + $new_states[$new_state->ID()] = $new_state; |
|
433 | + EE_Registry::instance()->SSN->set_session_data( |
|
434 | + array('nsmf_new_states' => $new_states) |
|
435 | + ); |
|
436 | + if (EE_Registry::instance()->REQ->ajax) { |
|
437 | + echo wp_json_encode(array( |
|
438 | + 'success' => true, |
|
439 | + 'id' => $new_state->ID(), |
|
440 | + 'name' => $new_state->name(), |
|
441 | + 'abbrev' => $new_state->abbrev(), |
|
442 | + 'country_iso' => $new_state->country_iso(), |
|
443 | + 'country_name' => $new_state->country()->name(), |
|
444 | + )); |
|
445 | + exit(); |
|
446 | + } |
|
447 | + return $new_state->ID(); |
|
448 | + } |
|
449 | + } else { |
|
450 | + $error = esc_html__( |
|
451 | + 'A new State/Province could not be added because invalid or missing data was received.', |
|
452 | + 'event_espresso' |
|
453 | + ); |
|
454 | + if (EE_Registry::instance()->REQ->ajax) { |
|
455 | + echo wp_json_encode(array('error' => $error)); |
|
456 | + exit(); |
|
457 | + } |
|
458 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
459 | + } |
|
460 | + } |
|
461 | + return false; |
|
462 | + } |
|
463 | + |
|
464 | + |
|
465 | + |
|
466 | + /** |
|
467 | + * recursively drills down through request params to remove any that were added by this module |
|
468 | + * |
|
469 | + * @param array $request_params |
|
470 | + * @return array |
|
471 | + */ |
|
472 | + public static function filter_checkout_request_params($request_params) |
|
473 | + { |
|
474 | + foreach ($request_params as $form_section) { |
|
475 | + if (is_array($form_section)) { |
|
476 | + EED_Add_New_State::unset_new_state_request_params($form_section); |
|
477 | + EED_Add_New_State::filter_checkout_request_params($form_section); |
|
478 | + } |
|
479 | + } |
|
480 | + return $request_params; |
|
481 | + } |
|
482 | + |
|
483 | + |
|
484 | + |
|
485 | + /** |
|
486 | + * @param array $request_params |
|
487 | + * @return array |
|
488 | + */ |
|
489 | + public static function unset_new_state_request_params($request_params) |
|
490 | + { |
|
491 | + unset( |
|
492 | + $request_params['new_state_micro_form'], |
|
493 | + $request_params['new_state_micro_add_new_state'], |
|
494 | + $request_params['new_state_micro_new_state_country'], |
|
495 | + $request_params['new_state_micro_new_state_name'], |
|
496 | + $request_params['new_state_micro_new_state_abbrv'] |
|
497 | + ); |
|
498 | + return $request_params; |
|
499 | + } |
|
500 | + |
|
501 | + |
|
502 | + |
|
503 | + /** |
|
504 | + * @param array $props_n_values |
|
505 | + * @return bool |
|
506 | + * @throws EE_Error |
|
507 | + */ |
|
508 | + public static function save_new_state_to_db($props_n_values = array()) |
|
509 | + { |
|
510 | + $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
511 | + if (! empty($existing_state)) { |
|
512 | + return array_pop($existing_state); |
|
513 | + } |
|
514 | + $new_state = EE_State::new_instance($props_n_values); |
|
515 | + if ($new_state instanceof EE_State) { |
|
516 | + // if not non-ajax admin |
|
517 | + $new_state_key = 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
518 | + $new_state_notice = sprintf( |
|
519 | + esc_html__( |
|
520 | + 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', |
|
521 | + 'event_espresso' |
|
522 | + ), |
|
523 | + '<b>' . $new_state->name() . '</b>', |
|
524 | + '<b>' . $new_state->abbrev() . '</b>', |
|
525 | + '<b>' . $new_state->country()->name() . '</b>', |
|
526 | + '<a href="' . add_query_arg(array( |
|
527 | + 'page' => 'espresso_general_settings', |
|
528 | + 'action' => 'country_settings', |
|
529 | + 'country' => $new_state->country_iso(), |
|
530 | + ), admin_url('admin.php')) . '">' . esc_html__('Event Espresso - General Settings > Countries Tab', |
|
531 | + 'event_espresso') . '</a>', |
|
532 | + '<br />' |
|
533 | + ); |
|
534 | + EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
535 | + $new_state->save(); |
|
536 | + EEM_State::instance()->reset_cached_states(); |
|
537 | + return $new_state; |
|
538 | + } |
|
539 | + return false; |
|
540 | + } |
|
541 | + |
|
542 | + |
|
543 | + |
|
544 | + /** |
|
545 | + * @param string $CNT_ISO |
|
546 | + * @param string $STA_ID |
|
547 | + * @param array $cols_n_values |
|
548 | + * @return void |
|
549 | + */ |
|
550 | + public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) |
|
551 | + { |
|
552 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : false; |
|
553 | + if (! $CNT_ISO) { |
|
554 | + EE_Error::add_error( |
|
555 | + esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), |
|
556 | + __FILE__, |
|
557 | + __FUNCTION__, |
|
558 | + __LINE__ |
|
559 | + ); |
|
560 | + } |
|
561 | + $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] |
|
562 | + : false; |
|
563 | + if (! $STA_abbrev && ! empty($STA_ID)) { |
|
564 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
565 | + if ($state instanceof EE_State) { |
|
566 | + $STA_abbrev = $state->abbrev(); |
|
567 | + } |
|
568 | + } |
|
569 | + if (! $STA_abbrev) { |
|
570 | + EE_Error::add_error( |
|
571 | + esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), |
|
572 | + __FILE__, |
|
573 | + __FUNCTION__, |
|
574 | + __LINE__ |
|
575 | + ); |
|
576 | + } |
|
577 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO . '-' . $STA_abbrev, true, true); |
|
578 | + } |
|
579 | + |
|
580 | + |
|
581 | + |
|
582 | + /** |
|
583 | + * @param EE_State[] $state_options |
|
584 | + * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step |
|
585 | + * @param EE_Registration $registration |
|
586 | + * @param EE_Question $question |
|
587 | + * @param $answer |
|
588 | + * @return array |
|
589 | + */ |
|
590 | + public static function inject_new_reg_state_into_options( |
|
591 | + $state_options = array(), |
|
592 | + EE_SPCO_Reg_Step_Attendee_Information $reg_step, |
|
593 | + EE_Registration $registration, |
|
594 | + EE_Question $question, |
|
595 | + $answer |
|
596 | + ) { |
|
597 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question |
|
598 | + && $question->type() |
|
599 | + === EEM_Question::QST_type_state |
|
600 | + ) { |
|
601 | + $STA_ID = $answer->value(); |
|
602 | + if (! empty($STA_ID)) { |
|
603 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
604 | + if ($state instanceof EE_State) { |
|
605 | + $country = $state->country(); |
|
606 | + if ($country instanceof EE_Country) { |
|
607 | + if (! isset($state_options[$country->name()])) { |
|
608 | + $state_options[$country->name()] = array(); |
|
609 | + } |
|
610 | + if (! isset($state_options[$country->name()][$STA_ID])) { |
|
611 | + $state_options[$country->name()][$STA_ID] = $state->name(); |
|
612 | + } |
|
613 | + } |
|
614 | + } |
|
615 | + } |
|
616 | + } |
|
617 | + return $state_options; |
|
618 | + } |
|
619 | + |
|
620 | + |
|
621 | + |
|
622 | + /** |
|
623 | + * @param EE_Country[] $country_options |
|
624 | + * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step |
|
625 | + * @param EE_Registration $registration |
|
626 | + * @param EE_Question $question |
|
627 | + * @param $answer |
|
628 | + * @return array |
|
629 | + */ |
|
630 | + public static function inject_new_reg_country_into_options( |
|
631 | + $country_options = array(), |
|
632 | + EE_SPCO_Reg_Step_Attendee_Information $reg_step, |
|
633 | + EE_Registration $registration, |
|
634 | + EE_Question $question, |
|
635 | + $answer |
|
636 | + ) { |
|
637 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question |
|
638 | + && $question->type() |
|
639 | + === EEM_Question::QST_type_country |
|
640 | + ) { |
|
641 | + $CNT_ISO = $answer->value(); |
|
642 | + if (! empty($CNT_ISO)) { |
|
643 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
644 | + if ($country instanceof EE_Country) { |
|
645 | + if (! isset($country_options[$CNT_ISO])) { |
|
646 | + $country_options[$CNT_ISO] = $country->name(); |
|
647 | + } |
|
648 | + } |
|
649 | + } |
|
650 | + } |
|
651 | + return $country_options; |
|
652 | + } |
|
653 | + |
|
654 | + |
|
655 | + |
|
656 | + /** |
|
657 | + * @param EE_State[] $state_options |
|
658 | + * @return array |
|
659 | + * @throws EE_Error |
|
660 | + */ |
|
661 | + public static function state_options($state_options = array()) |
|
662 | + { |
|
663 | + $new_states = EED_Add_New_State::_get_new_states(); |
|
664 | + foreach ($new_states as $new_state) { |
|
665 | + if ( |
|
666 | + $new_state instanceof EE_State |
|
667 | + && $new_state->country() instanceof EE_Country |
|
668 | + ) { |
|
669 | + $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
670 | + } |
|
671 | + } |
|
672 | + return $state_options; |
|
673 | + } |
|
674 | + |
|
675 | + |
|
676 | + |
|
677 | + /** |
|
678 | + * @return array |
|
679 | + */ |
|
680 | + protected static function _get_new_states() |
|
681 | + { |
|
682 | + $new_states = array(); |
|
683 | + if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
684 | + $new_states = EE_Registry::instance()->SSN->get_session_data( |
|
685 | + 'nsmf_new_states' |
|
686 | + ); |
|
687 | + } |
|
688 | + return is_array($new_states) ? $new_states : array(); |
|
689 | + } |
|
690 | + |
|
691 | + |
|
692 | + |
|
693 | + /** |
|
694 | + * @param EE_Country[] $country_options |
|
695 | + * @return array |
|
696 | + * @throws EE_Error |
|
697 | + */ |
|
698 | + public static function country_options($country_options = array()) |
|
699 | + { |
|
700 | + $new_states = EED_Add_New_State::_get_new_states(); |
|
701 | + foreach ($new_states as $new_state) { |
|
702 | + if ( |
|
703 | + $new_state instanceof EE_State |
|
704 | + && $new_state->country() instanceof EE_Country |
|
705 | + ) { |
|
706 | + $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
707 | + } |
|
708 | + } |
|
709 | + return $country_options; |
|
710 | + } |
|
711 | 711 | |
712 | 712 | |
713 | 713 |
@@ -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 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public static function set_definitions() |
95 | 95 | { |
96 | - define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
96 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
97 | 97 | define('ANS_TEMPLATES_PATH', str_replace( |
98 | 98 | '\\', |
99 | - DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
99 | + DS, plugin_dir_path(__FILE__)).'templates'.DS |
|
100 | 100 | ); |
101 | 101 | } |
102 | 102 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | public static function wp_enqueue_scripts() |
148 | 148 | { |
149 | 149 | if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
150 | - wp_register_script('add_new_state', ANS_ASSETS_URL . 'add_new_state.js', |
|
150 | + wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', |
|
151 | 151 | array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
152 | 152 | wp_enqueue_script('add_new_state'); |
153 | 153 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
188 | 188 | $country_options = array(); |
189 | 189 | $countries = EEM_Country::instance()->get_all_countries(); |
190 | - if (! empty($countries)) { |
|
190 | + if ( ! empty($countries)) { |
|
191 | 191 | foreach ($countries as $country) { |
192 | 192 | if ($country instanceof EE_Country) { |
193 | 193 | $country_options[$country->ID()] = $country->name(); |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | '', |
223 | 223 | esc_html__('click here to add a new state/province', 'event_espresso'), |
224 | 224 | '', |
225 | - 'display-' . $input->html_id(), |
|
225 | + 'display-'.$input->html_id(), |
|
226 | 226 | 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
227 | 227 | '', |
228 | - 'data-target="' . $input->html_id() . '"' |
|
228 | + 'data-target="'.$input->html_id().'"' |
|
229 | 229 | ) |
230 | 230 | ) |
231 | 231 | ), |
@@ -233,31 +233,31 @@ discard block |
||
233 | 233 | 'add_new_state_micro_form' => new EE_Form_Section_HTML( |
234 | 234 | apply_filters( |
235 | 235 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
236 | - EEH_HTML::div('', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', |
|
237 | - 'display: none;') . |
|
236 | + EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', |
|
237 | + 'display: none;'). |
|
238 | 238 | EEH_HTML::h6( |
239 | 239 | esc_html__( |
240 | 240 | 'If your State/Province does not appear in the list above, you can easily add it by doing the following:', |
241 | 241 | 'event_espresso' |
242 | 242 | ) |
243 | - ) . |
|
244 | - EEH_HTML::ul() . |
|
243 | + ). |
|
244 | + EEH_HTML::ul(). |
|
245 | 245 | EEH_HTML::li( |
246 | 246 | esc_html__( |
247 | 247 | 'first select the Country that your State/Province belongs to', |
248 | 248 | 'event_espresso' |
249 | 249 | ) |
250 | - ) . |
|
250 | + ). |
|
251 | 251 | EEH_HTML::li( |
252 | 252 | esc_html__('enter the name of your State/Province', 'event_espresso') |
253 | - ) . |
|
253 | + ). |
|
254 | 254 | EEH_HTML::li( |
255 | 255 | esc_html__( |
256 | 256 | 'enter a two to six letter abbreviation for the name of your State/Province', |
257 | 257 | 'event_espresso' |
258 | 258 | ) |
259 | - ) . |
|
260 | - EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . |
|
259 | + ). |
|
260 | + EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')). |
|
261 | 261 | EEH_HTML::ulx() |
262 | 262 | ) |
263 | 263 | ), |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'state', |
271 | 271 | 'nsmf_new_state_country', $input->html_id() |
272 | 272 | ), |
273 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
273 | + 'html_class' => $input->html_class().' new-state-country', |
|
274 | 274 | 'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), |
275 | 275 | 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
276 | 276 | 'required' => false, |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | 'state', |
285 | 285 | 'nsmf_new_state_name', $input->html_id() |
286 | 286 | ), |
287 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
287 | + 'html_class' => $input->html_class().' new-state-state', |
|
288 | 288 | 'html_label_text' => esc_html__('New State/Province Name', |
289 | 289 | 'event_espresso'), |
290 | 290 | 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
@@ -298,11 +298,11 @@ discard block |
||
298 | 298 | 'html_name' => $abbrv_name, |
299 | 299 | 'html_id' => str_replace('state', 'nsmf_new_state_abbrv', |
300 | 300 | $input->html_id()), |
301 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
301 | + 'html_class' => $input->html_class().' new-state-abbrv', |
|
302 | 302 | 'html_label_text' => esc_html__( |
303 | 303 | 'New State/Province Abbreviation', |
304 | 304 | 'event_espresso' |
305 | - ) . ' *', |
|
305 | + ).' *', |
|
306 | 306 | 'html_other_attributes' => 'size="24"', |
307 | 307 | 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
308 | 308 | 'required' => false, |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
313 | 313 | apply_filters( |
314 | 314 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
315 | - EEH_HTML::nbsp(3) . |
|
315 | + EEH_HTML::nbsp(3). |
|
316 | 316 | EEH_HTML::link( |
317 | 317 | '', |
318 | 318 | esc_html__('ADD', 'event_espresso'), |
319 | 319 | '', |
320 | - 'submit-' . $new_state_submit_id, |
|
320 | + 'submit-'.$new_state_submit_id, |
|
321 | 321 | 'ee-form-add-new-state-submit button button-secondary', |
322 | 322 | '', |
323 | - 'data-target="' . $new_state_submit_id . '"' |
|
323 | + 'data-target="'.$new_state_submit_id.'"' |
|
324 | 324 | ) |
325 | 325 | ) |
326 | 326 | ), |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | EEH_HTML::div('', '', 'small-text') |
334 | 334 | . |
335 | 335 | EEH_HTML::strong( |
336 | - '* ' . |
|
336 | + '* '. |
|
337 | 337 | esc_html__( |
338 | 338 | 'Don\'t know your State/Province Abbreviation?', |
339 | 339 | 'event_espresso' |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | '', |
367 | 367 | esc_html__('cancel new State/Province', 'event_espresso'), |
368 | 368 | '', |
369 | - 'hide-' . $input->html_id(), |
|
369 | + 'hide-'.$input->html_id(), |
|
370 | 370 | 'ee-form-cancel-new-state-lnk smaller-text', |
371 | 371 | '', |
372 | - 'data-target="' . $input->html_id() . '"' |
|
372 | + 'data-target="'.$input->html_id().'"' |
|
373 | 373 | ) |
374 | 374 | . |
375 | 375 | EEH_HTML::divx() |
@@ -508,27 +508,27 @@ discard block |
||
508 | 508 | public static function save_new_state_to_db($props_n_values = array()) |
509 | 509 | { |
510 | 510 | $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
511 | - if (! empty($existing_state)) { |
|
511 | + if ( ! empty($existing_state)) { |
|
512 | 512 | return array_pop($existing_state); |
513 | 513 | } |
514 | 514 | $new_state = EE_State::new_instance($props_n_values); |
515 | 515 | if ($new_state instanceof EE_State) { |
516 | 516 | // if not non-ajax admin |
517 | - $new_state_key = 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
517 | + $new_state_key = 'new-state-added-'.$new_state->country_iso().'-'.$new_state->abbrev(); |
|
518 | 518 | $new_state_notice = sprintf( |
519 | 519 | esc_html__( |
520 | 520 | 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', |
521 | 521 | 'event_espresso' |
522 | 522 | ), |
523 | - '<b>' . $new_state->name() . '</b>', |
|
524 | - '<b>' . $new_state->abbrev() . '</b>', |
|
525 | - '<b>' . $new_state->country()->name() . '</b>', |
|
526 | - '<a href="' . add_query_arg(array( |
|
523 | + '<b>'.$new_state->name().'</b>', |
|
524 | + '<b>'.$new_state->abbrev().'</b>', |
|
525 | + '<b>'.$new_state->country()->name().'</b>', |
|
526 | + '<a href="'.add_query_arg(array( |
|
527 | 527 | 'page' => 'espresso_general_settings', |
528 | 528 | 'action' => 'country_settings', |
529 | 529 | 'country' => $new_state->country_iso(), |
530 | - ), admin_url('admin.php')) . '">' . esc_html__('Event Espresso - General Settings > Countries Tab', |
|
531 | - 'event_espresso') . '</a>', |
|
530 | + ), admin_url('admin.php')).'">'.esc_html__('Event Espresso - General Settings > Countries Tab', |
|
531 | + 'event_espresso').'</a>', |
|
532 | 532 | '<br />' |
533 | 533 | ); |
534 | 534 | EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) |
551 | 551 | { |
552 | 552 | $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : false; |
553 | - if (! $CNT_ISO) { |
|
553 | + if ( ! $CNT_ISO) { |
|
554 | 554 | EE_Error::add_error( |
555 | 555 | esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), |
556 | 556 | __FILE__, |
@@ -560,13 +560,13 @@ discard block |
||
560 | 560 | } |
561 | 561 | $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] |
562 | 562 | : false; |
563 | - if (! $STA_abbrev && ! empty($STA_ID)) { |
|
563 | + if ( ! $STA_abbrev && ! empty($STA_ID)) { |
|
564 | 564 | $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
565 | 565 | if ($state instanceof EE_State) { |
566 | 566 | $STA_abbrev = $state->abbrev(); |
567 | 567 | } |
568 | 568 | } |
569 | - if (! $STA_abbrev) { |
|
569 | + if ( ! $STA_abbrev) { |
|
570 | 570 | EE_Error::add_error( |
571 | 571 | esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), |
572 | 572 | __FILE__, |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | __LINE__ |
575 | 575 | ); |
576 | 576 | } |
577 | - EE_Error::dismiss_persistent_admin_notice($CNT_ISO . '-' . $STA_abbrev, true, true); |
|
577 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, true, true); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -599,15 +599,15 @@ discard block |
||
599 | 599 | === EEM_Question::QST_type_state |
600 | 600 | ) { |
601 | 601 | $STA_ID = $answer->value(); |
602 | - if (! empty($STA_ID)) { |
|
602 | + if ( ! empty($STA_ID)) { |
|
603 | 603 | $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
604 | 604 | if ($state instanceof EE_State) { |
605 | 605 | $country = $state->country(); |
606 | 606 | if ($country instanceof EE_Country) { |
607 | - if (! isset($state_options[$country->name()])) { |
|
607 | + if ( ! isset($state_options[$country->name()])) { |
|
608 | 608 | $state_options[$country->name()] = array(); |
609 | 609 | } |
610 | - if (! isset($state_options[$country->name()][$STA_ID])) { |
|
610 | + if ( ! isset($state_options[$country->name()][$STA_ID])) { |
|
611 | 611 | $state_options[$country->name()][$STA_ID] = $state->name(); |
612 | 612 | } |
613 | 613 | } |
@@ -639,10 +639,10 @@ discard block |
||
639 | 639 | === EEM_Question::QST_type_country |
640 | 640 | ) { |
641 | 641 | $CNT_ISO = $answer->value(); |
642 | - if (! empty($CNT_ISO)) { |
|
642 | + if ( ! empty($CNT_ISO)) { |
|
643 | 643 | $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
644 | 644 | if ($country instanceof EE_Country) { |
645 | - if (! isset($country_options[$CNT_ISO])) { |
|
645 | + if ( ! isset($country_options[$CNT_ISO])) { |
|
646 | 646 | $country_options[$CNT_ISO] = $country->name(); |
647 | 647 | } |
648 | 648 | } |
@@ -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 | |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | class EE_Credit_Card_Normalization extends EE_Text_Normalization |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param string $value_to_normalize |
|
19 | - * @return mixed |
|
20 | - */ |
|
21 | - public function normalize($value_to_normalize) |
|
22 | - { |
|
23 | - $normalized_by_parent = parent::normalize($value_to_normalize); |
|
24 | - //we want to make it consistent, so remove whitespace from cc number |
|
25 | - return preg_replace('/\s+/', '', $normalized_by_parent); |
|
26 | - } |
|
17 | + /** |
|
18 | + * @param string $value_to_normalize |
|
19 | + * @return mixed |
|
20 | + */ |
|
21 | + public function normalize($value_to_normalize) |
|
22 | + { |
|
23 | + $normalized_by_parent = parent::normalize($value_to_normalize); |
|
24 | + //we want to make it consistent, so remove whitespace from cc number |
|
25 | + return preg_replace('/\s+/', '', $normalized_by_parent); |
|
26 | + } |
|
27 | 27 | } |
28 | 28 | // End of file EE_Credit_Card_Normalization.strategy.php |
@@ -1,4 +1,4 @@ |
||
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 |
@@ -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 | |
@@ -14,91 +14,91 @@ discard block |
||
14 | 14 | class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base |
15 | 15 | { |
16 | 16 | |
17 | - protected $_individual_item_normalization_strategy = array(); |
|
18 | - |
|
19 | - |
|
20 | - |
|
21 | - /** |
|
22 | - * @param EE_Normalization_Strategy_Base $individual_item_normalization_strategy |
|
23 | - */ |
|
24 | - public function __construct($individual_item_normalization_strategy) |
|
25 | - { |
|
26 | - $this->_individual_item_normalization_strategy = $individual_item_normalization_strategy; |
|
27 | - parent::__construct(); |
|
28 | - } |
|
29 | - |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * Normalizes the input into an array, and normalizes each item according to its |
|
34 | - * individual item normalization strategy |
|
35 | - * |
|
36 | - * @param array | string $value_to_normalize |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function normalize($value_to_normalize) |
|
40 | - { |
|
41 | - if (is_array($value_to_normalize)) { |
|
42 | - $items_to_normalize = $value_to_normalize; |
|
43 | - } else if ($value_to_normalize !== null) { |
|
44 | - $items_to_normalize = array($value_to_normalize); |
|
45 | - } else { |
|
46 | - $items_to_normalize = array(); |
|
47 | - } |
|
48 | - $normalized_array_value = array(); |
|
49 | - foreach ($items_to_normalize as $key => $individual_item) { |
|
50 | - $normalized_array_value[$key] = $this->normalize_one($individual_item); |
|
51 | - } |
|
52 | - return $normalized_array_value; |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * Normalized the one item (called for each array item in EE_Many_values_Normalization::normalize()) |
|
59 | - * |
|
60 | - * @param string $individual_value_to_normalize but definitely NOT an array |
|
61 | - * @return mixed |
|
62 | - */ |
|
63 | - public function normalize_one($individual_value_to_normalize) |
|
64 | - { |
|
65 | - return $this->_individual_item_normalization_strategy->normalize($individual_value_to_normalize); |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * Converts the array of normalized things to an array of raw html values. |
|
72 | - * |
|
73 | - * @param array $normalized_values |
|
74 | - * @return string[] |
|
75 | - */ |
|
76 | - public function unnormalize($normalized_values) |
|
77 | - { |
|
78 | - if ($normalized_values === null) { |
|
79 | - $normalized_values = array(); |
|
80 | - } |
|
81 | - if (! is_array($normalized_values)) { |
|
82 | - $normalized_values = array($normalized_values); |
|
83 | - } |
|
84 | - $non_normal_values = array(); |
|
85 | - foreach ($normalized_values as $key => $value) { |
|
86 | - $non_normal_values[$key] = $this->unnormalize_one($value); |
|
87 | - } |
|
88 | - return $non_normal_values; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * Unnormalizes an individual item in the array of values |
|
95 | - * |
|
96 | - * @param mixed $individual_value_to_unnormalize but certainly NOT an array |
|
97 | - * @return string |
|
98 | - */ |
|
99 | - public function unnormalize_one($individual_value_to_unnormalize) |
|
100 | - { |
|
101 | - return $this->_individual_item_normalization_strategy->unnormalize($individual_value_to_unnormalize); |
|
102 | - } |
|
17 | + protected $_individual_item_normalization_strategy = array(); |
|
18 | + |
|
19 | + |
|
20 | + |
|
21 | + /** |
|
22 | + * @param EE_Normalization_Strategy_Base $individual_item_normalization_strategy |
|
23 | + */ |
|
24 | + public function __construct($individual_item_normalization_strategy) |
|
25 | + { |
|
26 | + $this->_individual_item_normalization_strategy = $individual_item_normalization_strategy; |
|
27 | + parent::__construct(); |
|
28 | + } |
|
29 | + |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * Normalizes the input into an array, and normalizes each item according to its |
|
34 | + * individual item normalization strategy |
|
35 | + * |
|
36 | + * @param array | string $value_to_normalize |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function normalize($value_to_normalize) |
|
40 | + { |
|
41 | + if (is_array($value_to_normalize)) { |
|
42 | + $items_to_normalize = $value_to_normalize; |
|
43 | + } else if ($value_to_normalize !== null) { |
|
44 | + $items_to_normalize = array($value_to_normalize); |
|
45 | + } else { |
|
46 | + $items_to_normalize = array(); |
|
47 | + } |
|
48 | + $normalized_array_value = array(); |
|
49 | + foreach ($items_to_normalize as $key => $individual_item) { |
|
50 | + $normalized_array_value[$key] = $this->normalize_one($individual_item); |
|
51 | + } |
|
52 | + return $normalized_array_value; |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * Normalized the one item (called for each array item in EE_Many_values_Normalization::normalize()) |
|
59 | + * |
|
60 | + * @param string $individual_value_to_normalize but definitely NOT an array |
|
61 | + * @return mixed |
|
62 | + */ |
|
63 | + public function normalize_one($individual_value_to_normalize) |
|
64 | + { |
|
65 | + return $this->_individual_item_normalization_strategy->normalize($individual_value_to_normalize); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * Converts the array of normalized things to an array of raw html values. |
|
72 | + * |
|
73 | + * @param array $normalized_values |
|
74 | + * @return string[] |
|
75 | + */ |
|
76 | + public function unnormalize($normalized_values) |
|
77 | + { |
|
78 | + if ($normalized_values === null) { |
|
79 | + $normalized_values = array(); |
|
80 | + } |
|
81 | + if (! is_array($normalized_values)) { |
|
82 | + $normalized_values = array($normalized_values); |
|
83 | + } |
|
84 | + $non_normal_values = array(); |
|
85 | + foreach ($normalized_values as $key => $value) { |
|
86 | + $non_normal_values[$key] = $this->unnormalize_one($value); |
|
87 | + } |
|
88 | + return $non_normal_values; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * Unnormalizes an individual item in the array of values |
|
95 | + * |
|
96 | + * @param mixed $individual_value_to_unnormalize but certainly NOT an array |
|
97 | + * @return string |
|
98 | + */ |
|
99 | + public function unnormalize_one($individual_value_to_unnormalize) |
|
100 | + { |
|
101 | + return $this->_individual_item_normalization_strategy->unnormalize($individual_value_to_unnormalize); |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | // End of file EE_Many_Valued_Normalization.strategy.php |
@@ -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 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if ($normalized_values === null) { |
79 | 79 | $normalized_values = array(); |
80 | 80 | } |
81 | - if (! is_array($normalized_values)) { |
|
81 | + if ( ! is_array($normalized_values)) { |
|
82 | 82 | $normalized_values = array($normalized_values); |
83 | 83 | } |
84 | 84 | $non_normal_values = array(); |
@@ -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 | |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | if (is_float($value_to_normalize) || is_int($value_to_normalize)) { |
39 | - return (float)$value_to_normalize; |
|
39 | + return (float) $value_to_normalize; |
|
40 | 40 | } |
41 | - if (! is_string($value_to_normalize)) { |
|
41 | + if ( ! is_string($value_to_normalize)) { |
|
42 | 42 | throw new EE_Validation_Error( |
43 | 43 | sprintf( |
44 | 44 | __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | // if first match is the negative sign, |
61 | 61 | // then the number needs to be multiplied by -1 to remain negative |
62 | 62 | return $matches[1] === '-' |
63 | - ? (float)$matches[2] * -1 |
|
64 | - : (float)$matches[2]; |
|
63 | + ? (float) $matches[2] * -1 |
|
64 | + : (float) $matches[2]; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | //find if this input has a float validation strategy |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | //this really shouldn't ever happen because fields with a float normalization strategy |
76 | 76 | //should also have a float validation strategy, but in case it doesn't use the default |
77 | - if (! $validation_error_message) { |
|
77 | + if ( ! $validation_error_message) { |
|
78 | 78 | $default_validation_strategy = new EE_Float_Validation_Strategy(); |
79 | 79 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
80 | 80 | } |
@@ -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 | 26 | |
27 | - /** |
|
28 | - * @param string $value_to_normalize |
|
29 | - * @return float |
|
30 | - * @throws \EE_Validation_Error |
|
31 | - */ |
|
32 | - public function normalize($value_to_normalize) |
|
33 | - { |
|
34 | - if ($value_to_normalize === null) { |
|
35 | - return null; |
|
36 | - } |
|
37 | - if (is_float($value_to_normalize) || is_int($value_to_normalize)) { |
|
38 | - return (float)$value_to_normalize; |
|
39 | - } |
|
40 | - if (! is_string($value_to_normalize)) { |
|
41 | - throw new EE_Validation_Error( |
|
42 | - sprintf( |
|
43 | - __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
|
44 | - print_r($value_to_normalize, true), |
|
45 | - gettype($value_to_normalize) |
|
46 | - ) |
|
47 | - ); |
|
48 | - } |
|
49 | - $normalized_value = filter_var( |
|
50 | - $value_to_normalize, |
|
51 | - FILTER_SANITIZE_NUMBER_FLOAT, |
|
52 | - FILTER_FLAG_ALLOW_FRACTION |
|
53 | - ); |
|
54 | - if ($normalized_value === '') { |
|
55 | - return null; |
|
56 | - } |
|
57 | - if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $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 | - ? (float)$matches[2] * -1 |
|
63 | - : (float)$matches[2]; |
|
64 | - } |
|
65 | - } |
|
66 | - //find if this input has a float 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_Float_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 float normalization strategy |
|
75 | - //should also have a float validation strategy, but in case it doesn't use the default |
|
76 | - if (! $validation_error_message) { |
|
77 | - $default_validation_strategy = new EE_Float_Validation_Strategy(); |
|
78 | - $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
|
79 | - } |
|
80 | - throw new EE_Validation_Error($validation_error_message, 'float_only'); |
|
81 | - } |
|
27 | + /** |
|
28 | + * @param string $value_to_normalize |
|
29 | + * @return float |
|
30 | + * @throws \EE_Validation_Error |
|
31 | + */ |
|
32 | + public function normalize($value_to_normalize) |
|
33 | + { |
|
34 | + if ($value_to_normalize === null) { |
|
35 | + return null; |
|
36 | + } |
|
37 | + if (is_float($value_to_normalize) || is_int($value_to_normalize)) { |
|
38 | + return (float)$value_to_normalize; |
|
39 | + } |
|
40 | + if (! is_string($value_to_normalize)) { |
|
41 | + throw new EE_Validation_Error( |
|
42 | + sprintf( |
|
43 | + __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'), |
|
44 | + print_r($value_to_normalize, true), |
|
45 | + gettype($value_to_normalize) |
|
46 | + ) |
|
47 | + ); |
|
48 | + } |
|
49 | + $normalized_value = filter_var( |
|
50 | + $value_to_normalize, |
|
51 | + FILTER_SANITIZE_NUMBER_FLOAT, |
|
52 | + FILTER_FLAG_ALLOW_FRACTION |
|
53 | + ); |
|
54 | + if ($normalized_value === '') { |
|
55 | + return null; |
|
56 | + } |
|
57 | + if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $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 | + ? (float)$matches[2] * -1 |
|
63 | + : (float)$matches[2]; |
|
64 | + } |
|
65 | + } |
|
66 | + //find if this input has a float 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_Float_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 float normalization strategy |
|
75 | + //should also have a float validation strategy, but in case it doesn't use the default |
|
76 | + if (! $validation_error_message) { |
|
77 | + $default_validation_strategy = new EE_Float_Validation_Strategy(); |
|
78 | + $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
|
79 | + } |
|
80 | + throw new EE_Validation_Error($validation_error_message, 'float_only'); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * Converts a float into a string |
|
87 | - * |
|
88 | - * @param float $normalized_value |
|
89 | - * @return string |
|
90 | - */ |
|
91 | - public function unnormalize($normalized_value) |
|
92 | - { |
|
93 | - if (empty($normalized_value)) { |
|
94 | - return '0.00'; |
|
95 | - } |
|
96 | - return "{$normalized_value}"; |
|
97 | - } |
|
85 | + /** |
|
86 | + * Converts a float into a string |
|
87 | + * |
|
88 | + * @param float $normalized_value |
|
89 | + * @return string |
|
90 | + */ |
|
91 | + public function unnormalize($normalized_value) |
|
92 | + { |
|
93 | + if (empty($normalized_value)) { |
|
94 | + return '0.00'; |
|
95 | + } |
|
96 | + return "{$normalized_value}"; |
|
97 | + } |
|
98 | 98 | } |
99 | 99 | // End of file EE_Float_Normalization.strategy.php |
@@ -1,4 +1,4 @@ |
||
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 |
@@ -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,26 +15,26 @@ discard block |
||
15 | 15 | class EE_Slug_Normalization extends EE_Normalization_Strategy_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param string $value_to_normalize |
|
20 | - * @return string |
|
21 | - */ |
|
22 | - public function normalize($value_to_normalize) |
|
23 | - { |
|
24 | - return sanitize_title($value_to_normalize); |
|
25 | - } |
|
18 | + /** |
|
19 | + * @param string $value_to_normalize |
|
20 | + * @return string |
|
21 | + */ |
|
22 | + public function normalize($value_to_normalize) |
|
23 | + { |
|
24 | + return sanitize_title($value_to_normalize); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * It's hard to unnormalize this- let's just take a guess |
|
31 | - * |
|
32 | - * @param string $normalized_value |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function unnormalize($normalized_value) |
|
36 | - { |
|
37 | - return str_replace("-", " ", $normalized_value); |
|
38 | - } |
|
29 | + /** |
|
30 | + * It's hard to unnormalize this- let's just take a guess |
|
31 | + * |
|
32 | + * @param string $normalized_value |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function unnormalize($normalized_value) |
|
36 | + { |
|
37 | + return str_replace("-", " ", $normalized_value); |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | // End of file EE_Slug_Normalization.strategy.php |
@@ -1,4 +1,4 @@ |
||
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 |
@@ -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 | |
@@ -16,27 +16,27 @@ discard block |
||
16 | 16 | class EE_All_Caps_Normalization extends EE_Normalization_Strategy_Base |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @param string $value_to_normalize |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function normalize($value_to_normalize) |
|
24 | - { |
|
25 | - return strtoupper($value_to_normalize); |
|
26 | - } |
|
27 | - |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * It's kinda hard to unnormalize this- we can't determine which parts used to be lowercase |
|
32 | - * so just return it as-is. |
|
33 | - * |
|
34 | - * @param string $normalized_value |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function unnormalize($normalized_value) |
|
38 | - { |
|
39 | - return $normalized_value; |
|
40 | - } |
|
19 | + /** |
|
20 | + * @param string $value_to_normalize |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function normalize($value_to_normalize) |
|
24 | + { |
|
25 | + return strtoupper($value_to_normalize); |
|
26 | + } |
|
27 | + |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * It's kinda hard to unnormalize this- we can't determine which parts used to be lowercase |
|
32 | + * so just return it as-is. |
|
33 | + * |
|
34 | + * @param string $normalized_value |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function unnormalize($normalized_value) |
|
38 | + { |
|
39 | + return $normalized_value; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -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 | |
@@ -18,28 +18,28 @@ discard block |
||
18 | 18 | class EE_Boolean_Normalization extends EE_Normalization_Strategy_Base |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @param string | int | bool $value_to_normalize |
|
23 | - * @return boolean |
|
24 | - */ |
|
25 | - public function normalize($value_to_normalize) |
|
26 | - { |
|
27 | - return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN); |
|
28 | - } |
|
21 | + /** |
|
22 | + * @param string | int | bool $value_to_normalize |
|
23 | + * @return boolean |
|
24 | + */ |
|
25 | + public function normalize($value_to_normalize) |
|
26 | + { |
|
27 | + return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @param boolean $normalized_value |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function unnormalize($normalized_value) |
|
37 | - { |
|
38 | - if ($normalized_value) { |
|
39 | - return '1'; |
|
40 | - } else { |
|
41 | - return '0'; |
|
42 | - } |
|
43 | - } |
|
32 | + /** |
|
33 | + * @param boolean $normalized_value |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function unnormalize($normalized_value) |
|
37 | + { |
|
38 | + if ($normalized_value) { |
|
39 | + return '1'; |
|
40 | + } else { |
|
41 | + return '0'; |
|
42 | + } |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | // End of file EE_Boolean_Normalization.strategy.php |
@@ -1,4 +1,4 @@ |
||
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 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | 3 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
4 | - <span class="dashicons dashicons-cart"></span><?php _e( 'Transaction Items', 'event_espresso' );?> |
|
4 | + <span class="dashicons dashicons-cart"></span><?php _e('Transaction Items', 'event_espresso'); ?> |
|
5 | 5 | </h3> |
6 | 6 | |
7 | 7 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -10,27 +10,27 @@ discard block |
||
10 | 10 | </div> |
11 | 11 | |
12 | 12 | <a id="display-additional-transaction-session-info" class="display-the-hidden smaller-text" rel="additional-transaction-session-info"> |
13 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional transaction session details', 'event_espresso' );?> |
|
13 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional transaction session details', 'event_espresso'); ?> |
|
14 | 14 | </a> |
15 | 15 | |
16 | 16 | <div id="additional-transaction-session-info-dv" class="hidden"> |
17 | 17 | |
18 | 18 | <a id="hide-additional-transaction-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-transaction-session-info"> |
19 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional transaction session details', 'event_espresso' );?> |
|
19 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional transaction session details', 'event_espresso'); ?> |
|
20 | 20 | </a> |
21 | 21 | <br class="clear"/> |
22 | 22 | |
23 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Transaction Session Details', 'event_espresso' );?></h3> |
|
23 | + <h3 class="admin-primary-mbox-h4"><?php _e('Transaction Session Details', 'event_espresso'); ?></h3> |
|
24 | 24 | |
25 | 25 | <table id="admin-primary-mbox-txn-extra-session-info-tbl" class="form-table skinny-rows"> |
26 | 26 | <tbody> |
27 | - <?php foreach ( $txn_details as $key => $txn_detail ) : ?> |
|
27 | + <?php foreach ($txn_details as $key => $txn_detail) : ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | - <label for="<?php echo $key;?>"><?php echo $txn_detail['label'];?></label> |
|
30 | + <label for="<?php echo $key; ?>"><?php echo $txn_detail['label']; ?></label> |
|
31 | 31 | </th> |
32 | 32 | <td> |
33 | - <?php echo $txn_detail['value'];?> |
|
33 | + <?php echo $txn_detail['value']; ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $txn_details?> |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <br class="clear"/> |
41 | 41 | |
42 | 42 | |
43 | - <?php if ( $attendee instanceof EE_Attendee && ( $grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty( $payments ) ) ) : ?> |
|
43 | + <?php if ($attendee instanceof EE_Attendee && ($grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty($payments))) : ?> |
|
44 | 44 | |
45 | 45 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
46 | - <span class="ee-icon ee-icon-cash"></span><?php _e( 'Payment Details', 'event_espresso' );?> |
|
46 | + <span class="ee-icon ee-icon-cash"></span><?php _e('Payment Details', 'event_espresso'); ?> |
|
47 | 47 | </h3> |
48 | 48 | |
49 | 49 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -52,79 +52,79 @@ discard block |
||
52 | 52 | <tr> |
53 | 53 | <th></th> |
54 | 54 | <th class="jst-cntr"></th> |
55 | - <th class="jst-cntr"><?php _e( 'ID', 'event_espresso' );?></th> |
|
56 | - <th class="jst-left"><?php _e( 'Date', 'event_espresso' );?></th> |
|
57 | - <th class="jst-cntr"><?php _e( 'Source', 'event_espresso' );?></th> |
|
58 | - <th class="jst-left"><?php _e( 'Method', 'event_espresso' );?></th> |
|
59 | - <th class="jst-left"><?php _e( 'Gateway Response', 'event_espresso' );?></th> |
|
60 | - <th class="jst-left"><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></th> |
|
61 | - <th class="jst-left"><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></th> |
|
62 | - <th class="jst-left"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></th> |
|
63 | - <!--<th class="jst-left"><?php _e( 'Details', 'event_espresso' );?></th>--> |
|
64 | - <th class="jst-cntr"><?php _e( 'Amount', 'event_espresso' );?></th> |
|
55 | + <th class="jst-cntr"><?php _e('ID', 'event_espresso'); ?></th> |
|
56 | + <th class="jst-left"><?php _e('Date', 'event_espresso'); ?></th> |
|
57 | + <th class="jst-cntr"><?php _e('Source', 'event_espresso'); ?></th> |
|
58 | + <th class="jst-left"><?php _e('Method', 'event_espresso'); ?></th> |
|
59 | + <th class="jst-left"><?php _e('Gateway Response', 'event_espresso'); ?></th> |
|
60 | + <th class="jst-left"><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></th> |
|
61 | + <th class="jst-left"><?php _e('P.O. / S.O. #', 'event_espresso'); ?></th> |
|
62 | + <th class="jst-left"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></th> |
|
63 | + <!--<th class="jst-left"><?php _e('Details', 'event_espresso'); ?></th>--> |
|
64 | + <th class="jst-cntr"><?php _e('Amount', 'event_espresso'); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if ( $payments ) : ?> |
|
68 | + <?php if ($payments) : ?> |
|
69 | 69 | <?php $payment_total = 0; ?> |
70 | - <?php foreach ( $payments as $PAY_ID => $payment ) : |
|
71 | - $existing_reg_payment_json = isset( $existing_reg_payments[ $PAY_ID ] ) |
|
72 | - ? wp_json_encode( $existing_reg_payments[ $PAY_ID ] ) |
|
70 | + <?php foreach ($payments as $PAY_ID => $payment) : |
|
71 | + $existing_reg_payment_json = isset($existing_reg_payments[$PAY_ID]) |
|
72 | + ? wp_json_encode($existing_reg_payments[$PAY_ID]) |
|
73 | 73 | : '{}'; |
74 | 74 | ?> |
75 | - <tr id="txn-admin-payment-tr-<?php echo $PAY_ID;?>"> |
|
75 | + <tr id="txn-admin-payment-tr-<?php echo $PAY_ID; ?>"> |
|
76 | 76 | <td> |
77 | 77 | <span id="payment-status-<?php echo $PAY_ID; ?>" class="ee-status-strip-td ee-status-strip pymt-status-<?php echo $payment->STS_ID(); ?>"></span> |
78 | - <div id="payment-STS_ID-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->STS_ID();?></div> |
|
79 | - <div id="reg-payments-<?php echo $PAY_ID;?>" class="hidden"><?php echo $existing_reg_payment_json; ?></div> |
|
78 | + <div id="payment-STS_ID-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->STS_ID(); ?></div> |
|
79 | + <div id="reg-payments-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $existing_reg_payment_json; ?></div> |
|
80 | 80 | </td> |
81 | 81 | <td class=" jst-cntr"> |
82 | 82 | <ul class="txn-overview-actions-ul"> |
83 | 83 | <li> |
84 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
84 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
85 | 85 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
86 | 86 | </a> |
87 | 87 | </li> |
88 | 88 | <li> |
89 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
89 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
90 | 90 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
91 | 91 | </a> |
92 | 92 | </li> |
93 | 93 | </ul> |
94 | 94 | </td> |
95 | 95 | <td class=" jst-rght"> |
96 | - <div id="payment-id-<?php echo $PAY_ID;?>"><?php echo $PAY_ID;?></div> |
|
96 | + <div id="payment-id-<?php echo $PAY_ID; ?>"><?php echo $PAY_ID; ?></div> |
|
97 | 97 | </td> |
98 | 98 | <td class=" jst-left"> |
99 | - <div id="payment-date-<?php echo $PAY_ID;?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a');?></div> |
|
99 | + <div id="payment-date-<?php echo $PAY_ID; ?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a'); ?></div> |
|
100 | 100 | </td> |
101 | 101 | <td class=" jst-cntr"> |
102 | - <div id="payment-method-<?php echo $PAY_ID;?>"> |
|
103 | - <?php echo $payment->source();?> |
|
102 | + <div id="payment-method-<?php echo $PAY_ID; ?>"> |
|
103 | + <?php echo $payment->source(); ?> |
|
104 | 104 | </div> |
105 | 105 | </td> |
106 | 106 | <td class=" jst-left"> |
107 | - <div id="payment-gateway-<?php echo $PAY_ID;?>"> |
|
108 | - <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');?> |
|
107 | + <div id="payment-gateway-<?php echo $PAY_ID; ?>"> |
|
108 | + <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'); ?> |
|
109 | 109 | </div> |
110 | - <div id="payment-gateway-id-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0;?></div> |
|
110 | + <div id="payment-gateway-id-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0; ?></div> |
|
111 | 111 | </td> |
112 | 112 | <td class=" jst-left"> |
113 | - <div id="payment-response-<?php echo $PAY_ID;?>"><?php echo $payment->gateway_response();?></div> |
|
113 | + <div id="payment-response-<?php echo $PAY_ID; ?>"><?php echo $payment->gateway_response(); ?></div> |
|
114 | 114 | </td> |
115 | 115 | <td class=" jst-left"> |
116 | - <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->txn_id_chq_nmbr();?></div> |
|
116 | + <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->txn_id_chq_nmbr(); ?></div> |
|
117 | 117 | </td> |
118 | 118 | <td class=" jst-left"> |
119 | - <div id="payment-po-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->po_number();?></div> |
|
119 | + <div id="payment-po-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->po_number(); ?></div> |
|
120 | 120 | </td> |
121 | 121 | <td class=" jst-left"> |
122 | - <div id="payment-accntng-<?php echo $PAY_ID;?>"><?php echo $payment->extra_accntng();?></div> |
|
122 | + <div id="payment-accntng-<?php echo $PAY_ID; ?>"><?php echo $payment->extra_accntng(); ?></div> |
|
123 | 123 | </td> |
124 | 124 | <td class=" jst-rght"> |
125 | - <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-' . $payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
126 | - <span class="<?php echo $payment_class;?>"> |
|
127 | - <div id="payment-amount-<?php echo $PAY_ID;?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE ); ?></div> |
|
125 | + <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-'.$payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
126 | + <span class="<?php echo $payment_class; ?>"> |
|
127 | + <div id="payment-amount-<?php echo $PAY_ID; ?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE); ?></div> |
|
128 | 128 | </span> |
129 | 129 | </td> |
130 | 130 | </tr> |
@@ -134,25 +134,25 @@ discard block |
||
134 | 134 | <?php endforeach; // $payment?> |
135 | 135 | <?php |
136 | 136 | $pay_totals_class = $payment_total > $grand_raw_total ? ' important-notice' : ''; |
137 | - $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">' . __( 'This transaction has been overpaid ! ', 'event_espresso' ) . '</span>' : ''; |
|
137 | + $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">'.__('This transaction has been overpaid ! ', 'event_espresso').'</span>' : ''; |
|
138 | 138 | ?> |
139 | 139 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
140 | 140 | <td class=" jst-rght" colspan="11"> |
141 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
141 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | - <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class;?>"> |
|
145 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid . sprintf( __( 'Payments Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );?></span></th> |
|
146 | - <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE);?></span></th> |
|
144 | + <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class; ?>"> |
|
145 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid.sprintf(__('Payments Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); ?></span></th> |
|
146 | + <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE); ?></span></th> |
|
147 | 147 | </tr> |
148 | 148 | <?php else : ?> |
149 | 149 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
150 | 150 | <td class=" jst-rght" colspan="11"> |
151 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
151 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
152 | 152 | </td> |
153 | 153 | </tr> |
154 | 154 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
155 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __( 'Payments Total', 'event_espresso' );?></span></th> |
|
155 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __('Payments Total', 'event_espresso'); ?></span></th> |
|
156 | 156 | <th class=" jst-rght"><span id="txn-admin-payment-total"></span></th> |
157 | 157 | </tr> |
158 | 158 | <?php endif; // $payments?> |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | <td class=" jst-cntr"> |
166 | 166 | <ul class="txn-overview-actions-ul"> |
167 | 167 | <li> |
168 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
168 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
169 | 169 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
170 | 170 | </a> |
171 | 171 | </li> |
172 | 172 | <li> |
173 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
173 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
174 | 174 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
175 | 175 | </a> |
176 | 176 | </li> |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | <ul id="txn-admin-payment-options-ul"> |
218 | 218 | <li> |
219 | 219 | <a id="display-txn-admin-apply-payment" class="button-primary no-icon no-hide" rel="txn-admin-apply-payment" > <!--display-the-hidden --> |
220 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
220 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
221 | 221 | </a> |
222 | 222 | </li> |
223 | 223 | <li> |
224 | 224 | <a id="display-txn-admin-apply-refund" class="button-secondary no-icon no-hide" rel="txn-admin-apply-refund" > <!--display-the-hidden --> |
225 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
225 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
226 | 226 | </a> |
227 | 227 | </li> |
228 | 228 | </ul> |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | |
233 | 233 | <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
234 | 234 | <div class="ee-icon ee-icon-cash-add float-left"></div> |
235 | - <?php echo __( 'Apply a Payment to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
235 | + <?php echo __('Apply a Payment to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
236 | 236 | </h2> |
237 | 237 | |
238 | 238 | <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
239 | 239 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
240 | 240 | <?php |
241 | 241 | echo sprintf( |
242 | - __( 'Edit Payment #%s for Transaction #%s', 'event_espresso' ), |
|
242 | + __('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
243 | 243 | '<span></span>', |
244 | 244 | $txn_nmbr['value'] |
245 | 245 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
251 | 251 | <?php |
252 | 252 | echo sprintf( |
253 | - __( 'Edit Refund #%s for Transaction #%s', 'event_espresso' ), |
|
253 | + __('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
254 | 254 | '<span></span>', |
255 | 255 | $txn_nmbr['value'] |
256 | 256 | ); |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | |
260 | 260 | <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
261 | 261 | <div class="ee-icon ee-icon-cash-remove float-left"></div> |
262 | - <?php echo __( 'Apply a Refund to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
262 | + <?php echo __('Apply a Refund to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
263 | 263 | </h2> |
264 | 264 | |
265 | 265 | <form name="txn-admin-apply-payment-frm" id="txn-admin-apply-payment-frm" action="<?php echo $apply_payment_form_url; ?>"> |
266 | 266 | <div class="admin-modal-dialog-wrap"> |
267 | 267 | <div class="admin-modal-dialog-inner"> |
268 | 268 | |
269 | - <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_apply_payment_nonce' );?>"/> |
|
269 | + <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce('espresso_apply_payment_nonce'); ?>"/> |
|
270 | 270 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
271 | 271 | <input type="hidden" name="noheader" id="txn-admin-noheader-inp" value="0"/> |
272 | 272 | <input type="hidden" name="txn_admin_payment[PAY_ID]" id="txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
@@ -274,108 +274,108 @@ discard block |
||
274 | 274 | <input type="hidden" name="txn_admin_payment[type]" id="txn-admin-payment-type-inp" value="1"/> |
275 | 275 | <input type="hidden" name="txn_admin_payment[details]" id="txn-admin-payment-details-inp" value=""/> |
276 | 276 | <input type="hidden" name="txn_admin_delete_payment_form_url" id="txn-admin-delete-payment-form-url-inp" value="<?php echo $delete_payment_form_url; ?>"/> |
277 | - <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
277 | + <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
278 | 278 | |
279 | 279 | <div class="txn-admin-apply-payment-date-dv admin-modal-dialog-row"> |
280 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
281 | - <label for="txn-admin-payment-date-inp" class=""><?php _e( 'Payment Date', 'event_espresso' );?></label> |
|
282 | - <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date( 'Y-m-d g:i a', current_time( 'timestamp' )); ?>"/> |
|
283 | - <p class="description"><?php _e( 'The date the payment was actually made on', 'event_espresso' );?></p> |
|
280 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
281 | + <label for="txn-admin-payment-date-inp" class=""><?php _e('Payment Date', 'event_espresso'); ?></label> |
|
282 | + <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date('Y-m-d g:i a', current_time('timestamp')); ?>"/> |
|
283 | + <p class="description"><?php _e('The date the payment was actually made on', 'event_espresso'); ?></p> |
|
284 | 284 | </div> |
285 | 285 | |
286 | 286 | <div class="txn-admin-apply-payment-amount-dv admin-modal-dialog-row"> |
287 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
288 | - <label for="txn-admin-payment-amount-inp" class=""><?php _e( 'Amount', 'event_espresso' );?></label> |
|
287 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
288 | + <label for="txn-admin-payment-amount-inp" class=""><?php _e('Amount', 'event_espresso'); ?></label> |
|
289 | 289 | <input name="txn_admin_payment[amount]" id="txn-admin-payment-amount-inp" class="txn-admin-apply-payment-inp required" type="text" value=""/> |
290 | - <p class="description"><?php _e( 'The amount of the payment', 'event_espresso' );?></p> |
|
290 | + <p class="description"><?php _e('The amount of the payment', 'event_espresso'); ?></p> |
|
291 | 291 | </div> |
292 | 292 | |
293 | 293 | <div class="txn-admin-apply-payment-method-dv admin-modal-dialog-row"> |
294 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
295 | - <label for="txn-admin-payment-method-inp" class=""><?php _e( 'Method of Payment', 'event_espresso' );?></label> |
|
294 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
295 | + <label for="txn-admin-payment-method-inp" class=""><?php _e('Method of Payment', 'event_espresso'); ?></label> |
|
296 | 296 | <select name="txn_admin_payment[PMD_ID]" id="txn-admin-payment-method-slct" class="txn-admin-apply-payment-slct required" type="text" > |
297 | - <?php foreach ( $payment_methods as $method ) : ?> |
|
297 | + <?php foreach ($payment_methods as $method) : ?> |
|
298 | 298 | <?php $selected = $method->slug() == 'cash' ? ' selected="selected"' : ''; ?> |
299 | - <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key( $method->admin_desc() ) ? substr( $method->admin_desc(), 0, 128) : $method->admin_name() ; ?> </option> |
|
299 | + <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key($method->admin_desc()) ? substr($method->admin_desc(), 0, 128) : $method->admin_name(); ?> </option> |
|
300 | 300 | <?php endforeach; ?> |
301 | 301 | </select> |
302 | - <p class="description"><?php _e( 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso' );?></p> |
|
302 | + <p class="description"><?php _e('Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso'); ?></p> |
|
303 | 303 | </div> |
304 | 304 | |
305 | 305 | <div class="mop-PP mop-CC mop-CHQ mop"> |
306 | 306 | <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row"> |
307 | - <label for="txn-admin-payment-txn-id-inp" class=""><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></label> |
|
307 | + <label for="txn-admin-payment-txn-id-inp" class=""><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></label> |
|
308 | 308 | <input name="txn_admin_payment[txn_id_chq_nmbr]" id="txn-admin-payment-txn-id-chq-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
309 | - <p class="description"><?php _e( 'The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso' );?></p> |
|
309 | + <p class="description"><?php _e('The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso'); ?></p> |
|
310 | 310 | </div> |
311 | 311 | </div> |
312 | 312 | |
313 | 313 | <div class="mop-CC mop" style="display:none"> |
314 | 314 | <div class="txn-admin-apply-payment-response-dv admin-modal-dialog-row"> |
315 | - <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e( 'Gateway Response', 'event_espresso' );?></label> |
|
315 | + <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e('Gateway Response', 'event_espresso'); ?></label> |
|
316 | 316 | <input name="txn_admin_payment[gateway_response]" id="txn-admin-payment-gateway-response-inp" class="txn-admin-apply-payment-inp" type="text"/> |
317 | - <p class="description"><?php _e( 'The gateway response string (optional)', 'event_espresso' );?></p> |
|
317 | + <p class="description"><?php _e('The gateway response string (optional)', 'event_espresso'); ?></p> |
|
318 | 318 | </div> |
319 | 319 | </div> |
320 | 320 | |
321 | 321 | <div class="mop-PP mop-CC mop"> |
322 | 322 | <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row"> |
323 | - <label for="txn-admin-payment-status-inp" class=""><?php _e( 'Payment Status', 'event_espresso' );?></label> |
|
323 | + <label for="txn-admin-payment-status-inp" class=""><?php _e('Payment Status', 'event_espresso'); ?></label> |
|
324 | 324 | <select name="txn_admin_payment[status]" id="txn-admin-payment-status-slct" class="txn-admin-apply-payment-slct" type="text" > |
325 | - <?php foreach ( $payment_status as $STS_ID => $STS_code ) : ?> |
|
325 | + <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
|
326 | 326 | <?php $selected = $STS_ID == 'PAP' ? ' selected="selected"' : ''; ?> |
327 | 327 | <option id="payment-status-opt-<?php echo $STS_ID; ?>" value="<?php echo $STS_ID; ?>"<?php echo $selected; ?>><?php echo $STS_code; ?> </option> |
328 | 328 | <?php endforeach; ?> |
329 | 329 | </select> |
330 | - <p class="description"><?php _e( 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso' );?></p> |
|
330 | + <p class="description"><?php _e('Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso'); ?></p> |
|
331 | 331 | </div> |
332 | 332 | </div> |
333 | 333 | |
334 | 334 | <div class="txn-admin-apply-payment-po-nmbr-dv admin-modal-dialog-row"> |
335 | - <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></label> |
|
335 | + <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e('P.O. / S.O. #', 'event_espresso'); ?></label> |
|
336 | 336 | <input name="txn_admin_payment[po_number]" id="txn-admin-payment-po-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
337 | - <p class="description"><?php _e( 'The Purchase or Sales Order Number if any (optional)', 'event_espresso' );?></p> |
|
337 | + <p class="description"><?php _e('The Purchase or Sales Order Number if any (optional)', 'event_espresso'); ?></p> |
|
338 | 338 | </div> |
339 | 339 | |
340 | 340 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
341 | - <label for="txn-admin-payment-accounting-inp" class="last"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></label> |
|
341 | + <label for="txn-admin-payment-accounting-inp" class="last"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></label> |
|
342 | 342 | <input name="txn_admin_payment[accounting]" id="txn-admin-payment-accounting-inp" class="txn-admin-apply-payment-inp" type="text" value="<?php echo $REG_code; ?>" maxlength="100"/> <input type="hidden" id="txn-admin-reg-code-inp" value="<?php echo $REG_code; ?>"/> |
343 | - <p class="description"><?php _e( 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso' );?></p> |
|
343 | + <p class="description"><?php _e('An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso'); ?></p> |
|
344 | 344 | </div> |
345 | 345 | |
346 | 346 | <div class="txn-admin-apply-payment-registrations-dv admin-modal-dialog-row"> |
347 | - <label for="txn-admin-payment-registrations-inp" class="last"><?php _e( 'Registrations to Apply Payment to:', 'event_espresso' ); ?></label> |
|
347 | + <label for="txn-admin-payment-registrations-inp" class="last"><?php _e('Registrations to Apply Payment to:', 'event_espresso'); ?></label> |
|
348 | 348 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
349 | 349 | <input type="radio" value="1" id="txn-admin-apply-payment-to-all-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" checked="checked"/> |
350 | - <?php _e( 'ALL Registrations', 'event_espresso' ); ?> |
|
350 | + <?php _e('ALL Registrations', 'event_espresso'); ?> |
|
351 | 351 | </label> |
352 | 352 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
353 | 353 | <input type="radio" value="0" id="txn-admin-apply-payment-to-some-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" /> |
354 | - <?php _e( 'Just the following Registrations', 'event_espresso' ); ?> |
|
354 | + <?php _e('Just the following Registrations', 'event_espresso'); ?> |
|
355 | 355 | </label> |
356 | 356 | <?php echo $registrations_to_apply_payment_to; ?> |
357 | 357 | </div> |
358 | 358 | |
359 | 359 | <div class="txn-admin-payment-reg-status-dv admin-modal-dialog-row"> |
360 | - <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
360 | + <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
361 | 361 | <?php echo $status_change_select; ?> |
362 | - <p class="description"><?php _e( 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso' ); ?></p> |
|
362 | + <p class="description"><?php _e('If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso'); ?></p> |
|
363 | 363 | <br/> |
364 | 364 | </div> |
365 | 365 | |
366 | 366 | <div class="txn-admin-apply-payment-send-notifications-dv admin-modal-dialog-row"> |
367 | 367 | |
368 | - <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
368 | + <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
369 | 369 | <label class="txn-admin-payment-send-notifications-lbl"> |
370 | 370 | <input type="checkbox" value="1" name="txn_payments[send_notifications]" checked="checked" aria-checked="true" style="vertical-align: middle;"> |
371 | - <?php _e( 'Payment Messages?', 'event_espresso' ); ?> |
|
371 | + <?php _e('Payment Messages?', 'event_espresso'); ?> |
|
372 | 372 | </label> |
373 | 373 | <label class="txn-admin-payment-send-notifications-lbl"> |
374 | 374 | <input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" style="vertical-align: middle;"> |
375 | - <?php _e( 'Registration Messages?', 'event_espresso' ); ?> |
|
375 | + <?php _e('Registration Messages?', 'event_espresso'); ?> |
|
376 | 376 | </label> |
377 | 377 | <br class="clear-float"/> |
378 | - <p class="description"><?php printf( __('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />' ); ?></p> |
|
378 | + <p class="description"><?php printf(__('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />'); ?></p> |
|
379 | 379 | <label></label> |
380 | 380 | </div> |
381 | 381 | <div class="clear"></div> |
@@ -386,27 +386,27 @@ discard block |
||
386 | 386 | <ul id="admin-modal-dialog-options-ul"> |
387 | 387 | <li> |
388 | 388 | <a id="txn-admin-modal-dialog-apply-payment-lnk" class="button-primary no-icon" style="display:none;" > |
389 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
389 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
390 | 390 | </a> |
391 | 391 | </li> |
392 | 392 | <li> |
393 | 393 | <a id="txn-admin-modal-dialog-edit-payment-lnk" class="button-primary no-icon" style="display:none;" > |
394 | - <?php _e( 'Save Payment Details', 'event_espresso' );?> |
|
394 | + <?php _e('Save Payment Details', 'event_espresso'); ?> |
|
395 | 395 | </a> |
396 | 396 | </li> |
397 | 397 | <li> |
398 | 398 | <a id="txn-admin-modal-dialog-edit-refund-lnk" class="button-primary no-icon" style="display:none;" > |
399 | - <?php _e( 'Save Refund Details', 'event_espresso' );?> |
|
399 | + <?php _e('Save Refund Details', 'event_espresso'); ?> |
|
400 | 400 | </a> |
401 | 401 | </li> |
402 | 402 | <li> |
403 | 403 | <a id="txn-admin-modal-dialog-apply-refund-lnk" class="button-primary no-icon" style="display:none;" > |
404 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
404 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
405 | 405 | </a> |
406 | 406 | </li> |
407 | 407 | <li> |
408 | 408 | <a id="txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
409 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
409 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
410 | 410 | </a> |
411 | 411 | </li> |
412 | 412 | <li> |
@@ -423,29 +423,29 @@ discard block |
||
423 | 423 | |
424 | 424 | <h2 id="admin-modal-dialog-delete-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
425 | 425 | <span class="ee-icon ee-icon-cash-add"></span> |
426 | - <?php echo __( 'Delete Payment/Refund for Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
426 | + <?php echo __('Delete Payment/Refund for Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
427 | 427 | </h2> |
428 | 428 | |
429 | 429 | <form name="txn-admin-delete-payment-frm" id="txn-admin-delete-payment-frm" action="<?php echo $delete_payment_url; ?>"> |
430 | 430 | <div class="admin-modal-dialog-wrap"> |
431 | 431 | <div class="admin-modal-dialog-inner"> |
432 | 432 | |
433 | - <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_delete_payment_nonce' );?>"/> |
|
433 | + <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce('espresso_delete_payment_nonce'); ?>"/> |
|
434 | 434 | <input type="hidden" name="delete_espresso_ajax" id="delete-espresso-ajax" value="0"/> |
435 | 435 | <input type="hidden" name="delete_noheader" id="delete-txn-admin-noheader-inp" value="0"/> |
436 | 436 | <input type="hidden" name="delete_txn_admin_payment[PAY_ID]" id="delete-txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
437 | 437 | <input type="hidden" name="delete_txn_admin_payment[TXN_ID]" id="delete-txn-admin-payment-txn-id-inp" value="<?php echo $txn_nmbr['value']; ?>"/> |
438 | 438 | |
439 | 439 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
440 | - <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
440 | + <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
441 | 441 | <?php echo $delete_status_change_select; ?> |
442 | - <p class="description"><?php printf( __('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>' ); ?></p> |
|
442 | + <p class="description"><?php printf(__('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
443 | 443 | </div> |
444 | 444 | |
445 | 445 | <div class="ee-attention txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
446 | - <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
446 | + <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
447 | 447 | <input type="checkbox" value="1" name="delete_txn_reg_status_change[send_notifications]"> |
448 | - <p class="description"><?php _e( 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso' );?></p> |
|
448 | + <p class="description"><?php _e('If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso'); ?></p> |
|
449 | 449 | </div> |
450 | 450 | <div class="clear"></div> |
451 | 451 | |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | <ul id="del-admin-modal-dialog-options-ul"> |
456 | 456 | <li> |
457 | 457 | <a id="txn-admin-modal-dialog-delete-lnk" class="button-primary no-icon" style="display:none;" > |
458 | - <?php _e( 'Delete', 'event_espresso' );?> |
|
458 | + <?php _e('Delete', 'event_espresso'); ?> |
|
459 | 459 | </a> |
460 | 460 | </li> |
461 | 461 | <li> |
462 | 462 | <a id="del-txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
463 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
463 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
464 | 464 | </a> |
465 | 465 | </li> |
466 | 466 | <li> |
@@ -476,30 +476,30 @@ discard block |
||
476 | 476 | <?php endif; // $grand_raw_total > 0?> |
477 | 477 | |
478 | 478 | <?php |
479 | - if ( WP_DEBUG ) { |
|
480 | - $delivered_messages = get_option( 'EED_Messages__payment', array() ); |
|
481 | - if ( isset( $delivered_messages[ $TXN_ID ] )) { |
|
479 | + if (WP_DEBUG) { |
|
480 | + $delivered_messages = get_option('EED_Messages__payment', array()); |
|
481 | + if (isset($delivered_messages[$TXN_ID])) { |
|
482 | 482 | ?> |
483 | - <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Messages Sent to Primary Registrant', 'event_espresso' );?></h4> |
|
483 | + <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e('Messages Sent to Primary Registrant', 'event_espresso'); ?></h4> |
|
484 | 484 | |
485 | 485 | <div class="admin-primary-mbox-tbl-wrap"> |
486 | 486 | <table class="admin-primary-mbox-tbl"> |
487 | 487 | <thead> |
488 | 488 | <tr> |
489 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
490 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
491 | - <th class="jst-left"><?php _e( 'Payment Status Upon Sending', 'event_espresso' );?></th> |
|
492 | - <th class="jst-left"><?php _e( 'TXN Status Upon Sending', 'event_espresso' );?></th> |
|
489 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
490 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
491 | + <th class="jst-left"><?php _e('Payment Status Upon Sending', 'event_espresso'); ?></th> |
|
492 | + <th class="jst-left"><?php _e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
|
493 | 493 | </tr> |
494 | 494 | </thead> |
495 | 495 | <tbody> |
496 | - <?php foreach ( $delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message ) : |
|
496 | + <?php foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) : |
|
497 | 497 | ?> |
498 | 498 | <tr> |
499 | - <td class="jst-left"><?php echo date( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
500 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
501 | - <td class="jst-left"><?php echo isset( $delivered_message['pay_status'] ) ? $delivered_message['pay_status'] : '';?></td> |
|
502 | - <td class="jst-left"><?php echo isset( $delivered_message['txn_status'] ) ? $delivered_message['txn_status'] : '';?></td> |
|
499 | + <td class="jst-left"><?php echo date(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
500 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
501 | + <td class="jst-left"><?php echo isset($delivered_message['pay_status']) ? $delivered_message['pay_status'] : ''; ?></td> |
|
502 | + <td class="jst-left"><?php echo isset($delivered_message['txn_status']) ? $delivered_message['txn_status'] : ''; ?></td> |
|
503 | 503 | </tr> |
504 | 504 | <?php endforeach; // $delivered_messages?> |
505 | 505 | </tbody> |