@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class EE_Validation_Error extends Exception{ |
|
3 | +class EE_Validation_Error extends Exception { |
|
4 | 4 | /** |
5 | 5 | * Form Section from which this error originated. |
6 | 6 | * @var EE_Form_Section |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param EE_Form_Section_Validatable $form_section |
21 | 21 | * @param Exception $previous if there was an exception that caused this exception |
22 | 22 | */ |
23 | - function __construct( $message = null, $string_code = null,$form_section = null, $previous = null){ |
|
23 | + function __construct($message = null, $string_code = null, $form_section = null, $previous = null) { |
|
24 | 24 | $this->_form_section = $form_section; |
25 | 25 | $this->_string_code = $string_code; |
26 | 26 | parent::__construct($message, 500, $previous); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * returns teh form section which caused the error. |
31 | 31 | * @return EE_Form_Section_Validatable |
32 | 32 | */ |
33 | - public function get_form_section(){ |
|
33 | + public function get_form_section() { |
|
34 | 34 | return $this->_form_section; |
35 | 35 | } |
36 | 36 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param EE_Form_Section_Validatable $form_section |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - public function set_form_section($form_section){ |
|
41 | + public function set_form_section($form_section) { |
|
42 | 42 | $this->_form_section = $form_section; |
43 | 43 | } |
44 | 44 |
@@ -8,15 +8,15 @@ |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param array $input_settings |
15 | 15 | */ |
16 | - function __construct($input_settings = array()){ |
|
16 | + function __construct($input_settings = array()) { |
|
17 | 17 | $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
18 | 18 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
19 | - $this->_add_validation_strategy(new EE_URL_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) ); |
|
19 | + $this->_add_validation_strategy(new EE_URL_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)); |
|
20 | 20 | parent::__construct($input_settings); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * Class EE_Checkbox_Multi_Input |
@@ -11,16 +11,16 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Checkbox_Multi_Input extends EE_Form_Input_With_Options_Base{ |
|
14 | +class EE_Checkbox_Multi_Input extends EE_Form_Input_With_Options_Base { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $input_settings |
18 | 18 | * @param array | EE_Question_Option[] $answer_options |
19 | 19 | */ |
20 | - public function __construct( $answer_options, $input_settings = array() ) { |
|
21 | - $this->_set_display_strategy( new EE_Checkbox_Display_Strategy() ); |
|
22 | - $this->_add_validation_strategy( new EE_Many_Valued_Validation_Strategy( array( new EE_Enum_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) ))); |
|
20 | + public function __construct($answer_options, $input_settings = array()) { |
|
21 | + $this->_set_display_strategy(new EE_Checkbox_Display_Strategy()); |
|
22 | + $this->_add_validation_strategy(new EE_Many_Valued_Validation_Strategy(array(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)))); |
|
23 | 23 | $this->_multiple_selections = TRUE; |
24 | - parent::__construct( $answer_options, $input_settings ); |
|
24 | + parent::__construct($answer_options, $input_settings); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -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 | /** |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @subpackage |
10 | 10 | * @author Mike Nelson |
11 | 11 | */ |
12 | -class EE_Credit_Card_Year_Input extends EE_Year_Input{ |
|
12 | +class EE_Credit_Card_Year_Input extends EE_Year_Input { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @param array $input_settings |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | * @param int $years_behind |
18 | 18 | * @param int $years_ahead |
19 | 19 | */ |
20 | - function __construct( $input_settings = array(), $four_digit_year = true, $years_behind = 0, $years_ahead = 15 ){ |
|
21 | - $this->set_sensitive_data_removal_strategy( new EE_All_Sensitive_Data_Removal() ); |
|
22 | - parent::__construct( $input_settings, $four_digit_year, $years_behind, $years_ahead ); |
|
20 | + function __construct($input_settings = array(), $four_digit_year = true, $years_behind = 0, $years_ahead = 15) { |
|
21 | + $this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal()); |
|
22 | + parent::__construct($input_settings, $four_digit_year, $years_behind, $years_ahead); |
|
23 | 23 | } |
24 | 24 | } |
@@ -1,6 +1,7 @@ |
||
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 | * EE_Credit_Card_Year_Input |
@@ -8,24 +8,24 @@ |
||
8 | 8 | * @author Mike Nelson |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Currency_Input extends EE_Select_Input{ |
|
11 | +class EE_Currency_Input extends EE_Select_Input { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * |
15 | 15 | * @param array $only_specific_currency_codes numerically-indexed array of allowed currency codes. By default, all are allowed |
16 | 16 | * @param array $input_settings |
17 | 17 | */ |
18 | - function __construct( $only_specific_currency_codes = array(), $input_settings = array()){ |
|
18 | + function __construct($only_specific_currency_codes = array(), $input_settings = array()) { |
|
19 | 19 | $query_params = array('order_by'=>array('CNT_name'=>'asc')); |
20 | - if($only_specific_currency_codes){ |
|
21 | - $query_params[0]['CNT_cur_code'] = array('IN',$only_specific_currency_codes); |
|
20 | + if ($only_specific_currency_codes) { |
|
21 | + $query_params[0]['CNT_cur_code'] = array('IN', $only_specific_currency_codes); |
|
22 | 22 | } |
23 | 23 | $all_countries = EEM_Country::instance()->get_all($query_params); |
24 | 24 | $country_options = array(); |
25 | - foreach($all_countries as $country){ |
|
25 | + foreach ($all_countries as $country) { |
|
26 | 26 | /* @var $country EE_Country */ |
27 | - $country_options[$country->currency_code()] = $country->name().": ".$country->currency_name_single() ." (".$country->currency_sign().")"; |
|
27 | + $country_options[$country->currency_code()] = $country->name().": ".$country->currency_name_single()." (".$country->currency_sign().")"; |
|
28 | 28 | } |
29 | - parent::__construct($country_options,'int',$input_settings); |
|
29 | + parent::__construct($country_options, 'int', $input_settings); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -6,21 +6,21 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Datepicker_Input extends EE_Form_Input_Base{ |
|
9 | +class EE_Datepicker_Input extends EE_Form_Input_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $input_settings |
13 | 13 | */ |
14 | - function __construct( $input_settings = array() ){ |
|
15 | - $this->_set_display_strategy( new EE_Text_Input_Display_Strategy( 'datepicker' ) ); |
|
16 | - $this->_set_normalization_strategy( new EE_Text_Normalization() ); |
|
14 | + function __construct($input_settings = array()) { |
|
15 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker')); |
|
16 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
17 | 17 | //we could do better for validation, but at least verify its plaintext |
18 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) ); |
|
19 | - parent::__construct( $input_settings ); |
|
20 | - $this->set_html_class( $this->html_class() . ' datepicker' ); |
|
18 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)); |
|
19 | + parent::__construct($input_settings); |
|
20 | + $this->set_html_class($this->html_class().' datepicker'); |
|
21 | 21 | // add some style and make it dance |
22 | - add_action( 'wp_enqueue_scripts', array( 'EE_Datepicker_Input', 'enqueue_styles_and_scripts' )); |
|
23 | - add_action( 'admin_enqueue_scripts', array( 'EE_Datepicker_Input', 'enqueue_styles_and_scripts' )); |
|
22 | + add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
23 | + add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function enqueue_styles_and_scripts() { |
35 | 35 | // load css |
36 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
37 | - wp_enqueue_style( 'espresso-ui-theme'); |
|
36 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
37 | + wp_enqueue_style('espresso-ui-theme'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Brent Christensen |
8 | 8 | */ |
9 | -class EE_Fixed_Hidden_Input extends EE_Hidden_Input{ |
|
9 | +class EE_Fixed_Hidden_Input extends EE_Hidden_Input { |
|
10 | 10 | |
11 | 11 | |
12 | 12 | /** |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @param array $req_data like $_POST |
18 | 18 | * @return boolean whether or not there was an error |
19 | 19 | */ |
20 | - protected function _normalize( $req_data ) { |
|
20 | + protected function _normalize($req_data) { |
|
21 | 21 | } |
22 | 22 | |
23 | 23 |
@@ -6,15 +6,15 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Float_Input extends EE_Form_Input_Base{ |
|
9 | +class EE_Float_Input extends EE_Form_Input_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $input_settings |
13 | 13 | */ |
14 | - function __construct($input_settings = array()){ |
|
14 | + function __construct($input_settings = array()) { |
|
15 | 15 | $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
16 | - $this->_set_normalization_strategy(new EE_Float_Normalization( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) ); |
|
17 | - $this->_add_validation_strategy( new EE_Float_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) ); |
|
16 | + $this->_set_normalization_strategy(new EE_Float_Normalization(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)); |
|
17 | + $this->_add_validation_strategy(new EE_Float_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)); |
|
18 | 18 | parent::__construct($input_settings); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | if( $all_ints ){ |
109 | 109 | $normalization = new EE_Int_Normalization(); |
110 | - }else{ |
|
110 | + } else{ |
|
111 | 111 | $normalization = new EE_Text_Normalization(); |
112 | 112 | } |
113 | 113 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | foreach( $unnormalized_value_choices as $unnormalized_value_choice ){ |
259 | 259 | if( isset( $options[ $unnormalized_value_choice ] ) ){ |
260 | 260 | $pretty_strings[] = $options[ $unnormalized_value_choice ]; |
261 | - }else{ |
|
261 | + } else{ |
|
262 | 262 | $pretty_strings[] = $this->normalized_value(); |
263 | 263 | } |
264 | 264 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @subpackage |
8 | 8 | * @author Mike Nelson |
9 | 9 | */ |
10 | -class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base{ |
|
10 | +class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * array of available options to choose as an answer |
@@ -57,18 +57,18 @@ discard block |
||
57 | 57 | * } |
58 | 58 | * And all the options accepted by EE_Form_Input_Base |
59 | 59 | */ |
60 | - public function __construct( $answer_options = array(), $input_settings = array() ) { |
|
61 | - if ( isset( $input_settings['label_size'] )) { |
|
62 | - $this->_set_label_size( $input_settings['label_size'] ); |
|
63 | - if ( isset( $input_settings['enforce_label_size'] ) && $input_settings['enforce_label_size'] ) { |
|
60 | + public function __construct($answer_options = array(), $input_settings = array()) { |
|
61 | + if (isset($input_settings['label_size'])) { |
|
62 | + $this->_set_label_size($input_settings['label_size']); |
|
63 | + if (isset($input_settings['enforce_label_size']) && $input_settings['enforce_label_size']) { |
|
64 | 64 | $this->_enforce_label_size = TRUE; |
65 | 65 | } |
66 | 66 | } |
67 | - if ( isset( $input_settings['display_html_label_text'] )) { |
|
68 | - $this->set_display_html_label_text( $input_settings['display_html_label_text'] ); |
|
67 | + if (isset($input_settings['display_html_label_text'])) { |
|
68 | + $this->set_display_html_label_text($input_settings['display_html_label_text']); |
|
69 | 69 | } |
70 | - $this->set_select_options( $answer_options ); |
|
71 | - parent::__construct( $input_settings ); |
|
70 | + $this->set_select_options($answer_options); |
|
71 | + parent::__construct($input_settings); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,47 +79,47 @@ discard block |
||
79 | 79 | * @param array $answer_options |
80 | 80 | * @return void just has the side-effect of setting the options for this input |
81 | 81 | */ |
82 | - public function set_select_options( $answer_options = array() ){ |
|
83 | - $answer_options = is_array( $answer_options ) ? $answer_options : array( $answer_options ); |
|
82 | + public function set_select_options($answer_options = array()) { |
|
83 | + $answer_options = is_array($answer_options) ? $answer_options : array($answer_options); |
|
84 | 84 | //get the first item in the select options and check it's type |
85 | - if ( reset( $answer_options ) instanceof EE_Question_Option ) { |
|
86 | - $this->_options = $this->_process_question_options( $answer_options ); |
|
85 | + if (reset($answer_options) instanceof EE_Question_Option) { |
|
86 | + $this->_options = $this->_process_question_options($answer_options); |
|
87 | 87 | } else { |
88 | 88 | $this->_options = $answer_options; |
89 | 89 | } |
90 | 90 | //d( $this->_options ); |
91 | - $select_option_keys = array_keys( $this->_options ); |
|
91 | + $select_option_keys = array_keys($this->_options); |
|
92 | 92 | // attempt to determine data type for values in order to set normalization type |
93 | 93 | if ( |
94 | - count( $this->_options ) == 2 |
|
94 | + count($this->_options) == 2 |
|
95 | 95 | && |
96 | 96 | ( |
97 | - ( in_array( TRUE, $select_option_keys, true ) && in_array( FALSE, $select_option_keys, true )) |
|
98 | - || ( in_array( 1, $select_option_keys, true ) && in_array( 0, $select_option_keys, true )) |
|
97 | + (in_array(TRUE, $select_option_keys, true) && in_array(FALSE, $select_option_keys, true)) |
|
98 | + || (in_array(1, $select_option_keys, true) && in_array(0, $select_option_keys, true)) |
|
99 | 99 | ) |
100 | - ){ |
|
100 | + ) { |
|
101 | 101 | // values appear to be boolean, like TRUE, FALSE, 1, 0 |
102 | 102 | $normalization = new EE_Boolean_Normalization(); |
103 | - } else{ |
|
103 | + } else { |
|
104 | 104 | //are ALL the options ints? If so use int validation |
105 | 105 | $all_ints = true; |
106 | - foreach($select_option_keys as $value ){ |
|
107 | - if( ! is_int( $value ) ){ |
|
106 | + foreach ($select_option_keys as $value) { |
|
107 | + if ( ! is_int($value)) { |
|
108 | 108 | $all_ints = false; |
109 | 109 | break; |
110 | 110 | } |
111 | 111 | } |
112 | - if( $all_ints ){ |
|
112 | + if ($all_ints) { |
|
113 | 113 | $normalization = new EE_Int_Normalization(); |
114 | - }else{ |
|
114 | + } else { |
|
115 | 115 | $normalization = new EE_Text_Normalization(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | // does input type have multiple options ? |
119 | - if ( $this->_multiple_selections ) { |
|
120 | - $this->_set_normalization_strategy( new EE_Many_Valued_Normalization( $normalization )); |
|
119 | + if ($this->_multiple_selections) { |
|
120 | + $this->_set_normalization_strategy(new EE_Many_Valued_Normalization($normalization)); |
|
121 | 121 | } else { |
122 | - $this->_set_normalization_strategy( $normalization ); |
|
122 | + $this->_set_normalization_strategy($normalization); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @return array |
130 | 130 | */ |
131 | - public function options(){ |
|
131 | + public function options() { |
|
132 | 132 | return $this->_options; |
133 | 133 | } |
134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * Returns an array which is guaranteed to not be multidimensional |
139 | 139 | * @return array |
140 | 140 | */ |
141 | - public function flat_options(){ |
|
141 | + public function flat_options() { |
|
142 | 142 | return $this->_flatten_select_options($this->options()); |
143 | 143 | } |
144 | 144 | |
@@ -149,19 +149,19 @@ discard block |
||
149 | 149 | * @param array $arr |
150 | 150 | * @return array |
151 | 151 | */ |
152 | - protected function _flatten_select_options( $arr ){ |
|
152 | + protected function _flatten_select_options($arr) { |
|
153 | 153 | $flat_array = array(); |
154 | - if ( EEH_Array::is_multi_dimensional_array( $arr )) { |
|
155 | - foreach( $arr as $sub_array ){ |
|
156 | - foreach( $sub_array as $key => $value ) { |
|
157 | - $flat_array[ $key ] = $value; |
|
158 | - $this->_set_label_size( $value ); |
|
154 | + if (EEH_Array::is_multi_dimensional_array($arr)) { |
|
155 | + foreach ($arr as $sub_array) { |
|
156 | + foreach ($sub_array as $key => $value) { |
|
157 | + $flat_array[$key] = $value; |
|
158 | + $this->_set_label_size($value); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } else { |
162 | - foreach( $arr as $key => $value ) { |
|
163 | - $flat_array[ $key ] = $value; |
|
164 | - $this->_set_label_size( $value ); |
|
162 | + foreach ($arr as $key => $value) { |
|
163 | + $flat_array[$key] = $value; |
|
164 | + $this->_set_label_size($value); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | return $flat_array; |
@@ -173,18 +173,18 @@ discard block |
||
173 | 173 | * @param EE_Question_Option[] $question_options_array |
174 | 174 | * @return array |
175 | 175 | */ |
176 | - protected function _process_question_options( $question_options_array = array() ) { |
|
176 | + protected function _process_question_options($question_options_array = array()) { |
|
177 | 177 | $flat_array = array(); |
178 | - foreach( $question_options_array as $question_option ) { |
|
179 | - if ( $question_option instanceof EE_Question_Option ) { |
|
178 | + foreach ($question_options_array as $question_option) { |
|
179 | + if ($question_option instanceof EE_Question_Option) { |
|
180 | 180 | $desc = ''; |
181 | - if ( $this->_use_desc_in_label ) { |
|
181 | + if ($this->_use_desc_in_label) { |
|
182 | 182 | $desc = $question_option->desc(); |
183 | - $desc = ! empty( $desc ) ? '<span class="ee-question-option-desc"> - ' . $desc . '</span>' : ''; |
|
183 | + $desc = ! empty($desc) ? '<span class="ee-question-option-desc"> - '.$desc.'</span>' : ''; |
|
184 | 184 | } |
185 | - $flat_array[ $question_option->value() ] = $question_option->value() . $desc; |
|
186 | - } elseif ( is_array( $question_option )) { |
|
187 | - $non_question_option = $this->_flatten_select_options( $question_option ); |
|
185 | + $flat_array[$question_option->value()] = $question_option->value().$desc; |
|
186 | + } elseif (is_array($question_option)) { |
|
187 | + $non_question_option = $this->_flatten_select_options($question_option); |
|
188 | 188 | $flat_array = $flat_array + $non_question_option; |
189 | 189 | } |
190 | 190 | } |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | * set_label_sizes |
198 | 198 | * @return void |
199 | 199 | */ |
200 | - public function set_label_sizes(){ |
|
200 | + public function set_label_sizes() { |
|
201 | 201 | // did the input settings specifically say to NOT set the label size dynamically ? |
202 | - if ( ! $this->_enforce_label_size ) { |
|
203 | - foreach( $this->_options as $option ) { |
|
202 | + if ( ! $this->_enforce_label_size) { |
|
203 | + foreach ($this->_options as $option) { |
|
204 | 204 | // calculate the strlen of the label |
205 | - $this->_set_label_size( $option ); |
|
205 | + $this->_set_label_size($option); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | } |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | * @param int|string $value |
215 | 215 | * @return void |
216 | 216 | */ |
217 | - private function _set_label_size( $value = '' ){ |
|
217 | + private function _set_label_size($value = '') { |
|
218 | 218 | // determine length of option value |
219 | - $val_size = is_int( $value ) ? $value : strlen( $value ); |
|
219 | + $val_size = is_int($value) ? $value : strlen($value); |
|
220 | 220 | // use new value if bigger than existing |
221 | 221 | $this->_label_size = $val_size > $this->_label_size ? $val_size : $this->_label_size; |
222 | 222 | } |
@@ -227,22 +227,22 @@ discard block |
||
227 | 227 | * get_label_size_class |
228 | 228 | * @return string |
229 | 229 | */ |
230 | - function get_label_size_class(){ |
|
230 | + function get_label_size_class() { |
|
231 | 231 | // use maximum option value length to determine label size |
232 | - if( $this->_label_size < 3 ) { |
|
232 | + if ($this->_label_size < 3) { |
|
233 | 233 | $size = ' nano-lbl'; |
234 | - } else if ( $this->_label_size < 6 ) { |
|
235 | - $size = ' micro-lbl'; |
|
236 | - } else if ( $this->_label_size < 12 ) { |
|
237 | - $size = ' tiny-lbl'; |
|
238 | - } else if ( $this->_label_size < 25 ) { |
|
239 | - $size = ' small-lbl'; |
|
240 | - } else if ( $this->_label_size < 50 ) { |
|
241 | - $size = ' medium-lbl'; |
|
242 | - } else if ( $this->_label_size >= 100 ) { |
|
243 | - $size = ' big-lbl'; |
|
234 | + } else if ($this->_label_size < 6) { |
|
235 | + $size = ' micro-lbl'; |
|
236 | + } else if ($this->_label_size < 12) { |
|
237 | + $size = ' tiny-lbl'; |
|
238 | + } else if ($this->_label_size < 25) { |
|
239 | + $size = ' small-lbl'; |
|
240 | + } else if ($this->_label_size < 50) { |
|
241 | + $size = ' medium-lbl'; |
|
242 | + } else if ($this->_label_size >= 100) { |
|
243 | + $size = ' big-lbl'; |
|
244 | 244 | } else { |
245 | - $size = ' medium-lbl'; |
|
245 | + $size = ' medium-lbl'; |
|
246 | 246 | } |
247 | 247 | return $size; |
248 | 248 | } |
@@ -251,21 +251,21 @@ discard block |
||
251 | 251 | * Returns the pretty value for the normalized value |
252 | 252 | * @return string |
253 | 253 | */ |
254 | - function pretty_value(){ |
|
254 | + function pretty_value() { |
|
255 | 255 | $options = $this->flat_options(); |
256 | - $unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize( $this->_normalized_value ); |
|
257 | - if( ! $this->_multiple_selections ){ |
|
258 | - $unnormalized_value_choices = array( $unnormalized_value_choices ); |
|
256 | + $unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize($this->_normalized_value); |
|
257 | + if ( ! $this->_multiple_selections) { |
|
258 | + $unnormalized_value_choices = array($unnormalized_value_choices); |
|
259 | 259 | } |
260 | 260 | $pretty_strings = array(); |
261 | - foreach( $unnormalized_value_choices as $unnormalized_value_choice ){ |
|
262 | - if( isset( $options[ $unnormalized_value_choice ] ) ){ |
|
263 | - $pretty_strings[] = $options[ $unnormalized_value_choice ]; |
|
264 | - }else{ |
|
261 | + foreach ($unnormalized_value_choices as $unnormalized_value_choice) { |
|
262 | + if (isset($options[$unnormalized_value_choice])) { |
|
263 | + $pretty_strings[] = $options[$unnormalized_value_choice]; |
|
264 | + } else { |
|
265 | 265 | $pretty_strings[] = $this->normalized_value(); |
266 | 266 | } |
267 | 267 | } |
268 | - return implode(", ", $pretty_strings ); |
|
268 | + return implode(", ", $pretty_strings); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | /** |
283 | 283 | * @param boolean $display_html_label_text |
284 | 284 | */ |
285 | - public function set_display_html_label_text( $display_html_label_text ) { |
|
286 | - $this->_display_html_label_text = filter_var( $display_html_label_text, FILTER_VALIDATE_BOOLEAN ); |
|
285 | + public function set_display_html_label_text($display_html_label_text) { |
|
286 | + $this->_display_html_label_text = filter_var($display_html_label_text, FILTER_VALIDATE_BOOLEAN); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 |