@@ -8,19 +8,19 @@ discard block |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Text_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Text_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @param array $options |
16 | 16 | */ |
17 | - function __construct($options = array()){ |
|
17 | + function __construct($options = array()) { |
|
18 | 18 | $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
19 | 19 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
20 | 20 | parent::__construct($options); |
21 | 21 | //if the input hasn't specifically mentioned a more lenient validation strategy, |
22 | 22 | //apply plaintext validation strategy |
23 | - if( ! $this->has_validation_strategy( |
|
23 | + if ( ! $this->has_validation_strategy( |
|
24 | 24 | array( |
25 | 25 | 'EE_Full_HTML_Validation_Strategy', |
26 | 26 | 'EE_Simple_HTML_Validation_Strategy' |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ) { |
30 | 30 | //by default we use the plaintext validation. If you want something else, |
31 | 31 | //just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
32 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
32 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{ |
|
11 | +class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param null $validation_error_message |
15 | 15 | */ |
16 | - public function __construct( $validation_error_message = NULL ) { |
|
17 | - if( ! $validation_error_message ){ |
|
16 | + public function __construct($validation_error_message = NULL) { |
|
17 | + if ( ! $validation_error_message) { |
|
18 | 18 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
19 | 19 | } |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * @return bool |
30 | 30 | * @throws \EE_Validation_Error |
31 | 31 | */ |
32 | - public function validate( $normalized_value ) { |
|
33 | - if( $normalized_value && ! $this->_validate_email( $normalized_value ) ){ |
|
34 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
32 | + public function validate($normalized_value) { |
|
33 | + if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
34 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @return array |
42 | 42 | */ |
43 | - public function get_jquery_validation_rule_array(){ |
|
44 | - return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) ); |
|
43 | + public function get_jquery_validation_rule_array() { |
|
44 | + return array('email'=>true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -54,38 +54,38 @@ discard block |
||
54 | 54 | * @return bool of whether the email is valid or not |
55 | 55 | * @throws \EE_Validation_Error |
56 | 56 | */ |
57 | - private function _validate_email( $email ) { |
|
58 | - $validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level ) |
|
57 | + private function _validate_email($email) { |
|
58 | + $validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
|
59 | 59 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
60 | 60 | : 'wp_default'; |
61 | - if ( ! preg_match( '/^.+\@\S+$/', $email ) ) { // \.\S+ |
|
61 | + if ( ! preg_match('/^.+\@\S+$/', $email)) { // \.\S+ |
|
62 | 62 | // email not in correct {string}@{string} format |
63 | 63 | return false; |
64 | 64 | } else { |
65 | - $atIndex = strrpos( $email, "@" ); |
|
66 | - $domain = substr( $email, $atIndex + 1 ); |
|
67 | - $local = substr( $email, 0, $atIndex ); |
|
68 | - $localLen = strlen( $local ); |
|
69 | - $domainLen = strlen( $domain ); |
|
70 | - if ( $localLen < 1 || $localLen > 64 ) { |
|
65 | + $atIndex = strrpos($email, "@"); |
|
66 | + $domain = substr($email, $atIndex + 1); |
|
67 | + $local = substr($email, 0, $atIndex); |
|
68 | + $localLen = strlen($local); |
|
69 | + $domainLen = strlen($domain); |
|
70 | + if ($localLen < 1 || $localLen > 64) { |
|
71 | 71 | // local part length exceeded |
72 | 72 | return false; |
73 | - } else if ( $domainLen < 1 || $domainLen > 255 ) { |
|
73 | + } else if ($domainLen < 1 || $domainLen > 255) { |
|
74 | 74 | // domain part length exceeded |
75 | 75 | return false; |
76 | - } else if ( $local[ 0 ] === '.' || $local[ $localLen - 1 ] === '.' ) { |
|
76 | + } else if ($local[0] === '.' || $local[$localLen - 1] === '.') { |
|
77 | 77 | // local part starts or ends with '.' |
78 | 78 | return false; |
79 | - } else if ( preg_match( '/\\.\\./', $local ) ) { |
|
79 | + } else if (preg_match('/\\.\\./', $local)) { |
|
80 | 80 | // local part has two consecutive dots |
81 | 81 | return false; |
82 | - } else if ( preg_match( '/\\.\\./', $domain ) ) { |
|
82 | + } else if (preg_match('/\\.\\./', $domain)) { |
|
83 | 83 | // domain part has two consecutive dots |
84 | 84 | return false; |
85 | - } else if ( $validation_level === 'wp_default' ) { |
|
86 | - return is_email( $email ); |
|
85 | + } else if ($validation_level === 'wp_default') { |
|
86 | + return is_email($email); |
|
87 | 87 | } else if ( |
88 | - ( $validation_level === 'i18n' || $validation_level === 'i18n_dns' ) |
|
88 | + ($validation_level === 'i18n' || $validation_level === 'i18n_dns') |
|
89 | 89 | // plz see http://stackoverflow.com/a/24817336 re: the following regex |
90 | 90 | && ! preg_match( |
91 | 91 | '/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u', |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | ) { |
95 | 95 | return false; |
96 | 96 | } |
97 | - if ( $validation_level === 'i18n_dns' ) { |
|
98 | - if ( ! checkdnsrr( $domain, "MX" ) ) { |
|
97 | + if ($validation_level === 'i18n_dns') { |
|
98 | + if ( ! checkdnsrr($domain, "MX")) { |
|
99 | 99 | // domain not found in MX records |
100 | 100 | throw new EE_Validation_Error( |
101 | 101 | __( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'event_espresso' |
104 | 104 | ) |
105 | 105 | ); |
106 | - } else if ( ! checkdnsrr( $domain, "A" ) ) { |
|
106 | + } else if ( ! checkdnsrr($domain, "A")) { |
|
107 | 107 | // domain not found in A records |
108 | 108 | throw new EE_Validation_Error( |
109 | 109 | __( |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{ |
12 | 12 | |
13 | 13 | /** |
14 | - * @param null $validation_error_message |
|
15 | - */ |
|
14 | + * @param null $validation_error_message |
|
15 | + */ |
|
16 | 16 | public function __construct( $validation_error_message = NULL ) { |
17 | 17 | if( ! $validation_error_message ){ |
18 | 18 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
41 | - * @return array |
|
42 | - */ |
|
41 | + * @return array |
|
42 | + */ |
|
43 | 43 | public function get_jquery_validation_rule_array(){ |
44 | 44 | return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) ); |
45 | 45 | } |
@@ -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 |
@@ -342,14 +343,9 @@ discard block |
||
342 | 343 | else if ( $fieldName === 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
343 | 344 | $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
344 | 345 | $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
345 | - } |
|
346 | - |
|
347 | - |
|
348 | - else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
346 | + } else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
349 | 347 | $set_column_values[$fieldName] = 0; |
350 | - } |
|
351 | - |
|
352 | - else if ( $fieldName === 'QST_max' ) { |
|
348 | + } else if ( $fieldName === 'QST_max' ) { |
|
353 | 349 | $qst_system = EEM_Question::instance()->get_var( |
354 | 350 | array( |
355 | 351 | array( |
@@ -402,7 +398,7 @@ discard block |
||
402 | 398 | $question=$this->_question_model->get_one_by_ID($ID); |
403 | 399 | $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
404 | 400 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
405 | - }else{ |
|
401 | + } else{ |
|
406 | 402 | $question= EE_Question::new_instance(); |
407 | 403 | $question->set_order_to_latest(); |
408 | 404 | $this->_set_add_edit_form_tags('insert_question'); |
@@ -433,7 +429,7 @@ discard block |
||
433 | 429 | $ID=$this->_question_model->insert($set_column_values); |
434 | 430 | $success = $ID ? true : false; |
435 | 431 | $action_desc = 'added'; |
436 | - }else{ |
|
432 | + } else{ |
|
437 | 433 | $ID=absint($this->_req_data['QST_ID']); |
438 | 434 | $pk=$this->_question_model->primary_key_name(); |
439 | 435 | $wheres=array($pk=>$ID); |
@@ -454,7 +450,7 @@ discard block |
||
454 | 450 | $option_req_index=$this->_get_option_req_data_index($option_ID); |
455 | 451 | if($option_req_index!==FALSE){ |
456 | 452 | $option->save($this->_req_data['question_options'][$option_req_index]); |
457 | - }else{ |
|
453 | + } else{ |
|
458 | 454 | //not found, remove it |
459 | 455 | $option->delete(); |
460 | 456 | } |
@@ -531,7 +527,7 @@ discard block |
||
531 | 527 | 'QSG_name'=>array('LIKE',"%$search_string%"), |
532 | 528 | 'QSG_desc'=>array('LIKE',"%$search_string%")) |
533 | 529 | ); |
534 | - }else{ |
|
530 | + } else{ |
|
535 | 531 | $query_params[0]=array( |
536 | 532 | 'QST_display_text'=>array('LIKE',"%$search_string%") |
537 | 533 | ); |
@@ -587,7 +583,7 @@ discard block |
||
587 | 583 | if ($count){ |
588 | 584 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
589 | 585 | $results = $QST->count($where); |
590 | - }else{ |
|
586 | + } else{ |
|
591 | 587 | $results = $QST->get_all($query_params); |
592 | 588 | } |
593 | 589 | 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 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
69 | 69 | * @access public |
70 | 70 | */ |
71 | - public function __construct( $routing = TRUE ) { |
|
72 | - require_once( EE_MODELS . 'EEM_Question.model.php' ); |
|
73 | - require_once( EE_MODELS . 'EEM_Question_Group.model.php' ); |
|
74 | - $this->_question_model= EEM_Question::instance(); |
|
75 | - $this->_question_group_model=EEM_Question_Group::instance(); |
|
76 | - parent::__construct( $routing ); |
|
71 | + public function __construct($routing = TRUE) { |
|
72 | + require_once(EE_MODELS.'EEM_Question.model.php'); |
|
73 | + require_once(EE_MODELS.'EEM_Question_Group.model.php'); |
|
74 | + $this->_question_model = EEM_Question::instance(); |
|
75 | + $this->_question_group_model = EEM_Question_Group::instance(); |
|
76 | + parent::__construct($routing); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | *_set_page_routes |
110 | 110 | */ |
111 | 111 | protected function _set_page_routes() { |
112 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
112 | + $qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
113 | 113 | $this->_page_routes = array( |
114 | 114 | 'default' => array( |
115 | 115 | 'func' => '_questions_overview_list_table', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | 'update_question' => array( |
132 | 132 | 'func' => '_insert_or_update_question', |
133 | - 'args' => array('new_question' => FALSE ), |
|
133 | + 'args' => array('new_question' => FALSE), |
|
134 | 134 | 'capability' => 'ee_edit_question', |
135 | 135 | 'obj_id' => $qst_id, |
136 | 136 | 'noheader' => TRUE, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | 'filename' => 'registration_form_questions_overview_views_bulk_actions_search' |
166 | 166 | ) |
167 | 167 | ), |
168 | - 'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'), |
|
168 | + 'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'), |
|
169 | 169 | 'require_nonce' => FALSE, |
170 | 170 | 'qtips' => array( |
171 | 171 | 'EE_Registration_Form_Tips' |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'filename' => 'registration_form_question_groups' |
185 | 185 | ), |
186 | 186 | ), |
187 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
187 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
188 | 188 | 'require_nonce' => FALSE |
189 | 189 | ), |
190 | 190 | |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | 'label' => esc_html__('Edit Question', 'event_espresso'), |
194 | 194 | 'order' => 15, |
195 | 195 | 'persistent' => FALSE, |
196 | - '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 |
|
196 | + '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 |
|
197 | 197 | ), |
198 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
198 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
199 | 199 | 'help_tabs' => array( |
200 | 200 | 'registration_form_edit_question_group_help_tab' => array( |
201 | 201 | 'title' => esc_html__('Edit Question', 'event_espresso'), |
202 | 202 | 'filename' => 'registration_form_edit_question' |
203 | 203 | ), |
204 | 204 | ), |
205 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
205 | + 'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'), |
|
206 | 206 | 'require_nonce' => FALSE |
207 | 207 | ), |
208 | 208 | ); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | //none of the below group are currently used for Event Categories |
231 | 231 | protected function _add_feature_pointers() {} |
232 | 232 | public function load_scripts_styles() { |
233 | - wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
233 | + wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
234 | 234 | wp_enqueue_style('espresso_registration'); |
235 | 235 | } |
236 | 236 | public function admin_init() {} |
@@ -246,20 +246,20 @@ discard block |
||
246 | 246 | |
247 | 247 | public function load_scripts_styles_add_question() { |
248 | 248 | $this->load_scripts_styles_forms(); |
249 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
250 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
249 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
250 | + wp_enqueue_script('espresso_registration_form_single'); |
|
251 | 251 | } |
252 | 252 | public function load_scripts_styles_edit_question() { |
253 | 253 | $this->load_scripts_styles_forms(); |
254 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
255 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
254 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
255 | + wp_enqueue_script('espresso_registration_form_single'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
259 | 259 | |
260 | 260 | |
261 | 261 | public function recaptcha_info_help_tab() { |
262 | - $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php'; |
|
262 | + $template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php'; |
|
263 | 263 | EEH_Template::display_template($template, array()); |
264 | 264 | } |
265 | 265 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | |
294 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
294 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
295 | 295 | $this->_views['trash'] = array( |
296 | 296 | 'slug' => 'trash', |
297 | 297 | 'label' => esc_html__('Trash', 'event_espresso'), |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | */ |
310 | 310 | protected function _questions_groups_preview() { |
311 | 311 | $this->_admin_page_title = esc_html__('Question Groups (Preview)', 'event_espresso'); |
312 | - $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' ) . '" />'; |
|
313 | - $this->_template_args['preview_text'] = '<strong>'.esc_html__( '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>'; |
|
314 | - $this->display_admin_caf_preview_page( 'question_groups_tab' ); |
|
312 | + $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').'" />'; |
|
313 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__('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>'; |
|
314 | + $this->display_admin_caf_preview_page('question_groups_tab'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -322,58 +322,58 @@ discard block |
||
322 | 322 | * @param \EEM_Base $model |
323 | 323 | * @return array where each key is the name of a model's field/db column, and each value is its value. |
324 | 324 | */ |
325 | - protected function _set_column_values_for(EEM_Base $model){ |
|
326 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
327 | - $set_column_values=array(); |
|
325 | + protected function _set_column_values_for(EEM_Base $model) { |
|
326 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
327 | + $set_column_values = array(); |
|
328 | 328 | |
329 | 329 | //some initial checks for proper values. |
330 | 330 | //if QST_admin_only, then no matter what QST_required is we disable. |
331 | - if ( !empty( $this->_req_data['QST_admin_only'] ) ) { |
|
331 | + if ( ! empty($this->_req_data['QST_admin_only'])) { |
|
332 | 332 | $this->_req_data['QST_required'] = 0; |
333 | 333 | } |
334 | - foreach($model->field_settings() as $fieldName=>$settings){ |
|
334 | + foreach ($model->field_settings() as $fieldName=>$settings) { |
|
335 | 335 | // basically if QSG_identifier is empty or not set |
336 | - if ( $fieldName === 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) { |
|
337 | - $QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ; |
|
338 | - $set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid( '', true ); |
|
336 | + if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) { |
|
337 | + $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : ''; |
|
338 | + $set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid('', true); |
|
339 | 339 | // dd($set_column_values); |
340 | 340 | } |
341 | 341 | //if the admin label is blank, use a slug version of the question text |
342 | - else if ( $fieldName === 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
|
343 | - $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
|
344 | - $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
|
342 | + else if ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) { |
|
343 | + $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : ''; |
|
344 | + $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
348 | - else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
348 | + else if ($fieldName === 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) { |
|
349 | 349 | $set_column_values[$fieldName] = 0; |
350 | 350 | } |
351 | 351 | |
352 | - else if ( $fieldName === 'QST_max' ) { |
|
352 | + else if ($fieldName === 'QST_max') { |
|
353 | 353 | $qst_system = EEM_Question::instance()->get_var( |
354 | 354 | array( |
355 | 355 | array( |
356 | - 'QST_ID' => isset( $this->_req_data[ 'QST_ID' ] ) ? $this->_req_data[ 'QST_ID' ] : 0 |
|
356 | + 'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0 |
|
357 | 357 | ) |
358 | 358 | ), |
359 | 359 | 'QST_system' ); |
360 | - $max_max = EEM_Question::instance()->absolute_max_for_system_question( $qst_system ); |
|
361 | - if( empty( $this->_req_data[ 'QST_max' ] ) || |
|
362 | - $this->_req_data[ 'QST_max' ] > $max_max ) { |
|
363 | - $set_column_values[ $fieldName ] = $max_max; |
|
360 | + $max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system); |
|
361 | + if (empty($this->_req_data['QST_max']) || |
|
362 | + $this->_req_data['QST_max'] > $max_max) { |
|
363 | + $set_column_values[$fieldName] = $max_max; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | 368 | //only add a property to the array if it's not null (otherwise the model should just use the default value) |
369 | - if( |
|
370 | - ! isset( $set_column_values[ $fieldName ] ) && |
|
371 | - isset($this->_req_data[$fieldName] ) ){ |
|
372 | - $set_column_values[$fieldName]=$this->_req_data[$fieldName]; |
|
369 | + if ( |
|
370 | + ! isset($set_column_values[$fieldName]) && |
|
371 | + isset($this->_req_data[$fieldName]) ) { |
|
372 | + $set_column_values[$fieldName] = $this->_req_data[$fieldName]; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | } |
376 | - return $set_column_values;//validation fo this data to be performed by the model before insertion. |
|
376 | + return $set_column_values; //validation fo this data to be performed by the model before insertion. |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -392,39 +392,39 @@ discard block |
||
392 | 392 | * _edit_question |
393 | 393 | */ |
394 | 394 | protected function _edit_question() { |
395 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
396 | - $ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE; |
|
395 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
396 | + $ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE; |
|
397 | 397 | |
398 | - switch( $this->_req_action ) { |
|
398 | + switch ($this->_req_action) { |
|
399 | 399 | case 'add_question' : |
400 | - $this->_admin_page_title = esc_html__( 'Add Question', 'event_espresso' ); |
|
400 | + $this->_admin_page_title = esc_html__('Add Question', 'event_espresso'); |
|
401 | 401 | break; |
402 | 402 | case 'edit_question' : |
403 | - $this->_admin_page_title = esc_html__( 'Edit Question', 'event_espresso' ); |
|
403 | + $this->_admin_page_title = esc_html__('Edit Question', 'event_espresso'); |
|
404 | 404 | break; |
405 | 405 | default : |
406 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
406 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | // add PRC_ID to title if editing |
410 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
411 | - if($ID){ |
|
412 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
413 | - $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
410 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
411 | + if ($ID) { |
|
412 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
413 | + $additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
414 | 414 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
415 | - }else{ |
|
416 | - $question= EE_Question::new_instance(); |
|
415 | + } else { |
|
416 | + $question = EE_Question::new_instance(); |
|
417 | 417 | $question->set_order_to_latest(); |
418 | 418 | $this->_set_add_edit_form_tags('insert_question'); |
419 | 419 | } |
420 | - $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types(); |
|
421 | - $this->_template_args['QST_ID']=$ID; |
|
422 | - $this->_template_args['question']=$question; |
|
423 | - $this->_template_args['question_types']= $question_types; |
|
424 | - $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
420 | + $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types(); |
|
421 | + $this->_template_args['QST_ID'] = $ID; |
|
422 | + $this->_template_args['question'] = $question; |
|
423 | + $this->_template_args['question_types'] = $question_types; |
|
424 | + $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
425 | 425 | $this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions(); |
426 | - $this->_set_publish_post_box_vars( 'id', $ID ); |
|
427 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
426 | + $this->_set_publish_post_box_vars('id', $ID); |
|
427 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE); |
|
428 | 428 | |
429 | 429 | // the details template wrapper |
430 | 430 | $this->display_admin_page_with_sidebar(); |
@@ -439,18 +439,18 @@ discard block |
||
439 | 439 | EE_Registry::instance()->load_helper('HTML'); |
440 | 440 | $descriptions = ''; |
441 | 441 | $question_type_descriptions = EEM_Question::instance()->question_descriptions(); |
442 | - foreach ( $question_type_descriptions as $type => $question_type_description ) { |
|
443 | - if ( $type == 'HTML_TEXTAREA' ) { |
|
442 | + foreach ($question_type_descriptions as $type => $question_type_description) { |
|
443 | + if ($type == 'HTML_TEXTAREA') { |
|
444 | 444 | $html = new EE_Simple_HTML_Validation_Strategy(); |
445 | 445 | $question_type_description .= sprintf( |
446 | - esc_html__( '%1$s(allowed tags: %2$s)', 'event_espresso' ), |
|
446 | + esc_html__('%1$s(allowed tags: %2$s)', 'event_espresso'), |
|
447 | 447 | '<br/>', |
448 | 448 | $html->get_list_of_allowed_tags() |
449 | 449 | ); |
450 | 450 | } |
451 | 451 | $descriptions .= EEH_HTML::p( |
452 | 452 | $question_type_description, |
453 | - 'question_type_description-' . $type, |
|
453 | + 'question_type_description-'.$type, |
|
454 | 454 | 'question_type_description description', |
455 | 455 | 'display:none;' |
456 | 456 | ); |
@@ -464,58 +464,58 @@ discard block |
||
464 | 464 | * @param bool|true $new_question |
465 | 465 | * @throws \EE_Error |
466 | 466 | */ |
467 | - protected function _insert_or_update_question( $new_question = TRUE) { |
|
468 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
469 | - $set_column_values=$this->_set_column_values_for($this->_question_model); |
|
470 | - if($new_question){ |
|
471 | - $ID=$this->_question_model->insert($set_column_values); |
|
467 | + protected function _insert_or_update_question($new_question = TRUE) { |
|
468 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
469 | + $set_column_values = $this->_set_column_values_for($this->_question_model); |
|
470 | + if ($new_question) { |
|
471 | + $ID = $this->_question_model->insert($set_column_values); |
|
472 | 472 | $success = $ID ? true : false; |
473 | 473 | $action_desc = 'added'; |
474 | - }else{ |
|
475 | - $ID=absint($this->_req_data['QST_ID']); |
|
476 | - $pk=$this->_question_model->primary_key_name(); |
|
477 | - $wheres=array($pk=>$ID); |
|
474 | + } else { |
|
475 | + $ID = absint($this->_req_data['QST_ID']); |
|
476 | + $pk = $this->_question_model->primary_key_name(); |
|
477 | + $wheres = array($pk=>$ID); |
|
478 | 478 | unset($set_column_values[$pk]); |
479 | - $success= $this->_question_model->update($set_column_values,array($wheres)); |
|
480 | - $action_desc='updated'; |
|
479 | + $success = $this->_question_model->update($set_column_values, array($wheres)); |
|
480 | + $action_desc = 'updated'; |
|
481 | 481 | } |
482 | 482 | |
483 | - if ($ID){ |
|
483 | + if ($ID) { |
|
484 | 484 | //save the related options |
485 | 485 | //trash removed options, save old ones |
486 | 486 | //get list of all options |
487 | 487 | /** @type EE_Question $question */ |
488 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
489 | - $options=$question->options(); |
|
490 | - if(! empty($options)){ |
|
491 | - foreach($options as $option_ID=>$option){ |
|
492 | - $option_req_index=$this->_get_option_req_data_index($option_ID); |
|
493 | - if($option_req_index!==FALSE){ |
|
488 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
489 | + $options = $question->options(); |
|
490 | + if ( ! empty($options)) { |
|
491 | + foreach ($options as $option_ID=>$option) { |
|
492 | + $option_req_index = $this->_get_option_req_data_index($option_ID); |
|
493 | + if ($option_req_index !== FALSE) { |
|
494 | 494 | $option->save($this->_req_data['question_options'][$option_req_index]); |
495 | - }else{ |
|
495 | + } else { |
|
496 | 496 | //not found, remove it |
497 | 497 | $option->delete(); |
498 | 498 | } |
499 | 499 | } |
500 | 500 | } |
501 | 501 | //save new related options |
502 | - foreach($this->_req_data['question_options'] as $index=>$option_req_data){ |
|
503 | - 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! |
|
504 | - if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === '' ){ |
|
505 | - $option_req_data['QSO_value']=$option_req_data['QSO_desc']; |
|
502 | + foreach ($this->_req_data['question_options'] as $index=>$option_req_data) { |
|
503 | + 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! |
|
504 | + if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') { |
|
505 | + $option_req_data['QSO_value'] = $option_req_data['QSO_desc']; |
|
506 | 506 | } |
507 | - $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())); |
|
507 | + $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())); |
|
508 | 508 | $new_option->save(); |
509 | 509 | } |
510 | 510 | } |
511 | 511 | } |
512 | - $query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID ); |
|
513 | - if ( $success !== FALSE ) { |
|
514 | - $msg = $new_question ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() ); |
|
515 | - EE_Error::add_success( $msg ); |
|
512 | + $query_args = array('action' => 'edit_question', 'QST_ID' => $ID); |
|
513 | + if ($success !== FALSE) { |
|
514 | + $msg = $new_question ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name()); |
|
515 | + EE_Error::add_success($msg); |
|
516 | 516 | } |
517 | 517 | |
518 | - $this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE); |
|
518 | + $this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -528,10 +528,10 @@ discard block |
||
528 | 528 | * @param int $ID of the question option to find |
529 | 529 | * @return int index in question_options array if successful, FALSE if unsuccessful |
530 | 530 | */ |
531 | - protected function _get_option_req_data_index($ID){ |
|
532 | - $req_data_for_question_options=$this->_req_data['question_options']; |
|
533 | - foreach($req_data_for_question_options as $num=>$option_data){ |
|
534 | - if( array_key_exists('QSO_ID',$option_data) && (int)$option_data['QSO_ID'] === $ID ){ |
|
531 | + protected function _get_option_req_data_index($ID) { |
|
532 | + $req_data_for_question_options = $this->_req_data['question_options']; |
|
533 | + foreach ($req_data_for_question_options as $num=>$option_data) { |
|
534 | + if (array_key_exists('QSO_ID', $option_data) && (int) $option_data['QSO_ID'] === $ID) { |
|
535 | 535 | return $num; |
536 | 536 | } |
537 | 537 | } |
@@ -553,25 +553,25 @@ discard block |
||
553 | 553 | * @param int $current_page |
554 | 554 | * @return array lik EEM_Base::get_all's $query_params parameter |
555 | 555 | */ |
556 | - protected function get_query_params($model, $per_page=10,$current_page=10){ |
|
556 | + protected function get_query_params($model, $per_page = 10, $current_page = 10) { |
|
557 | 557 | $query_params = array(); |
558 | - $offset=($current_page-1)*$per_page; |
|
559 | - $query_params['limit']=array($offset,$per_page); |
|
560 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
558 | + $offset = ($current_page - 1) * $per_page; |
|
559 | + $query_params['limit'] = array($offset, $per_page); |
|
560 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
561 | 561 | $orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order'; |
562 | 562 | $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby']; |
563 | - $query_params['order_by']=array( $field_to_order_by => $order ); |
|
564 | - $search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null; |
|
565 | - if(! empty($search_string)){ |
|
566 | - if($model instanceof EEM_Question_Group){ |
|
567 | - $query_params[0]=array( |
|
563 | + $query_params['order_by'] = array($field_to_order_by => $order); |
|
564 | + $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null; |
|
565 | + if ( ! empty($search_string)) { |
|
566 | + if ($model instanceof EEM_Question_Group) { |
|
567 | + $query_params[0] = array( |
|
568 | 568 | 'OR'=>array( |
569 | - 'QSG_name'=>array('LIKE',"%$search_string%"), |
|
570 | - 'QSG_desc'=>array('LIKE',"%$search_string%")) |
|
569 | + 'QSG_name'=>array('LIKE', "%$search_string%"), |
|
570 | + 'QSG_desc'=>array('LIKE', "%$search_string%")) |
|
571 | 571 | ); |
572 | - }else{ |
|
573 | - $query_params[0]=array( |
|
574 | - 'QST_display_text'=>array('LIKE',"%$search_string%") |
|
572 | + } else { |
|
573 | + $query_params[0] = array( |
|
574 | + 'QST_display_text'=>array('LIKE', "%$search_string%") |
|
575 | 575 | ); |
576 | 576 | } |
577 | 577 | } |
@@ -619,13 +619,13 @@ discard block |
||
619 | 619 | * @param bool|false $count |
620 | 620 | * @return \EE_Soft_Delete_Base_Class[]|int |
621 | 621 | */ |
622 | - public function get_questions( $per_page=10, $current_page = 1, $count = FALSE ) { |
|
622 | + public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) { |
|
623 | 623 | $QST = EEM_Question::instance(); |
624 | 624 | $query_params = $this->get_query_params($QST, $per_page, $current_page); |
625 | - if ($count){ |
|
626 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
625 | + if ($count) { |
|
626 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
627 | 627 | $results = $QST->count($where); |
628 | - }else{ |
|
628 | + } else { |
|
629 | 629 | $results = $QST->get_all($query_params); |
630 | 630 | } |
631 | 631 | return $results; |
@@ -640,10 +640,10 @@ discard block |
||
640 | 640 | * @param bool|false $count |
641 | 641 | * @return \EE_Soft_Delete_Base_Class[]|int |
642 | 642 | */ |
643 | - public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) { |
|
644 | - $query_params =$this->get_query_params( EEM_Question::instance(), $per_page, $current_page); |
|
645 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
646 | - $questions =$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
643 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
644 | + $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
|
645 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
646 | + $questions = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
647 | 647 | return $questions; |
648 | 648 | } |
649 | 649 | |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | * @param bool|false $count |
656 | 656 | * @return \EE_Soft_Delete_Base_Class[] |
657 | 657 | */ |
658 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
658 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
659 | 659 | /** @type EEM_Question_Group $questionGroupModel */ |
660 | 660 | $questionGroupModel = EEM_Question_Group::instance(); |
661 | 661 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
662 | 662 | return $questionGroupModel->get_all( |
663 | - $this->get_query_params( $questionGroupModel, $per_page, $current_page ) |
|
663 | + $this->get_query_params($questionGroupModel, $per_page, $current_page) |
|
664 | 664 | ); |
665 | 665 | } |
666 | 666 | |
@@ -677,36 +677,36 @@ discard block |
||
677 | 677 | |
678 | 678 | $this->_template_args['values'] = $this->_yes_no_values; |
679 | 679 | |
680 | - $this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
681 | - $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': ''; |
|
680 | + $this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
681 | + $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : ''; |
|
682 | 682 | |
683 | - $this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''; |
|
684 | - $this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''; |
|
685 | - $this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500; |
|
683 | + $this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''; |
|
684 | + $this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''; |
|
685 | + $this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500; |
|
686 | 686 | |
687 | 687 | $this->_template_args['recaptcha_theme_options'] = array( |
688 | - array('id' => 'red','text'=> esc_html__('Red', 'event_espresso')), |
|
689 | - array('id' => 'white','text'=> esc_html__('White', 'event_espresso')), |
|
690 | - array('id' => 'blackglass','text'=> esc_html__('Blackglass', 'event_espresso')), |
|
691 | - array('id' => 'clean','text'=> esc_html__('Clean', 'event_espresso')) |
|
688 | + array('id' => 'red', 'text'=> esc_html__('Red', 'event_espresso')), |
|
689 | + array('id' => 'white', 'text'=> esc_html__('White', 'event_espresso')), |
|
690 | + array('id' => 'blackglass', 'text'=> esc_html__('Blackglass', 'event_espresso')), |
|
691 | + array('id' => 'clean', 'text'=> esc_html__('Clean', 'event_espresso')) |
|
692 | 692 | ); |
693 | - $this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean'; |
|
693 | + $this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean'; |
|
694 | 694 | |
695 | 695 | $this->_template_args['recaptcha_language_options'] = array( |
696 | - array('id' => 'en','text'=> esc_html__('English', 'event_espresso')), |
|
697 | - array('id' => 'es','text'=> esc_html__('Spanish', 'event_espresso')), |
|
698 | - array('id' => 'nl','text'=> esc_html__('Dutch', 'event_espresso')), |
|
699 | - array('id' => 'fr','text'=> esc_html__('French', 'event_espresso')), |
|
700 | - array('id' => 'de','text'=> esc_html__('German', 'event_espresso')), |
|
701 | - array('id' => 'pt','text'=> esc_html__('Portuguese', 'event_espresso')), |
|
702 | - array('id' => 'ru','text'=> esc_html__('Russian', 'event_espresso')), |
|
703 | - array('id' => 'tr','text'=> esc_html__('Turkish', 'event_espresso')) |
|
696 | + array('id' => 'en', 'text'=> esc_html__('English', 'event_espresso')), |
|
697 | + array('id' => 'es', 'text'=> esc_html__('Spanish', 'event_espresso')), |
|
698 | + array('id' => 'nl', 'text'=> esc_html__('Dutch', 'event_espresso')), |
|
699 | + array('id' => 'fr', 'text'=> esc_html__('French', 'event_espresso')), |
|
700 | + array('id' => 'de', 'text'=> esc_html__('German', 'event_espresso')), |
|
701 | + array('id' => 'pt', 'text'=> esc_html__('Portuguese', 'event_espresso')), |
|
702 | + array('id' => 'ru', 'text'=> esc_html__('Russian', 'event_espresso')), |
|
703 | + array('id' => 'tr', 'text'=> esc_html__('Turkish', 'event_espresso')) |
|
704 | 704 | ); |
705 | - $this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
705 | + $this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
706 | 706 | |
707 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
708 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
709 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
707 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
708 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
709 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
710 | 710 | $this->display_admin_page_with_sidebar(); |
711 | 711 | } |
712 | 712 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | *_question_model EEM_Question model instance (for queries) |
51 | 51 | * |
52 | 52 | * @var EEM_Question $_question_model; |
53 | - */ |
|
53 | + */ |
|
54 | 54 | protected $_question_model; |
55 | 55 | |
56 | 56 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ), |
152 | 152 | 'list_table' => 'Registration_Form_Questions_Admin_List_Table', |
153 | 153 | 'metaboxes' => $this->_default_espresso_metaboxes, |
154 | - 'help_tabs' => array( |
|
154 | + 'help_tabs' => array( |
|
155 | 155 | 'registration_form_questions_overview_help_tab' => array( |
156 | 156 | 'title' => esc_html__('Questions Overview', 'event_espresso'), |
157 | 157 | 'filename' => 'registration_form_questions_overview' |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'filename' => 'registration_form_edit_question' |
203 | 203 | ), |
204 | 204 | ), |
205 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
205 | + 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
206 | 206 | 'require_nonce' => FALSE |
207 | 207 | ), |
208 | 208 | ); |
@@ -3,15 +3,15 @@ |
||
3 | 3 | <?php _e('This page shows options for Email Validation, the EE "Bot Trap" and reCAPTCHA which can help prevent SPAM registrations on your site.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <div id="email_validation_info"> |
6 | -<p><strong><?php _e('Email Validation', 'event_espresso');?></strong></p> |
|
6 | +<p><strong><?php _e('Email Validation', 'event_espresso'); ?></strong></p> |
|
7 | 7 | <p><?php _e("Validating an email address is extremely difficult to do correctly. Your server's configuration, as well as your own tolerances and needs, can affect the type of validation needed. We offer different types of validation so that you can control how strict your registration form responds to entered email addresses. If you are receiving too many bogus email addresses, then you can try the WordPress Default validation setting. If you find that the form validation is blocking a valid email address you can try the Basic setting, or if available, the International validation settings.", 'event_espresso'); ?> |
8 | 8 | </p> |
9 | -<p><strong><?php _e('Validation Options:', 'event_espresso' );?></strong></p> |
|
9 | +<p><strong><?php _e('Validation Options:', 'event_espresso'); ?></strong></p> |
|
10 | 10 | <ul> |
11 | 11 | <li> |
12 | 12 | <?php _e('"Basic" - only checks that an email address follows the most basic structure guidelines ( ie: [email protected] ). Will work with the widest range of email addresses but will also allow the most garbage through.', 'event_espresso'); ?></li> |
13 | 13 | <li> |
14 | - <?php _e('"WordPress Default" - uses built in WordPress email validation, but does not support unicode characters (ie: international characters from non-latin based languages).','event_espresso'); ?></li> |
|
14 | + <?php _e('"WordPress Default" - uses built in WordPress email validation, but does not support unicode characters (ie: international characters from non-latin based languages).', 'event_espresso'); ?></li> |
|
15 | 15 | <li> |
16 | 16 | <?php _e('"International" - supports unicode characters but may not be supported by all server configurations. Try this first if you need to international language support, but drop back down to "Basic" if your server configuration conflicts.', 'event_espresso'); ?> |
17 | 17 | </li> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @access public |
44 | 44 | * @param \EEI_Request_Decorator $request_stack |
45 | 45 | */ |
46 | - public function __construct( EEI_Request_Decorator $request_stack ) { |
|
46 | + public function __construct(EEI_Request_Decorator $request_stack) { |
|
47 | 47 | $this->_request_stack = $request_stack; |
48 | 48 | } |
49 | 49 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | * @param EE_Response $response |
58 | 58 | * @return EE_Response |
59 | 59 | */ |
60 | - protected function process_request_stack( EE_Request $request, EE_Response $response ) { |
|
60 | + protected function process_request_stack(EE_Request $request, EE_Response $response) { |
|
61 | 61 | $this->_request = $request; |
62 | 62 | $this->_response = $response; |
63 | - if ( ! $this->_response->request_terminated() ) { |
|
64 | - $this->_response = $this->_request_stack->handle_request( $this->_request, $this->_response ); |
|
63 | + if ( ! $this->_response->request_terminated()) { |
|
64 | + $this->_response = $this->_request_stack->handle_request($this->_request, $this->_response); |
|
65 | 65 | } |
66 | 66 | return $this->_response; |
67 | 67 | } |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * @param EE_Response $response |
22 | 22 | * @return EE_Response |
23 | 23 | */ |
24 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
24 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
25 | 25 | $this->_request = $request; |
26 | 26 | $this->_response = $response; |
27 | 27 | $this->display_alpha_banner_warning(); |
28 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
28 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
29 | 29 | return $this->_response; |
30 | 30 | } |
31 | 31 | |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function display_alpha_banner_warning() { |
43 | 43 | // skip AJAX requests |
44 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
44 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | // skip stable releases |
48 | - if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) { |
|
48 | + if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | // post release candidate warning |
52 | - if ( is_admin() ) { |
|
53 | - add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 ); |
|
52 | + if (is_admin()) { |
|
53 | + add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999); |
|
54 | 54 | } else { |
55 | 55 | // site admin has authorized use of non-stable release candidate for production |
56 | - if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) { |
|
56 | + if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | - add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 ); |
|
59 | + add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function alpha_banner_admin_notice() { |
73 | 73 | EE_Error::add_attention( |
74 | 74 | sprintf( |
75 | - __( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ), |
|
75 | + __('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'), |
|
76 | 76 | '<strong>', |
77 | 77 | '</strong>' |
78 | 78 | ), |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function alpha_banner_warning_notice() { |
93 | 93 | printf( |
94 | - __( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ), |
|
94 | + __('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'), |
|
95 | 95 | '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>', |
96 | 96 | '<strong>', |
97 | 97 | '</strong>', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param EEI_Request_Decorator $application |
44 | 44 | * @param array $middlewares |
45 | 45 | */ |
46 | - public function __construct( EEI_Request_Decorator $application, $middlewares = array() ) { |
|
46 | + public function __construct(EEI_Request_Decorator $application, $middlewares = array()) { |
|
47 | 47 | $this->_application = $application; |
48 | 48 | $this->_middlewares = $middlewares; |
49 | 49 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @param EE_Response $response |
56 | 56 | * @return EE_Response |
57 | 57 | */ |
58 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
58 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
59 | 59 | $this->_request = $request; |
60 | 60 | $this->_response = $response; |
61 | - return $this->_application->handle_request( $request, $response ); |
|
61 | + return $this->_application->handle_request($request, $response); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * after the request stack has been fully processed |
70 | 70 | */ |
71 | 71 | public function handle_response() { |
72 | - foreach ( $this->_middlewares as $middleware ) { |
|
73 | - if ( $middleware instanceof EEI_Request_Stack_Core_App ) { |
|
74 | - $middleware->handle_response( $this->_request, $this->_response ); |
|
72 | + foreach ($this->_middlewares as $middleware) { |
|
73 | + if ($middleware instanceof EEI_Request_Stack_Core_App) { |
|
74 | + $middleware->handle_response($this->_request, $this->_response); |
|
75 | 75 | // exit loop since we should be done |
76 | 76 | // (also in case someone has accidentally labeled multiple apps as the EEI_Request_Stack_Core_App ) |
77 | 77 | break; |
@@ -1,25 +1,25 @@ |
||
1 | 1 | <div class="changelog point-releases"> |
2 | - <!-- <h3><?php echo _n( 'Minor Release Information', 'Minor Releases', 1 ); ?></h3> --> |
|
3 | - <h3><?php echo _n( 'Major Release Information', 'Major Releases', 1 ); ?></h3> |
|
2 | + <!-- <h3><?php echo _n('Minor Release Information', 'Minor Releases', 1); ?></h3> --> |
|
3 | + <h3><?php echo _n('Major Release Information', 'Major Releases', 1); ?></h3> |
|
4 | 4 | <?php //$type = 'minor'; ?> |
5 | 5 | <?php $type = 'major'; ?> |
6 | - <p><?php printf( __( '<strong>Version %1$s</strong> is a %2$s release.', 'event_espresso'), EVENT_ESPRESSO_VERSION, $type ); ?> |
|
6 | + <p><?php printf(__('<strong>Version %1$s</strong> is a %2$s release.', 'event_espresso'), EVENT_ESPRESSO_VERSION, $type); ?> |
|
7 | 7 | <?php |
8 | - $ver = explode( '.', EVENT_ESPRESSO_VERSION ); |
|
9 | - array_pop( $ver ); |
|
10 | - $ver = implode( '.', $ver ); |
|
8 | + $ver = explode('.', EVENT_ESPRESSO_VERSION); |
|
9 | + array_pop($ver); |
|
10 | + $ver = implode('.', $ver); |
|
11 | 11 | ?> |
12 | - <?php printf( __( 'For more information, see <a href="%s" target="_blank">the release notes</a>.' ), 'http://eventespresso.com/wiki/ee4-changelog/#' . $ver ); ?> |
|
12 | + <?php printf(__('For more information, see <a href="%s" target="_blank">the release notes</a>.'), 'http://eventespresso.com/wiki/ee4-changelog/#'.$ver); ?> |
|
13 | 13 | </p> |
14 | 14 | </div> |
15 | 15 | |
16 | 16 | <div class="changelog"> |
17 | 17 | <?php |
18 | 18 | //maintenance mode on? |
19 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
19 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
20 | 20 | ?> |
21 | 21 | <div class="ee-attention"> |
22 | - <h2 class="ee-maintenance-mode-callout"><?php _e('Event Espresso is in full maintenance mode.' , 'event_espresso'); ?></h2> |
|
22 | + <h2 class="ee-maintenance-mode-callout"><?php _e('Event Espresso is in full maintenance mode.', 'event_espresso'); ?></h2> |
|
23 | 23 | <p> |
24 | 24 | <?php |
25 | 25 | printf( |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | |
17 | 17 | use EventEspressoBatchRequest\Helpers\BatchRequestException; |
18 | 18 | |
19 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
20 | - exit( 'No direct script access allowed' ); |
|
19 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
20 | + exit('No direct script access allowed'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param \EEHI_File|null $file_helper |
41 | 41 | */ |
42 | - public function __construct( \EEHI_File $file_helper = null ) { |
|
43 | - if( ! $file_helper ) { |
|
42 | + public function __construct(\EEHI_File $file_helper = null) { |
|
43 | + if ( ! $file_helper) { |
|
44 | 44 | $this->_file_helper = new \EEH_File(); |
45 | 45 | } |
46 | 46 | } |
@@ -56,39 +56,39 @@ discard block |
||
56 | 56 | * @return string |
57 | 57 | * @throws \EventEspressoBatchRequest\Helpers\BatchRequestException |
58 | 58 | */ |
59 | - public function create_file_from_job_with_name( $job_id, $filename, $filetype = 'application/ms-excel' ) { |
|
59 | + public function create_file_from_job_with_name($job_id, $filename, $filetype = 'application/ms-excel') { |
|
60 | 60 | $filepath = ''; |
61 | - try{ |
|
61 | + try { |
|
62 | 62 | $base_folder = $this->get_base_folder(); |
63 | 63 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
64 | - $base_folder . JobHandlerFile::temp_folder_name |
|
64 | + $base_folder.JobHandlerFile::temp_folder_name |
|
65 | 65 | ); |
66 | - if ( $success ) { |
|
66 | + if ($success) { |
|
67 | 67 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
68 | - $base_folder . JobHandlerFile::temp_folder_name . DS . $job_id |
|
68 | + $base_folder.JobHandlerFile::temp_folder_name.DS.$job_id |
|
69 | 69 | ); |
70 | 70 | } |
71 | - if( $success ) { |
|
72 | - $filepath = $base_folder . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename; |
|
73 | - $success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath ); |
|
71 | + if ($success) { |
|
72 | + $filepath = $base_folder.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename; |
|
73 | + $success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath); |
|
74 | 74 | } |
75 | 75 | //let's add the .htaccess file so safari will open the file properly |
76 | - if( $success ) { |
|
77 | - $extension = \EEH_File::get_file_extension( $filepath ); |
|
76 | + if ($success) { |
|
77 | + $extension = \EEH_File::get_file_extension($filepath); |
|
78 | 78 | \EEH_File::write_to_file( |
79 | - $base_folder . JobHandlerFile::temp_folder_name . DS . $job_id . DS . '.htaccess', |
|
80 | - 'AddType ' . $filetype . ' ' . $extension, |
|
79 | + $base_folder.JobHandlerFile::temp_folder_name.DS.$job_id.DS.'.htaccess', |
|
80 | + 'AddType '.$filetype.' '.$extension, |
|
81 | 81 | '.htaccess' |
82 | 82 | ); |
83 | 83 | } |
84 | 84 | //those methods normally fail with an exception, but if not, let's do it |
85 | - if( ! $success ) { |
|
86 | - throw new \EE_Error( __( 'Could not create temporary file, an unknown error occurred', 'event_espresso' ) ); |
|
85 | + if ( ! $success) { |
|
86 | + throw new \EE_Error(__('Could not create temporary file, an unknown error occurred', 'event_espresso')); |
|
87 | 87 | } |
88 | - } catch( \EE_Error $e ) { |
|
88 | + } catch (\EE_Error $e) { |
|
89 | 89 | throw new BatchRequestException( |
90 | 90 | sprintf( |
91 | - __( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ), |
|
91 | + __('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'), |
|
92 | 92 | $job_id, |
93 | 93 | $e->getMessage() |
94 | 94 | ), |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $filepath |
105 | 105 | * @return string url to file |
106 | 106 | */ |
107 | - public function get_url_to_file( $filepath ) { |
|
108 | - return str_replace( $this->get_base_folder(), $this->get_base_url(), $filepath ); |
|
107 | + public function get_url_to_file($filepath) { |
|
108 | + return str_replace($this->get_base_folder(), $this->get_base_url(), $filepath); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |