Completed
Branch BUG-9540-thnx-page-html (1be88d)
by
unknown
554:25 queued 537:57
created
core/libraries/form_sections/inputs/EE_Credit_Card_Year_Input.input.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Currency_Input.input.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,24 +8,24 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Datepicker_Input.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,21 +6,21 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Fixed_Hidden_Input.input.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- * EE_Fixed_Hidden_Input
4
- *
5
- * @package			Event Espresso
6
- * @subpackage
7
- * @author				Brent Christensen
8
- */
3
+	 * EE_Fixed_Hidden_Input
4
+	 *
5
+	 * @package			Event Espresso
6
+	 * @subpackage
7
+	 * @author				Brent Christensen
8
+	 */
9 9
 class EE_Fixed_Hidden_Input extends EE_Hidden_Input{
10 10
 
11 11
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Float_Input.input.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- * EE_Float_Input
4
- *
5
- * @package			Event Espresso
6
- * @subpackage
7
- * @author				Mike Nelson
8
- */
3
+	 * EE_Float_Input
4
+	 *
5
+	 * @package			Event Espresso
6
+	 * @subpackage
7
+	 * @author				Mike Nelson
8
+	 */
9 9
 class EE_Float_Input extends EE_Form_Input_Base{
10 10
 
11 11
 	/**
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 4 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- * EE_Form_Input_Base
4
- * For representing a single form input. Extends EE_Form_Section_Base because
5
- * it is a part of a form and shares a surprisingly large amount of functionality
6
- *
7
- * @package			Event Espresso
8
- * @subpackage
9
- * @author				Mike Nelson
10
- */
3
+	 * EE_Form_Input_Base
4
+	 * For representing a single form input. Extends EE_Form_Section_Base because
5
+	 * it is a part of a form and shares a surprisingly large amount of functionality
6
+	 *
7
+	 * @package			Event Espresso
8
+	 * @subpackage
9
+	 * @author				Mike Nelson
10
+	 */
11 11
 abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
12 12
 
13 13
 	/**
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	/**
263 263
 	 * Sets sensitive_data_removal_strategy
264 264
 	 * @param EE_Sensitive_Data_Removal_Base $sensitive_data_removal_strategy
265
-	 * @return boolean
265
+	 * @return boolean|null
266 266
 	 */
267 267
 	public function set_sensitive_data_removal_strategy($sensitive_data_removal_strategy) {
268 268
 		$this->_sensitive_data_removal_strategy = $sensitive_data_removal_strategy;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	/**
357 357
 	 * returns true if input employs any of the validation strategy defined by the supplied array of classnames
358 358
 	 *
359
-	 * @param array $validation_strategy_classnames
359
+	 * @param string[] $validation_strategy_classnames
360 360
 	 * @return bool
361 361
 	 */
362 362
 	public function has_validation_strategy( $validation_strategy_classnames ) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 * Returns whether or not any validation errors occurred
480 480
 	 *
481 481
 	 * @param array $req_data like $_POST
482
-	 * @return boolean whether or not there was an error
482
+	 * @return boolean|null whether or not there was an error
483 483
 	 */
484 484
 	protected function _normalize( $req_data ) {
485 485
 		//any existing validation errors don't apply so clear them
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -141,61 +141,61 @@  discard block
 block discarded – undo
141 141
 	 *		@type EE_Validation_Strategy_Base[] $validation_strategies
142 142
 	 * }
143 143
 	 */
144
-	public function __construct( $input_args = array() ){
145
-		$input_args = apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
144
+	public function __construct($input_args = array()) {
145
+		$input_args = apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
146 146
 		// the following properties must be cast as arrays
147
-		if ( isset( $input_args['validation_strategies'] ) ) {
148
-			foreach ( $input_args['validation_strategies'] as $validation_strategy ) {
149
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
150
-					$this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy;
147
+		if (isset($input_args['validation_strategies'])) {
148
+			foreach ($input_args['validation_strategies'] as $validation_strategy) {
149
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
150
+					$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
151 151
 				}
152 152
 			}
153
-			unset( $input_args['validation_strategies'] );
153
+			unset($input_args['validation_strategies']);
154 154
 		}
155 155
 		// loop thru incoming options
156
-		foreach( $input_args as $key => $value ) {
156
+		foreach ($input_args as $key => $value) {
157 157
 			// add underscore to $key to match property names
158
-			$_key = '_' . $key;
159
-			if ( property_exists( $this, $_key )) {
158
+			$_key = '_'.$key;
159
+			if (property_exists($this, $_key)) {
160 160
 				$this->{$_key} = $value;
161 161
 			}
162 162
 		}
163 163
 		// ensure that "required" is set correctly
164
-		$this->set_required( $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) ? $input_args[ 'required_validation_error_message' ] : NULL );
164
+		$this->set_required($this->_required, isset($input_args['required_validation_error_message']) ? $input_args['required_validation_error_message'] : NULL);
165 165
 
166 166
 		//$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
167 167
 
168 168
 		$this->_display_strategy->_construct_finalize($this);
169
-		foreach( $this->_validation_strategies as $validation_strategy ){
169
+		foreach ($this->_validation_strategies as $validation_strategy) {
170 170
 			$validation_strategy->_construct_finalize($this);
171 171
 		}
172 172
 
173
-		if( ! $this->_normalization_strategy){
173
+		if ( ! $this->_normalization_strategy) {
174 174
 			$this->_normalization_strategy = new EE_Text_Normalization();
175 175
 		}
176 176
 		$this->_normalization_strategy->_construct_finalize($this);
177 177
 
178 178
 		//at least we can use the normalization strategy to populate the default
179
-		if( isset( $input_args[ 'default' ] ) ) {
180
-			$this->set_default( $input_args[ 'default' ] );
179
+		if (isset($input_args['default'])) {
180
+			$this->set_default($input_args['default']);
181 181
 		}
182 182
 
183
-		if( ! $this->_sensitive_data_removal_strategy){
183
+		if ( ! $this->_sensitive_data_removal_strategy) {
184 184
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
185 185
 		}
186 186
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
187
-		parent::__construct( $input_args );
187
+		parent::__construct($input_args);
188 188
 	}
189 189
 
190 190
 	/**
191 191
 	 * Sets the html_name to its default value, if none was specified in teh constructor.
192 192
 	 * Calculation involves using the name and the parent's html_name
193 193
 	 */
194
-	protected function _set_default_html_name_if_empty(){
195
-		if( ! $this->_html_name){
196
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
197
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
198
-			}else{
194
+	protected function _set_default_html_name_if_empty() {
195
+		if ( ! $this->_html_name) {
196
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
197
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
198
+			} else {
199 199
 				$this->_html_name = $this->name();
200 200
 			}
201 201
 		}
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 	function _construct_finalize($parent_form_section, $name) {
211 211
 		parent::_construct_finalize($parent_form_section, $name);
212 212
 		$this->_set_default_html_name_if_empty();
213
-		if( ! $this->_html_label ){
214
-			if( ! $this->_html_label_text){
215
-				$this->_html_label_text = ucwords( str_replace("_"," ",$name));
213
+		if ( ! $this->_html_label) {
214
+			if ( ! $this->_html_label_text) {
215
+				$this->_html_label_text = ucwords(str_replace("_", " ", $name));
216 216
 			}
217 217
 		}
218
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
218
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
219 219
 	}
220 220
 
221 221
 	 /**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	  * @return EE_Display_Strategy_Base
224 224
 	  * @throws EE_Error
225 225
 	  */
226
-	protected function _get_display_strategy(){
227
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
228
-			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
229
-		}else{
226
+	protected function _get_display_strategy() {
227
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
228
+			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"), $this->html_name(), $this->html_id()));
229
+		} else {
230 230
 			return $this->_display_strategy;
231 231
 		}
232 232
 	}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * Sets the display strategy.
235 235
 	 * @param EE_Display_Strategy_Base $strategy
236 236
 	 */
237
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
237
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
238 238
 		$this->_display_strategy = $strategy;
239 239
 	}
240 240
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * Sets the sanitization strategy
243 243
 	 * @param EE_Normalization_Strategy_Base $strategy
244 244
 	 */
245
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
245
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
246 246
 		$this->_normalization_strategy = $strategy;
247 247
 	}
248 248
 
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
 	 * Gets the display strategy for this input
269 269
 	 * @return EE_Display_Strategy_Base
270 270
 	 */
271
-	public function get_display_strategy(){
271
+	public function get_display_strategy() {
272 272
 		return $this->_display_strategy;
273 273
 	}
274 274
 	/**
275 275
 	 * Overwrites the display strategy
276 276
 	 * @param EE_Display_Strategy_Base $display_strategy
277 277
 	 */
278
-	public function set_display_strategy($display_strategy){
278
+	public function set_display_strategy($display_strategy) {
279 279
 		$this->_display_strategy = $display_strategy;
280 280
 		$this->_display_strategy->_construct_finalize($this);
281 281
 	}
@@ -283,14 +283,14 @@  discard block
 block discarded – undo
283 283
 	 * Gets the normalization strategy set on this input
284 284
 	 * @return EE_Normalization_Strategy_Base
285 285
 	 */
286
-	public function get_normalization_strategy(){
286
+	public function get_normalization_strategy() {
287 287
 		return $this->_normalization_strategy;
288 288
 	}
289 289
 	/**
290 290
 	 * Overwrites the normalization strategy
291 291
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
292 292
 	 */
293
-	public function set_normalization_strategy($normalization_strategy){
293
+	public function set_normalization_strategy($normalization_strategy) {
294 294
 		$this->_normalization_strategy = $normalization_strategy;
295 295
 		$this->_normalization_strategy->_construct_finalize($this);
296 296
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
300 300
 	 * @return EE_Validation_Strategy_Base[]
301 301
 	 */
302
-	public function get_validation_strategies(){
302
+	public function get_validation_strategies() {
303 303
 		return $this->_validation_strategies;
304 304
 	}
305 305
 
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 	 * @param EE_Validation_Strategy_Base $validation_strategy
311 311
 	 * @return void
312 312
 	 */
313
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
314
-		$validation_strategy->_construct_finalize( $this );
315
-		$this->_validation_strategies[ get_class($validation_strategy) ] = $validation_strategy;
313
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
314
+		$validation_strategy->_construct_finalize($this);
315
+		$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
316 316
 	}
317 317
 
318 318
 
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 	 * @param EE_Validation_Strategy_Base $validation_strategy
323 323
 	 * @return void
324 324
 	 */
325
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
326
-		$this->_add_validation_strategy( $validation_strategy );
325
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
326
+		$this->_add_validation_strategy($validation_strategy);
327 327
 	}
328 328
 
329 329
 
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
 	 *
334 334
 	 * @param string $validation_strategy_classname
335 335
 	 */
336
-	public function remove_validation_strategy( $validation_strategy_classname ) {
337
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
338
-			if(
336
+	public function remove_validation_strategy($validation_strategy_classname) {
337
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
338
+			if (
339 339
 				$validation_strategy instanceof $validation_strategy_classname
340
-				|| is_subclass_of( $validation_strategy, $validation_strategy_classname )
340
+				|| is_subclass_of($validation_strategy, $validation_strategy_classname)
341 341
 			) {
342
-				unset( $this->_validation_strategies[ $key ] );
342
+				unset($this->_validation_strategies[$key]);
343 343
 			}
344 344
 		}
345 345
 	}
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
 	 * @param array $validation_strategy_classnames
353 353
 	 * @return bool
354 354
 	 */
355
-	public function has_validation_strategy( $validation_strategy_classnames ) {
356
-		$validation_strategy_classnames = is_array( $validation_strategy_classnames )
355
+	public function has_validation_strategy($validation_strategy_classnames) {
356
+		$validation_strategy_classnames = is_array($validation_strategy_classnames)
357 357
 			? $validation_strategy_classnames
358
-			: array( $validation_strategy_classnames );
359
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
360
-			if( in_array( $key, $validation_strategy_classnames ) ) {
358
+			: array($validation_strategy_classnames);
359
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
360
+			if (in_array($key, $validation_strategy_classnames)) {
361 361
 				return true;
362 362
 			}
363 363
 		}
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 * to the parent form's layout strategy
372 372
 	 * @return string
373 373
 	 */
374
-	public function get_html_and_js(){
374
+	public function get_html_and_js() {
375 375
 		return $this->_parent_section->get_html_for_input($this);
376 376
 	}
377 377
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * Makes sure the JS and CSS are enqueued for it
384 384
 	 * @return string
385 385
 	 */
386
-	public function get_html_for_input(){
386
+	public function get_html_for_input() {
387 387
 		return  $this->_get_display_strategy()->display();
388 388
 	}
389 389
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	 * @return string
394 394
 	 */
395 395
 	public function html_other_attributes() {
396
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
396
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
397 397
 	}
398 398
 
399 399
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	/**
402 402
 	 * @param string $html_other_attributes
403 403
 	 */
404
-	public function set_html_other_attributes( $html_other_attributes ) {
404
+	public function set_html_other_attributes($html_other_attributes) {
405 405
 		$this->_html_other_attributes = $html_other_attributes;
406 406
 	}
407 407
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * according to the form section's layout strategy
411 411
 	 * @return string
412 412
 	 */
413
-	public function get_html_for_label(){
413
+	public function get_html_for_label() {
414 414
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
415 415
 	}
416 416
 	/**
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 * according to the form section's layout strategy
419 419
 	 * @return string
420 420
 	 */
421
-	public function get_html_for_errors(){
421
+	public function get_html_for_errors() {
422 422
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
423 423
 	}
424 424
 	/**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * according to the form section's layout strategy
427 427
 	 * @return string
428 428
 	 */
429
-	public function get_html_for_help(){
429
+	public function get_html_for_help() {
430 430
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
431 431
 	}
432 432
 	/**
@@ -435,18 +435,18 @@  discard block
 block discarded – undo
435 435
 	 * @return boolean
436 436
 	 */
437 437
 	protected function _validate() {
438
-		foreach($this->_validation_strategies as $validation_strategy){
439
-			if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
440
-				try{
438
+		foreach ($this->_validation_strategies as $validation_strategy) {
439
+			if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
440
+				try {
441 441
 					$validation_strategy->validate($this->normalized_value());
442
-				}catch(EE_Validation_Error $e){
442
+				} catch (EE_Validation_Error $e) {
443 443
 					$this->add_validation_error($e);
444 444
 				}
445 445
 			}
446 446
 		}
447
-		if( $this->get_validation_errors()){
447
+		if ($this->get_validation_errors()) {
448 448
 			return false;
449
-		}else{
449
+		} else {
450 450
 			return true;
451 451
 		}
452 452
 	}
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 	 * @param string $value
460 460
 	 * @return null|string
461 461
 	 */
462
-	private function _sanitize($value){
463
-		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field
462
+	private function _sanitize($value) {
463
+		return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field
464 464
 	}
465 465
 
466 466
 
@@ -472,24 +472,24 @@  discard block
 block discarded – undo
472 472
 	 * @param array $req_data like $_POST
473 473
 	 * @return boolean whether or not there was an error
474 474
 	 */
475
-	protected function _normalize( $req_data ) {
475
+	protected function _normalize($req_data) {
476 476
 		//any existing validation errors don't apply so clear them
477 477
 		$this->_validation_errors = array();
478 478
 		try {
479
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
479
+			$raw_input = $this->find_form_data_for_this_section($req_data);
480 480
 			//super simple sanitization for now
481
-			if ( is_array( $raw_input )) {
481
+			if (is_array($raw_input)) {
482 482
 				$this->_raw_value = array();
483
-				foreach( $raw_input as $key => $value ) {
484
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
483
+				foreach ($raw_input as $key => $value) {
484
+					$this->_raw_value[$key] = $this->_sanitize($value);
485 485
 				}
486 486
 			} else {
487
-				$this->_raw_value = $this->_sanitize( $raw_input );
487
+				$this->_raw_value = $this->_sanitize($raw_input);
488 488
 			}
489 489
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
490
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
491
-		} catch ( EE_Validation_Error $e ) {
492
-			$this->add_validation_error( $e );
490
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
491
+		} catch (EE_Validation_Error $e) {
492
+			$this->add_validation_error($e);
493 493
 		}
494 494
 	}
495 495
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	/**
499 499
 	 * @return string
500 500
 	 */
501
-	public function html_name(){
501
+	public function html_name() {
502 502
 		return $this->_html_name;
503 503
 	}
504 504
 
@@ -507,8 +507,8 @@  discard block
 block discarded – undo
507 507
 	/**
508 508
 	 * @return string
509 509
 	 */
510
-	function html_label_id(){
511
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
510
+	function html_label_id() {
511
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
512 512
 	}
513 513
 
514 514
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	/**
517 517
 	 * @return string
518 518
 	 */
519
-	function html_label_class(){
519
+	function html_label_class() {
520 520
 		return $this->_html_label_class;
521 521
 	}
522 522
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	/**
526 526
 	 * @return string
527 527
 	 */
528
-	function html_label_style(){
528
+	function html_label_style() {
529 529
 		return $this->_html_label_style;
530 530
 	}
531 531
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	/**
535 535
 	 * @return string
536 536
 	 */
537
-	function html_label_text(){
537
+	function html_label_text() {
538 538
 		return $this->_html_label_text;
539 539
 	}
540 540
 
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	/**
544 544
 	 * @return string
545 545
 	 */
546
-	function html_help_text(){
546
+	function html_help_text() {
547 547
 		return $this->_html_help_text;
548 548
 	}
549 549
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	/**
553 553
 	 * @return string
554 554
 	 */
555
-	function html_help_class(){
555
+	function html_help_class() {
556 556
 		return $this->_html_help_class;
557 557
 	}
558 558
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	/**
562 562
 	 * @return string
563 563
 	 */
564
-	function html_help_style(){
564
+	function html_help_style() {
565 565
 		return $this->_html_style;
566 566
 	}
567 567
 	/**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	 * in which case, we would have stored the malicious content to our database.
575 575
 	 * @return string
576 576
 	 */
577
-	function raw_value(){
577
+	function raw_value() {
578 578
 		return $this->_raw_value;
579 579
 	}
580 580
 	/**
@@ -582,15 +582,15 @@  discard block
 block discarded – undo
582 582
 	 * it escapes all html entities
583 583
 	 * @return string
584 584
 	 */
585
-	function raw_value_in_form(){
586
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
585
+	function raw_value_in_form() {
586
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
587 587
 	}
588 588
 	/**
589 589
 	 * returns the value after it's been sanitized, and then converted into it's proper type
590 590
 	 * in PHP. Eg, a string, an int, an array,
591 591
 	 * @return mixed
592 592
 	 */
593
-	function normalized_value(){
593
+	function normalized_value() {
594 594
 		return $this->_normalized_value;
595 595
 	}
596 596
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 * the best thing to display
601 601
 	 * @return string
602 602
 	 */
603
-	function pretty_value(){
603
+	function pretty_value() {
604 604
 		return $this->_normalized_value;
605 605
 	}
606 606
 	/**
@@ -619,19 +619,19 @@  discard block
 block discarded – undo
619 619
 		  }</code>
620 620
 	 * @return array
621 621
 	 */
622
-	function get_jquery_validation_rules(){
622
+	function get_jquery_validation_rules() {
623 623
 
624 624
 		$jquery_validation_rules = array();
625
-		foreach($this->get_validation_strategies() as $validation_strategy){
625
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
626 626
 			$jquery_validation_rules = array_replace_recursive(
627 627
 				$jquery_validation_rules,
628 628
 				$validation_strategy->get_jquery_validation_rule_array()
629 629
 			);
630 630
 		}
631 631
 
632
-		if(! empty($jquery_validation_rules)){
633
-			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
634
-		}else{
632
+		if ( ! empty($jquery_validation_rules)) {
633
+			$jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules;
634
+		} else {
635 635
 			return array();
636 636
 		}
637 637
 		return $jquery_validation_js;
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 	 * @param mixed $value
644 644
 	 * @return void
645 645
 	 */
646
-	function set_default($value){
646
+	function set_default($value) {
647 647
 		$this->_normalized_value = $value;
648
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
648
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
649 649
 	}
650 650
 
651 651
 	/**
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @param string $label
654 654
 	 * @return void
655 655
 	 */
656
-	function set_html_label_text($label){
656
+	function set_html_label_text($label) {
657 657
 		$this->_html_label_text = $label;
658 658
 	}
659 659
 
@@ -665,12 +665,12 @@  discard block
 block discarded – undo
665 665
 	 * @param boolean $required
666 666
 	 * @param null    $required_text
667 667
 	 */
668
-	function set_required($required = true, $required_text = NULL ){
669
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN );
670
-		if ( $required ) {
671
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
668
+	function set_required($required = true, $required_text = NULL) {
669
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
670
+		if ($required) {
671
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
672 672
 		} else {
673
-			unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] );
673
+			unset($this->_validation_strategies['EE_Required_Validation_Strategy']);
674 674
 		}
675 675
 		$this->_required = $required;
676 676
 	}
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	 * Returns whether or not this field is required
679 679
 	 * @return boolean
680 680
 	 */
681
-	public function required(){
681
+	public function required() {
682 682
 		return $this->_required;
683 683
 	}
684 684
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	/**
688 688
 	 * @param string $required_css_class
689 689
 	 */
690
-	public function set_required_css_class( $required_css_class ) {
690
+	public function set_required_css_class($required_css_class) {
691 691
 		$this->_required_css_class = $required_css_class;
692 692
 	}
693 693
 
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 	 * Sets the help text, in case
707 707
 	 * @param string $text
708 708
 	 */
709
-	public function set_html_help_text($text){
709
+	public function set_html_help_text($text) {
710 710
 		$this->_html_help_text = $text;
711 711
 	}
712 712
 	/**
@@ -718,8 +718,8 @@  discard block
 block discarded – undo
718 718
 	public function clean_sensitive_data() {
719 719
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
720 720
 		//if we need more logic than this we'll make a strategy for it
721
-		if( $this->_sensitive_data_removal_strategy &&
722
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
721
+		if ($this->_sensitive_data_removal_strategy &&
722
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
723 723
 			$this->_raw_value = NULL;
724 724
 		}
725 725
 		//and clean the normalized value according to the appropriate strategy
@@ -733,10 +733,10 @@  discard block
 block discarded – undo
733 733
 	 * @param string $button_size
734 734
 	 * @param string $other_attributes
735 735
 	 */
736
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
736
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
737 737
 		$button_css_attributes = 'button';
738 738
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
739
-		switch ( $button_size ) {
739
+		switch ($button_size) {
740 740
 			case 'xs' :
741 741
 			case 'extra-small' :
742 742
 				$button_css_attributes .= ' button-xs';
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 			default :
758 758
 				$button_css_attributes .= '';
759 759
 		}
760
-		$this->_button_css_attributes .= ! empty( $other_attributes ) ? $button_css_attributes . ' ' . $other_attributes : $button_css_attributes;
760
+		$this->_button_css_attributes .= ! empty($other_attributes) ? $button_css_attributes.' '.$other_attributes : $button_css_attributes;
761 761
 	}
762 762
 
763 763
 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 	 * @return string
767 767
 	 */
768 768
 	public function button_css_attributes() {
769
-		if ( empty( $this->_button_css_attributes )) {
769
+		if (empty($this->_button_css_attributes)) {
770 770
 			$this->set_button_css_attributes();
771 771
 		}
772 772
 		return $this->_button_css_attributes;
@@ -786,27 +786,27 @@  discard block
 block discarded – undo
786 786
 	 * @param array $req_data
787 787
 	 * @return mixed whatever the raw value of this form section is in the request data
788 788
 	 */
789
-	public function find_form_data_for_this_section( $req_data ){
789
+	public function find_form_data_for_this_section($req_data) {
790 790
 		// break up the html name by "[]"
791
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
792
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
791
+		if (strpos($this->html_name(), '[') !== FALSE) {
792
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
793 793
 		} else {
794 794
 			$before_any_brackets = $this->html_name();
795 795
 		}
796 796
 		// grab all of the segments
797
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
798
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
799
-			$name_parts = $matches[ 1 ];
797
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
798
+		if (isset($matches[1]) && is_array($matches[1])) {
799
+			$name_parts = $matches[1];
800 800
 			array_unshift($name_parts, $before_any_brackets);
801
-		}else{
802
-			$name_parts = array( $before_any_brackets );
801
+		} else {
802
+			$name_parts = array($before_any_brackets);
803 803
 		}
804 804
 		// now get the value for the input
805 805
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
806
-		if( $value === NULL ){
806
+		if ($value === NULL) {
807 807
 			//check if this thing's name is at the TOP level of the request data
808
-			if( isset( $req_data[ $this->name() ] ) ){
809
-				$value = $req_data[ $this->name() ];
808
+			if (isset($req_data[$this->name()])) {
809
+				$value = $req_data[$this->name()];
810 810
 			}
811 811
 		}
812 812
 		return $value;
@@ -820,15 +820,15 @@  discard block
 block discarded – undo
820 820
 	 * @param array $req_data
821 821
 	 * @return array | NULL
822 822
 	 */
823
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
824
-		$first_part_to_consider = array_shift( $html_name_parts );
825
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
826
-			if( empty($html_name_parts ) ){
827
-				return $req_data[ $first_part_to_consider ];
828
-			}else{
829
-				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
823
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
824
+		$first_part_to_consider = array_shift($html_name_parts);
825
+		if (isset($req_data[$first_part_to_consider])) {
826
+			if (empty($html_name_parts)) {
827
+				return $req_data[$first_part_to_consider];
828
+			} else {
829
+				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[$first_part_to_consider]);
830 830
 			}
831
-		}else{
831
+		} else {
832 832
 			return NULL;
833 833
 		}
834 834
 	}
@@ -840,14 +840,14 @@  discard block
 block discarded – undo
840 840
 	 * @param array $req_data like $_POST
841 841
 	 * @return boolean
842 842
 	 */
843
-	public function form_data_present_in($req_data = NULL){
844
-		if( $req_data === NULL ){
843
+	public function form_data_present_in($req_data = NULL) {
844
+		if ($req_data === NULL) {
845 845
 			$req_data = $_POST;
846 846
 		}
847
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
848
-		if( $checked_value !== null ){
847
+		$checked_value = $this->find_form_data_for_this_section($req_data);
848
+		if ($checked_value !== null) {
849 849
 			return TRUE;
850
-		}else{
850
+		} else {
851 851
 			return FALSE;
852 852
 		}
853 853
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		if( ! $this->_html_name){
196 196
 			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
197 197
 				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
198
-			}else{
198
+			} else{
199 199
 				$this->_html_name = $this->name();
200 200
 			}
201 201
 		}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	protected function _get_display_strategy(){
227 227
 		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
228 228
 			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
229
-		}else{
229
+		} else{
230 230
 			return $this->_display_strategy;
231 231
 		}
232 232
 	}
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
 			if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
440 440
 				try{
441 441
 					$validation_strategy->validate($this->normalized_value());
442
-				}catch(EE_Validation_Error $e){
442
+				} catch(EE_Validation_Error $e){
443 443
 					$this->add_validation_error($e);
444 444
 				}
445 445
 			}
446 446
 		}
447 447
 		if( $this->get_validation_errors()){
448 448
 			return false;
449
-		}else{
449
+		} else{
450 450
 			return true;
451 451
 		}
452 452
 	}
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 
632 632
 		if(! empty($jquery_validation_rules)){
633 633
 			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
634
-		}else{
634
+		} else{
635 635
 			return array();
636 636
 		}
637 637
 		return $jquery_validation_js;
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
799 799
 			$name_parts = $matches[ 1 ];
800 800
 			array_unshift($name_parts, $before_any_brackets);
801
-		}else{
801
+		} else{
802 802
 			$name_parts = array( $before_any_brackets );
803 803
 		}
804 804
 		// now get the value for the input
@@ -825,10 +825,10 @@  discard block
 block discarded – undo
825 825
 		if( isset( $req_data[ $first_part_to_consider ] ) ){
826 826
 			if( empty($html_name_parts ) ){
827 827
 				return $req_data[ $first_part_to_consider ];
828
-			}else{
828
+			} else{
829 829
 				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
830 830
 			}
831
-		}else{
831
+		} else{
832 832
 			return NULL;
833 833
 		}
834 834
 	}
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 		$checked_value = $this->find_form_data_for_this_section( $req_data );
848 848
 		if( $checked_value !== null ){
849 849
 			return TRUE;
850
-		}else{
850
+		} else{
851 851
 			return FALSE;
852 852
 		}
853 853
 	}
Please login to merge, or discard this patch.
libraries/form_sections/inputs/EE_Form_Input_With_Options_Base.input.php 2 patches
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
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
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 	 * @param array $answer_options
54 54
 	 * @param array $input_settings
55 55
 	 */
56
-	public function __construct( $answer_options = array(), $input_settings = array() ) {
57
-		if ( isset( $input_settings['label_size'] )) {
58
-			$this->_set_label_size( $input_settings['label_size'] );
59
-			if ( isset( $input_settings['enforce_label_size'] ) && $input_settings['enforce_label_size'] ) {
56
+	public function __construct($answer_options = array(), $input_settings = array()) {
57
+		if (isset($input_settings['label_size'])) {
58
+			$this->_set_label_size($input_settings['label_size']);
59
+			if (isset($input_settings['enforce_label_size']) && $input_settings['enforce_label_size']) {
60 60
 				$this->_enforce_label_size = TRUE;
61 61
 			}
62 62
 		}
63
-		if ( isset( $input_settings['display_html_label_text'] )) {
64
-			$this->set_display_html_label_text( $input_settings['display_html_label_text'] );
63
+		if (isset($input_settings['display_html_label_text'])) {
64
+			$this->set_display_html_label_text($input_settings['display_html_label_text']);
65 65
 		}
66
-		$this->set_select_options( $answer_options );
67
-		parent::__construct( $input_settings );
66
+		$this->set_select_options($answer_options);
67
+		parent::__construct($input_settings);
68 68
 	}
69 69
 
70 70
 
@@ -75,47 +75,47 @@  discard block
 block discarded – undo
75 75
 	 * @param array $answer_options
76 76
 	 * @return void  just has the side-effect of setting the options for this input
77 77
 	 */
78
-	public function set_select_options( $answer_options = array() ){
79
-		$answer_options = is_array( $answer_options ) ? $answer_options : array( $answer_options );
78
+	public function set_select_options($answer_options = array()) {
79
+		$answer_options = is_array($answer_options) ? $answer_options : array($answer_options);
80 80
 		//get the first item in the select options and check it's type
81
-		if ( reset( $answer_options ) instanceof EE_Question_Option ) {
82
-			$this->_options = $this->_process_question_options( $answer_options );
81
+		if (reset($answer_options) instanceof EE_Question_Option) {
82
+			$this->_options = $this->_process_question_options($answer_options);
83 83
 		} else {
84 84
 			$this->_options = $answer_options;
85 85
 		}
86 86
 		//d( $this->_options );
87
-		$select_option_keys = array_keys( $this->_options );
87
+		$select_option_keys = array_keys($this->_options);
88 88
 		// attempt to determine data type for values in order to set normalization type
89 89
 		if (
90
-			count( $this->_options ) == 2
90
+			count($this->_options) == 2
91 91
 			&&
92 92
 			(
93
-				( in_array( TRUE, $select_option_keys, true ) && in_array( FALSE, $select_option_keys, true ))
94
-				|| ( in_array( 1, $select_option_keys, true ) && in_array( 0, $select_option_keys, true ))
93
+				(in_array(TRUE, $select_option_keys, true) && in_array(FALSE, $select_option_keys, true))
94
+				|| (in_array(1, $select_option_keys, true) && in_array(0, $select_option_keys, true))
95 95
 			)
96
-		){
96
+		) {
97 97
 			// values appear to be boolean, like TRUE, FALSE, 1, 0
98 98
 			$normalization = new EE_Boolean_Normalization();
99
-		} else{
99
+		} else {
100 100
 			//are ALL the options ints? If so use int validation
101 101
 			$all_ints = true;
102
-			foreach($select_option_keys as $value ){
103
-				if( ! is_int( $value ) ){
102
+			foreach ($select_option_keys as $value) {
103
+				if ( ! is_int($value)) {
104 104
 					$all_ints = false;
105 105
 					break;
106 106
 				}
107 107
 			}
108
-			if( $all_ints ){
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
 		}
114 114
 		// does input type have multiple options ?
115
-		if ( $this->_multiple_selections ) {
116
-			$this->_set_normalization_strategy( new EE_Many_Valued_Normalization( $normalization ));
115
+		if ($this->_multiple_selections) {
116
+			$this->_set_normalization_strategy(new EE_Many_Valued_Normalization($normalization));
117 117
 		} else {
118
-			$this->_set_normalization_strategy( $normalization );
118
+			$this->_set_normalization_strategy($normalization);
119 119
 		}
120 120
 	}
121 121
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	/**
125 125
 	 * @return array
126 126
 	 */
127
-	public function options(){
127
+	public function options() {
128 128
 		return $this->_options;
129 129
 	}
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * Returns an array which is guaranteed to not be multidimensional
135 135
 	 * @return array
136 136
 	 */
137
-	public function flat_options(){
137
+	public function flat_options() {
138 138
 		return $this->_flatten_select_options($this->options());
139 139
 	}
140 140
 
@@ -145,20 +145,20 @@  discard block
 block discarded – undo
145 145
 	 * @param array $arr
146 146
 	 * @return array
147 147
 	 */
148
-	protected function _flatten_select_options( $arr ){
148
+	protected function _flatten_select_options($arr) {
149 149
 		$flat_array = array();
150 150
 		EE_Registry::instance()->load_helper('Array');
151
-		if ( EEH_Array::is_multi_dimensional_array( $arr )) {
152
-			foreach( $arr as $sub_array ){
153
-				foreach( $sub_array as $key => $value ) {
154
-					$flat_array[ $key ] = $value;
155
-					$this->_set_label_size( $value );
151
+		if (EEH_Array::is_multi_dimensional_array($arr)) {
152
+			foreach ($arr as $sub_array) {
153
+				foreach ($sub_array as $key => $value) {
154
+					$flat_array[$key] = $value;
155
+					$this->_set_label_size($value);
156 156
 				}
157 157
 			}
158 158
 		} else {
159
-			foreach( $arr as $key => $value ) {
160
-				$flat_array[ $key ] = $value;
161
-				$this->_set_label_size( $value );
159
+			foreach ($arr as $key => $value) {
160
+				$flat_array[$key] = $value;
161
+				$this->_set_label_size($value);
162 162
 			}
163 163
 		}
164 164
 		return $flat_array;
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 	 * @param EE_Question_Option[] $question_options_array
171 171
 	 * @return array
172 172
 	 */
173
-	protected function _process_question_options( $question_options_array = array() ) {
173
+	protected function _process_question_options($question_options_array = array()) {
174 174
 		$flat_array = array();
175
-		foreach( $question_options_array as $question_option ) {
176
-			if ( $question_option instanceof EE_Question_Option ) {
175
+		foreach ($question_options_array as $question_option) {
176
+			if ($question_option instanceof EE_Question_Option) {
177 177
 				$desc = '';
178
-				if ( $this->_use_desc_in_label ) {
178
+				if ($this->_use_desc_in_label) {
179 179
 					$desc = $question_option->desc();
180
-					$desc = ! empty( $desc ) ? '<span class="ee-question-option-desc"> - ' . $desc . '</span>' : '';
180
+					$desc = ! empty($desc) ? '<span class="ee-question-option-desc"> - '.$desc.'</span>' : '';
181 181
 				}
182
-				$flat_array[ $question_option->value() ] = $question_option->value() . $desc;
183
-			} elseif ( is_array( $question_option )) {
184
-				$non_question_option = $this->_flatten_select_options( $question_option );
182
+				$flat_array[$question_option->value()] = $question_option->value().$desc;
183
+			} elseif (is_array($question_option)) {
184
+				$non_question_option = $this->_flatten_select_options($question_option);
185 185
 				$flat_array = $flat_array + $non_question_option;
186 186
 			}
187 187
 		}
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 	 *    set_label_sizes
195 195
 	 * @return void
196 196
 	 */
197
-	public function set_label_sizes(){
197
+	public function set_label_sizes() {
198 198
 		// did the input settings specifically say to NOT set the label size dynamically ?
199
-		if ( ! $this->_enforce_label_size ) {
200
-			foreach( $this->_options as $option ) {
199
+		if ( ! $this->_enforce_label_size) {
200
+			foreach ($this->_options as $option) {
201 201
 				// calculate the strlen of the label
202
-				$this->_set_label_size( $option );
202
+				$this->_set_label_size($option);
203 203
 			}
204 204
 		}
205 205
 	}
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @param int|string $value
212 212
 	 * @return void
213 213
 	 */
214
-	private function _set_label_size( $value = '' ){
214
+	private function _set_label_size($value = '') {
215 215
 		// determine length of option value
216
-		$val_size = is_int( $value ) ? $value : strlen( $value );
216
+		$val_size = is_int($value) ? $value : strlen($value);
217 217
 		// use new value if bigger than existing
218 218
 		$this->_label_size = $val_size > $this->_label_size ? $val_size : $this->_label_size;
219 219
 	}
@@ -224,22 +224,22 @@  discard block
 block discarded – undo
224 224
 	 * 	get_label_size_class
225 225
 	 * @return string
226 226
 	 */
227
-	function get_label_size_class(){
227
+	function get_label_size_class() {
228 228
 		// use maximum option value length to determine label size
229
-		if( $this->_label_size < 3 ) {
229
+		if ($this->_label_size < 3) {
230 230
 			$size = ' nano-lbl';
231
-		} else if ( $this->_label_size < 6 ) {
232
-			$size =  ' micro-lbl';
233
-		} else if ( $this->_label_size < 12 ) {
234
-			$size =  ' tiny-lbl';
235
-		} else if ( $this->_label_size < 25 ) {
236
-			$size =  ' small-lbl';
237
-		} else if ( $this->_label_size < 50 ) {
238
-			$size =  ' medium-lbl';
239
-		} else if ( $this->_label_size >= 100 ) {
240
-			$size =  ' big-lbl';
231
+		} else if ($this->_label_size < 6) {
232
+			$size = ' micro-lbl';
233
+		} else if ($this->_label_size < 12) {
234
+			$size = ' tiny-lbl';
235
+		} else if ($this->_label_size < 25) {
236
+			$size = ' small-lbl';
237
+		} else if ($this->_label_size < 50) {
238
+			$size = ' medium-lbl';
239
+		} else if ($this->_label_size >= 100) {
240
+			$size = ' big-lbl';
241 241
 		} else {
242
-			$size =  ' medium-lbl';
242
+			$size = ' medium-lbl';
243 243
 		}
244 244
 		return $size;
245 245
 	}
@@ -248,21 +248,21 @@  discard block
 block discarded – undo
248 248
 	 * Returns the pretty value for the normalized value
249 249
 	 * @return string
250 250
 	 */
251
-	function pretty_value(){
251
+	function pretty_value() {
252 252
 		$options = $this->flat_options();
253
-		$unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize( $this->_normalized_value );
254
-		if( ! $this->_multiple_selections ){
255
-			$unnormalized_value_choices = array( $unnormalized_value_choices );
253
+		$unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize($this->_normalized_value);
254
+		if ( ! $this->_multiple_selections) {
255
+			$unnormalized_value_choices = array($unnormalized_value_choices);
256 256
 		}
257 257
 		$pretty_strings = array();
258
-		foreach( $unnormalized_value_choices as $unnormalized_value_choice ){
259
-			if( isset( $options[ $unnormalized_value_choice ] ) ){
260
-				$pretty_strings[] =  $options[ $unnormalized_value_choice ];
261
-			}else{
258
+		foreach ($unnormalized_value_choices as $unnormalized_value_choice) {
259
+			if (isset($options[$unnormalized_value_choice])) {
260
+				$pretty_strings[] = $options[$unnormalized_value_choice];
261
+			} else {
262 262
 				$pretty_strings[] = $this->normalized_value();
263 263
 			}
264 264
 		}
265
-		return implode(", ", $pretty_strings );
265
+		return implode(", ", $pretty_strings);
266 266
 	}
267 267
 
268 268
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	/**
280 280
 	 * @param boolean $display_html_label_text
281 281
 	 */
282
-	public function set_display_html_label_text( $display_html_label_text ) {
283
-		$this->_display_html_label_text = filter_var( $display_html_label_text, FILTER_VALIDATE_BOOLEAN );
282
+	public function set_display_html_label_text($display_html_label_text) {
283
+		$this->_display_html_label_text = filter_var($display_html_label_text, FILTER_VALIDATE_BOOLEAN);
284 284
 	}
285 285
 
286 286
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		foreach( $answer_options as $model_obj ){
53 53
 			if( $this->_naming_method ){
54 54
 				$display_value = call_user_func( array( $model_obj, $this->_naming_method ));
55
-			}else{
55
+			} else{
56 56
 				$display_value = $model_obj->name();
57 57
 			}
58 58
 			$select_options[ $model_obj->ID() ] = $display_value;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		foreach($values as $key => $value){
73 73
 			if($value instanceof EE_Base_Class){
74 74
 				$defaults_as_simple_ids[] = $value->ID();
75
-			}else{
75
+			} else{
76 76
 				$defaults_as_simple_ids[] = $value;
77 77
 			}
78 78
 		}
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Hidden_Input.input.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Hidden_Input extends EE_Form_Input_Base{
9
+class EE_Hidden_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
 		//require_once('strategies/display_strategies/EE_Text_Input_Display_Strategy.strategy.php');
16 16
 		$this->_set_display_strategy(new EE_Hidden_Display_Strategy());
17
-		if ( isset( $input_settings['normalization_strategy'] ) && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base ) {
18
-			$this->_set_normalization_strategy( $input_settings['normalization_strategy'] );
17
+		if (isset($input_settings['normalization_strategy']) && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base) {
18
+			$this->_set_normalization_strategy($input_settings['normalization_strategy']);
19 19
 		} else {
20
-			$this->_set_normalization_strategy( new EE_Text_Normalization() );
20
+			$this->_set_normalization_strategy(new EE_Text_Normalization());
21 21
 		}
22
-		parent::__construct( $input_settings );
22
+		parent::__construct($input_settings);
23 23
 	}
24 24
 
25 25
 
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- * EE_Hidden_Input
4
- *
5
- * @package			Event Espresso
6
- * @subpackage
7
- * @author				Mike Nelson
8
- */
3
+	 * EE_Hidden_Input
4
+	 *
5
+	 * @package			Event Espresso
6
+	 * @subpackage
7
+	 * @author				Mike Nelson
8
+	 */
9 9
 class EE_Hidden_Input extends EE_Form_Input_Base{
10 10
 
11 11
 	/**
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Month_Input.input.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Month_Input extends EE_Select_Input{
9
+class EE_Month_Input extends EE_Select_Input {
10 10
 
11 11
 	/**
12 12
 	 * @param bool  $leading_zero
13 13
 	 * @param array $input_settings
14 14
 	 */
15
-	function __construct( $leading_zero = false, $input_settings = array()){
16
-		if($leading_zero){
15
+	function __construct($leading_zero = false, $input_settings = array()) {
16
+		if ($leading_zero) {
17 17
 			$select_options = array(
18 18
 			'01'=>'01',
19 19
 			'02'=>'02',
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			'11'=>'11',
29 29
 			'12'=>'12'
30 30
 			);
31
-		}else{
31
+		} else {
32 32
 			$select_options = array(
33 33
 				1=>'01',
34 34
 				2=>'02',
@@ -44,6 +44,6 @@  discard block
 block discarded – undo
44 44
 				12=>'12'
45 45
 			);
46 46
 		}
47
-		parent::__construct($select_options,$input_settings);
47
+		parent::__construct($select_options, $input_settings);
48 48
 	}
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.