@@ -10,15 +10,15 @@ |
||
10 | 10 | { |
11 | 11 | |
12 | 12 | |
13 | - /** |
|
14 | - * Fixed Inputs are inputs that do NOT accept user input |
|
15 | - * therefore they will ALWAYS return the default value that was set upon their creation |
|
16 | - * and NO normalization or sanitization will occur because the $_REQUEST value is being ignored |
|
17 | - * |
|
18 | - * @param array $req_data like $_POST |
|
19 | - * @return boolean whether or not there was an error |
|
20 | - */ |
|
21 | - protected function _normalize($req_data) |
|
22 | - { |
|
23 | - } |
|
13 | + /** |
|
14 | + * Fixed Inputs are inputs that do NOT accept user input |
|
15 | + * therefore they will ALWAYS return the default value that was set upon their creation |
|
16 | + * and NO normalization or sanitization will occur because the $_REQUEST value is being ignored |
|
17 | + * |
|
18 | + * @param array $req_data like $_POST |
|
19 | + * @return boolean whether or not there was an error |
|
20 | + */ |
|
21 | + protected function _normalize($req_data) |
|
22 | + { |
|
23 | + } |
|
24 | 24 | } |
@@ -12,21 +12,21 @@ |
||
12 | 12 | class EE_Credit_Card_Month_Input extends EE_Month_Input |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @param bool $leading_zero |
|
17 | - * @param array $input_settings |
|
18 | - * @param bool $january_is_month_1 |
|
19 | - */ |
|
20 | - public function __construct( |
|
21 | - $leading_zero = false, |
|
22 | - $input_settings = array(), |
|
23 | - $january_is_month_1 = true |
|
24 | - ) { |
|
25 | - $this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal()); |
|
26 | - parent::__construct( |
|
27 | - $leading_zero, |
|
28 | - $input_settings, |
|
29 | - $january_is_month_1 |
|
30 | - ); |
|
31 | - } |
|
15 | + /** |
|
16 | + * @param bool $leading_zero |
|
17 | + * @param array $input_settings |
|
18 | + * @param bool $january_is_month_1 |
|
19 | + */ |
|
20 | + public function __construct( |
|
21 | + $leading_zero = false, |
|
22 | + $input_settings = array(), |
|
23 | + $january_is_month_1 = true |
|
24 | + ) { |
|
25 | + $this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal()); |
|
26 | + parent::__construct( |
|
27 | + $leading_zero, |
|
28 | + $input_settings, |
|
29 | + $january_is_month_1 |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | } |
@@ -12,26 +12,26 @@ |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | |
15 | - /** |
|
16 | - * @param array $options |
|
17 | - */ |
|
18 | - public function __construct($options = array()) |
|
19 | - { |
|
20 | - $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
|
21 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
22 | - parent::__construct($options); |
|
23 | - // if the input hasn't specifically mentioned a more lenient validation strategy, |
|
24 | - // apply plaintext validation strategy |
|
25 | - if (! $this->has_validation_strategy( |
|
26 | - array( |
|
27 | - 'EE_Full_HTML_Validation_Strategy', |
|
28 | - 'EE_Simple_HTML_Validation_Strategy' |
|
29 | - ) |
|
30 | - ) |
|
31 | - ) { |
|
32 | - // by default we use the plaintext validation. If you want something else, |
|
33 | - // just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
|
34 | - $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
35 | - } |
|
36 | - } |
|
15 | + /** |
|
16 | + * @param array $options |
|
17 | + */ |
|
18 | + public function __construct($options = array()) |
|
19 | + { |
|
20 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
|
21 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
22 | + parent::__construct($options); |
|
23 | + // if the input hasn't specifically mentioned a more lenient validation strategy, |
|
24 | + // apply plaintext validation strategy |
|
25 | + if (! $this->has_validation_strategy( |
|
26 | + array( |
|
27 | + 'EE_Full_HTML_Validation_Strategy', |
|
28 | + 'EE_Simple_HTML_Validation_Strategy' |
|
29 | + ) |
|
30 | + ) |
|
31 | + ) { |
|
32 | + // by default we use the plaintext validation. If you want something else, |
|
33 | + // just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
|
34 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | parent::__construct($options); |
23 | 23 | // if the input hasn't specifically mentioned a more lenient validation strategy, |
24 | 24 | // apply plaintext validation strategy |
25 | - if (! $this->has_validation_strategy( |
|
25 | + if ( ! $this->has_validation_strategy( |
|
26 | 26 | array( |
27 | 27 | 'EE_Full_HTML_Validation_Strategy', |
28 | 28 | 'EE_Simple_HTML_Validation_Strategy' |
@@ -9,21 +9,21 @@ |
||
9 | 9 | class EE_Email_Input extends EE_Form_Input_Base |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param array $input_settings |
|
14 | - */ |
|
15 | - public function __construct($input_settings = array()) |
|
16 | - { |
|
17 | - $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
18 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
19 | - $this->_add_validation_strategy( |
|
20 | - new EE_Email_Validation_Strategy( |
|
21 | - isset($input_settings['validation_error_message']) |
|
22 | - ? $input_settings['validation_error_message'] |
|
23 | - : null |
|
24 | - ) |
|
25 | - ); |
|
26 | - parent::__construct($input_settings); |
|
27 | - $this->set_html_class($this->html_class() . ' email'); |
|
28 | - } |
|
12 | + /** |
|
13 | + * @param array $input_settings |
|
14 | + */ |
|
15 | + public function __construct($input_settings = array()) |
|
16 | + { |
|
17 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
18 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
19 | + $this->_add_validation_strategy( |
|
20 | + new EE_Email_Validation_Strategy( |
|
21 | + isset($input_settings['validation_error_message']) |
|
22 | + ? $input_settings['validation_error_message'] |
|
23 | + : null |
|
24 | + ) |
|
25 | + ); |
|
26 | + parent::__construct($input_settings); |
|
27 | + $this->set_html_class($this->html_class() . ' email'); |
|
28 | + } |
|
29 | 29 | } |
@@ -24,6 +24,6 @@ |
||
24 | 24 | ) |
25 | 25 | ); |
26 | 26 | parent::__construct($input_settings); |
27 | - $this->set_html_class($this->html_class() . ' email'); |
|
27 | + $this->set_html_class($this->html_class().' email'); |
|
28 | 28 | } |
29 | 29 | } |
@@ -12,67 +12,67 @@ |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | |
15 | - protected $_rows = 2; |
|
16 | - protected $_cols = 20; |
|
15 | + protected $_rows = 2; |
|
16 | + protected $_cols = 20; |
|
17 | 17 | |
18 | - /** |
|
19 | - * sets the rows property on this input |
|
20 | - * @param int $rows |
|
21 | - */ |
|
22 | - public function set_rows($rows) |
|
23 | - { |
|
24 | - $this->_rows = $rows; |
|
25 | - } |
|
26 | - /** |
|
27 | - * sets the cols html property on this input |
|
28 | - * @param int $cols |
|
29 | - */ |
|
30 | - public function set_cols($cols) |
|
31 | - { |
|
32 | - $this->_cols = $cols; |
|
33 | - } |
|
34 | - /** |
|
35 | - * |
|
36 | - * @return int |
|
37 | - */ |
|
38 | - public function get_rows() |
|
39 | - { |
|
40 | - return $this->_rows; |
|
41 | - } |
|
42 | - /** |
|
43 | - * |
|
44 | - * @return int |
|
45 | - */ |
|
46 | - public function get_cols() |
|
47 | - { |
|
48 | - return $this->_cols; |
|
49 | - } |
|
18 | + /** |
|
19 | + * sets the rows property on this input |
|
20 | + * @param int $rows |
|
21 | + */ |
|
22 | + public function set_rows($rows) |
|
23 | + { |
|
24 | + $this->_rows = $rows; |
|
25 | + } |
|
26 | + /** |
|
27 | + * sets the cols html property on this input |
|
28 | + * @param int $cols |
|
29 | + */ |
|
30 | + public function set_cols($cols) |
|
31 | + { |
|
32 | + $this->_cols = $cols; |
|
33 | + } |
|
34 | + /** |
|
35 | + * |
|
36 | + * @return int |
|
37 | + */ |
|
38 | + public function get_rows() |
|
39 | + { |
|
40 | + return $this->_rows; |
|
41 | + } |
|
42 | + /** |
|
43 | + * |
|
44 | + * @return int |
|
45 | + */ |
|
46 | + public function get_cols() |
|
47 | + { |
|
48 | + return $this->_cols; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | 52 | |
53 | - /** |
|
54 | - * @param array $options_array |
|
55 | - */ |
|
56 | - public function __construct($options_array = array()) |
|
57 | - { |
|
58 | - $this->_set_display_strategy(new EE_Text_Area_Display_Strategy()); |
|
59 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
53 | + /** |
|
54 | + * @param array $options_array |
|
55 | + */ |
|
56 | + public function __construct($options_array = array()) |
|
57 | + { |
|
58 | + $this->_set_display_strategy(new EE_Text_Area_Display_Strategy()); |
|
59 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
60 | 60 | |
61 | 61 | |
62 | - parent::__construct($options_array); |
|
62 | + parent::__construct($options_array); |
|
63 | 63 | |
64 | - // if the input hasn't specifically mentioned a more lenient validation strategy, |
|
65 | - // apply plaintext validation strategy |
|
66 | - if (! $this->has_validation_strategy( |
|
67 | - array( |
|
68 | - 'EE_Full_HTML_Validation_Strategy', |
|
69 | - 'EE_Simple_HTML_Validation_Strategy' |
|
70 | - ) |
|
71 | - ) |
|
72 | - ) { |
|
73 | - // by default we use the plaintext validation. If you want something else, |
|
74 | - // just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
|
75 | - $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
76 | - } |
|
77 | - } |
|
64 | + // if the input hasn't specifically mentioned a more lenient validation strategy, |
|
65 | + // apply plaintext validation strategy |
|
66 | + if (! $this->has_validation_strategy( |
|
67 | + array( |
|
68 | + 'EE_Full_HTML_Validation_Strategy', |
|
69 | + 'EE_Simple_HTML_Validation_Strategy' |
|
70 | + ) |
|
71 | + ) |
|
72 | + ) { |
|
73 | + // by default we use the plaintext validation. If you want something else, |
|
74 | + // just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
|
75 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
76 | + } |
|
77 | + } |
|
78 | 78 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | |
64 | 64 | // if the input hasn't specifically mentioned a more lenient validation strategy, |
65 | 65 | // apply plaintext validation strategy |
66 | - if (! $this->has_validation_strategy( |
|
66 | + if ( ! $this->has_validation_strategy( |
|
67 | 67 | array( |
68 | 68 | 'EE_Full_HTML_Validation_Strategy', |
69 | 69 | 'EE_Simple_HTML_Validation_Strategy' |
@@ -13,20 +13,20 @@ |
||
13 | 13 | class EE_Select_Input extends EE_Form_Input_With_Options_Base |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @param array $answer_options |
|
18 | - * @param array $input_settings |
|
19 | - */ |
|
20 | - public function __construct($answer_options, $input_settings = array()) |
|
21 | - { |
|
22 | - $this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options)); |
|
23 | - $this->_add_validation_strategy( |
|
24 | - new EE_Enum_Validation_Strategy( |
|
25 | - isset($input_settings['validation_error_message']) |
|
26 | - ? $input_settings['validation_error_message'] |
|
27 | - : null |
|
28 | - ) |
|
29 | - ); |
|
30 | - parent::__construct($answer_options, $input_settings); |
|
31 | - } |
|
16 | + /** |
|
17 | + * @param array $answer_options |
|
18 | + * @param array $input_settings |
|
19 | + */ |
|
20 | + public function __construct($answer_options, $input_settings = array()) |
|
21 | + { |
|
22 | + $this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options)); |
|
23 | + $this->_add_validation_strategy( |
|
24 | + new EE_Enum_Validation_Strategy( |
|
25 | + isset($input_settings['validation_error_message']) |
|
26 | + ? $input_settings['validation_error_message'] |
|
27 | + : null |
|
28 | + ) |
|
29 | + ); |
|
30 | + parent::__construct($answer_options, $input_settings); |
|
31 | + } |
|
32 | 32 | } |
@@ -9,40 +9,40 @@ |
||
9 | 9 | abstract class EE_Form_Input_Strategy_Base |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * Form Input to display |
|
14 | - * |
|
15 | - * @var EE_Form_Input_Base |
|
16 | - */ |
|
17 | - protected $_input; |
|
12 | + /** |
|
13 | + * Form Input to display |
|
14 | + * |
|
15 | + * @var EE_Form_Input_Base |
|
16 | + */ |
|
17 | + protected $_input; |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
23 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * The form input on which this strategy is to perform |
|
29 | - * |
|
30 | - * @param EE_Form_Input_Base $form_input |
|
31 | - */ |
|
32 | - public function _construct_finalize(EE_Form_Input_Base $form_input) |
|
33 | - { |
|
34 | - $this->_input = $form_input; |
|
35 | - } |
|
27 | + /** |
|
28 | + * The form input on which this strategy is to perform |
|
29 | + * |
|
30 | + * @param EE_Form_Input_Base $form_input |
|
31 | + */ |
|
32 | + public function _construct_finalize(EE_Form_Input_Base $form_input) |
|
33 | + { |
|
34 | + $this->_input = $form_input; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * Gets this strategy's input |
|
41 | - * |
|
42 | - * @return EE_Form_Input_Base |
|
43 | - */ |
|
44 | - public function get_input() |
|
45 | - { |
|
46 | - return $this->_input; |
|
47 | - } |
|
39 | + /** |
|
40 | + * Gets this strategy's input |
|
41 | + * |
|
42 | + * @return EE_Form_Input_Base |
|
43 | + */ |
|
44 | + public function get_input() |
|
45 | + { |
|
46 | + return $this->_input; |
|
47 | + } |
|
48 | 48 | } |
@@ -12,29 +12,29 @@ |
||
12 | 12 | class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @return string of html to display the input |
|
17 | - */ |
|
18 | - public function display() |
|
19 | - { |
|
20 | - $default_value = $this->_input->get_default(); |
|
21 | - if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) { |
|
22 | - $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value); |
|
23 | - } |
|
24 | - $html = $this->_opening_tag('input'); |
|
25 | - $html .= $this->_attributes_string( |
|
26 | - array_merge( |
|
27 | - $this->_standard_attributes_array(), |
|
28 | - array( |
|
29 | - 'type' => 'submit', |
|
30 | - 'value' => $default_value, |
|
31 | - // overwrite the standard id with the backwards compatible one |
|
32 | - 'id' => $this->_input->html_id() . '-submit', |
|
33 | - 'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() |
|
34 | - ) |
|
35 | - ) |
|
36 | - ); |
|
37 | - $html .= $this->_close_tag(); |
|
38 | - return $html; |
|
39 | - } |
|
15 | + /** |
|
16 | + * @return string of html to display the input |
|
17 | + */ |
|
18 | + public function display() |
|
19 | + { |
|
20 | + $default_value = $this->_input->get_default(); |
|
21 | + if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) { |
|
22 | + $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value); |
|
23 | + } |
|
24 | + $html = $this->_opening_tag('input'); |
|
25 | + $html .= $this->_attributes_string( |
|
26 | + array_merge( |
|
27 | + $this->_standard_attributes_array(), |
|
28 | + array( |
|
29 | + 'type' => 'submit', |
|
30 | + 'value' => $default_value, |
|
31 | + // overwrite the standard id with the backwards compatible one |
|
32 | + 'id' => $this->_input->html_id() . '-submit', |
|
33 | + 'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() |
|
34 | + ) |
|
35 | + ) |
|
36 | + ); |
|
37 | + $html .= $this->_close_tag(); |
|
38 | + return $html; |
|
39 | + } |
|
40 | 40 | } |
@@ -29,8 +29,8 @@ |
||
29 | 29 | 'type' => 'submit', |
30 | 30 | 'value' => $default_value, |
31 | 31 | // overwrite the standard id with the backwards compatible one |
32 | - 'id' => $this->_input->html_id() . '-submit', |
|
33 | - 'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() |
|
32 | + 'id' => $this->_input->html_id().'-submit', |
|
33 | + 'class' => $this->_input->html_class().' '.$this->_input->button_css_attributes() |
|
34 | 34 | ) |
35 | 35 | ) |
36 | 36 | ); |
@@ -11,13 +11,13 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Hidden_Display_Strategy extends EE_Display_Strategy_Base |
13 | 13 | { |
14 | - /** |
|
15 | - * |
|
16 | - * @return string of html to display the HIDDEN field |
|
17 | - */ |
|
18 | - public function display() |
|
19 | - { |
|
20 | - $input = $this->_input; |
|
21 | - return "<input type='hidden' id='{$input->html_id()}' name='{$input->html_name()}' class='{$input->html_class()}' style='{$input->html_style()}' value='{$input->raw_value_in_form()}' {$input->other_html_attributes()}/>"; |
|
22 | - } |
|
14 | + /** |
|
15 | + * |
|
16 | + * @return string of html to display the HIDDEN field |
|
17 | + */ |
|
18 | + public function display() |
|
19 | + { |
|
20 | + $input = $this->_input; |
|
21 | + return "<input type='hidden' id='{$input->html_id()}' name='{$input->html_name()}' class='{$input->html_class()}' style='{$input->html_style()}' value='{$input->raw_value_in_form()}' {$input->other_html_attributes()}/>"; |
|
22 | + } |
|
23 | 23 | } |