@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Fieldset_Section_Layout |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Fieldset_Section_Layout |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout{ |
15 | 15 | |
16 | 16 | /** |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout{ |
|
14 | +class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * legend_class |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param array $options |
34 | 34 | */ |
35 | - function __construct( $options = array() ){ |
|
36 | - foreach( $options as $key => $value ) { |
|
37 | - $key = '_' . $key; |
|
38 | - if ( property_exists( $this, $key )) { |
|
35 | + function __construct($options = array()) { |
|
36 | + foreach ($options as $key => $value) { |
|
37 | + $key = '_'.$key; |
|
38 | + if (property_exists($this, $key)) { |
|
39 | 39 | $this->$key = $value; |
40 | 40 | } |
41 | 41 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @return string |
48 | 48 | */ |
49 | 49 | public function layout_form_begin() { |
50 | - $html = EEH_HTML::nl(1) . '<fieldset id="' . $this->_form_section->html_id() . '" class="' . $this->_form_section->html_class() . '" style="' . $this->_form_section->html_style() . '">'; |
|
51 | - $html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>'; |
|
50 | + $html = EEH_HTML::nl(1).'<fieldset id="'.$this->_form_section->html_id().'" class="'.$this->_form_section->html_class().'" style="'.$this->_form_section->html_style().'">'; |
|
51 | + $html .= '<legend class="'.$this->legend_class().'">'.$this->legend_text().'</legend>'; |
|
52 | 52 | return $html; |
53 | 53 | } |
54 | 54 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * closing div tag for a form |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - public function layout_form_end(){ |
|
62 | - return EEH_HTML::nl(-1) . '</fieldset>'; |
|
61 | + public function layout_form_end() { |
|
62 | + return EEH_HTML::nl(-1).'</fieldset>'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * @param string $legend_class |
69 | 69 | */ |
70 | - public function set_legend_class( $legend_class ) { |
|
70 | + public function set_legend_class($legend_class) { |
|
71 | 71 | $this->_legend_class = $legend_class; |
72 | 72 | } |
73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @param string $legend_text |
87 | 87 | */ |
88 | - public function set_legend_text( $legend_text ) { |
|
88 | + public function set_legend_text($legend_text) { |
|
89 | 89 | $this->_legend_text = $legend_text; |
90 | 90 | } |
91 | 91 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * stating where the proper subsections should be placed (but usually leaving them to layout |
9 | 9 | * their own headers and footers etc). |
10 | 10 | */ |
11 | -abstract class EE_Form_Section_Layout_Base{ |
|
11 | +abstract class EE_Form_Section_Layout_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Form form section to lay out |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * __construct |
23 | 23 | */ |
24 | - function __construct(){ |
|
24 | + function __construct() { |
|
25 | 25 | EE_Registry::instance()->load_helper('HTML'); |
26 | 26 | } |
27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * The form section on which this strategy is to perform |
32 | 32 | * @param EE_Form_Section_Proper $form |
33 | 33 | */ |
34 | - function _construct_finalize(EE_Form_Section_Proper $form){ |
|
34 | + function _construct_finalize(EE_Form_Section_Proper $form) { |
|
35 | 35 | $this->_form_section = $form; |
36 | 36 | } |
37 | 37 | |
@@ -54,28 +54,28 @@ discard block |
||
54 | 54 | * Returns the HTML |
55 | 55 | * @return string HTML for displaying |
56 | 56 | */ |
57 | - function layout_form(){ |
|
57 | + function layout_form() { |
|
58 | 58 | $html = ''; |
59 | 59 | // layout_form_begin |
60 | 60 | $html .= apply_filters( |
61 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(), |
|
61 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_'.$this->_form_section->name(), |
|
62 | 62 | $this->layout_form_begin(), |
63 | 63 | $this->_form_section |
64 | 64 | ); |
65 | 65 | // layout_form_loop |
66 | 66 | $html .= apply_filters( |
67 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(), |
|
67 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_'.$this->_form_section->name(), |
|
68 | 68 | $this->layout_form_loop(), |
69 | 69 | $this->_form_section |
70 | 70 | ); |
71 | 71 | // layout_form_end |
72 | 72 | $html .= apply_filters( |
73 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(), |
|
73 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_'.$this->_form_section->name(), |
|
74 | 74 | $this->layout_form_end(), |
75 | 75 | $this->_form_section |
76 | 76 | ); |
77 | 77 | |
78 | - $html = $this->add_form_section_hooks_and_filters( $html ); |
|
78 | + $html = $this->add_form_section_hooks_and_filters($html); |
|
79 | 79 | return $html; |
80 | 80 | } |
81 | 81 | |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * @return string |
86 | 86 | */ |
87 | - function layout_form_loop(){ |
|
87 | + function layout_form_loop() { |
|
88 | 88 | $html = ''; |
89 | - foreach( $this->_form_section->subsections() as $name => $subsection ){ |
|
90 | - if ( $subsection instanceof EE_Form_Input_Base ){ |
|
89 | + foreach ($this->_form_section->subsections() as $name => $subsection) { |
|
90 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
91 | 91 | $html .= apply_filters( |
92 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' . $name . '__in_' . $this->_form_section->name(), |
|
93 | - $this->layout_input( $subsection ), |
|
92 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'.$name.'__in_'.$this->_form_section->name(), |
|
93 | + $this->layout_input($subsection), |
|
94 | 94 | $this->_form_section, |
95 | 95 | $subsection |
96 | 96 | ); |
97 | - } elseif ( $subsection instanceof EE_Form_Section_Base ){ |
|
97 | + } elseif ($subsection instanceof EE_Form_Section_Base) { |
|
98 | 98 | $html .= apply_filters( |
99 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' . $name . '__in_' . $this->_form_section->name(), |
|
100 | - $this->layout_subsection( $subsection ), |
|
99 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'.$name.'__in_'.$this->_form_section->name(), |
|
100 | + $this->layout_subsection($subsection), |
|
101 | 101 | $this->_form_section, |
102 | 102 | $subsection |
103 | 103 | ); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param EE_Form_Section_Base $subsection |
146 | 146 | * @return string html |
147 | 147 | */ |
148 | - abstract function layout_subsection( $subsection ); |
|
148 | + abstract function layout_subsection($subsection); |
|
149 | 149 | |
150 | 150 | |
151 | 151 | |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | * @param EE_Form_Input_Base $input |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public function display_label($input){ |
|
158 | - $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class(); |
|
159 | - $label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
160 | - return '<label id="' . $input->html_label_id() . '" class="' . $class . '" style="' . $input->html_label_style() . '" for="' . $input->html_name() . '">' . $label_text . '</label>'; |
|
157 | + public function display_label($input) { |
|
158 | + $class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class(); |
|
159 | + $label_text = $input->required() ? $input->html_label_text().'<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
160 | + return '<label id="'.$input->html_label_id().'" class="'.$class.'" style="'.$input->html_label_style().'" for="'.$input->html_name().'">'.$label_text.'</label>'; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | * @param EE_Form_Input_Base $input |
171 | 171 | * @return string |
172 | 172 | */ |
173 | - public function display_errors($input){ |
|
174 | - if( $input->get_validation_errors() ){ |
|
175 | - return "<span id='" . $input->html_id() . "-error' class='ee-error-label red ee-red' for='{$input->html_name()}'>" . $input->get_validation_error_string() . "</span>"; |
|
176 | - }else{ |
|
173 | + public function display_errors($input) { |
|
174 | + if ($input->get_validation_errors()) { |
|
175 | + return "<span id='".$input->html_id()."-error' class='ee-error-label red ee-red' for='{$input->html_name()}'>".$input->get_validation_error_string()."</span>"; |
|
176 | + } else { |
|
177 | 177 | return ''; |
178 | 178 | } |
179 | 179 | } |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | * @param EE_Form_Input_Base $input |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - public function display_help_text( $input ){ |
|
187 | - if ( $input->html_help_text() != '' ) { |
|
186 | + public function display_help_text($input) { |
|
187 | + if ($input->html_help_text() != '') { |
|
188 | 188 | $tag = is_admin() ? 'p' : 'span'; |
189 | - return '<' . $tag . ' id="' . $input->html_id() . '-help" class="' . $input->html_help_class() . '" style="' . $input->html_help_style() . '">' . $input->html_help_text() . '</' . $tag . '>'; |
|
189 | + return '<'.$tag.' id="'.$input->html_id().'-help" class="'.$input->html_help_class().'" style="'.$input->html_help_style().'">'.$input->html_help_text().'</'.$tag.'>'; |
|
190 | 190 | } |
191 | 191 | return ''; |
192 | 192 | } |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | * @param string $html |
199 | 199 | * @return string |
200 | 200 | */ |
201 | - public function add_form_section_hooks_and_filters( $html ){ |
|
201 | + public function add_form_section_hooks_and_filters($html) { |
|
202 | 202 | // replace dashes and spaces with underscores |
203 | - $hook_name = str_replace( array( '-', ' ' ), '_', $this->_form_section->html_id() ); |
|
204 | - do_action( 'AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section ); |
|
205 | - $html = apply_filters( 'AFEE__Form_Section_Layout__' . $hook_name . '__html', $html, $this->_form_section ); |
|
206 | - $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->'; |
|
207 | - $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->'; |
|
203 | + $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id()); |
|
204 | + do_action('AHEE__Form_Section_Layout__'.$hook_name, $this->_form_section); |
|
205 | + $html = apply_filters('AFEE__Form_Section_Layout__'.$hook_name.'__html', $html, $this->_form_section); |
|
206 | + $html .= EEH_HTML::nl().'<!-- AHEE__Form_Section_Layout__'.$hook_name.'__html -->'; |
|
207 | + $html .= EEH_HTML::nl().'<!-- AFEE__Form_Section_Layout__'.$hook_name.' -->'; |
|
208 | 208 | return $html; |
209 | 209 | } |
210 | 210 |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_All_Caps_Normalization extends EE_Normalization_Strategy_Base{ |
|
11 | +class EE_All_Caps_Normalization extends EE_Normalization_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param string $value_to_normalize |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param string $normalized_value |
25 | 25 | * @return string |
26 | 26 | */ |
27 | - public function unnormalize( $normalized_value ) { |
|
27 | + public function unnormalize($normalized_value) { |
|
28 | 28 | return $normalized_value; |
29 | 29 | } |
30 | 30 |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | * @subpackage |
11 | 11 | * @author Mike Nelson |
12 | 12 | */ |
13 | -class EE_Boolean_Normalization extends EE_Normalization_Strategy_Base{ |
|
13 | +class EE_Boolean_Normalization extends EE_Normalization_Strategy_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param string | int | bool $value_to_normalize |
17 | 17 | * @return boolean |
18 | 18 | */ |
19 | - public function normalize( $value_to_normalize ) { |
|
20 | - return filter_var( $value_to_normalize, FILTER_VALIDATE_BOOLEAN ); |
|
19 | + public function normalize($value_to_normalize) { |
|
20 | + return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | * @param boolean $normalized_value |
28 | 28 | * @return string |
29 | 29 | */ |
30 | - public function unnormalize( $normalized_value ) { |
|
31 | - if( $normalized_value ){ |
|
30 | + public function unnormalize($normalized_value) { |
|
31 | + if ($normalized_value) { |
|
32 | 32 | return '1'; |
33 | - }else{ |
|
33 | + } else { |
|
34 | 34 | return '0'; |
35 | 35 | } |
36 | 36 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Credit_Card_Normalization extends EE_Text_Normalization{ |
|
9 | +class EE_Credit_Card_Normalization extends EE_Text_Normalization { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param string $value_to_normalize |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @subpackage |
8 | 8 | * @author Mike Nelson |
9 | 9 | */ |
10 | -class EE_Float_Normalization extends EE_Normalization_Strategy_Base{ |
|
10 | +class EE_Float_Normalization extends EE_Normalization_Strategy_Base { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @param string $value_to_normalize |
@@ -15,34 +15,34 @@ discard block |
||
15 | 15 | * @throws \EE_Validation_Error |
16 | 16 | */ |
17 | 17 | public function normalize($value_to_normalize) { |
18 | - if($value_to_normalize === NULL){ |
|
18 | + if ($value_to_normalize === NULL) { |
|
19 | 19 | return 0.00; |
20 | 20 | } |
21 | 21 | $normalized_value = ''; |
22 | - if(is_string($value_to_normalize)){ |
|
23 | - $normalized_value = str_replace(array(" ",EE_Config::instance()->currency->thsnds),"",$value_to_normalize); |
|
22 | + if (is_string($value_to_normalize)) { |
|
23 | + $normalized_value = str_replace(array(" ", EE_Config::instance()->currency->thsnds), "", $value_to_normalize); |
|
24 | 24 | //normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now) |
25 | - $normalized_value = str_replace( EE_Config::instance()->currency->dec_mrk, ".", $normalized_value) ; |
|
25 | + $normalized_value = str_replace(EE_Config::instance()->currency->dec_mrk, ".", $normalized_value); |
|
26 | 26 | //double-check there's absolutely nothing left on this string besides numbers |
27 | - $normalized_value = preg_replace( "/[^0-9,. ]/", "", $normalized_value); |
|
27 | + $normalized_value = preg_replace("/[^0-9,. ]/", "", $normalized_value); |
|
28 | 28 | } |
29 | - if(strlen($value_to_normalize) > strlen($normalized_value)){ |
|
29 | + if (strlen($value_to_normalize) > strlen($normalized_value)) { |
|
30 | 30 | //find if this input has a float validation strategy |
31 | 31 | //in which case, use its message |
32 | 32 | $validation_error_message = NULL; |
33 | - foreach( $this->_input->get_validation_strategies() as $validation_strategy ){ |
|
34 | - if( $validation_strategy instanceof EE_Float_Validation_Strategy ){ |
|
33 | + foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
34 | + if ($validation_strategy instanceof EE_Float_Validation_Strategy) { |
|
35 | 35 | $validation_error_message = $validation_strategy->get_validation_error_message(); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | //this really shouldn't ever happen because fields with a float normalization strategy |
39 | 39 | //should also have a float validation strategy, but in case it doesnt use the default |
40 | - if( ! $validation_error_message ){ |
|
40 | + if ( ! $validation_error_message) { |
|
41 | 41 | $default_validation_strategy = new EE_Float_Validation_Strategy(); |
42 | 42 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
43 | 43 | } |
44 | - throw new EE_Validation_Error( $validation_error_message, 'float_only' ); |
|
45 | - }else{ |
|
44 | + throw new EE_Validation_Error($validation_error_message, 'float_only'); |
|
45 | + } else { |
|
46 | 46 | return floatval($normalized_value); |
47 | 47 | } |
48 | 48 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return string |
54 | 54 | */ |
55 | 55 | public function unnormalize($normalized_value) { |
56 | - if( empty( $normalized_value ) ){ |
|
56 | + if (empty($normalized_value)) { |
|
57 | 57 | return '0.00'; |
58 | - }else{ |
|
58 | + } else { |
|
59 | 59 | return "$normalized_value"; |
60 | 60 | } |
61 | 61 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
43 | 43 | } |
44 | 44 | throw new EE_Validation_Error( $validation_error_message, 'float_only' ); |
45 | - }else{ |
|
45 | + } else{ |
|
46 | 46 | return floatval($normalized_value); |
47 | 47 | } |
48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function unnormalize($normalized_value) { |
56 | 56 | if( empty( $normalized_value ) ){ |
57 | 57 | return '0.00'; |
58 | - }else{ |
|
58 | + } else{ |
|
59 | 59 | return "$normalized_value"; |
60 | 60 | } |
61 | 61 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base{ |
|
9 | +class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base { |
|
10 | 10 | protected $_individual_item_normalization_strategy = array(); |
11 | 11 | /** |
12 | 12 | * |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | * @return array |
24 | 24 | */ |
25 | 25 | public function normalize($value_to_normalize) { |
26 | - if ( is_array( $value_to_normalize )){ |
|
26 | + if (is_array($value_to_normalize)) { |
|
27 | 27 | $items_to_normalize = $value_to_normalize; |
28 | - } else if( $value_to_normalize !== NULL ){ |
|
29 | - $items_to_normalize = array( $value_to_normalize ); |
|
28 | + } else if ($value_to_normalize !== NULL) { |
|
29 | + $items_to_normalize = array($value_to_normalize); |
|
30 | 30 | } else { |
31 | 31 | $items_to_normalize = array(); |
32 | 32 | } |
33 | 33 | $normalized_array_value = array(); |
34 | - foreach( $items_to_normalize as $key => $individual_item ){ |
|
35 | - $normalized_array_value[ $key ] = $this->normalize_one( $individual_item ); |
|
34 | + foreach ($items_to_normalize as $key => $individual_item) { |
|
35 | + $normalized_array_value[$key] = $this->normalize_one($individual_item); |
|
36 | 36 | } |
37 | 37 | return $normalized_array_value; |
38 | 38 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $individual_value_to_normalize but definitely NOT an array |
43 | 43 | * @return mixed |
44 | 44 | */ |
45 | - public function normalize_one( $individual_value_to_normalize ) { |
|
46 | - return $this->_individual_item_normalization_strategy->normalize( $individual_value_to_normalize ); |
|
45 | + public function normalize_one($individual_value_to_normalize) { |
|
46 | + return $this->_individual_item_normalization_strategy->normalize($individual_value_to_normalize); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | * @param array $normalized_values |
52 | 52 | * @return string[] |
53 | 53 | */ |
54 | - public function unnormalize( $normalized_values ) { |
|
55 | - if( ! is_array( $normalized_values ) ){ |
|
56 | - $normalized_values = array( $normalized_values ); |
|
54 | + public function unnormalize($normalized_values) { |
|
55 | + if ( ! is_array($normalized_values)) { |
|
56 | + $normalized_values = array($normalized_values); |
|
57 | 57 | } |
58 | 58 | $non_normal_values = array(); |
59 | - foreach( $normalized_values as $key => $value ) { |
|
60 | - $non_normal_values[ $key ] = $this->unnormalize_one( $value ); |
|
59 | + foreach ($normalized_values as $key => $value) { |
|
60 | + $non_normal_values[$key] = $this->unnormalize_one($value); |
|
61 | 61 | } |
62 | 62 | return $non_normal_values; |
63 | 63 | } |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | * @param mixed $individual_value_to_unnormalize but certainly NOT an array |
68 | 68 | * @return string |
69 | 69 | */ |
70 | - public function unnormalize_one( $individual_value_to_unnormalize ) { |
|
71 | - return $this->_individual_item_normalization_strategy->unnormalize( $individual_value_to_unnormalize ); |
|
70 | + public function unnormalize_one($individual_value_to_unnormalize) { |
|
71 | + return $this->_individual_item_normalization_strategy->unnormalize($individual_value_to_unnormalize); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -abstract class EE_Normalization_Strategy_Base extends EE_Form_Input_Strategy_Base{ |
|
9 | +abstract class EE_Normalization_Strategy_Base extends EE_Form_Input_Strategy_Base { |
|
10 | 10 | /** |
11 | 11 | * Takes the sanitized value for the input and casts it into the correct PHP type. |
12 | 12 | * Eg, turns it into an int, float, string, boolean, datetime, etc. The validation |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @param string $individual_item_to_normalize |
30 | 30 | * @return mixed |
31 | 31 | */ |
32 | - public function normalize_one( $individual_item_to_normalize ){ |
|
33 | - return $this->normalize( $individual_item_to_normalize ); |
|
32 | + public function normalize_one($individual_item_to_normalize) { |
|
33 | + return $this->normalize($individual_item_to_normalize); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param $normalized_value |
43 | 43 | * @return array|string the 'raw' value as used in the form, usually a string or array of strings. |
44 | 44 | */ |
45 | - abstract function unnormalize( $normalized_value ); |
|
45 | + abstract function unnormalize($normalized_value); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Normally the same as unnormalize, except it CANNOT be passed an array and |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @param mixed $individual_item_to_unnormalize NOT an array |
51 | 51 | * @return string |
52 | 52 | */ |
53 | - public function unnormalize_one( $individual_item_to_unnormalize ) { |
|
54 | - return $this->unnormalize( $individual_item_to_unnormalize ); |
|
53 | + public function unnormalize_one($individual_item_to_unnormalize) { |
|
54 | + return $this->unnormalize($individual_item_to_unnormalize); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * the value you would use in the html form (for a Yes_No_Input this could be '1' or '0'). |
41 | 41 | * |
42 | 42 | * @param $normalized_value |
43 | - * @return array|string the 'raw' value as used in the form, usually a string or array of strings. |
|
43 | + * @return string the 'raw' value as used in the form, usually a string or array of strings. |
|
44 | 44 | */ |
45 | 45 | abstract function unnormalize( $normalized_value ); |
46 | 46 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @subpackage |
8 | 8 | * @author Mike Nelson |
9 | 9 | */ |
10 | -class EE_Slug_Normalization extends EE_Normalization_Strategy_Base{ |
|
10 | +class EE_Slug_Normalization extends EE_Normalization_Strategy_Base { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @param string $value_to_normalize |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * @param string $normalized_value |
23 | 23 | * @return string |
24 | 24 | */ |
25 | - public function unnormalize( $normalized_value ) { |
|
26 | - return str_replace( "-", " ", $normalized_value ); |
|
25 | + public function unnormalize($normalized_value) { |
|
26 | + return str_replace("-", " ", $normalized_value); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | } |