@@ -8,36 +8,36 @@ |
||
8 | 8 | * @subpackage Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php. |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | protected $_max_length; |
14 | 14 | |
15 | - public function __construct( $validation_error_message = NULL, $max_length = EE_INF ) { |
|
15 | + public function __construct($validation_error_message = NULL, $max_length = EE_INF) { |
|
16 | 16 | $this->_max_length = $max_length; |
17 | - if( $validation_error_message === null ) { |
|
18 | - $validation_error_message = sprintf( __( 'Input is too long. Maximum number of characters is %1$s', 'event_espresso' ), $max_length ); |
|
17 | + if ($validation_error_message === null) { |
|
18 | + $validation_error_message = sprintf(__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length); |
|
19 | 19 | } |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @param $normalized_value |
25 | 25 | */ |
26 | 26 | public function validate($normalized_value) { |
27 | - if( $this->_max_length !== EE_INF && |
|
27 | + if ($this->_max_length !== EE_INF && |
|
28 | 28 | $normalized_value && |
29 | - is_string( $normalized_value ) && |
|
30 | - strlen( $normalized_value ) > $this->_max_length){ |
|
31 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'maxlength' ); |
|
29 | + is_string($normalized_value) && |
|
30 | + strlen($normalized_value) > $this->_max_length) { |
|
31 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength'); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @return array |
37 | 37 | */ |
38 | - function get_jquery_validation_rule_array(){ |
|
39 | - if( $this->_max_length !== EE_INF ) { |
|
40 | - return array( 'maxlength'=> $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) ); |
|
38 | + function get_jquery_validation_rule_array() { |
|
39 | + if ($this->_max_length !== EE_INF) { |
|
40 | + return array('maxlength'=> $this->_max_length, 'messages' => array('maxlength' => $this->get_validation_error_message())); |
|
41 | 41 | } else { |
42 | 42 | return array(); |
43 | 43 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -330,14 +331,9 @@ discard block |
||
330 | 331 | else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
331 | 332 | $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
332 | 333 | $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
333 | - } |
|
334 | - |
|
335 | - |
|
336 | - else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
334 | + } else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
337 | 335 | $set_column_values[$fieldName] = 0; |
338 | - } |
|
339 | - |
|
340 | - else if ( $fieldName == 'QST_max' ) { |
|
336 | + } else if ( $fieldName == 'QST_max' ) { |
|
341 | 337 | $qst_system = EEM_Question::instance()->get_var( |
342 | 338 | array( |
343 | 339 | array( |
@@ -390,7 +386,7 @@ discard block |
||
390 | 386 | $question=$this->_question_model->get_one_by_ID($ID); |
391 | 387 | $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
392 | 388 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
393 | - }else{ |
|
389 | + } else{ |
|
394 | 390 | $question= EE_Question::new_instance(); |
395 | 391 | $question->set_order_to_latest(); |
396 | 392 | $this->_set_add_edit_form_tags('insert_question'); |
@@ -421,7 +417,7 @@ discard block |
||
421 | 417 | $ID=$this->_question_model->insert($set_column_values); |
422 | 418 | $success = $ID ? true : false; |
423 | 419 | $action_desc = 'added'; |
424 | - }else{ |
|
420 | + } else{ |
|
425 | 421 | $ID=absint($this->_req_data['QST_ID']); |
426 | 422 | $pk=$this->_question_model->primary_key_name(); |
427 | 423 | $wheres=array($pk=>$ID); |
@@ -442,7 +438,7 @@ discard block |
||
442 | 438 | $option_req_index=$this->_get_option_req_data_index($option_ID); |
443 | 439 | if($option_req_index!==FALSE){ |
444 | 440 | $option->save($this->_req_data['question_options'][$option_req_index]); |
445 | - }else{ |
|
441 | + } else{ |
|
446 | 442 | //not found, remove it |
447 | 443 | $option->delete(); |
448 | 444 | } |
@@ -519,7 +515,7 @@ discard block |
||
519 | 515 | 'QSG_name'=>array('LIKE',"%$search_string%"), |
520 | 516 | 'QSG_desc'=>array('LIKE',"%$search_string%")) |
521 | 517 | ); |
522 | - }else{ |
|
518 | + } else{ |
|
523 | 519 | $query_params[0]=array( |
524 | 520 | 'QST_display_text'=>array('LIKE',"%$search_string%") |
525 | 521 | ); |
@@ -575,7 +571,7 @@ discard block |
||
575 | 571 | if ($count){ |
576 | 572 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
577 | 573 | $results = $QST->count($where); |
578 | - }else{ |
|
574 | + } else{ |
|
579 | 575 | $results = $QST->get_all($query_params); |
580 | 576 | } |
581 | 577 | return $results; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | - public function __construct( $routing = TRUE ) { |
|
62 | - require_once( EE_MODELS . 'EEM_Question.model.php' ); |
|
63 | - require_once( EE_MODELS . 'EEM_Question_Group.model.php' ); |
|
64 | - $this->_question_model= EEM_Question::instance(); |
|
65 | - $this->_question_group_model=EEM_Question_Group::instance(); |
|
66 | - parent::__construct( $routing ); |
|
61 | + public function __construct($routing = TRUE) { |
|
62 | + require_once(EE_MODELS.'EEM_Question.model.php'); |
|
63 | + require_once(EE_MODELS.'EEM_Question_Group.model.php'); |
|
64 | + $this->_question_model = EEM_Question::instance(); |
|
65 | + $this->_question_group_model = EEM_Question_Group::instance(); |
|
66 | + parent::__construct($routing); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | |
99 | 99 | protected function _set_page_routes() { |
100 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
100 | + $qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
101 | 101 | $this->_page_routes = array( |
102 | 102 | 'default' => array( |
103 | 103 | 'func' => '_questions_overview_list_table', |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | 'update_question' => array( |
120 | 120 | 'func' => '_insert_or_update_question', |
121 | - 'args' => array('new_question' => FALSE ), |
|
121 | + 'args' => array('new_question' => FALSE), |
|
122 | 122 | 'capability' => 'ee_edit_question', |
123 | 123 | 'obj_id' => $qst_id, |
124 | 124 | 'noheader' => TRUE, |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'filename' => 'registration_form_questions_overview_views_bulk_actions_search' |
154 | 154 | ) |
155 | 155 | ), |
156 | - 'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'), |
|
156 | + 'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'), |
|
157 | 157 | 'require_nonce' => FALSE, |
158 | 158 | 'qtips' => array( |
159 | 159 | 'EE_Registration_Form_Tips' |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'filename' => 'registration_form_question_groups' |
173 | 173 | ), |
174 | 174 | ), |
175 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
175 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
176 | 176 | 'require_nonce' => FALSE |
177 | 177 | ), |
178 | 178 | |
@@ -181,16 +181,16 @@ discard block |
||
181 | 181 | 'label' => __('Edit Question', 'event_espresso'), |
182 | 182 | 'order' => 15, |
183 | 183 | 'persistent' => FALSE, |
184 | - 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
184 | + 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
185 | 185 | ), |
186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
187 | 187 | 'help_tabs' => array( |
188 | 188 | 'registration_form_edit_question_group_help_tab' => array( |
189 | 189 | 'title' => __('Edit Question', 'event_espresso'), |
190 | 190 | 'filename' => 'registration_form_edit_question' |
191 | 191 | ), |
192 | 192 | ), |
193 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
193 | + 'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'), |
|
194 | 194 | 'require_nonce' => FALSE |
195 | 195 | ), |
196 | 196 | ); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | //none of the below group are currently used for Event Categories |
219 | 219 | protected function _add_feature_pointers() {} |
220 | 220 | public function load_scripts_styles() { |
221 | - wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
221 | + wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
222 | 222 | wp_enqueue_style('espresso_registration'); |
223 | 223 | } |
224 | 224 | public function admin_init() {} |
@@ -234,20 +234,20 @@ discard block |
||
234 | 234 | |
235 | 235 | public function load_scripts_styles_add_question() { |
236 | 236 | $this->load_scripts_styles_forms(); |
237 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
238 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
237 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
238 | + wp_enqueue_script('espresso_registration_form_single'); |
|
239 | 239 | } |
240 | 240 | public function load_scripts_styles_edit_question() { |
241 | 241 | $this->load_scripts_styles_forms(); |
242 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
243 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
242 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
243 | + wp_enqueue_script('espresso_registration_form_single'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
247 | 247 | |
248 | 248 | |
249 | 249 | public function recaptcha_info_help_tab() { |
250 | - $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php'; |
|
250 | + $template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php'; |
|
251 | 251 | EEH_Template::display_template($template, array()); |
252 | 252 | } |
253 | 253 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | ) |
280 | 280 | ); |
281 | 281 | |
282 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
282 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
283 | 283 | $this->_views['trash'] = array( |
284 | 284 | 'slug' => 'trash', |
285 | 285 | 'label' => __('Trash', 'event_espresso'), |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | */ |
298 | 298 | protected function _questions_groups_preview() { |
299 | 299 | $this->_admin_page_title = __('Question Groups (Preview)', 'event_espresso'); |
300 | - $this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />'; |
|
301 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>'; |
|
302 | - $this->display_admin_caf_preview_page( 'question_groups_tab' ); |
|
300 | + $this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />'; |
|
301 | + $this->_template_args['preview_text'] = '<strong>'.__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>'; |
|
302 | + $this->display_admin_caf_preview_page('question_groups_tab'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -310,58 +310,58 @@ discard block |
||
310 | 310 | * @param \EEM_Base $model |
311 | 311 | * @return array where each key is the name of a model's field/db column, and each value is its value. |
312 | 312 | */ |
313 | - protected function _set_column_values_for(EEM_Base $model){ |
|
314 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
315 | - $set_column_values=array(); |
|
313 | + protected function _set_column_values_for(EEM_Base $model) { |
|
314 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
315 | + $set_column_values = array(); |
|
316 | 316 | |
317 | 317 | //some initial checks for proper values. |
318 | 318 | //if QST_admin_only, then no matter what QST_required is we disable. |
319 | - if ( !empty( $this->_req_data['QST_admin_only'] ) ) { |
|
319 | + if ( ! empty($this->_req_data['QST_admin_only'])) { |
|
320 | 320 | $this->_req_data['QST_required'] = 0; |
321 | 321 | } |
322 | - foreach($model->field_settings() as $fieldName=>$settings){ |
|
322 | + foreach ($model->field_settings() as $fieldName=>$settings) { |
|
323 | 323 | // basically if QSG_identifier is empty or not set |
324 | - if ( $fieldName == 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) { |
|
325 | - $QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ; |
|
326 | - $set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid(); |
|
324 | + if ($fieldName == 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) { |
|
325 | + $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : ''; |
|
326 | + $set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid(); |
|
327 | 327 | // dd($set_column_values); |
328 | 328 | } |
329 | 329 | //if the admin label is blank, use a slug version of the question text |
330 | - else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
|
331 | - $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
|
332 | - $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
|
330 | + else if ($fieldName == 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) { |
|
331 | + $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : ''; |
|
332 | + $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10)); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
336 | - else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
336 | + else if ($fieldName == 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) { |
|
337 | 337 | $set_column_values[$fieldName] = 0; |
338 | 338 | } |
339 | 339 | |
340 | - else if ( $fieldName == 'QST_max' ) { |
|
340 | + else if ($fieldName == 'QST_max') { |
|
341 | 341 | $qst_system = EEM_Question::instance()->get_var( |
342 | 342 | array( |
343 | 343 | array( |
344 | - 'QST_ID' => isset( $this->_req_data[ 'QST_ID' ] ) ? $this->_req_data[ 'QST_ID' ] : 0 |
|
344 | + 'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0 |
|
345 | 345 | ) |
346 | 346 | ), |
347 | 347 | 'QST_system' ); |
348 | - $max_max = EEM_Question::instance()->absolute_max_for_system_question( $qst_system ); |
|
349 | - if( empty( $this->_req_data[ 'QST_max' ] ) || |
|
350 | - $this->_req_data[ 'QST_max' ] > $max_max ) { |
|
351 | - $set_column_values[ $fieldName ] = $max_max; |
|
348 | + $max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system); |
|
349 | + if (empty($this->_req_data['QST_max']) || |
|
350 | + $this->_req_data['QST_max'] > $max_max) { |
|
351 | + $set_column_values[$fieldName] = $max_max; |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | 356 | //only add a property to the array if it's not null (otherwise the model should just use the default value) |
357 | - if( |
|
358 | - ! isset( $set_column_values[ $fieldName ] ) && |
|
359 | - isset($this->_req_data[$fieldName] ) ){ |
|
360 | - $set_column_values[$fieldName]=$this->_req_data[$fieldName]; |
|
357 | + if ( |
|
358 | + ! isset($set_column_values[$fieldName]) && |
|
359 | + isset($this->_req_data[$fieldName]) ) { |
|
360 | + $set_column_values[$fieldName] = $this->_req_data[$fieldName]; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | } |
364 | - return $set_column_values;//validation fo this data to be performed by the model before insertion. |
|
364 | + return $set_column_values; //validation fo this data to be performed by the model before insertion. |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -379,30 +379,30 @@ discard block |
||
379 | 379 | /** |
380 | 380 | * @param string $action |
381 | 381 | */ |
382 | - protected function _edit_question( $action= 'add' ) { |
|
383 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
384 | - $ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE; |
|
382 | + protected function _edit_question($action = 'add') { |
|
383 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
384 | + $ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE; |
|
385 | 385 | |
386 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
386 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
387 | 387 | // add PRC_ID to title if editing |
388 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
389 | - if($ID){ |
|
390 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
391 | - $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
388 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
389 | + if ($ID) { |
|
390 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
391 | + $additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
392 | 392 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
393 | - }else{ |
|
394 | - $question= EE_Question::new_instance(); |
|
393 | + } else { |
|
394 | + $question = EE_Question::new_instance(); |
|
395 | 395 | $question->set_order_to_latest(); |
396 | 396 | $this->_set_add_edit_form_tags('insert_question'); |
397 | 397 | } |
398 | - $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types(); |
|
399 | - $this->_template_args['QST_ID']=$ID; |
|
400 | - $this->_template_args['question']=$question; |
|
401 | - $this->_template_args['question_types']= $question_types; |
|
402 | - $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
398 | + $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types(); |
|
399 | + $this->_template_args['QST_ID'] = $ID; |
|
400 | + $this->_template_args['question'] = $question; |
|
401 | + $this->_template_args['question_types'] = $question_types; |
|
402 | + $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
403 | 403 | |
404 | - $this->_set_publish_post_box_vars( 'id', $ID ); |
|
405 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
404 | + $this->_set_publish_post_box_vars('id', $ID); |
|
405 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE); |
|
406 | 406 | |
407 | 407 | // the details template wrapper |
408 | 408 | $this->display_admin_page_with_sidebar(); |
@@ -414,58 +414,58 @@ discard block |
||
414 | 414 | * @param bool|true $new_question |
415 | 415 | * @throws \EE_Error |
416 | 416 | */ |
417 | - protected function _insert_or_update_question( $new_question = TRUE) { |
|
418 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
419 | - $set_column_values=$this->_set_column_values_for($this->_question_model); |
|
420 | - if($new_question){ |
|
421 | - $ID=$this->_question_model->insert($set_column_values); |
|
417 | + protected function _insert_or_update_question($new_question = TRUE) { |
|
418 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
419 | + $set_column_values = $this->_set_column_values_for($this->_question_model); |
|
420 | + if ($new_question) { |
|
421 | + $ID = $this->_question_model->insert($set_column_values); |
|
422 | 422 | $success = $ID ? true : false; |
423 | 423 | $action_desc = 'added'; |
424 | - }else{ |
|
425 | - $ID=absint($this->_req_data['QST_ID']); |
|
426 | - $pk=$this->_question_model->primary_key_name(); |
|
427 | - $wheres=array($pk=>$ID); |
|
424 | + } else { |
|
425 | + $ID = absint($this->_req_data['QST_ID']); |
|
426 | + $pk = $this->_question_model->primary_key_name(); |
|
427 | + $wheres = array($pk=>$ID); |
|
428 | 428 | unset($set_column_values[$pk]); |
429 | - $success= $this->_question_model->update($set_column_values,array($wheres)); |
|
430 | - $action_desc='updated'; |
|
429 | + $success = $this->_question_model->update($set_column_values, array($wheres)); |
|
430 | + $action_desc = 'updated'; |
|
431 | 431 | } |
432 | 432 | |
433 | - if ($ID){ |
|
433 | + if ($ID) { |
|
434 | 434 | //save the related options |
435 | 435 | //trash removed options, save old ones |
436 | 436 | //get list of all options |
437 | 437 | /** @type EE_Question $question */ |
438 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
439 | - $options=$question->options(); |
|
440 | - if(! empty($options)){ |
|
441 | - foreach($options as $option_ID=>$option){ |
|
442 | - $option_req_index=$this->_get_option_req_data_index($option_ID); |
|
443 | - if($option_req_index!==FALSE){ |
|
438 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
439 | + $options = $question->options(); |
|
440 | + if ( ! empty($options)) { |
|
441 | + foreach ($options as $option_ID=>$option) { |
|
442 | + $option_req_index = $this->_get_option_req_data_index($option_ID); |
|
443 | + if ($option_req_index !== FALSE) { |
|
444 | 444 | $option->save($this->_req_data['question_options'][$option_req_index]); |
445 | - }else{ |
|
445 | + } else { |
|
446 | 446 | //not found, remove it |
447 | 447 | $option->delete(); |
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
451 | 451 | //save new related options |
452 | - foreach($this->_req_data['question_options'] as $index=>$option_req_data){ |
|
453 | - if( empty($option_req_data['QSO_ID'] ) && ( ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it! |
|
454 | - if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === '' ){ |
|
455 | - $option_req_data['QSO_value']=$option_req_data['QSO_desc']; |
|
452 | + foreach ($this->_req_data['question_options'] as $index=>$option_req_data) { |
|
453 | + if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it! |
|
454 | + if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') { |
|
455 | + $option_req_data['QSO_value'] = $option_req_data['QSO_desc']; |
|
456 | 456 | } |
457 | - $new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
457 | + $new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
458 | 458 | $new_option->save(); |
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
462 | - $query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID ); |
|
463 | - if ( $success !== FALSE ) { |
|
464 | - $msg = $new_question ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() ); |
|
465 | - EE_Error::add_success( $msg ); |
|
462 | + $query_args = array('action' => 'edit_question', 'QST_ID' => $ID); |
|
463 | + if ($success !== FALSE) { |
|
464 | + $msg = $new_question ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name()); |
|
465 | + EE_Error::add_success($msg); |
|
466 | 466 | } |
467 | 467 | |
468 | - $this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE); |
|
468 | + $this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
@@ -478,10 +478,10 @@ discard block |
||
478 | 478 | * @param int $ID of the question option to find |
479 | 479 | * @return int index in question_options array if successful, FALSE if unsuccessful |
480 | 480 | */ |
481 | - protected function _get_option_req_data_index($ID){ |
|
482 | - $req_data_for_question_options=$this->_req_data['question_options']; |
|
483 | - foreach($req_data_for_question_options as $num=>$option_data){ |
|
484 | - if(array_key_exists('QSO_ID',$option_data) && intval($option_data['QSO_ID'])==$ID){ |
|
481 | + protected function _get_option_req_data_index($ID) { |
|
482 | + $req_data_for_question_options = $this->_req_data['question_options']; |
|
483 | + foreach ($req_data_for_question_options as $num=>$option_data) { |
|
484 | + if (array_key_exists('QSO_ID', $option_data) && intval($option_data['QSO_ID']) == $ID) { |
|
485 | 485 | return $num; |
486 | 486 | } |
487 | 487 | } |
@@ -503,25 +503,25 @@ discard block |
||
503 | 503 | * @param int $current_page |
504 | 504 | * @return array lik EEM_Base::get_all's $query_params parameter |
505 | 505 | */ |
506 | - protected function get_query_params($model, $per_page=10,$current_page=10){ |
|
506 | + protected function get_query_params($model, $per_page = 10, $current_page = 10) { |
|
507 | 507 | $query_params = array(); |
508 | - $offset=($current_page-1)*$per_page; |
|
509 | - $query_params['limit']=array($offset,$per_page); |
|
510 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
508 | + $offset = ($current_page - 1) * $per_page; |
|
509 | + $query_params['limit'] = array($offset, $per_page); |
|
510 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
511 | 511 | $orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order'; |
512 | 512 | $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby']; |
513 | - $query_params['order_by']=array( $field_to_order_by => $order ); |
|
514 | - $search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null; |
|
515 | - if(! empty($search_string)){ |
|
516 | - if($model instanceof EEM_Question_Group){ |
|
517 | - $query_params[0]=array( |
|
513 | + $query_params['order_by'] = array($field_to_order_by => $order); |
|
514 | + $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null; |
|
515 | + if ( ! empty($search_string)) { |
|
516 | + if ($model instanceof EEM_Question_Group) { |
|
517 | + $query_params[0] = array( |
|
518 | 518 | 'OR'=>array( |
519 | - 'QSG_name'=>array('LIKE',"%$search_string%"), |
|
520 | - 'QSG_desc'=>array('LIKE',"%$search_string%")) |
|
519 | + 'QSG_name'=>array('LIKE', "%$search_string%"), |
|
520 | + 'QSG_desc'=>array('LIKE', "%$search_string%")) |
|
521 | 521 | ); |
522 | - }else{ |
|
523 | - $query_params[0]=array( |
|
524 | - 'QST_display_text'=>array('LIKE',"%$search_string%") |
|
522 | + } else { |
|
523 | + $query_params[0] = array( |
|
524 | + 'QST_display_text'=>array('LIKE', "%$search_string%") |
|
525 | 525 | ); |
526 | 526 | } |
527 | 527 | } |
@@ -569,13 +569,13 @@ discard block |
||
569 | 569 | * @param bool|false $count |
570 | 570 | * @return \EE_Soft_Delete_Base_Class[]|int |
571 | 571 | */ |
572 | - public function get_questions( $per_page=10, $current_page = 1, $count = FALSE ) { |
|
572 | + public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) { |
|
573 | 573 | $QST = EEM_Question::instance(); |
574 | 574 | $query_params = $this->get_query_params($QST, $per_page, $current_page); |
575 | - if ($count){ |
|
576 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
575 | + if ($count) { |
|
576 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
577 | 577 | $results = $QST->count($where); |
578 | - }else{ |
|
578 | + } else { |
|
579 | 579 | $results = $QST->get_all($query_params); |
580 | 580 | } |
581 | 581 | return $results; |
@@ -590,10 +590,10 @@ discard block |
||
590 | 590 | * @param bool|false $count |
591 | 591 | * @return \EE_Soft_Delete_Base_Class[]|int |
592 | 592 | */ |
593 | - public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) { |
|
594 | - $query_params =$this->get_query_params( EEM_Question::instance(), $per_page, $current_page); |
|
595 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
596 | - $questions =$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
593 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
594 | + $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
|
595 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
596 | + $questions = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
597 | 597 | return $questions; |
598 | 598 | } |
599 | 599 | |
@@ -605,11 +605,11 @@ discard block |
||
605 | 605 | * @param bool|false $count |
606 | 606 | * @return \EE_Soft_Delete_Base_Class[] |
607 | 607 | */ |
608 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
608 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
609 | 609 | /** @type EEM_Question_Group $questionGroupModel */ |
610 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
611 | - $query_params=$this->get_query_params( $questionGroupModel, $per_page, $current_page ); |
|
612 | - $questionGroups=$questionGroupModel->get_all($query_params);//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
|
610 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
611 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
612 | + $questionGroups = $questionGroupModel->get_all($query_params); //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
|
613 | 613 | return $questionGroups; |
614 | 614 | } |
615 | 615 | |
@@ -626,36 +626,36 @@ discard block |
||
626 | 626 | |
627 | 627 | $this->_template_args['values'] = $this->_yes_no_values; |
628 | 628 | |
629 | - $this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
630 | - $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': ''; |
|
629 | + $this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
630 | + $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : ''; |
|
631 | 631 | |
632 | - $this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''; |
|
633 | - $this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''; |
|
634 | - $this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500; |
|
632 | + $this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''; |
|
633 | + $this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''; |
|
634 | + $this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500; |
|
635 | 635 | |
636 | 636 | $this->_template_args['recaptcha_theme_options'] = array( |
637 | - array('id' => 'red','text'=> __('Red', 'event_espresso')), |
|
638 | - array('id' => 'white','text'=> __('White', 'event_espresso')), |
|
639 | - array('id' => 'blackglass','text'=> __('Blackglass', 'event_espresso')), |
|
640 | - array('id' => 'clean','text'=> __('Clean', 'event_espresso')) |
|
637 | + array('id' => 'red', 'text'=> __('Red', 'event_espresso')), |
|
638 | + array('id' => 'white', 'text'=> __('White', 'event_espresso')), |
|
639 | + array('id' => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')), |
|
640 | + array('id' => 'clean', 'text'=> __('Clean', 'event_espresso')) |
|
641 | 641 | ); |
642 | - $this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean'; |
|
642 | + $this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean'; |
|
643 | 643 | |
644 | 644 | $this->_template_args['recaptcha_language_options'] = array( |
645 | - array('id' => 'en','text'=> __('English', 'event_espresso')), |
|
646 | - array('id' => 'es','text'=> __('Spanish', 'event_espresso')), |
|
647 | - array('id' => 'nl','text'=> __('Dutch', 'event_espresso')), |
|
648 | - array('id' => 'fr','text'=> __('French', 'event_espresso')), |
|
649 | - array('id' => 'de','text'=> __('German', 'event_espresso')), |
|
650 | - array('id' => 'pt','text'=> __('Portuguese', 'event_espresso')), |
|
651 | - array('id' => 'ru','text'=> __('Russian', 'event_espresso')), |
|
652 | - array('id' => 'tr','text'=> __('Turkish', 'event_espresso')) |
|
645 | + array('id' => 'en', 'text'=> __('English', 'event_espresso')), |
|
646 | + array('id' => 'es', 'text'=> __('Spanish', 'event_espresso')), |
|
647 | + array('id' => 'nl', 'text'=> __('Dutch', 'event_espresso')), |
|
648 | + array('id' => 'fr', 'text'=> __('French', 'event_espresso')), |
|
649 | + array('id' => 'de', 'text'=> __('German', 'event_espresso')), |
|
650 | + array('id' => 'pt', 'text'=> __('Portuguese', 'event_espresso')), |
|
651 | + array('id' => 'ru', 'text'=> __('Russian', 'event_espresso')), |
|
652 | + array('id' => 'tr', 'text'=> __('Turkish', 'event_espresso')) |
|
653 | 653 | ); |
654 | - $this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
654 | + $this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
655 | 655 | |
656 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
657 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
658 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
656 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
657 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
658 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
659 | 659 | $this->display_admin_page_with_sidebar(); |
660 | 660 | } |
661 | 661 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | <tbody> |
22 | 22 | <tr> |
23 | 23 | <th> |
24 | - <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?> |
|
24 | + <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?> |
|
25 | 25 | </th> |
26 | 26 | <td> |
27 | 27 | <input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/> |
@@ -31,23 +31,23 @@ discard block |
||
31 | 31 | |
32 | 32 | <tr> |
33 | 33 | <th> |
34 | - <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?> |
|
34 | + <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?> |
|
35 | 35 | </th> |
36 | 36 | <td> |
37 | 37 | <?php |
38 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
39 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
38 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
39 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
40 | 40 | ?> |
41 | 41 | <input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/> |
42 | 42 | <input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" /> |
43 | - <?php if ( ! empty( $QST_system )) { ?> |
|
43 | + <?php if ( ! empty($QST_system)) { ?> |
|
44 | 44 | <input type="hidden" id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/> |
45 | 45 | <?php } ?> |
46 | 46 | <br/> |
47 | 47 | <p class="description"> |
48 | - <?php if ( ! empty( $QST_system )) { ?> |
|
48 | + <?php if ( ! empty($QST_system)) { ?> |
|
49 | 49 | <span class="description" style="color:#D54E21;"> |
50 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
50 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
51 | 51 | </span> |
52 | 52 | <?php } ?> |
53 | 53 | |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | |
58 | 58 | <tr> |
59 | 59 | <th> |
60 | - <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?> |
|
60 | + <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?> |
|
61 | 61 | </th> |
62 | 62 | <td> |
63 | 63 | <?php |
64 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
65 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
64 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
65 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
66 | 66 | $admin_only = $question->get('QST_admin_only'); |
67 | - $checked = !empty( $admin_only ) ? ' checked="checked"' : ''; |
|
67 | + $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
68 | 68 | ?> |
69 | 69 | <input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/> |
70 | 70 | <br/> |
71 | 71 | <p class="description"> |
72 | - <?php if ( ! empty( $QST_system )) { ?> |
|
72 | + <?php if ( ! empty($QST_system)) { ?> |
|
73 | 73 | <span class="description" style="color:#D54E21;"> |
74 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
74 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
75 | 75 | </span> |
76 | 76 | <?php } ?> |
77 | 77 | |
@@ -81,21 +81,21 @@ discard block |
||
81 | 81 | |
82 | 82 | <tr> |
83 | 83 | <th> |
84 | - <label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?> |
|
84 | + <label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?> |
|
85 | 85 | </th> |
86 | 86 | <td> |
87 | 87 | <?php |
88 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
89 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
90 | - echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled ); |
|
91 | - if( ! empty( $QST_system ) ) { ?> |
|
88 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
89 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
90 | + echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled); |
|
91 | + if ( ! empty($QST_system)) { ?> |
|
92 | 92 | <input type="hidden" id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/> |
93 | 93 | <?php |
94 | - $explanatory_text = __('System question! This field cannot be changed.','event_espresso'); |
|
95 | - }else{ |
|
96 | - $explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso'); |
|
94 | + $explanatory_text = __('System question! This field cannot be changed.', 'event_espresso'); |
|
95 | + } else { |
|
96 | + $explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso'); |
|
97 | 97 | } |
98 | - if ( ! empty( $QST_system ) || $has_answers ) { ?> |
|
98 | + if ( ! empty($QST_system) || $has_answers) { ?> |
|
99 | 99 | <p><span class="description" style="color:#D54E21;"> |
100 | 100 | <?php echo $explanatory_text; ?> |
101 | 101 | </span></p> |
@@ -108,22 +108,22 @@ discard block |
||
108 | 108 | <tr id="text_input_question_options"> |
109 | 109 | <th> |
110 | 110 | <label> |
111 | - <?php _e( 'Maximum Allowed Response Size', 'event_espresso' );?> |
|
111 | + <?php _e('Maximum Allowed Response Size', 'event_espresso'); ?> |
|
112 | 112 | </label> |
113 | 113 | </th> |
114 | 114 | <td> |
115 | - <input id="QST_max" name="QST_max" type="number" <?php echo $max_max == EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1"> |
|
115 | + <input id="QST_max" name="QST_max" type="number" <?php echo $max_max == EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1"> |
|
116 | 116 | <p> |
117 | 117 | <span class="description"> |
118 | - <?php _e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?> |
|
118 | + <?php _e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?> |
|
119 | 119 | </span> |
120 | 120 | </p> |
121 | - <?php if ( $QST_system ) { ?> |
|
121 | + <?php if ($QST_system) { ?> |
|
122 | 122 | <p> |
123 | 123 | <span class="description" style="color:#D54E21;"> |
124 | 124 | <?php printf( |
125 | - __( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ), |
|
126 | - $max_max );?> |
|
125 | + __('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'), |
|
126 | + $max_max ); ?> |
|
127 | 127 | </span> |
128 | 128 | </p> |
129 | 129 | <?php } ?> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | <tr id="question_options"> |
133 | 133 | <th> |
134 | 134 | <label> |
135 | - <?php _e('Answer Options','event_espresso')?> |
|
135 | + <?php _e('Answer Options', 'event_espresso')?> |
|
136 | 136 | </label> |
137 | 137 | </th> |
138 | 138 | <td> |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | <thead> |
142 | 142 | <tr> |
143 | 143 | <th class="option-value-header"> |
144 | - <?php _e('Value','event_espresso')?> |
|
144 | + <?php _e('Value', 'event_espresso')?> |
|
145 | 145 | </th> |
146 | 146 | <th class="option-desc-header"> |
147 | - <?php _e('Description (optional, only shown on registration form)','event_espresso')?> |
|
147 | + <?php _e('Description (optional, only shown on registration form)', 'event_espresso')?> |
|
148 | 148 | </th> |
149 | 149 | <th> |
150 | 150 | </th> |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | </tr> |
168 | 168 | |
169 | 169 | <?php |
170 | - $count=0; |
|
170 | + $count = 0; |
|
171 | 171 | $question_options = $question->options(); |
172 | - if ( ! empty( $question_options )) { |
|
173 | - foreach( $question_options as $option_id => $option ) { |
|
174 | - $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
172 | + if ( ! empty($question_options)) { |
|
173 | + foreach ($question_options as $option_id => $option) { |
|
174 | + $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
175 | 175 | ?> |
176 | 176 | <tr class="question-option ee-options-sortable"> |
177 | 177 | <td class="option-value-cell"> |
178 | 178 | <input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>"> |
179 | 179 | <input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php $option->f('QSO_value')?>"<?php echo $disabled; ?>> |
180 | - <?php if ( $has_answers ) : ?> |
|
180 | + <?php if ($has_answers) : ?> |
|
181 | 181 | <input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" > |
182 | 182 | <?php endif; ?> |
183 | 183 | </td> |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | <input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>"> |
186 | 186 | </td> |
187 | 187 | <td> |
188 | - <?php if ( ! $option->system() ) { ?> |
|
188 | + <?php if ( ! $option->system()) { ?> |
|
189 | 189 | <span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span> |
190 | 190 | <?php } ?> |
191 | 191 | <span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span> |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | </table> |
225 | 225 | |
226 | 226 | <a id="new-question-option" class="button" style="margin:0 0 1em 3px;"> |
227 | - <?php _e('Add Another Answer Option','event_espresso')?> |
|
227 | + <?php _e('Add Another Answer Option', 'event_espresso')?> |
|
228 | 228 | </a><br/> |
229 | 229 | |
230 | 230 | <p class="description"> |
231 | - <?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?> |
|
231 | + <?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?> |
|
232 | 232 | </p> |
233 | - <?php if ( $has_answers ) : ?> |
|
233 | + <?php if ($has_answers) : ?> |
|
234 | 234 | <p class="description" style="color:#D54E21;"> |
235 | 235 | <?php _e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?> |
236 | 236 | </p> |
@@ -241,32 +241,32 @@ discard block |
||
241 | 241 | |
242 | 242 | <tr> |
243 | 243 | <th> |
244 | - <label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?> |
|
244 | + <label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?> |
|
245 | 245 | </th> |
246 | 246 | <td> |
247 | 247 | <?php |
248 | - $system_required = array( 'fname', 'email' ); |
|
249 | - $disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : ''; |
|
248 | + $system_required = array('fname', 'email'); |
|
249 | + $disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
250 | 250 | $required_on = $question->get('QST_admin_only'); |
251 | 251 | $show_required_msg = $required_on ? '' : ' display:none;'; |
252 | - $disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : ''; |
|
253 | - $id = ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : ''; |
|
254 | - $requiredOptions=array( |
|
255 | - array('text'=>'Optional','id'=>0), |
|
256 | - array('text'=>'Required','id'=>1) |
|
252 | + $disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : ''; |
|
253 | + $id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
254 | + $requiredOptions = array( |
|
255 | + array('text'=>'Optional', 'id'=>0), |
|
256 | + array('text'=>'Required', 'id'=>1) |
|
257 | 257 | ); |
258 | - echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled ); |
|
258 | + echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled); |
|
259 | 259 | ?> |
260 | 260 | <p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>"> |
261 | - <?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?> |
|
261 | + <?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?> |
|
262 | 262 | </span></p> |
263 | 263 | <p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
264 | - <?php _e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?> |
|
264 | + <?php _e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?> |
|
265 | 265 | </span></p> |
266 | - <?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?> |
|
266 | + <?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?> |
|
267 | 267 | <input type="hidden" id="QST_required" name="QST_required" value="1"/> |
268 | 268 | <p><span class="description" style="color:#D54E21;"> |
269 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
269 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
270 | 270 | </span></p> |
271 | 271 | <?php } ?> |
272 | 272 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | <tr> |
277 | 277 | <th> |
278 | - <label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?> |
|
278 | + <label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
279 | 279 | </th> |
280 | 280 | <td> |
281 | 281 | <input type="text" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php $question->f('QST_required_text')?>"/> |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once( EE_CLASSES . 'EE_Question.class.php'); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Question extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -69,21 +69,21 @@ discard block |
||
69 | 69 | // private instance of the Attendee object |
70 | 70 | protected static $_instance = NULL; |
71 | 71 | |
72 | - protected function __construct( $timezone = NULL ) { |
|
73 | - $this->singular_item = __('Question','event_espresso'); |
|
74 | - $this->plural_item = __('Questions','event_espresso'); |
|
75 | - $this->_allowed_question_types=apply_filters( |
|
72 | + protected function __construct($timezone = NULL) { |
|
73 | + $this->singular_item = __('Question', 'event_espresso'); |
|
74 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
75 | + $this->_allowed_question_types = apply_filters( |
|
76 | 76 | 'FHEE__EEM_Question__construct__allowed_question_types', |
77 | 77 | array( |
78 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
79 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
80 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
81 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
82 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
83 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
84 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
85 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
86 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
78 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
79 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
80 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
81 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
82 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
83 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
84 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
85 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
86 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | $this->_question_type_categories = apply_filters( |
@@ -102,22 +102,22 @@ discard block |
||
102 | 102 | ); |
103 | 103 | |
104 | 104 | $this->_tables = array( |
105 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
105 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
106 | 106 | ); |
107 | 107 | $this->_fields = array( |
108 | 108 | 'Question'=>array( |
109 | - 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
110 | - 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
111 | - 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
|
112 | - 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ), |
|
113 | - 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
114 | - 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
115 | - 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
116 | - 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
117 | - 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
118 | - 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
|
119 | - 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
120 | - 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
109 | + 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
110 | + 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
111 | + 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
112 | + 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL), |
|
113 | + 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
114 | + 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
115 | + 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
116 | + 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
117 | + 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
118 | + 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), |
|
119 | + 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
120 | + 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
121 | 121 | ) |
122 | 122 | ); |
123 | 123 | $this->_model_relations = array( |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
130 | 130 | ); |
131 | 131 | //this model is generally available for reading |
132 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
133 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
134 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
135 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
136 | - parent::__construct( $timezone ); |
|
132 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
133 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
134 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
135 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
136 | + parent::__construct($timezone); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * but they can be extended |
142 | 142 | * @return string[] |
143 | 143 | */ |
144 | - public function allowed_question_types(){ |
|
144 | + public function allowed_question_types() { |
|
145 | 145 | return $this->_allowed_question_types; |
146 | 146 | } |
147 | 147 | /** |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | * @param string $question_type one of EEM_Question::allowed_question_types( |
150 | 150 | * @return string[] like EEM_Question::allowed_question_types() |
151 | 151 | */ |
152 | - public function question_types_in_same_category( $question_type ) { |
|
153 | - $question_types = array( $question_type ); |
|
154 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
155 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
152 | + public function question_types_in_same_category($question_type) { |
|
153 | + $question_types = array($question_type); |
|
154 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
155 | + if (in_array($question_type, $question_types_in_category)) { |
|
156 | 156 | $question_types = $question_types_in_category; |
157 | 157 | break; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
161 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | * @param string $category one of the top-level keys of EEM_Question::question_type_categories() |
168 | 168 | * @return boolean |
169 | 169 | */ |
170 | - public function question_type_is_in_category( $question_type, $category ) { |
|
171 | - if( ! isset( $this->_question_type_categories[ $category ] ) ) { |
|
170 | + public function question_type_is_in_category($question_type, $category) { |
|
171 | + if ( ! isset($this->_question_type_categories[$category])) { |
|
172 | 172 | return false; |
173 | 173 | } |
174 | - return in_array( $question_type, $this->_question_type_categories[ $category ] ); |
|
174 | + return in_array($question_type, $this->_question_type_categories[$category]); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | * @param string $system_question_group_id QSG_system |
189 | 189 | * @return array of system question names (QST_system) |
190 | 190 | */ |
191 | - public function allowed_system_questions_in_system_question_group( $system_question_group_id ) { |
|
191 | + public function allowed_system_questions_in_system_question_group($system_question_group_id) { |
|
192 | 192 | $question_system_ids = array(); |
193 | - switch( $system_question_group_id ) { |
|
193 | + switch ($system_question_group_id) { |
|
194 | 194 | case EEM_Question_Group::system_personal: |
195 | 195 | $question_system_ids = array( |
196 | 196 | EEM_Attendee::system_question_fname, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | ); |
212 | 212 | break; |
213 | 213 | } |
214 | - return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id ); |
|
214 | + return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | * @param string $system_question_group_id QSG_system |
221 | 221 | * @return array of system question names (QST_system) |
222 | 222 | */ |
223 | - public function required_system_questions_in_system_question_group( $system_question_group_id ) { |
|
223 | + public function required_system_questions_in_system_question_group($system_question_group_id) { |
|
224 | 224 | $question_system_ids = null; |
225 | - switch( $system_question_group_id ) { |
|
225 | + switch ($system_question_group_id) { |
|
226 | 226 | case EEM_Question_Group::system_personal: |
227 | - $question_system_ids = array( |
|
227 | + $question_system_ids = array( |
|
228 | 228 | EEM_Attendee::system_question_fname, |
229 | 229 | EEM_Attendee::system_question_email, |
230 | 230 | ); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | default: |
233 | 233 | $question_system_ids = array(); |
234 | 234 | } |
235 | - return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id ); |
|
235 | + return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @param $QST_system |
244 | 244 | * @return int of QST_ID for the question that corresponds to that QST_system |
245 | 245 | */ |
246 | - public function get_Question_ID_from_system_string( $QST_system ){ |
|
247 | - return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
|
246 | + public function get_Question_ID_from_system_string($QST_system) { |
|
247 | + return $this->get_var(array(array('QST_system' => $QST_system))); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function get_latest_question_order() { |
258 | 258 | $columns_to_select = array( |
259 | - 'max_order' => array("MAX(QST_order)","%d") |
|
259 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
260 | 260 | ); |
261 | - $max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select ); |
|
261 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
262 | 262 | return $max[0]['max_order']; |
263 | 263 | } |
264 | 264 | |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | * @param string $system_question_value |
289 | 289 | * @return int|float |
290 | 290 | */ |
291 | - public function absolute_max_for_system_question( $system_question_value ) { |
|
291 | + public function absolute_max_for_system_question($system_question_value) { |
|
292 | 292 | $maxes = $this->system_question_maxes(); |
293 | - if( isset( $maxes[ $system_question_value ] ) ) { |
|
294 | - return $maxes[ $system_question_value ]; |
|
293 | + if (isset($maxes[$system_question_value])) { |
|
294 | + return $maxes[$system_question_value]; |
|
295 | 295 | } else { |
296 | 296 | return EE_INF; |
297 | 297 | } |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * @param EE_Checkout $checkout |
38 | 38 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
39 | 39 | */ |
40 | - public function __construct( EE_Checkout $checkout ) { |
|
40 | + public function __construct(EE_Checkout $checkout) { |
|
41 | 41 | $this->_slug = 'attendee_information'; |
42 | 42 | $this->_name = __('Attendee Information', 'event_espresso'); |
43 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
43 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
44 | 44 | $this->checkout = $checkout; |
45 | 45 | $this->_reset_success_message(); |
46 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
46 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
54 | 54 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
55 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
55 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
56 | 56 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
57 | 57 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
58 | 58 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | EEH_Autoloader::register_line_item_display_autoloaders(); |
86 | 86 | $Line_Item_Display = new EE_Line_Item_Display(); |
87 | 87 | // calculate taxes |
88 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
88 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
89 | 89 | EE_Registry::instance()->load_helper('Line_Item'); |
90 | 90 | /** @var $subsections EE_Form_Section_Proper[] */ |
91 | 91 | $subsections = array( |
@@ -97,33 +97,33 @@ discard block |
||
97 | 97 | 'ticket_count' => array() |
98 | 98 | ); |
99 | 99 | // grab the saved registrations from the transaction |
100 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
101 | - if ( $registrations ) { |
|
102 | - foreach ( $registrations as $registration ) { |
|
103 | - if ( $registration instanceof EE_Registration ) { |
|
100 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
101 | + if ($registrations) { |
|
102 | + foreach ($registrations as $registration) { |
|
103 | + if ($registration instanceof EE_Registration) { |
|
104 | 104 | // can this registration be processed during this visit ? |
105 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
106 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
107 | - if ( ! $this->checkout->admin_request ) { |
|
108 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
109 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
110 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
111 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
112 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
105 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
106 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
107 | + if ( ! $this->checkout->admin_request) { |
|
108 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
109 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
110 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
111 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
112 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
113 | 113 | } |
114 | - if ( $registration->is_primary_registrant() ) { |
|
114 | + if ($registration->is_primary_registrant()) { |
|
115 | 115 | $primary_registrant = $registration->reg_url_link(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | // print_copy_info ? |
121 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
121 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
122 | 122 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
123 | 123 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
124 | 124 | // generate hidden input |
125 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
126 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
125 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
126 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -135,8 +135,7 @@ discard block |
||
135 | 135 | 'html_id' => $this->reg_form_name(), |
136 | 136 | 'subsections' => $subsections, |
137 | 137 | 'layout_strategy' => $this->checkout->admin_request ? |
138 | - new EE_Div_Per_Section_Layout() : |
|
139 | - new EE_Template_Layout( |
|
138 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
140 | 139 | array( |
141 | 140 | 'layout_template_file' => $this->_template, // layout_template |
142 | 141 | 'template_args' => $template_args |
@@ -153,61 +152,61 @@ discard block |
||
153 | 152 | * @param EE_Registration $registration |
154 | 153 | * @return EE_Form_Section_Proper |
155 | 154 | */ |
156 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
157 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
155 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
156 | + EE_Registry::instance()->load_helper('Template'); |
|
158 | 157 | static $attendee_nmbr = 1; |
159 | 158 | // array of params to pass to parent constructor |
160 | 159 | $form_args = array( |
161 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
160 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
162 | 161 | 'html_class' => 'ee-reg-form-attendee-dv', |
163 | 162 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
164 | 163 | 'subsections' => array(), |
165 | 164 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
166 | 165 | array( |
167 | 166 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
168 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
167 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
169 | 168 | ) |
170 | 169 | ) |
171 | 170 | ); |
172 | 171 | // verify that registration has valid event |
173 | - if ( $registration->event() instanceof EE_Event ) { |
|
172 | + if ($registration->event() instanceof EE_Event) { |
|
174 | 173 | $query_params = array( |
175 | 174 | array( |
176 | 175 | 'Event.EVT_ID' => $registration->event()->ID(), |
177 | 176 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
178 | 177 | ), |
179 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
178 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
180 | 179 | ); |
181 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
182 | - if ( $question_groups ) { |
|
183 | - foreach ( $question_groups as $question_group ) { |
|
184 | - if ( $question_group instanceof EE_Question_Group ) { |
|
185 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
180 | + $question_groups = $registration->event()->question_groups($query_params); |
|
181 | + if ($question_groups) { |
|
182 | + foreach ($question_groups as $question_group) { |
|
183 | + if ($question_group instanceof EE_Question_Group) { |
|
184 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
186 | 185 | // add hidden input |
187 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
186 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
188 | 187 | } |
189 | 188 | } |
190 | 189 | // if we have question groups for additional attendees, then display the copy options |
191 | 190 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
192 | 191 | } else { |
193 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
192 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
194 | 193 | EEH_Template::locate_template( |
195 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
196 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
194 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
195 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
197 | 196 | TRUE, |
198 | 197 | TRUE |
199 | 198 | ) |
200 | 199 | ); |
201 | 200 | // add hidden input |
202 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
201 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
203 | 202 | } |
204 | 203 | } |
205 | - if ( $registration->is_primary_registrant() ) { |
|
204 | + if ($registration->is_primary_registrant()) { |
|
206 | 205 | // generate hidden input |
207 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
206 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
208 | 207 | } |
209 | 208 | $attendee_nmbr++; |
210 | - return new EE_Form_Section_Proper( $form_args ); |
|
209 | + return new EE_Form_Section_Proper($form_args); |
|
211 | 210 | } |
212 | 211 | |
213 | 212 | |
@@ -220,11 +219,11 @@ discard block |
||
220 | 219 | * @param bool $additional_attendee_reg_info |
221 | 220 | * @return EE_Form_Input_Base |
222 | 221 | */ |
223 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
222 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
224 | 223 | // generate hidden input |
225 | 224 | return new EE_Hidden_Input( |
226 | 225 | array( |
227 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
226 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
228 | 227 | 'default' => $additional_attendee_reg_info |
229 | 228 | ) |
230 | 229 | ); |
@@ -237,22 +236,22 @@ discard block |
||
237 | 236 | * @param EE_Question_Group $question_group |
238 | 237 | * @return EE_Form_Section_Proper |
239 | 238 | */ |
240 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
239 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
241 | 240 | // array of params to pass to parent constructor |
242 | 241 | $form_args = array( |
243 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
242 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
244 | 243 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
245 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
244 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
246 | 245 | 'subsections' => array( |
247 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
246 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
248 | 247 | ), |
249 | 248 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
250 | 249 | ); |
251 | 250 | // where params |
252 | - $query_params = array( 'QST_deleted' => 0 ); |
|
251 | + $query_params = array('QST_deleted' => 0); |
|
253 | 252 | // don't load admin only questions on the frontend |
254 | - if ( ! $this->checkout->admin_request ) { |
|
255 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
253 | + if ( ! $this->checkout->admin_request) { |
|
254 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
256 | 255 | } |
257 | 256 | $questions = $question_group->get_many_related( |
258 | 257 | 'Question', |
@@ -264,21 +263,21 @@ discard block |
||
264 | 263 | ) |
265 | 264 | ); |
266 | 265 | // filter for additional content before questions |
267 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
266 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
268 | 267 | // loop thru questions |
269 | - foreach ( $questions as $question ) { |
|
270 | - if( $question instanceof EE_Question ){ |
|
268 | + foreach ($questions as $question) { |
|
269 | + if ($question instanceof EE_Question) { |
|
271 | 270 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
272 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
271 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
273 | 272 | } |
274 | 273 | } |
275 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
274 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
276 | 275 | |
277 | 276 | // filter for additional content after questions |
278 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
277 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
279 | 278 | // d( $form_args ); |
280 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
281 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
279 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
280 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
282 | 281 | } |
283 | 282 | |
284 | 283 | |
@@ -288,12 +287,12 @@ discard block |
||
288 | 287 | * @param EE_Question_Group $question_group |
289 | 288 | * @return EE_Form_Section_HTML |
290 | 289 | */ |
291 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
290 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
292 | 291 | $html = ''; |
293 | 292 | // group_name |
294 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
293 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
295 | 294 | EE_Registry::instance()->load_helper('HTML'); |
296 | - if ( $this->checkout->admin_request ) { |
|
295 | + if ($this->checkout->admin_request) { |
|
297 | 296 | $html .= EEH_HTML::br(); |
298 | 297 | $html .= EEH_HTML::h3( |
299 | 298 | $question_group->name(), |
@@ -307,7 +306,7 @@ discard block |
||
307 | 306 | } |
308 | 307 | } |
309 | 308 | // group_desc |
310 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
309 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
311 | 310 | $html .= EEH_HTML::p( |
312 | 311 | $question_group->desc(), |
313 | 312 | '', |
@@ -315,7 +314,7 @@ discard block |
||
315 | 314 | ); |
316 | 315 | |
317 | 316 | } |
318 | - return new EE_Form_Section_HTML( $html ); |
|
317 | + return new EE_Form_Section_HTML($html); |
|
319 | 318 | } |
320 | 319 | |
321 | 320 | |
@@ -324,14 +323,14 @@ discard block |
||
324 | 323 | * @access public |
325 | 324 | * @return EE_Form_Section_Proper |
326 | 325 | */ |
327 | - private function _copy_attendee_info_form(){ |
|
326 | + private function _copy_attendee_info_form() { |
|
328 | 327 | // array of params to pass to parent constructor |
329 | 328 | return new EE_Form_Section_Proper( |
330 | 329 | array( |
331 | 330 | 'subsections' => $this->_copy_attendee_info_inputs(), |
332 | 331 | 'layout_strategy' => new EE_Template_Layout( |
333 | 332 | array( |
334 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
333 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
335 | 334 | 'begin_template_file' => NULL, |
336 | 335 | 'input_template_file' => NULL, |
337 | 336 | 'subsection_template_file' => NULL, |
@@ -353,8 +352,8 @@ discard block |
||
353 | 352 | private function _auto_copy_attendee_info() { |
354 | 353 | return new EE_Form_Section_HTML( |
355 | 354 | EEH_Template::locate_template( |
356 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
357 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
355 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
356 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
358 | 357 | TRUE, |
359 | 358 | TRUE |
360 | 359 | ) |
@@ -373,25 +372,25 @@ discard block |
||
373 | 372 | $copy_attendee_info_inputs = array(); |
374 | 373 | $prev_ticket = NULL; |
375 | 374 | // grab the saved registrations from the transaction |
376 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
377 | - foreach ( $registrations as $registration ) { |
|
375 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
376 | + foreach ($registrations as $registration) { |
|
378 | 377 | // for all attendees other than the primary attendee |
379 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
378 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
380 | 379 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
381 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
380 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
382 | 381 | $item_name = $registration->ticket()->name(); |
383 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
385 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
382 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
384 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
386 | 385 | ); |
387 | 386 | $prev_ticket = $registration->ticket()->ID(); |
388 | 387 | } |
389 | 388 | |
390 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
389 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
391 | 390 | EE_Checkbox_Multi_Input( |
392 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
391 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
393 | 392 | array( |
394 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
393 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
395 | 394 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
396 | 395 | 'display_html_label_text' => FALSE |
397 | 396 | ) |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param EE_Registration $registration |
411 | 410 | * @return EE_Form_Input_Base |
412 | 411 | */ |
413 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
412 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
414 | 413 | // generate hidden input |
415 | 414 | return new EE_Hidden_Input( |
416 | 415 | array( |
@@ -428,31 +427,31 @@ discard block |
||
428 | 427 | * @param EE_Question $question |
429 | 428 | * @return EE_Form_Input_Base |
430 | 429 | */ |
431 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
430 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
432 | 431 | |
433 | 432 | // if this question was for an attendee detail, then check for that answer |
434 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() ); |
|
433 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID()); |
|
435 | 434 | $answer = $answer_value === null |
436 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
435 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
437 | 436 | : null; |
438 | 437 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
439 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
438 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
440 | 439 | // create an EE_Answer object for storing everything in |
441 | - $answer = EE_Answer::new_instance ( array( |
|
440 | + $answer = EE_Answer::new_instance(array( |
|
442 | 441 | 'QST_ID'=> $question->ID(), |
443 | 442 | 'REG_ID'=> $registration->ID() |
444 | 443 | )); |
445 | 444 | } |
446 | 445 | // verify instance |
447 | - if( $answer instanceof EE_Answer ){ |
|
448 | - if ( ! empty( $answer_value )) { |
|
449 | - $answer->set( 'ANS_value', $answer_value ); |
|
446 | + if ($answer instanceof EE_Answer) { |
|
447 | + if ( ! empty($answer_value)) { |
|
448 | + $answer->set('ANS_value', $answer_value); |
|
450 | 449 | } |
451 | - $answer->cache( 'Question', $question ); |
|
452 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
453 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
450 | + $answer->cache('Question', $question); |
|
451 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
452 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
454 | 453 | } |
455 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
454 | + return $this->_generate_question_input($registration, $question, $answer); |
|
456 | 455 | |
457 | 456 | } |
458 | 457 | |
@@ -464,7 +463,7 @@ discard block |
||
464 | 463 | * @param mixed EE_Answer|NULL $answer |
465 | 464 | * @return EE_Form_Input_Base |
466 | 465 | */ |
467 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
466 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
468 | 467 | // d( $registration ); |
469 | 468 | // d( $question ); |
470 | 469 | // d( $answer ); |
@@ -487,29 +486,29 @@ discard block |
||
487 | 486 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
488 | 487 | |
489 | 488 | $input_constructor_args = array( |
490 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
491 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
492 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
489 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
490 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
491 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
493 | 492 | 'required' => $question->required() ? TRUE : FALSE, |
494 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
493 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
495 | 494 | 'html_label_class' => 'ee-reg-qstn', |
496 | 495 | 'html_label_text' => $question->display_text(), |
497 | 496 | 'required_validation_error_message' => $question->required_text() |
498 | 497 | ); |
499 | 498 | // has this question been answered ? |
500 | - if ( $answer instanceof EE_Answer ) { |
|
501 | - if ( $answer->ID() ) { |
|
502 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
503 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
504 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
499 | + if ($answer instanceof EE_Answer) { |
|
500 | + if ($answer->ID()) { |
|
501 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
502 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
503 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
505 | 504 | } |
506 | 505 | $input_constructor_args['default'] = $answer->value(); |
507 | 506 | } |
508 | 507 | //add "-lbl" to the end of the label id |
509 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
510 | - $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
511 | - if( EEM_Question::instance()->question_type_is_in_category( $question->type(), 'text' ) ) { |
|
512 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( |
|
508 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
509 | + $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
510 | + if (EEM_Question::instance()->question_type_is_in_category($question->type(), 'text')) { |
|
511 | + $input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( |
|
513 | 512 | null, |
514 | 513 | min( |
515 | 514 | $max_max_for_question, |
@@ -517,83 +516,83 @@ discard block |
||
517 | 516 | ) |
518 | 517 | ); |
519 | 518 | } |
520 | - $input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
519 | + $input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
521 | 520 | $input_constructor_args, |
522 | 521 | $registration, |
523 | 522 | $question, |
524 | 523 | $answer |
525 | 524 | ); |
526 | 525 | |
527 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
526 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
528 | 527 | |
529 | - switch ( $question->type() ) { |
|
528 | + switch ($question->type()) { |
|
530 | 529 | // Text |
531 | 530 | case EEM_Question::QST_type_text : |
532 | - if( $identifier == 'email' ){ |
|
533 | - return new EE_Email_Input( $input_constructor_args ); |
|
534 | - }else{ |
|
535 | - return new EE_Text_Input( $input_constructor_args ); |
|
531 | + if ($identifier == 'email') { |
|
532 | + return new EE_Email_Input($input_constructor_args); |
|
533 | + } else { |
|
534 | + return new EE_Text_Input($input_constructor_args); |
|
536 | 535 | } |
537 | 536 | break; |
538 | 537 | // Textarea |
539 | 538 | case EEM_Question::QST_type_textarea : |
540 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
539 | + return new EE_Text_Area_Input($input_constructor_args); |
|
541 | 540 | break; |
542 | 541 | // Radio Buttons |
543 | 542 | case EEM_Question::QST_type_radio : |
544 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
543 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
545 | 544 | break; |
546 | 545 | // Dropdown |
547 | 546 | case EEM_Question::QST_type_dropdown : |
548 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
547 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
549 | 548 | break; |
550 | 549 | // State Dropdown |
551 | 550 | case EEM_Question::QST_type_state : |
552 | - $state_options = array( '' => array( '' => '')); |
|
551 | + $state_options = array('' => array('' => '')); |
|
553 | 552 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
554 | - if ( ! empty( $states )) { |
|
555 | - foreach( $states as $state ){ |
|
556 | - if ( $state instanceof EE_State ) { |
|
557 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
553 | + if ( ! empty($states)) { |
|
554 | + foreach ($states as $state) { |
|
555 | + if ($state instanceof EE_State) { |
|
556 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
558 | 557 | } |
559 | 558 | } |
560 | 559 | } |
561 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
562 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
560 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
561 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
563 | 562 | break; |
564 | 563 | // Country Dropdown |
565 | 564 | case EEM_Question::QST_type_country : |
566 | - $country_options = array( '' => '' ); |
|
565 | + $country_options = array('' => ''); |
|
567 | 566 | // get possibly cached list of countries |
568 | 567 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
569 | - if ( ! empty( $countries )) { |
|
570 | - foreach( $countries as $country ){ |
|
571 | - if ( $country instanceof EE_Country ) { |
|
572 | - $country_options[ $country->ID() ] = $country->name(); |
|
568 | + if ( ! empty($countries)) { |
|
569 | + foreach ($countries as $country) { |
|
570 | + if ($country instanceof EE_Country) { |
|
571 | + $country_options[$country->ID()] = $country->name(); |
|
573 | 572 | } |
574 | 573 | } |
575 | 574 | } |
576 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
577 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
575 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
576 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
578 | 577 | break; |
579 | 578 | // Checkboxes |
580 | 579 | case EEM_Question::QST_type_checkbox : |
581 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
580 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
582 | 581 | break; |
583 | 582 | // Date |
584 | 583 | case EEM_Question::QST_type_date : |
585 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
584 | + return new EE_Datepicker_Input($input_constructor_args); |
|
586 | 585 | break; |
587 | 586 | case EEM_Question::QST_type_html_textarea : |
588 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
589 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
590 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
587 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
588 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
589 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
591 | 590 | return $input; |
592 | 591 | // fallback |
593 | 592 | default : |
594 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
595 | - if( ! $default_input ){ |
|
596 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
593 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
594 | + if ( ! $default_input) { |
|
595 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
597 | 596 | } |
598 | 597 | return $default_input; |
599 | 598 | } |
@@ -618,65 +617,65 @@ discard block |
||
618 | 617 | */ |
619 | 618 | public function process_reg_step() { |
620 | 619 | |
621 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
620 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
622 | 621 | // grab validated data from form |
623 | 622 | $valid_data = $this->checkout->current_step->valid_data(); |
624 | 623 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
625 | 624 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
626 | 625 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
627 | - if ( empty( $valid_data )) { |
|
628 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
626 | + if (empty($valid_data)) { |
|
627 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
629 | 628 | return FALSE; |
630 | 629 | } |
631 | 630 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
632 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
633 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
631 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
632 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
634 | 633 | return FALSE; |
635 | 634 | } |
636 | 635 | // get cached registrations |
637 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
636 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
638 | 637 | // verify we got the goods |
639 | - if ( empty( $registrations )) { |
|
640 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
638 | + if (empty($registrations)) { |
|
639 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
641 | 640 | return FALSE; |
642 | 641 | } |
643 | 642 | // extract attendee info from form data and save to model objects |
644 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
643 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
645 | 644 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
646 | - if ( $registrations_processed === FALSE ) { |
|
645 | + if ($registrations_processed === FALSE) { |
|
647 | 646 | // but return immediately if the previous step exited early due to errors |
648 | 647 | return FALSE; |
649 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
648 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
650 | 649 | // generate a correctly translated string for all possible singular/plural combinations |
651 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
650 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
652 | 651 | $error_msg = sprintf( |
653 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
652 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
654 | 653 | $this->checkout->total_ticket_count, |
655 | 654 | $registrations_processed |
656 | 655 | ); |
657 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
656 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
658 | 657 | $error_msg = sprintf( |
659 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
658 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
660 | 659 | $this->checkout->total_ticket_count, |
661 | 660 | $registrations_processed |
662 | 661 | ); |
663 | 662 | } else { |
664 | 663 | $error_msg = sprintf( |
665 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
664 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
666 | 665 | $this->checkout->total_ticket_count, |
667 | 666 | $registrations_processed |
668 | 667 | ); |
669 | 668 | |
670 | 669 | } |
671 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
670 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
672 | 671 | return FALSE; |
673 | 672 | } |
674 | 673 | // mark this reg step as completed |
675 | 674 | $this->set_completed(); |
676 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
675 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
677 | 676 | //do action in case a plugin wants to do something with the data submitted in step 1. |
678 | 677 | //passes EE_Single_Page_Checkout, and it's posted data |
679 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
678 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
680 | 679 | return TRUE; |
681 | 680 | |
682 | 681 | } |
@@ -690,9 +689,9 @@ discard block |
||
690 | 689 | * @param array $valid_data |
691 | 690 | * @return boolean | int |
692 | 691 | */ |
693 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
692 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
694 | 693 | // load resources and set some defaults |
695 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
694 | + EE_Registry::instance()->load_model('Attendee'); |
|
696 | 695 | // holder for primary registrant attendee object |
697 | 696 | $this->checkout->primary_attendee_obj = NULL; |
698 | 697 | // array for tracking reg form data for the primary registrant |
@@ -709,19 +708,19 @@ discard block |
||
709 | 708 | // attendee counter |
710 | 709 | $att_nmbr = 0; |
711 | 710 | // grab the saved registrations from the transaction |
712 | - foreach ( $registrations as $registration ) { |
|
711 | + foreach ($registrations as $registration) { |
|
713 | 712 | // verify EE_Registration object |
714 | - if ( ! $registration instanceof EE_Registration ) { |
|
715 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
713 | + if ( ! $registration instanceof EE_Registration) { |
|
714 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
716 | 715 | return FALSE; |
717 | 716 | } |
718 | 717 | $reg_url_link = $registration->reg_url_link(); |
719 | 718 | // reg_url_link exists ? |
720 | - if ( $reg_url_link ) { |
|
719 | + if ($reg_url_link) { |
|
721 | 720 | // should this registration be processed during this visit ? |
722 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
721 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
723 | 722 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
724 | - if ( ! $this->checkout->revisit ) { |
|
723 | + if ( ! $this->checkout->revisit) { |
|
725 | 724 | $registration->save(); |
726 | 725 | } |
727 | 726 | |
@@ -732,41 +731,41 @@ discard block |
||
732 | 731 | * @var bool if TRUE is returned by the plugin then the |
733 | 732 | * registration processing is halted. |
734 | 733 | */ |
735 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
734 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
736 | 735 | return FALSE; |
737 | 736 | } |
738 | 737 | |
739 | 738 | // Houston, we have a registration! |
740 | 739 | $att_nmbr++; |
741 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
740 | + $this->_attendee_data[$reg_url_link] = array(); |
|
742 | 741 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
743 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
742 | + if (isset($valid_data[$reg_url_link])) { |
|
744 | 743 | // do we need to copy basic info from primary attendee ? |
745 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
744 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
746 | 745 | // filter form input data for this registration |
747 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
746 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
748 | 747 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
749 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
750 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
751 | - unset( $valid_data['primary_attendee'] ); |
|
748 | + if (isset($valid_data['primary_attendee'])) { |
|
749 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
750 | + unset($valid_data['primary_attendee']); |
|
752 | 751 | } |
753 | 752 | // now loop through our array of valid post data && process attendee reg forms |
754 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
755 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
756 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
753 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
754 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
755 | + foreach ($form_inputs as $form_input => $input_value) { |
|
757 | 756 | // check for critical inputs |
758 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
757 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
759 | 758 | return FALSE; |
760 | 759 | } |
761 | 760 | // store a bit of data about the primary attendee |
762 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
763 | - $primary_registrant[ $form_input ] = $input_value; |
|
764 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
765 | - $input_value = $primary_registrant[ $form_input ]; |
|
761 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
762 | + $primary_registrant[$form_input] = $input_value; |
|
763 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
764 | + $input_value = $primary_registrant[$form_input]; |
|
766 | 765 | } |
767 | 766 | // now attempt to save the input data |
768 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
769 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
767 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
768 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 769 | return FALSE; |
771 | 770 | } |
772 | 771 | } |
@@ -775,51 +774,51 @@ discard block |
||
775 | 774 | } |
776 | 775 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
777 | 776 | // this registration does not require additional attendee information ? |
778 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
777 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
779 | 778 | // just copy the primary registrant |
780 | 779 | $attendee = $this->checkout->primary_attendee_obj; |
781 | 780 | } else { |
782 | 781 | // have we met before? |
783 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
782 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
784 | 783 | // did we find an already existing record for this attendee ? |
785 | - if ( $attendee instanceof EE_Attendee ) { |
|
786 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
784 | + if ($attendee instanceof EE_Attendee) { |
|
785 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
787 | 786 | } else { |
788 | 787 | // ensure critical details are set for additional attendees |
789 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
790 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
788 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
789 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
791 | 790 | } |
792 | 791 | // who's #1 ? |
793 | - if ( $att_nmbr == 1 ) { |
|
792 | + if ($att_nmbr == 1) { |
|
794 | 793 | $this->checkout->primary_attendee_obj = $attendee; |
795 | 794 | } |
796 | 795 | } |
797 | 796 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
798 | 797 | // add relation to registration, set attendee ID, and cache attendee |
799 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
800 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
801 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
798 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
799 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
800 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
802 | 801 | return FALSE; |
803 | 802 | } |
804 | 803 | /** @type EE_Registration_Processor $registration_processor */ |
805 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
804 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
806 | 805 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
807 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
806 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
808 | 807 | /** @type EE_Transaction_Processor $transaction_processor */ |
809 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
808 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
810 | 809 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
811 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
810 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
812 | 811 | // if we've gotten this far, then let's save what we have |
813 | 812 | $registration->save(); |
814 | 813 | // add relation between TXN and registration |
815 | - $this->_associate_registration_with_transaction( $registration ); |
|
814 | + $this->_associate_registration_with_transaction($registration); |
|
816 | 815 | |
817 | 816 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
818 | 817 | |
819 | - } else { |
|
820 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
818 | + } else { |
|
819 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
821 | 820 | // remove malformed data |
822 | - unset( $valid_data[ $reg_url_link ] ); |
|
821 | + unset($valid_data[$reg_url_link]); |
|
823 | 822 | return FALSE; |
824 | 823 | } |
825 | 824 | |
@@ -837,22 +836,22 @@ discard block |
||
837 | 836 | * @param string $input_value |
838 | 837 | * @return boolean |
839 | 838 | */ |
840 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
839 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
841 | 840 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
842 | 841 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
843 | 842 | // allow for plugins to hook in and do their own processing of the form input. |
844 | 843 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
845 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
844 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
846 | 845 | return TRUE; |
847 | 846 | } |
848 | 847 | |
849 | 848 | // grab related answer objects |
850 | 849 | $answers = $registration->answers(); |
851 | 850 | // $answer_cache_id is the key used to find the EE_Answer we want |
852 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
853 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
851 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
852 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
854 | 853 | //rename form_inputs if they are EE_Attendee properties |
855 | - switch( (string)$form_input ) { |
|
854 | + switch ((string) $form_input) { |
|
856 | 855 | |
857 | 856 | case 'state' : |
858 | 857 | case 'STA_ID' : |
@@ -867,33 +866,33 @@ discard block |
||
867 | 866 | break; |
868 | 867 | |
869 | 868 | default : |
870 | - $ATT_input = 'ATT_' . $form_input; |
|
869 | + $ATT_input = 'ATT_'.$form_input; |
|
871 | 870 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
872 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
873 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
871 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
872 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
874 | 873 | } |
875 | 874 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
876 | 875 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
877 | 876 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
878 | 877 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
879 | 878 | // if this form input has a corresponding attendee property |
880 | - if ( $attendee_property ) { |
|
881 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
882 | - if ( $answer_is_obj ) { |
|
879 | + if ($attendee_property) { |
|
880 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
881 | + if ($answer_is_obj) { |
|
883 | 882 | // and delete the corresponding answer since we won't be storing this data in that object |
884 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
885 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
883 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
884 | + $answers[$answer_cache_id]->delete_permanently(); |
|
886 | 885 | } |
887 | 886 | return TRUE; |
888 | - } elseif ( $answer_is_obj ) { |
|
887 | + } elseif ($answer_is_obj) { |
|
889 | 888 | // save this data to the answer object |
890 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
891 | - $result = $answers[ $answer_cache_id ]->save(); |
|
889 | + $answers[$answer_cache_id]->set_value($input_value); |
|
890 | + $result = $answers[$answer_cache_id]->save(); |
|
892 | 891 | return $result !== false ? true : false; |
893 | 892 | } else { |
894 | - foreach ( $answers as $answer ) { |
|
895 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
896 | - $answer->set_value( $input_value ); |
|
893 | + foreach ($answers as $answer) { |
|
894 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
895 | + $answer->set_value($input_value); |
|
897 | 896 | $result = $answer->save(); |
898 | 897 | return $result !== false ? true : false; |
899 | 898 | } |
@@ -911,33 +910,33 @@ discard block |
||
911 | 910 | * @param string $input_value |
912 | 911 | * @return boolean |
913 | 912 | */ |
914 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
915 | - if ( empty( $input_value )) { |
|
913 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
914 | + if (empty($input_value)) { |
|
916 | 915 | // if the form input isn't marked as being required, then just return |
917 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
916 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
918 | 917 | return true; |
919 | 918 | } |
920 | - switch( $form_input ) { |
|
919 | + switch ($form_input) { |
|
921 | 920 | case 'fname' : |
922 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
921 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
923 | 922 | return FALSE; |
924 | 923 | break; |
925 | 924 | case 'lname' : |
926 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
925 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
927 | 926 | return FALSE; |
928 | 927 | break; |
929 | 928 | case 'email' : |
930 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
929 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
931 | 930 | return FALSE; |
932 | 931 | break; |
933 | 932 | } |
934 | - } else if ( $form_input === 'email' ) { |
|
933 | + } else if ($form_input === 'email') { |
|
935 | 934 | // clean the email address |
936 | - $valid_email = sanitize_email( $input_value ); |
|
935 | + $valid_email = sanitize_email($input_value); |
|
937 | 936 | // check if it matches |
938 | - if ( $input_value != $valid_email ) { |
|
937 | + if ($input_value != $valid_email) { |
|
939 | 938 | // whoops!!! |
940 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
939 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
941 | 940 | return FALSE; |
942 | 941 | } |
943 | 942 | } |
@@ -965,14 +964,14 @@ discard block |
||
965 | 964 | * @param array $attendee_data |
966 | 965 | * @return boolean |
967 | 966 | */ |
968 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
967 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
969 | 968 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
970 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
971 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
972 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
969 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
970 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
971 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
973 | 972 | // but only if those have values |
974 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
975 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
973 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
974 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
976 | 975 | 'ATT_fname' => $ATT_fname, |
977 | 976 | 'ATT_lname' => $ATT_lname, |
978 | 977 | 'ATT_email' => $ATT_email |
@@ -980,7 +979,7 @@ discard block |
||
980 | 979 | } else { |
981 | 980 | $existing_attendee = NULL; |
982 | 981 | } |
983 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
982 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
984 | 983 | } |
985 | 984 | |
986 | 985 | |
@@ -992,13 +991,13 @@ discard block |
||
992 | 991 | * @param array $attendee_data |
993 | 992 | * @return \EE_Attendee |
994 | 993 | */ |
995 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
994 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
996 | 995 | // first remove fname, lname, and email from attendee data |
997 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
996 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
998 | 997 | // now loop thru what's left and add to attendee CPT |
999 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1000 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1001 | - $existing_attendee->set( $property_name, $property_value ); |
|
998 | + foreach ($attendee_data as $property_name => $property_value) { |
|
999 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1000 | + $existing_attendee->set($property_name, $property_value); |
|
1002 | 1001 | } |
1003 | 1002 | } |
1004 | 1003 | // better save that now |
@@ -1015,11 +1014,11 @@ discard block |
||
1015 | 1014 | * @param EE_Attendee $attendee |
1016 | 1015 | * @return void |
1017 | 1016 | */ |
1018 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1017 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1019 | 1018 | // add relation to attendee |
1020 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1021 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1022 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1019 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1020 | + $registration->set_attendee_id($attendee->ID()); |
|
1021 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1023 | 1022 | } |
1024 | 1023 | |
1025 | 1024 | |
@@ -1030,10 +1029,10 @@ discard block |
||
1030 | 1029 | * @param EE_Registration $registration |
1031 | 1030 | * @return void |
1032 | 1031 | */ |
1033 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1032 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1034 | 1033 | // add relation to attendee |
1035 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1036 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1034 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1035 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1037 | 1036 | } |
1038 | 1037 | |
1039 | 1038 | |
@@ -1045,17 +1044,17 @@ discard block |
||
1045 | 1044 | * @param array $attendee_data |
1046 | 1045 | * @return array |
1047 | 1046 | */ |
1048 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1047 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1049 | 1048 | // bare minimum critical details include first name, last name, email address |
1050 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1049 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1051 | 1050 | // add address info to critical details? |
1052 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1053 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1054 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1051 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1052 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1053 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1055 | 1054 | } |
1056 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1057 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1058 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1055 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1056 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1057 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1059 | 1058 | } |
1060 | 1059 | } |
1061 | 1060 | return $attendee_data; |
@@ -1070,11 +1069,11 @@ discard block |
||
1070 | 1069 | * @param array $attendee_data |
1071 | 1070 | * @return \EE_Attendee |
1072 | 1071 | */ |
1073 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1072 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1074 | 1073 | // create new attendee object |
1075 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1074 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1076 | 1075 | // set author to event creator |
1077 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1076 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1078 | 1077 | $new_attendee->save(); |
1079 | 1078 | return $new_attendee; |
1080 | 1079 | } |
@@ -1090,7 +1089,7 @@ discard block |
||
1090 | 1089 | */ |
1091 | 1090 | public function update_reg_step() { |
1092 | 1091 | // save everything |
1093 | - if ( $this->process_reg_step() ) { |
|
1092 | + if ($this->process_reg_step()) { |
|
1094 | 1093 | $this->checkout->redirect = TRUE; |
1095 | 1094 | $this->checkout->redirect_url = add_query_arg( |
1096 | 1095 | array( |
@@ -1099,7 +1098,7 @@ discard block |
||
1099 | 1098 | ), |
1100 | 1099 | $this->checkout->thank_you_page_url |
1101 | 1100 | ); |
1102 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1101 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1103 | 1102 | return TRUE; |
1104 | 1103 | } |
1105 | 1104 | return FALSE; |
@@ -69,104 +69,104 @@ discard block |
||
69 | 69 | * @param array $options |
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
72 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
73 | 73 | |
74 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
75 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
74 | + EE_Registry::instance()->load_helper('Template'); |
|
75 | + EE_Registry::instance()->load_helper('HTML'); |
|
76 | 76 | |
77 | 77 | $html = ''; |
78 | 78 | // set some default options and merge with incoming |
79 | 79 | $default_options = array( |
80 | - 'show_desc' => true, // true false |
|
80 | + 'show_desc' => true, // true false |
|
81 | 81 | 'odd' => false |
82 | 82 | ); |
83 | - $options = array_merge( $default_options, (array)$options ); |
|
83 | + $options = array_merge($default_options, (array) $options); |
|
84 | 84 | |
85 | - switch( $line_item->type() ) { |
|
85 | + switch ($line_item->type()) { |
|
86 | 86 | |
87 | 87 | case EEM_Line_Item::type_line_item: |
88 | 88 | $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes; |
89 | - if ( $line_item->OBJ_type() == 'Ticket' ) { |
|
89 | + if ($line_item->OBJ_type() == 'Ticket') { |
|
90 | 90 | // item row |
91 | - $html .= $this->_ticket_row( $line_item, $options ); |
|
91 | + $html .= $this->_ticket_row($line_item, $options); |
|
92 | 92 | // got any kids? |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - $this->display_line_item( $child_line_item, $options ); |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + $this->display_line_item($child_line_item, $options); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | 97 | // item row |
98 | - $html .= $this->_item_row( $line_item, $options ); |
|
98 | + $html .= $this->_item_row($line_item, $options); |
|
99 | 99 | // got any kids? |
100 | - foreach ( $line_item->children() as $child_line_item ) { |
|
101 | - $this->display_line_item( $child_line_item, $options ); |
|
100 | + foreach ($line_item->children() as $child_line_item) { |
|
101 | + $this->display_line_item($child_line_item, $options); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | |
106 | 106 | case EEM_Line_Item::type_sub_line_item: |
107 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
107 | + $html .= $this->_sub_item_row($line_item, $options); |
|
108 | 108 | break; |
109 | 109 | |
110 | 110 | case EEM_Line_Item::type_sub_total: |
111 | 111 | static $sub_total = 0; |
112 | 112 | $event_sub_total = 0; |
113 | - $text = __( 'Sub-Total', 'event_espresso' ); |
|
114 | - if ( $line_item->OBJ_type() == 'Event' ) { |
|
115 | - $options[ 'event_id' ] = $event_id = $line_item->OBJ_ID(); |
|
116 | - if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
117 | - $event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] ); |
|
118 | - if ( $event instanceof EE_Event ) { |
|
119 | - if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) { |
|
113 | + $text = __('Sub-Total', 'event_espresso'); |
|
114 | + if ($line_item->OBJ_type() == 'Event') { |
|
115 | + $options['event_id'] = $event_id = $line_item->OBJ_ID(); |
|
116 | + if ( ! isset($this->_events[$options['event_id']])) { |
|
117 | + $event = EEM_Event::instance()->get_one_by_ID($options['event_id']); |
|
118 | + if ($event instanceof EE_Event) { |
|
119 | + if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) { |
|
120 | 120 | return ''; |
121 | 121 | } |
122 | 122 | } |
123 | - $this->_events[ $options[ 'event_id' ] ] = 0; |
|
124 | - $html .= $this->_event_row( $line_item ); |
|
125 | - $text = __( 'Event Sub-Total', 'event_espresso' ); |
|
123 | + $this->_events[$options['event_id']] = 0; |
|
124 | + $html .= $this->_event_row($line_item); |
|
125 | + $text = __('Event Sub-Total', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | $child_line_items = $line_item->children(); |
129 | 129 | // loop thru children |
130 | - foreach( $child_line_items as $child_line_item ) { |
|
130 | + foreach ($child_line_items as $child_line_item) { |
|
131 | 131 | // recursively feed children back into this method |
132 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
132 | + $html .= $this->display_line_item($child_line_item, $options); |
|
133 | 133 | } |
134 | - $event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0; |
|
134 | + $event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0; |
|
135 | 135 | $sub_total += $event_sub_total; |
136 | 136 | if ( |
137 | 137 | ( |
138 | 138 | // event subtotals |
139 | 139 | $line_item->code() != 'pre-tax-subtotal' && |
140 | - count( $child_line_items ) > 1 |
|
140 | + count($child_line_items) > 1 |
|
141 | 141 | ) |
142 | 142 | || |
143 | 143 | ( |
144 | 144 | // pre-tax subtotals |
145 | 145 | $line_item->code() == 'pre-tax-subtotal' && |
146 | - count( $this->_events ) > 1 |
|
146 | + count($this->_events) > 1 |
|
147 | 147 | ) |
148 | 148 | ) { |
149 | 149 | $options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total; |
150 | - $html .= $this->_sub_total_row( $line_item, $text, $options ); |
|
150 | + $html .= $this->_sub_total_row($line_item, $text, $options); |
|
151 | 151 | } |
152 | 152 | break; |
153 | 153 | |
154 | 154 | case EEM_Line_Item::type_tax: |
155 | - if ( $this->_show_taxes ) { |
|
156 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
155 | + if ($this->_show_taxes) { |
|
156 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
157 | 157 | } |
158 | 158 | break; |
159 | 159 | |
160 | 160 | case EEM_Line_Item::type_tax_sub_total: |
161 | - if ( $this->_show_taxes ) { |
|
161 | + if ($this->_show_taxes) { |
|
162 | 162 | $child_line_items = $line_item->children(); |
163 | 163 | // loop thru children |
164 | - foreach( $child_line_items as $child_line_item ) { |
|
164 | + foreach ($child_line_items as $child_line_item) { |
|
165 | 165 | // recursively feed children back into this method |
166 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
166 | + $html .= $this->display_line_item($child_line_item, $options); |
|
167 | 167 | } |
168 | - if ( count( $child_line_items ) > 1 ) { |
|
169 | - $this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) ); |
|
168 | + if (count($child_line_items) > 1) { |
|
169 | + $this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso')); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | break; |
@@ -175,25 +175,25 @@ discard block |
||
175 | 175 | // get all child line items |
176 | 176 | $children = $line_item->children(); |
177 | 177 | // loop thru all non-tax child line items |
178 | - foreach( $children as $child_line_item ) { |
|
179 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
178 | + foreach ($children as $child_line_item) { |
|
179 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
180 | 180 | // recursively feed children back into this method |
181 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
181 | + $html .= $this->display_line_item($child_line_item, $options); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | 185 | // now loop thru tax child line items |
186 | - foreach( $children as $child_line_item ) { |
|
187 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
186 | + foreach ($children as $child_line_item) { |
|
187 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
188 | 188 | // recursively feed children back into this method |
189 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
189 | + $html .= $this->display_line_item($child_line_item, $options); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | $html .= $this->_taxes_html; |
193 | - $html .= $this->_total_row( $line_item, __('Total', 'event_espresso') ); |
|
193 | + $html .= $this->_total_row($line_item, __('Total', 'event_espresso')); |
|
194 | 194 | |
195 | 195 | |
196 | - $html .= $this->_payments_and_amount_owing_rows( $line_item, $options ); |
|
196 | + $html .= $this->_payments_and_amount_owing_rows($line_item, $options); |
|
197 | 197 | break; |
198 | 198 | |
199 | 199 | } |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | * @param EE_Line_Item $line_item |
209 | 209 | * @return mixed |
210 | 210 | */ |
211 | - private function _event_row( EE_Line_Item $line_item ) { |
|
211 | + private function _event_row(EE_Line_Item $line_item) { |
|
212 | 212 | // start of row |
213 | - $html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' ); |
|
213 | + $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd'); |
|
214 | 214 | // event name td |
215 | - $html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' ); |
|
215 | + $html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"'); |
|
216 | 216 | // end of row |
217 | 217 | $html .= EEH_HTML::trx(); |
218 | 218 | return $html; |
@@ -227,10 +227,10 @@ discard block |
||
227 | 227 | * @param array $options |
228 | 228 | * @return mixed |
229 | 229 | */ |
230 | - private function _ticket_row( EE_Line_Item $line_item, $options = array() ) { |
|
230 | + private function _ticket_row(EE_Line_Item $line_item, $options = array()) { |
|
231 | 231 | // start of row |
232 | 232 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
233 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
233 | + $html = EEH_HTML::tr('', '', $row_class); |
|
234 | 234 | // name && desc |
235 | 235 | $name_and_desc = apply_filters( |
236 | 236 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
@@ -239,23 +239,23 @@ discard block |
||
239 | 239 | ); |
240 | 240 | $name_and_desc .= apply_filters( |
241 | 241 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
242 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
242 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
243 | 243 | $line_item, |
244 | 244 | $options |
245 | 245 | ); |
246 | 246 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
247 | 247 | // name td |
248 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
248 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
249 | 249 | // price td |
250 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
250 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
251 | 251 | // quantity td |
252 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
252 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
253 | 253 | $this->_total_items += $line_item->quantity(); |
254 | 254 | // determine total for line item |
255 | 255 | $total = $line_item->total(); |
256 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
256 | + $this->_events[$options['event_id']] += $total; |
|
257 | 257 | // total td |
258 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
258 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
259 | 259 | // end of row |
260 | 260 | $html .= EEH_HTML::trx(); |
261 | 261 | return $html; |
@@ -270,41 +270,41 @@ discard block |
||
270 | 270 | * @param array $options |
271 | 271 | * @return mixed |
272 | 272 | */ |
273 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
273 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
274 | 274 | // start of row |
275 | 275 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
276 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
277 | - $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type() . ': ' : ''; |
|
276 | + $html = EEH_HTML::tr('', '', $row_class); |
|
277 | + $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type().': ' : ''; |
|
278 | 278 | // name && desc |
279 | 279 | $name_and_desc = apply_filters( |
280 | 280 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
281 | - $obj_name . $line_item->name(), |
|
281 | + $obj_name.$line_item->name(), |
|
282 | 282 | $line_item |
283 | 283 | ); |
284 | 284 | $name_and_desc .= apply_filters( |
285 | 285 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
286 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
286 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
287 | 287 | $line_item, |
288 | 288 | $options |
289 | 289 | ); |
290 | 290 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
291 | 291 | // name td |
292 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
292 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
293 | 293 | // price td |
294 | - if ( $line_item->is_percent() ) { |
|
295 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' ); |
|
294 | + if ($line_item->is_percent()) { |
|
295 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght'); |
|
296 | 296 | } else { |
297 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
297 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
298 | 298 | } |
299 | 299 | // quantity td |
300 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
300 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
301 | 301 | //$total = $line_item->total() * $line_item->quantity(); |
302 | 302 | $total = $line_item->total(); |
303 | - if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
304 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
303 | + if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) { |
|
304 | + $this->_events[$options['event_id']] += $total; |
|
305 | 305 | } |
306 | 306 | // total td |
307 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
307 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
308 | 308 | // end of row |
309 | 309 | $html .= EEH_HTML::trx(); |
310 | 310 | return $html; |
@@ -319,22 +319,22 @@ discard block |
||
319 | 319 | * @param array $options |
320 | 320 | * @return mixed |
321 | 321 | */ |
322 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
322 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
323 | 323 | // start of row |
324 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
324 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
325 | 325 | // name && desc |
326 | 326 | $name_and_desc = $line_item->name(); |
327 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
327 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
328 | 328 | // name td |
329 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
329 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
330 | 330 | // discount/surcharge td |
331 | - if ( $line_item->is_percent() ) { |
|
332 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
331 | + if ($line_item->is_percent()) { |
|
332 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
333 | 333 | } else { |
334 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
334 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
335 | 335 | } |
336 | 336 | // total td |
337 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
337 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
338 | 338 | // end of row |
339 | 339 | $html .= EEH_HTML::trx(); |
340 | 340 | return $html; |
@@ -349,21 +349,21 @@ discard block |
||
349 | 349 | * @param array $options |
350 | 350 | * @return mixed |
351 | 351 | */ |
352 | - private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
352 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
353 | 353 | // start of row |
354 | - $html = EEH_HTML::tr( '', 'item sub-item tax-total' ); |
|
354 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
355 | 355 | // name && desc |
356 | 356 | $name_and_desc = $line_item->name(); |
357 | - $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>'; |
|
358 | - $name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : ''; |
|
357 | + $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>'; |
|
358 | + $name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : ''; |
|
359 | 359 | // name td |
360 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
360 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
361 | 361 | // percent td |
362 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', ' jst-rght', '' ); |
|
362 | + $html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', ''); |
|
363 | 363 | // empty td (price) |
364 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
364 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
365 | 365 | // total td |
366 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
366 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
367 | 367 | // end of row |
368 | 368 | $html .= EEH_HTML::trx(); |
369 | 369 | return $html; |
@@ -378,17 +378,17 @@ discard block |
||
378 | 378 | * @param string $text |
379 | 379 | * @return mixed |
380 | 380 | */ |
381 | - private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) { |
|
381 | + private function _total_tax_row(EE_Line_Item $line_item, $text = '') { |
|
382 | 382 | $html = ''; |
383 | - if ( $line_item->total() ) { |
|
383 | + if ($line_item->total()) { |
|
384 | 384 | // start of row |
385 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
385 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
386 | 386 | // total td |
387 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' ); |
|
387 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"'); |
|
388 | 388 | // empty td (price) |
389 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
389 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
390 | 390 | // total td |
391 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
391 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
392 | 392 | // end of row |
393 | 393 | $html .= EEH_HTML::trx(); |
394 | 394 | } |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | * @param array $options |
406 | 406 | * @return mixed |
407 | 407 | */ |
408 | - private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
408 | + private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
409 | 409 | $html = ''; |
410 | - if ( $line_item->total() ) { |
|
410 | + if ($line_item->total()) { |
|
411 | 411 | // start of row |
412 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
412 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
413 | 413 | // total td |
414 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
414 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
415 | 415 | // total td |
416 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' ); |
|
416 | + $html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght'); |
|
417 | 417 | // end of row |
418 | 418 | $html .= EEH_HTML::trx(); |
419 | 419 | } |
@@ -430,13 +430,13 @@ discard block |
||
430 | 430 | * @param string $text |
431 | 431 | * @return mixed |
432 | 432 | */ |
433 | - private function _total_row( EE_Line_Item $line_item, $text = '' ) { |
|
433 | + private function _total_row(EE_Line_Item $line_item, $text = '') { |
|
434 | 434 | // start of row |
435 | - $html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' ); |
|
435 | + $html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd'); |
|
436 | 436 | // total td |
437 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
437 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
438 | 438 | // total td |
439 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
439 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
440 | 440 | // end of row |
441 | 441 | $html .= EEH_HTML::trx(); |
442 | 442 | return $html; |
@@ -451,30 +451,30 @@ discard block |
||
451 | 451 | * @param array $options |
452 | 452 | * @return mixed |
453 | 453 | */ |
454 | - private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) { |
|
454 | + private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) { |
|
455 | 455 | $html = ''; |
456 | 456 | $owing = $line_item->total(); |
457 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() ); |
|
458 | - if ( $transaction instanceof EE_Transaction ) { |
|
457 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID()); |
|
458 | + if ($transaction instanceof EE_Transaction) { |
|
459 | 459 | $registration_payments = array(); |
460 | - $registrations = ! empty( $options['registrations'] ) |
|
461 | - ? $options[ 'registrations' ] |
|
460 | + $registrations = ! empty($options['registrations']) |
|
461 | + ? $options['registrations'] |
|
462 | 462 | : $transaction->registrations(); |
463 | - foreach ( $registrations as $registration ) { |
|
464 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
463 | + foreach ($registrations as $registration) { |
|
464 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
465 | 465 | $registration_payments = $registration_payments + $registration->registration_payments(); |
466 | 466 | } |
467 | 467 | } |
468 | - if ( ! empty( $registration_payments )) { |
|
469 | - foreach ( $registration_payments as $registration_payment ) { |
|
470 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
468 | + if ( ! empty($registration_payments)) { |
|
469 | + foreach ($registration_payments as $registration_payment) { |
|
470 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
471 | 471 | $owing = $owing - $registration_payment->amount(); |
472 | 472 | $payment = $registration_payment->payment(); |
473 | - if ( $payment instanceof EE_Payment ) { |
|
473 | + if ($payment instanceof EE_Payment) { |
|
474 | 474 | $payment_desc = sprintf( |
475 | - __( 'Payment%1$s Received: %2$s', 'event_espresso' ), |
|
475 | + __('Payment%1$s Received: %2$s', 'event_espresso'), |
|
476 | 476 | $payment->txn_id_chq_nmbr() != '' |
477 | - ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' |
|
477 | + ? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> ' |
|
478 | 478 | : '', |
479 | 479 | $payment->timestamp() |
480 | 480 | ); |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | $payment_desc = ''; |
483 | 483 | } |
484 | 484 | // start of row |
485 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
485 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
486 | 486 | // payment desc |
487 | - $html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' ); |
|
487 | + $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"'); |
|
488 | 488 | // total td |
489 | 489 | $html .= EEH_HTML::td( |
490 | - EEH_Template::format_currency( $registration_payment->amount(), false, false ), |
|
490 | + EEH_Template::format_currency($registration_payment->amount(), false, false), |
|
491 | 491 | '', |
492 | 492 | 'total jst-rght' |
493 | 493 | ); |
@@ -495,17 +495,17 @@ discard block |
||
495 | 495 | $html .= EEH_HTML::trx(); |
496 | 496 | } |
497 | 497 | } |
498 | - if ( $line_item->total() ) { |
|
498 | + if ($line_item->total()) { |
|
499 | 499 | // start of row |
500 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
500 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
501 | 501 | // total td |
502 | 502 | $html .= EEH_HTML::td( |
503 | 503 | __('Amount Owing', 'event_espresso'), |
504 | - '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
504 | + '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
505 | 505 | ); |
506 | 506 | // total td |
507 | 507 | $html .= EEH_HTML::td( |
508 | - EEH_Template::format_currency( $owing, false, false ), '', 'total jst-rght' |
|
508 | + EEH_Template::format_currency($owing, false, false), '', 'total jst-rght' |
|
509 | 509 | ); |
510 | 510 | // end of row |
511 | 511 | $html .= EEH_HTML::trx(); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the PayPal Standard payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <h3><?php _e('PayPal Standard Settings', 'event_espresso'); ?></h3> |
9 | 9 | <ul> |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | </li> |
22 | 22 | <li> |
23 | 23 | <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br /> |
24 | -<?php printf( __('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>' ); ?><br/> |
|
25 | -<?php _e( 'Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso' );?> |
|
24 | +<?php printf(__('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/> |
|
25 | +<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso'); ?> |
|
26 | 26 | </li> |
27 | 27 | <li> |
28 | 28 | <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br /> |
29 | 29 | <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it should calculate the shipping on each payment (if there are multiple payments for a single transaction, PayPal is permitted to add shipping charges to each payment.)', 'event_espresso'); ?><br/> |
30 | -<?php _e( 'Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso' );?> |
|
30 | +<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?> |
|
31 | 31 | <li> |
32 | -<strong><?php _e( 'Notes Regarding Paypal Taxes and Shipping', 'event_espresso' );?></strong><br/> |
|
33 | -<?php _e( 'If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso' );?><br/> |
|
34 | -<?php _e( 'However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso' );?><br/> |
|
35 | -<?php _e( 'Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso' );?> |
|
32 | +<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/> |
|
33 | +<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/> |
|
34 | +<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?><br/> |
|
35 | +<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso'); ?> |
|
36 | 36 | </li> |
37 | 37 | <li> |
38 | 38 | <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br /> |