Completed
Branch BETA-4.9-message-activity (09871e)
by
unknown
17:34
created
core/libraries/form_sections/inputs/EE_Country_Select_Input.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php  if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); }
2 2
 /**
3
- * Class EE_Country_Select_Input
4
- *
5
- * Generates an HTML <select> form input
6
- * and populates it with a list of Countries from the wp_esp_country table
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				$VID:$
12
- *
13
- */
3
+	 * Class EE_Country_Select_Input
4
+	 *
5
+	 * Generates an HTML <select> form input
6
+	 * and populates it with a list of Countries from the wp_esp_country table
7
+	 *
8
+	 * @package 			Event Espresso
9
+	 * @subpackage 	core
10
+	 * @author 				Brent Christensen
11
+	 * @since 				$VID:$
12
+	 *
13
+	 */
14 14
 class EE_Country_Select_Input extends EE_Select_Input{
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
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
  * Class EE_Country_Select_Input
4 4
  *
@@ -11,20 +11,20 @@  discard block
 block discarded – undo
11 11
  * @since 				$VID:$
12 12
  *
13 13
  */
14
-class EE_Country_Select_Input extends EE_Select_Input{
14
+class EE_Country_Select_Input extends EE_Select_Input {
15 15
 
16 16
 	/**
17 17
 	 * @param array $country_options
18 18
 	 * @param array $input_settings
19 19
 	 * @return EE_Country_Select_Input
20 20
 	 */
21
-	public function __construct( $country_options = NULL, $input_settings = array() ){
21
+	public function __construct($country_options = NULL, $input_settings = array()) {
22 22
 		$country_options = apply_filters(
23 23
 			'FHEE__EE_Country_Select_Input____construct__country_options',
24
-			$this->get_country_answer_options( $country_options ),
24
+			$this->get_country_answer_options($country_options),
25 25
 			$this
26 26
 		);
27
-		parent::__construct( $country_options, $input_settings );
27
+		parent::__construct($country_options, $input_settings);
28 28
 	}
29 29
 
30 30
 
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 	 * @param array $country_options
36 36
 	 * @return array
37 37
 	 */
38
-	public function get_country_answer_options( $country_options = NULL ){
38
+	public function get_country_answer_options($country_options = NULL) {
39 39
 		// if passed something that is NOT an array
40
-		if ( ! is_array( $country_options )) {
40
+		if ( ! is_array($country_options)) {
41 41
 			// get possibly cached list of countries
42 42
 			$countries = EEM_Country::instance()->get_all_active_countries();
43
-			if ( ! empty( $countries )) {
44
-				$country_options[ '' ] = '';
45
-				foreach( $countries as $country ){
46
-					if ( $country instanceof EE_Country ) {
47
-						$country_options[ $country->ID() ] = $country->name();
43
+			if ( ! empty($countries)) {
44
+				$country_options[''] = '';
45
+				foreach ($countries as $country) {
46
+					if ($country instanceof EE_Country) {
47
+						$country_options[$country->ID()] = $country->name();
48 48
 					}
49 49
 				}
50 50
 			} else {
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Credit_Card_Input.input.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 block discarded – undo
7 7
  * @subpackage
8 8
  * @author				Mike Nelson
9 9
  */
10
-class EE_Credit_Card_Input extends EE_Form_Input_Base{
10
+class EE_Credit_Card_Input extends EE_Form_Input_Base {
11 11
 
12 12
 	/**
13 13
 	 * @param array $input_settings
14 14
 	 */
15
-	function __construct($input_settings = array()){
16
-		$input_settings['required'] = isset( $input_settings['required'] ) ? $input_settings['required'] : TRUE;
15
+	function __construct($input_settings = array()) {
16
+		$input_settings['required'] = isset($input_settings['required']) ? $input_settings['required'] : TRUE;
17 17
 		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy());
18 18
 		$this->_set_normalization_strategy(new EE_Text_Normalization());
19
-		$this->_add_validation_strategy(new EE_Credit_Card_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ));
19
+		$this->_add_validation_strategy(new EE_Credit_Card_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL));
20 20
 		$this->set_sensitive_data_removal_strategy(new EE_Credit_Card_Sensitive_Data_Removal());
21 21
 		parent::__construct($input_settings);
22 22
 	}
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- *
4
- * EE_Credit_Card_Input
5
- *
6
- * @package			Event Espresso
7
- * @subpackage
8
- * @author				Mike Nelson
9
- */
3
+	 *
4
+	 * EE_Credit_Card_Input
5
+	 *
6
+	 * @package			Event Espresso
7
+	 * @subpackage
8
+	 * @author				Mike Nelson
9
+	 */
10 10
 class EE_Credit_Card_Input extends EE_Form_Input_Base{
11 11
 
12 12
 	/**
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Credit_Card_Month_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
 /**
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * ------------------------------------------------------------------------
26 26
  */
27
-class EE_Credit_Card_Month_Input extends EE_Month_Input{
27
+class EE_Credit_Card_Month_Input extends EE_Month_Input {
28 28
 
29 29
 	/**
30 30
 	 * @param bool  $leading_zero
31 31
 	 * @param array $input_settings
32 32
 	 */
33
-	function __construct( $leading_zero = false, $input_settings = array()){
34
-		$this->set_sensitive_data_removal_strategy( new EE_All_Sensitive_Data_Removal() );
35
-		parent::__construct($leading_zero,$input_settings);
33
+	function __construct($leading_zero = false, $input_settings = array()) {
34
+		$this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal());
35
+		parent::__construct($leading_zero, $input_settings);
36 36
 	}
37 37
 }
38 38
\ No newline at end of file
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_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 2 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
- *
4
- * EE_Currency_Input
5
- *
6
- * @package			Event Espresso
7
- * @subpackage
8
- * @author				Mike Nelson
9
- *
10
- */
3
+	 *
4
+	 * EE_Currency_Input
5
+	 *
6
+	 * @package			Event Espresso
7
+	 * @subpackage
8
+	 * @author				Mike Nelson
9
+	 *
10
+	 */
11 11
 class EE_Currency_Input extends EE_Select_Input{
12 12
 
13 13
 	/**
Please login to merge, or discard this 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 1 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 1 patch
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.
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.
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.
Spacing   +136 added lines, -136 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,8 +310,8 @@  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 );
313
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
314
+		$validation_strategy->_construct_finalize($this);
315 315
 		$this->_validation_strategies[] = $validation_strategy;
316 316
 	}
317 317
 
@@ -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.