Completed
Branch FET-8837-purchasing-agent (3c506c)
by
unknown
832:15 queued 816:38
created
core/interfaces/EEI_Collection.interface.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param mixed  $info
26 26
 	 * @return bool
27 27
 	 */
28
-	public function add( $object, $info = null );
28
+	public function add($object, $info = null);
29 29
 
30 30
 
31 31
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param mixed  $info
40 40
 	 * @return bool
41 41
 	 */
42
-	public function set_info( $object, $info = null );
42
+	public function set_info($object, $info = null);
43 43
 
44 44
 
45 45
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @param mixed
53 53
 	 * @return null | object
54 54
 	 */
55
-	public function get_by_info( $info );
55
+	public function get_by_info($info);
56 56
 
57 57
 
58 58
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param object $object
66 66
 	 * @return bool
67 67
 	 */
68
-	public function has( $object );
68
+	public function has($object);
69 69
 
70 70
 
71 71
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @param $object
79 79
 	 * @return void
80 80
 	 */
81
-	public function remove( $object );
81
+	public function remove($object);
82 82
 
83 83
 
84 84
 
Please login to merge, or discard this patch.
core/interfaces/EEI_Repository.interface.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return bool | int
31 31
 	 * @throws \EE_Error
32 32
 	 */
33
-	public function persist( $persistence_callback = '', $persistence_arguments = array() );
33
+	public function persist($persistence_callback = '', $persistence_arguments = array());
34 34
 
35 35
 
36 36
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param string $persistence_callback name of method found on object that can be used for persisting it
44 44
 	 * @return bool | int
45 45
 	 */
46
-	public function persist_all( $persistence_callback = '' );
46
+	public function persist_all($persistence_callback = '');
47 47
 
48 48
 	}
49 49
 // End of file EEI_Repository.interface.php
Please login to merge, or discard this patch.
core/interfaces/line_items/EEI_Line_Item.interface.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 	exit( 'No direct script access allowed' );
4 4
 }
5 5
 /**
6
- * Class EEI_Line_Item
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Mike Nelson / Brent Christensen
11
- *
12
- */
6
+	 * Class EEI_Line_Item
7
+	 *
8
+	 * @package 			Event Espresso
9
+	 * @subpackage 	core
10
+	 * @author 				Mike Nelson / Brent Christensen
11
+	 *
12
+	 */
13 13
 interface EEI_Line_Item {
14 14
 
15 15
 	/**
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EEI_Line_Item
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @param    mixed  $field_value
19 19
 	 * @param bool      $use_default
20 20
 	 */
21
-	public function set( $field_name, $field_value, $use_default = false );
21
+	public function set($field_name, $field_value, $use_default = false);
22 22
 
23 23
 
24 24
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * Sets quantity
57 57
 	 * @param int $quantity
58 58
 	 */
59
-	function set_quantity( $quantity );
59
+	function set_quantity($quantity);
60 60
 
61 61
 
62 62
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @param int $txn_id if none is provided, assumes $this->TXN_ID()
116 116
 	 * @return int count of items saved
117 117
 	 */
118
-	function save_this_and_descendants_to_txn( $txn_id = null );
118
+	function save_this_and_descendants_to_txn($txn_id = null);
119 119
 
120 120
 
121 121
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param bool         $set_order
143 143
 	 * @return bool true for success, false for fail
144 144
 	 */
145
-	function add_child_line_item( EEI_Line_Item $line_item, $set_order = true );
145
+	function add_child_line_item(EEI_Line_Item $line_item, $set_order = true);
146 146
 
147 147
 
148 148
 
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 	 * @param float $total
198 198
 	 * @return boolean
199 199
 	 */
200
-	function set_total( $total );
200
+	function set_total($total);
201 201
 
202 202
 	/**
203 203
 	 * Sets unit_price
204 204
 	 * @param float $unit_price
205 205
 	 * @return boolean
206 206
 	 */
207
-	function set_unit_price( $unit_price );
207
+	function set_unit_price($unit_price);
208 208
 
209 209
 	/**
210 210
 	 * If this line item has been saved to the DB, deletes its child with LIN_code == $code. If this line
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * @param bool $stop_search_once_found
216 216
 	 * @return int count of items deleted (or simply removed from the line item's cache, if not has not been saved to the DB yet)
217 217
 	 */
218
-	function delete_child_line_item( $code, $stop_search_once_found = true );
218
+	function delete_child_line_item($code, $stop_search_once_found = true);
219 219
 
220 220
 	/**
221 221
 	 * Forgets the cached model of the given relation Name. So the next time we request it,
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @param boolean $allow_persist
239 239
 	 * @return boolean
240 240
 	 */
241
-	function set_allow_persist( $allow_persist );
241
+	function set_allow_persist($allow_persist);
242 242
 
243 243
 
244 244
 }
Please login to merge, or discard this patch.
core/interfaces/line_items/EEI_Line_Item_Filter.interface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param \EEI_Line_Item $line_item
27 27
 	 * @return \EEI_Line_Item
28 28
 	 */
29
-	public function process( EEI_Line_Item $line_item );
29
+	public function process(EEI_Line_Item $line_item);
30 30
 
31 31
 
32 32
 
Please login to merge, or discard this patch.
core/libraries/form_sections/EE_Sample_Form.form.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class EE_Sample_Form extends EE_Form_Section_Proper{
3
-	function __construct(){
2
+class EE_Sample_Form extends EE_Form_Section_Proper {
3
+	function __construct() {
4 4
 		$this->_subsections = array(
5 5
 			'h1'=>new EE_Form_Section_HTML('hello wordl'),
6
-			'name'=>new EE_Text_Input(array('required'=>true,'default'=>'your name here')),
6
+			'name'=>new EE_Text_Input(array('required'=>true, 'default'=>'your name here')),
7 7
 			'email'=>new EE_Email_Input(array('required'=>false)),
8
-			'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=>  __("Small", "event_espresso"),'m'=>  __("Medium", "event_espresso"),'l'=>  __("Large", "event_espresso")),array('required'=>true,'default'=>'s')),
8
+			'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=>  __("Small", "event_espresso"), 'm'=>  __("Medium", "event_espresso"), 'l'=>  __("Large", "event_espresso")), array('required'=>true, 'default'=>'s')),
9 9
 			'month_normal'=>new EE_Month_Input(),
10 10
 			'month_leading_zero'=>new EE_Month_Input(true),
11 11
 			'year_2'=>new EE_Year_Input(false, 1, 1),
12
-			'year_4'=>new EE_Year_Input(true, 0,10,array('default'=>'2017')),
12
+			'year_4'=>new EE_Year_Input(true, 0, 10, array('default'=>'2017')),
13 13
 			'yes_no'=>new EE_Yes_No_Input(array('html_label_text'=>  __("Yes or No", "event_espresso"))),
14 14
 			'credit_card'=>new EE_Credit_Card_Input(),
15 15
 			'image_1'=>new EE_Admin_File_Uploader_Input(),
16 16
 			'image_2'=>new EE_Admin_File_Uploader_Input(),
17
-			'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP','mysql'=>'MYSQL'),array('default'=>array('php'))),
17
+			'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP', 'mysql'=>'MYSQL'), array('default'=>array('php'))),
18 18
 			'float'=>new EE_Float_Input(),
19 19
 			'essay'=>new EE_Text_Area_Input(),
20 20
 			'amenities'=>new EE_Select_Multiple_Input(
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 	 * Extra validation for the 'name' input.
41 41
 	 * @param EE_Text_Input $form_input
42 42
 	 */
43
-	function _validate_name($form_input){
44
-		if($form_input->raw_value() != 'Mike'){
43
+	function _validate_name($form_input) {
44
+		if ($form_input->raw_value() != 'Mike') {
45 45
 			$form_input->add_validation_error(__("You are not mike. You must be brent or darren. Thats ok, I guess", 'event_espresso'), 'not-mike');
46 46
 		}
47 47
 	}
48 48
 
49
-	function _validate(){
49
+	function _validate() {
50 50
 		parent::_validate();
51
-		if($this->_subsections['shirt_size']->normalized_value() =='s'
52
-				&& $this->_subsections['year_4']->normalized_value() < 2010){
51
+		if ($this->_subsections['shirt_size']->normalized_value() == 's'
52
+				&& $this->_subsections['year_4']->normalized_value() < 2010) {
53 53
 			$this->add_validation_error(__("If you want a small shirt, you should be born after 2010. Otherwise theyre just too big", 'event_espresso'), 'too-old');
54 54
 		}
55 55
 	}
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_HTML.form.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@
 block discarded – undo
2 2
 if (!defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('No direct script access allowed');
4 4
 /**
5
- * EE_Form_Section_HTML
6
- * HTML to be laid out like a proper subsection
7
- *
8
- *
9
- * @package			Event Espresso
10
- * @subpackage
11
- * @author				Mike Nelson
12
- *
13
- * ------------------------------------------------------------------------
14
- */
5
+	 * EE_Form_Section_HTML
6
+	 * HTML to be laid out like a proper subsection
7
+	 *
8
+	 *
9
+	 * @package			Event Espresso
10
+	 * @subpackage
11
+	 * @author				Mike Nelson
12
+	 *
13
+	 * ------------------------------------------------------------------------
14
+	 */
15 15
 class EE_Form_Section_HTML extends EE_Form_Section_Base{
16 16
 
17 17
 	protected $_html = '';
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 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
  * EE_Form_Section_HTML
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  *
13 13
  * ------------------------------------------------------------------------
14 14
  */
15
-class EE_Form_Section_HTML extends EE_Form_Section_Base{
15
+class EE_Form_Section_HTML extends EE_Form_Section_Base {
16 16
 
17 17
 	protected $_html = '';
18 18
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param string $html
23 23
 	 * @param array $options_array
24 24
 	 */
25
-	public function __construct( $html = '', $options_array = array() ) {
25
+	public function __construct($html = '', $options_array = array()) {
26 26
 		$this->_html = $html;
27
-		parent::__construct( $options_array );
27
+		parent::__construct($options_array);
28 28
 	}
29 29
 
30 30
 
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.
libraries/form_sections/base/EE_Form_Section_HTML_From_Template.form.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 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
 /**
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML{
29
-	public function __construct($template_file,$args = array(), $options_array = array()) {
28
+class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML {
29
+	public function __construct($template_file, $args = array(), $options_array = array()) {
30 30
 		EE_Registry::instance()->load_helper('Template');
31
-		$html = EEH_Template::locate_template( $template_file, $args );
31
+		$html = EEH_Template::locate_template($template_file, $args);
32 32
 
33 33
 //		echo " filepath:$template_file html $html";
34 34
 		parent::__construct($html, $options_array);
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/base/EE_Form_Section_Proper.form.php 3 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			if(isset($default_data[$subsection_name])){
210 210
 				if($subsection instanceof EE_Form_Input_Base){
211 211
 					$subsection->set_default($default_data[$subsection_name]);
212
-				}elseif($subsection instanceof EE_Form_Section_Proper){
212
+				} elseif($subsection instanceof EE_Form_Section_Proper){
213 213
 					$subsection->populate_defaults($default_data[$subsection_name]);
214 214
 				}
215 215
 			}
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		foreach($this->subsections() as $subsection){
441 441
 			if( $subsection instanceof EE_Form_Input_Base ){
442 442
 				$inputs[ $subsection->html_name() ] = $subsection;
443
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
443
+			} elseif($subsection instanceof EE_Form_Section_Proper ){
444 444
 				$inputs += $subsection->inputs_in_subsections();
445 445
 			}
446 446
 		}
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 		foreach($this->get_validatable_subsections() as $subsection){
549 549
 			try{
550 550
 				$subsection->_normalize($req_data);
551
-			}catch( EE_Validation_Error $e ){
551
+			} catch( EE_Validation_Error $e ){
552 552
 				$subsection->add_validation_error( $e );
553 553
 			}
554 554
 		}
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 	public function html_name_prefix(){
867 867
 		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
868 868
 			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
869
-		}else{
869
+		} else{
870 870
 			return $this->name();
871 871
 		}
872 872
 	}
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 				if( $subsection->form_data_present_in( $req_data ) ) {
919 919
 					return TRUE;
920 920
 				}
921
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
921
+			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
922 922
 				if( $subsection->form_data_present_in( $req_data ) ) {
923 923
 					return TRUE;
924 924
 				}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@
 block discarded – undo
225 225
 	 * leave this as TRUE so that the inputs will be properly configured. However,
226 226
 	 * some client code may be ok with construction finalize being called later
227 227
 	 * (realizing that the subsections' html names might not be set yet, etc.)
228
-	 * @return EE_Form_Section_Base
228
+	 * @return EE_Form_Section_Validatable|null
229 229
 	 */
230 230
 	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
231 231
 		if( $require_construction_to_be_finalized ){
Please login to merge, or discard this patch.
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html_and_js) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	/**
13 13
 	 * Subsections
@@ -68,38 +68,38 @@  discard block
 block discarded – undo
68 68
 	 * } @see EE_Form_Section_Validatable::__construct()
69 69
 	 *
70 70
 	 */
71
-	public function __construct( $options_array = array() ){
71
+	public function __construct($options_array = array()) {
72 72
 		EE_Registry::instance()->load_helper('Formatter');
73
-		$options_array = apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
73
+		$options_array = apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
74 74
 		//call parent first, as it may be setting the name
75 75
 		parent::__construct($options_array);
76 76
 		//if they've included subsections in the constructor, add them now
77
-		if( isset( $options_array['include'] )){
77
+		if (isset($options_array['include'])) {
78 78
 			//we are going to make sure we ONLY have those subsections to include
79 79
 			//AND we are going to make sure they're in that specified order
80 80
 			$reordered_subsections = array();
81
-			foreach($options_array['include'] as $input_name){
82
-				if(isset($this->_subsections[$input_name])){
81
+			foreach ($options_array['include'] as $input_name) {
82
+				if (isset($this->_subsections[$input_name])) {
83 83
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
84 84
 				}
85 85
 			}
86 86
 			$this->_subsections = $reordered_subsections;
87 87
 		}
88
-		if(isset($options_array['exclude'])){
88
+		if (isset($options_array['exclude'])) {
89 89
 			$exclude = $options_array['exclude'];
90 90
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
91 91
 		}
92
-		if(isset($options_array['layout_strategy'])){
92
+		if (isset($options_array['layout_strategy'])) {
93 93
 			$this->_layout_strategy = $options_array['layout_strategy'];
94 94
 		}
95
-		if( ! $this->_layout_strategy){
95
+		if ( ! $this->_layout_strategy) {
96 96
 			$this->_layout_strategy = new EE_Two_Column_Layout();
97 97
 		}
98 98
 		$this->_layout_strategy->_construct_finalize($this);
99 99
 
100
-		add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
101
-		add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
102
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
100
+		add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
101
+		add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
102
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
103 103
 	}
104 104
 
105 105
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 * @param string                 $name
112 112
 	 * @throws \EE_Error
113 113
 	 */
114
-	public function _construct_finalize( $parent_form_section, $name ) {
114
+	public function _construct_finalize($parent_form_section, $name) {
115 115
 		parent::_construct_finalize($parent_form_section, $name);
116 116
 		$this->_set_default_name_if_empty();
117 117
 		$this->_set_default_html_id_if_empty();
118
-		foreach( $this->_subsections as $subsection_name => $subsection ){
119
-			if ( $subsection instanceof EE_Form_Section_Base ) {
120
-				$subsection->_construct_finalize( $this, $subsection_name );
118
+		foreach ($this->_subsections as $subsection_name => $subsection) {
119
+			if ($subsection instanceof EE_Form_Section_Base) {
120
+				$subsection->_construct_finalize($this, $subsection_name);
121 121
 			} else {
122 122
 				throw new EE_Error(
123 123
 					sprintf(
124
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
124
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
125 125
 						$subsection_name,
126 126
 						get_class($this),
127
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
127
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
128 128
 					)
129 129
 				);
130 130
 			}
131 131
 		}
132
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
132
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
133 133
 	}
134 134
 
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * Gets the layout strategy for this form section
139 139
 	 * @return EE_Form_Section_Layout_Base
140 140
 	 */
141
-	public function get_layout_strategy(){
141
+	public function get_layout_strategy() {
142 142
 		return $this->_layout_strategy;
143 143
 	}
144 144
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @param EE_Form_Input_Base $input
151 151
 	 * @return string
152 152
 	 */
153
-	public function get_html_for_input($input){
153
+	public function get_html_for_input($input) {
154 154
 		return $this->_layout_strategy->layout_input($input);
155 155
 	}
156 156
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param null $form_data
164 164
 	 * @return boolean
165 165
 	 */
166
-	public function was_submitted($form_data = NULL){
166
+	public function was_submitted($form_data = NULL) {
167 167
 		return $this->form_data_present_in($form_data);
168 168
 	}
169 169
 
@@ -184,16 +184,16 @@  discard block
 block discarded – undo
184 184
 	 * to skip this step.
185 185
 	 * @return void
186 186
 	 */
187
-	public function receive_form_submission($req_data = NULL, $validate = TRUE){
188
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate );
189
-		if( $req_data === NULL){
187
+	public function receive_form_submission($req_data = NULL, $validate = TRUE) {
188
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate);
189
+		if ($req_data === NULL) {
190 190
 			$req_data = $_REQUEST;
191 191
 		}
192 192
 		$this->_normalize($req_data);
193
-		if( $validate ){
193
+		if ($validate) {
194 194
 			$this->_validate();
195 195
 		}
196
-		do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate );
196
+		do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate);
197 197
 	}
198 198
 
199 199
 
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 	 * the value being an array formatted in teh same way
207 207
 	 * @param array $default_data
208 208
 	 */
209
-	public function populate_defaults($default_data){
210
-		foreach($this->subsections() as $subsection_name => $subsection){
211
-			if(isset($default_data[$subsection_name])){
212
-				if($subsection instanceof EE_Form_Input_Base){
209
+	public function populate_defaults($default_data) {
210
+		foreach ($this->subsections() as $subsection_name => $subsection) {
211
+			if (isset($default_data[$subsection_name])) {
212
+				if ($subsection instanceof EE_Form_Input_Base) {
213 213
 					$subsection->set_default($default_data[$subsection_name]);
214
-				}elseif($subsection instanceof EE_Form_Section_Proper){
214
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
215 215
 					$subsection->populate_defaults($default_data[$subsection_name]);
216 216
 				}
217 217
 			}
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 	 * (realizing that the subsections' html names might not be set yet, etc.)
230 230
 	 * @return EE_Form_Section_Base
231 231
 	 */
232
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
233
-		if( $require_construction_to_be_finalized ){
232
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
233
+		if ($require_construction_to_be_finalized) {
234 234
 			$this->ensure_construct_finalized_called();
235 235
 		}
236 236
 		return isset($this->_subsections[$name]) ? $this->_subsections[$name] : NULL;
@@ -245,23 +245,23 @@  discard block
 block discarded – undo
245 245
 	 * @param EE_Form_Section_Proper[] $subsections
246 246
 	 * @return \EE_Form_Section_Base
247 247
 	 */
248
-	public function find_subsection( $subsection_to_find, $subsections = array() ){
248
+	public function find_subsection($subsection_to_find, $subsections = array()) {
249 249
 		// if subsections were not specified then use those from this form
250
-		$subsections = is_array( $subsections ) && ! empty( $subsections )
250
+		$subsections = is_array($subsections) && ! empty($subsections)
251 251
 			? $subsections
252 252
 			: $this->_subsections;
253 253
 		// loop through each subsection
254
-		foreach( $subsections as $subsection_name => $subsection ){
254
+		foreach ($subsections as $subsection_name => $subsection) {
255 255
 			// found a match? then return it
256
-			if ( $subsection_to_find == $subsection_name ) {
256
+			if ($subsection_to_find == $subsection_name) {
257 257
 				return $subsection;
258 258
 			}
259 259
 			// if this is not a form type that can have subsections, then skip to the next item
260
-			if ( ! $subsection instanceof EE_Form_Section_Proper ) {
260
+			if ( ! $subsection instanceof EE_Form_Section_Proper) {
261 261
 				continue;
262 262
 			}
263 263
 			// search through the subsections of this subsection's subsections, la la la SUBSECTIONS!!!
264
-			return $this->find_subsection( $subsection_to_find, $subsection->subsections() );
264
+			return $this->find_subsection($subsection_to_find, $subsection->subsections());
265 265
 		}
266 266
 		// found nuttin
267 267
 		return null;
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 	 * Gets all the validatable subsections of this form section
274 274
 	 * @return EE_Form_Section_Validatable[]
275 275
 	 */
276
-	public function get_validatable_subsections(){
276
+	public function get_validatable_subsections() {
277 277
 		$validatable_subsections = array();
278
-		foreach($this->subsections() as $name=>$obj){
279
-			if($obj instanceof EE_Form_Section_Validatable){
278
+		foreach ($this->subsections() as $name=>$obj) {
279
+			if ($obj instanceof EE_Form_Section_Validatable) {
280 280
 				$validatable_subsections[$name] = $obj;
281 281
 			}
282 282
 		}
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
 	 * @return EE_Form_Input_Base
297 297
 	 * @throws EE_Error
298 298
 	 */
299
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
299
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
300 300
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
301
-		if( ! $subsection instanceof EE_Form_Input_Base){
302
-			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'),$name, get_class($this),$subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
301
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
302
+			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'), $name, get_class($this), $subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
303 303
 		}
304 304
 		return $subsection;
305 305
 	}
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 	 * @return EE_Form_Section_Proper
318 318
 	 * @throws EE_Error
319 319
 	 */
320
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
321
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
322
-		if( ! $subsection instanceof EE_Form_Section_Proper){
323
-			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),$name, get_class($this)));
320
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
321
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
322
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
323
+			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), $name, get_class($this)));
324 324
 		}
325 325
 		return $subsection;
326 326
 	}
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 * @param string $name
334 334
 	 * @return mixed depending on the input's type and its normalization strategy
335 335
 	 */
336
-	public function get_input_value($name){
336
+	public function get_input_value($name) {
337 337
 		$input = $this->get_input($name);
338 338
 		return $input->normalized_value();
339 339
 	}
@@ -346,16 +346,16 @@  discard block
 block discarded – undo
346 346
 	 * @return boolean
347 347
 	 */
348 348
 	public function is_valid() {
349
-		if( ! $this->has_received_submission()){
349
+		if ( ! $this->has_received_submission()) {
350 350
 			throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso")));
351 351
 		}
352
-		if( ! parent::is_valid()){
352
+		if ( ! parent::is_valid()) {
353 353
 			return false;
354 354
 		}
355 355
 		//ok so no errors general to this entire form section. so let's check the subsections
356
-		foreach( $this->get_validatable_subsections() as $subsection ){
357
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '' ){
358
-				$this->set_submission_error_message( $subsection->get_validation_error_string() );
356
+		foreach ($this->get_validatable_subsections() as $subsection) {
357
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '') {
358
+				$this->set_submission_error_message($subsection->get_validation_error_string());
359 359
 				return false;
360 360
 			}
361 361
 		}
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 	 * gets teh default name of this form section if none is specified
369 369
 	 * @return string
370 370
 	 */
371
-	protected function _set_default_name_if_empty(){
372
-		if( ! $this->_name ){
371
+	protected function _set_default_name_if_empty() {
372
+		if ( ! $this->_name) {
373 373
 			$classname = get_class($this);
374 374
 			$default_name = str_replace("EE_", "", $classname);
375
-			$this->_name =  $default_name;
375
+			$this->_name = $default_name;
376 376
 		}
377 377
 	}
378 378
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * Also returns the HTML for the form, except for the form opening and closing tags
384 384
 	 * (as the form section doesn't know where you necessarily want to send the information to), and except for a submit button.
385 385
 	 */
386
-	public function get_html_and_js(){
386
+	public function get_html_and_js() {
387 387
 		$this->enqueue_js();
388 388
 		return $this->get_html();
389 389
 	}
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	 * returns HTML for displaying this form section. recursively calls display_section() on all subsections
395 395
 	 * @return string
396 396
 	 */
397
-	public function get_html(){
397
+	public function get_html() {
398 398
 		$this->ensure_construct_finalized_called();
399 399
 		return $this->_layout_strategy->layout_form();
400 400
 	}
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * enqueues JS for the form
406 406
 	 * @return string
407 407
 	 */
408
-	public function enqueue_js(){
408
+	public function enqueue_js() {
409 409
 		$this->_enqueue_and_localize_form_js();
410 410
 	}
411 411
 
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
 	 * @param boolean $init_form_validation_automatically whether or not we want the form validation to be triggered automatically or not
422 422
 	 * @return void
423 423
 	 */
424
-	public static function wp_enqueue_scripts( $init_form_validation_automatically = false ){
425
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
426
-		wp_register_script( 'ee_form_section_validation', EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', array( 'jquery-validate', 'jquery-ui-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
424
+	public static function wp_enqueue_scripts($init_form_validation_automatically = false) {
425
+		add_filter('FHEE_load_jquery_validate', '__return_true');
426
+		wp_register_script('ee_form_section_validation', EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', array('jquery-validate', 'jquery-ui-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
427 427
 		
428
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_validation_init', array( 'init' => $init_form_validation_automatically ) );
428
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_validation_init', array('init' => $init_form_validation_automatically));
429 429
 	}
430 430
 
431 431
 
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
 	 * This needs to be called AFTER we've called $this->_enqueue_jquery_validate_script,
436 436
 	 * but before the wordpress hook wp_loaded
437 437
 	 */
438
-	public function _enqueue_and_localize_form_js(){
438
+	public function _enqueue_and_localize_form_js() {
439 439
 		$this->ensure_construct_finalized_called();
440 440
 		//actually, we don't want to localize just yet. There may be other forms on the page.
441 441
 		//so we need to add our form section data to a static variable accessible by all form sections
442 442
 		//and localize it just before the footer
443 443
 		$this->localize_validation_rules();
444
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
445
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
444
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
445
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
446 446
 	}
447 447
 
448 448
 
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
 	 * @param bool $return_for_subsection
453 453
 	 * @return void
454 454
 	 */
455
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
455
+	public function localize_validation_rules($return_for_subsection = FALSE) {
456 456
 		// we only want to localize vars ONCE for the entire form, so if the form section doesn't have a parent, then it must be the top dog
457
-		if ( ! $this->parent_section() || $return_for_subsection ) {
458
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
459
-				'form_section_id'=> $this->html_id( TRUE ),
457
+		if ( ! $this->parent_section() || $return_for_subsection) {
458
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
459
+				'form_section_id'=> $this->html_id(TRUE),
460 460
 				'validation_rules'=> $this->get_jquery_validation_rules(),
461 461
 				'errors'=> $this->subsection_validation_errors_by_html_name()
462 462
 			);
@@ -471,12 +471,12 @@  discard block
 block discarded – undo
471 471
 	 * Keys are their form names, and values are the inputs themselves
472 472
 	 * @return EE_Form_Input_Base
473 473
 	 */
474
-	public function inputs_in_subsections(){
474
+	public function inputs_in_subsections() {
475 475
 		$inputs = array();
476
-		foreach($this->subsections() as $subsection){
477
-			if( $subsection instanceof EE_Form_Input_Base ){
478
-				$inputs[ $subsection->html_name() ] = $subsection;
479
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
476
+		foreach ($this->subsections() as $subsection) {
477
+			if ($subsection instanceof EE_Form_Input_Base) {
478
+				$inputs[$subsection->html_name()] = $subsection;
479
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
480 480
 				$inputs += $subsection->inputs_in_subsections();
481 481
 			}
482 482
 		}
@@ -489,12 +489,12 @@  discard block
 block discarded – undo
489 489
 	 * and values are a string of all their validation errors
490 490
 	 * @return string[]
491 491
 	 */
492
-	public function subsection_validation_errors_by_html_name(){
492
+	public function subsection_validation_errors_by_html_name() {
493 493
 		$inputs = $this->inputs();
494 494
 		$errors = array();
495
-		foreach( $inputs as $form_input ){
496
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
497
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
495
+		foreach ($inputs as $form_input) {
496
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
497
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
498 498
 			}
499 499
 		}
500 500
 		return $errors;
@@ -506,12 +506,12 @@  discard block
 block discarded – undo
506 506
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
507 507
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
508 508
 	 */
509
-	public static function localize_script_for_all_forms(){
509
+	public static function localize_script_for_all_forms() {
510 510
 		//allow inputs and stuff to hook in their JS and stuff here
511 511
 		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
512 512
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
513
-		wp_enqueue_script( 'ee_form_section_validation' );
514
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization );
513
+		wp_enqueue_script('ee_form_section_validation');
514
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization);
515 515
 	}
516 516
 
517 517
 
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
 	/**
520 520
 	 * ensure_scripts_localized
521 521
 	 */
522
-	public function ensure_scripts_localized(){
523
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
522
+	public function ensure_scripts_localized() {
523
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
524 524
 			$this->_enqueue_and_localize_form_js();
525 525
 		}
526 526
 	}
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	 * is that the key here should be the same as the custom validation rule put in the JS file
533 533
 	 * @return array keys are custom validation rules, and values are internationalized strings
534 534
 	 */
535
-	private static function _get_localized_error_messages(){
535
+	private static function _get_localized_error_messages() {
536 536
 		return array(
537 537
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
538
-			'regex' => __( 'Please check your input', 'event_espresso' ),
538
+			'regex' => __('Please check your input', 'event_espresso'),
539 539
 		);
540 540
 	}
541 541
 
@@ -563,10 +563,10 @@  discard block
 block discarded – undo
563 563
 	 * Gets the JS to put inside the jquery validation rules for subsection of this form section. See parent function for more...
564 564
 	 * @return array
565 565
 	 */
566
-	function get_jquery_validation_rules(){
566
+	function get_jquery_validation_rules() {
567 567
 		$jquery_validation_rules = array();
568
-		foreach($this->get_validatable_subsections() as $subsection){
569
-			$jquery_validation_rules = array_merge( $jquery_validation_rules,  $subsection->get_jquery_validation_rules() );
568
+		foreach ($this->get_validatable_subsections() as $subsection) {
569
+			$jquery_validation_rules = array_merge($jquery_validation_rules, $subsection->get_jquery_validation_rules());
570 570
 		}
571 571
 		return $jquery_validation_rules;
572 572
 	}
@@ -581,11 +581,11 @@  discard block
 block discarded – undo
581 581
 	protected function _normalize($req_data) {
582 582
 		$this->_received_submission = TRUE;
583 583
 		$this->_validation_errors = array();
584
-		foreach($this->get_validatable_subsections() as $subsection){
585
-			try{
584
+		foreach ($this->get_validatable_subsections() as $subsection) {
585
+			try {
586 586
 				$subsection->_normalize($req_data);
587
-			}catch( EE_Validation_Error $e ){
588
-				$subsection->add_validation_error( $e );
587
+			} catch (EE_Validation_Error $e) {
588
+				$subsection->add_validation_error($e);
589 589
 			}
590 590
 		}
591 591
 	}
@@ -599,9 +599,9 @@  discard block
 block discarded – undo
599 599
 	 * calling parent::_validate() first.
600 600
 	 */
601 601
 	protected function _validate() {
602
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
603
-			if(method_exists($this,'_validate_'.$subsection_name)){
604
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
602
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
603
+			if (method_exists($this, '_validate_'.$subsection_name)) {
604
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
605 605
 			}
606 606
 			$subsection->_validate();
607 607
 		}
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
 	 * Gets all the validated inputs for the form section
614 614
 	 * @return array
615 615
 	 */
616
-	public function valid_data(){
616
+	public function valid_data() {
617 617
 		$inputs = array();
618
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
619
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
620
-				$inputs[ $subsection_name ] = $subsection->valid_data();
621
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
622
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
618
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
619
+			if ($subsection instanceof EE_Form_Section_Proper) {
620
+				$inputs[$subsection_name] = $subsection->valid_data();
621
+			} else if ($subsection instanceof EE_Form_Input_Base) {
622
+				$inputs[$subsection_name] = $subsection->normalized_value();
623 623
 			}
624 624
 		}
625 625
 		return $inputs;
@@ -631,11 +631,11 @@  discard block
 block discarded – undo
631 631
 	 * Gets all the inputs on this form section
632 632
 	 * @return EE_Form_Input_Base[]
633 633
 	 */
634
-	public function inputs(){
634
+	public function inputs() {
635 635
 		$inputs = array();
636
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
637
-			if ( $subsection instanceof EE_Form_Input_Base ){
638
-				$inputs[ $subsection_name ] = $subsection;
636
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
637
+			if ($subsection instanceof EE_Form_Input_Base) {
638
+				$inputs[$subsection_name] = $subsection;
639 639
 			}
640 640
 		}
641 641
 		return $inputs;
@@ -647,10 +647,10 @@  discard block
 block discarded – undo
647 647
 	 * Gets all the subsections which are a proper form
648 648
 	 * @return EE_Form_Section_Proper[]
649 649
 	 */
650
-	public function subforms(){
650
+	public function subforms() {
651 651
 		$form_sections = array();
652
-		foreach($this->subsections() as $name=>$obj){
653
-			if($obj instanceof EE_Form_Section_Proper){
652
+		foreach ($this->subsections() as $name=>$obj) {
653
+			if ($obj instanceof EE_Form_Section_Proper) {
654 654
 				$form_sections[$name] = $obj;
655 655
 			}
656 656
 		}
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 	 * if you only want form inputs or proper form sections.
666 666
 	 * @return EE_Form_Section_Proper[]
667 667
 	 */
668
-	public function subsections(){
668
+	public function subsections() {
669 669
 		$this->ensure_construct_finalized_called();
670 670
 		return $this->_subsections;
671 671
 	}
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
684 684
 	 * input's normalized value, or an array like the top-level array
685 685
 	 */
686
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
687
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
686
+	public function input_values($include_subform_inputs = false, $flatten = false) {
687
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
688 688
 	}
689 689
 
690 690
 	/**
@@ -700,8 +700,8 @@  discard block
 block discarded – undo
700 700
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
701 701
 	 * input's normalized value, or an array like the top-level array
702 702
 	 */
703
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
704
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
703
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
704
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
705 705
 	}
706 706
 
707 707
 	/**
@@ -714,17 +714,17 @@  discard block
 block discarded – undo
714 714
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
715 715
 	 * input's normalized value, or an array like the top-level array
716 716
 	 */
717
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
717
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
718 718
 		$input_values = array();
719
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
720
-			if( $subsection instanceof EE_Form_Input_Base ) {
721
-				$input_values[ $subsection_name ] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
722
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
723
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
724
-				if( $flatten ) {
725
-					$input_values = array_merge( $input_values, $subform_input_values );
719
+		foreach ($this->subsections() as $subsection_name => $subsection) {
720
+			if ($subsection instanceof EE_Form_Input_Base) {
721
+				$input_values[$subsection_name] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
722
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
723
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
724
+				if ($flatten) {
725
+					$input_values = array_merge($input_values, $subform_input_values);
726 726
 				} else {
727
-					$input_values[ $subsection_name ] = $subform_input_values;
727
+					$input_values[$subsection_name] = $subform_input_values;
728 728
 				}
729 729
 			}
730 730
 		}
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	 * (ie, had receive_form_submission called on it yet)
739 739
 	 * @return boolean
740 740
 	 */
741
-	public function has_received_submission(){
741
+	public function has_received_submission() {
742 742
 		$this->ensure_construct_finalized_called();
743 743
 		return $this->_received_submission;
744 744
 	}
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
 	 * @param array $inputs_to_exclude values are the input names
752 752
 	 * @return void
753 753
 	 */
754
-	public function exclude( array $inputs_to_exclude = array() ){
755
-		foreach( (array)$inputs_to_exclude as $input_to_exclude_name){
754
+	public function exclude(array $inputs_to_exclude = array()) {
755
+		foreach ((array) $inputs_to_exclude as $input_to_exclude_name) {
756 756
 			unset($this->_subsections[$input_to_exclude_name]);
757 757
 		}
758 758
 	}
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
 	/**
763 763
 	 * @param array $inputs_to_hide
764 764
 	 */
765
-	public function hide($inputs_to_hide= array()){
766
-		foreach($inputs_to_hide as $input_to_hide){
765
+	public function hide($inputs_to_hide = array()) {
766
+		foreach ($inputs_to_hide as $input_to_hide) {
767 767
 			$input = $this->get_input($input_to_hide);
768 768
 
769 769
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -788,13 +788,13 @@  discard block
 block discarded – undo
788 788
 	 * 																								or if $subsection_name_to_target is null, before or after entire subsections array
789 789
 	 * @return void
790 790
 	 */
791
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
792
-		foreach($new_subsections as $subsection_name => $subsection){
793
-			if( ! $subsection instanceof EE_Form_Section_Base){
791
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
792
+		foreach ($new_subsections as $subsection_name => $subsection) {
793
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
794 794
 				EE_Error::add_error(
795 795
 					sprintf(
796 796
 						__("Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", "event_espresso"),
797
-						get_class( $subsection ),
797
+						get_class($subsection),
798 798
 						$subsection_name,
799 799
 						$this->name()
800 800
 					)
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 			}
804 804
 		}
805 805
 
806
-		EE_Registry::instance()->load_helper( 'Array' );
807
-		$this->_subsections = EEH_Array::insert_into_array( $this->_subsections, $new_subsections, $subsection_name_to_target, $add_before );
806
+		EE_Registry::instance()->load_helper('Array');
807
+		$this->_subsections = EEH_Array::insert_into_array($this->_subsections, $new_subsections, $subsection_name_to_target, $add_before);
808 808
 
809 809
 		/*$subsections_before = array();
810 810
 		if( $subsection_name_to_target ){
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 				$this->_subsections = $new_subsections;
836 836
 			}
837 837
 		}*/
838
-		if( $this->_construction_finalized ){
839
-			foreach($this->_subsections as $name => $subsection){
838
+		if ($this->_construction_finalized) {
839
+			foreach ($this->_subsections as $name => $subsection) {
840 840
 				$subsection->_construct_finalize($this, $name);
841 841
 			}
842 842
 		}
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
 	/**
848 848
 	 * Just gets all validatable subsections to clean their sensitive data
849 849
 	 */
850
-	public function clean_sensitive_data(){
851
-		foreach($this->get_validatable_subsections() as $subsection){
850
+	public function clean_sensitive_data() {
851
+		foreach ($this->get_validatable_subsections() as $subsection) {
852 852
 			$subsection->clean_sensitive_data();
853 853
 		}
854 854
 	}
@@ -858,8 +858,8 @@  discard block
 block discarded – undo
858 858
 	/**
859 859
 	 * @param string $form_submission_error_message
860 860
 	 */
861
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
862
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message ) ? $form_submission_error_message : __( 'Form submission failed due to errors', 'event_espresso' );
861
+	public function set_submission_error_message($form_submission_error_message = '') {
862
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message) ? $form_submission_error_message : __('Form submission failed due to errors', 'event_espresso');
863 863
 	}
864 864
 
865 865
 
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 	/**
877 877
 	 * @param string $form_submission_success_message
878 878
 	 */
879
-	public function set_submission_success_message( $form_submission_success_message ) {
880
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message ) ? $form_submission_success_message : __( 'Form submitted successfully', 'event_espresso' );
879
+	public function set_submission_success_message($form_submission_success_message) {
880
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message) ? $form_submission_success_message : __('Form submitted successfully', 'event_espresso');
881 881
 	}
882 882
 
883 883
 
@@ -899,10 +899,10 @@  discard block
 block discarded – undo
899 899
 	 * EE_Form_Input_Base::_set_default_html_name_if_empty
900 900
 	 * @return string
901 901
 	 */
902
-	public function html_name_prefix(){
903
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
904
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
905
-		}else{
902
+	public function html_name_prefix() {
903
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
904
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
905
+		} else {
906 906
 			return $this->name();
907 907
 		}
908 908
 	}
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 	 * was set, which is probably nothing, or the classname)
914 914
 	 * @return string
915 915
 	 */
916
-	public function name(){
916
+	public function name() {
917 917
 		$this->ensure_construct_finalized_called();
918 918
 		return parent::name();
919 919
 	}
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	 *
923 923
 	 * @return EE_Form_Section_Proper
924 924
 	 */
925
-	public function parent_section(){
925
+	public function parent_section() {
926 926
 		$this->ensure_construct_finalized_called();
927 927
 		return parent::parent_section();
928 928
 	}
@@ -931,9 +931,9 @@  discard block
 block discarded – undo
931 931
 	 * make sure construction finalized was called, otherwise children might not be ready
932 932
 	 * @return void
933 933
 	 */
934
-	public function ensure_construct_finalized_called(){
935
-		if( ! $this->_construction_finalized ){
936
-			$this->_construct_finalize($this->_parent_section, $this->_name );
934
+	public function ensure_construct_finalized_called() {
935
+		if ( ! $this->_construction_finalized) {
936
+			$this->_construct_finalize($this->_parent_section, $this->_name);
937 937
 		}
938 938
 	}
939 939
 
@@ -945,17 +945,17 @@  discard block
 block discarded – undo
945 945
 	 * @param array $req_data
946 946
 	 * @return boolean
947 947
 	 */
948
-	public function form_data_present_in( $req_data = NULL ) {
949
-		if( $req_data === NULL){
948
+	public function form_data_present_in($req_data = NULL) {
949
+		if ($req_data === NULL) {
950 950
 			$req_data = $_POST;
951 951
 		}
952
-		foreach( $this->subsections() as $subsection ) {
953
-			if($subsection instanceof EE_Form_Input_Base ) {
954
-				if( $subsection->form_data_present_in( $req_data ) ) {
952
+		foreach ($this->subsections() as $subsection) {
953
+			if ($subsection instanceof EE_Form_Input_Base) {
954
+				if ($subsection->form_data_present_in($req_data)) {
955 955
 					return TRUE;
956 956
 				}
957
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
958
-				if( $subsection->form_data_present_in( $req_data ) ) {
957
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
958
+				if ($subsection->form_data_present_in($req_data)) {
959 959
 					return TRUE;
960 960
 				}
961 961
 			}
@@ -972,14 +972,14 @@  discard block
 block discarded – undo
972 972
 	 */
973 973
 	public function get_validation_errors_accumulated() {
974 974
 		$validation_errors = $this->get_validation_errors();
975
-		foreach($this->get_validatable_subsections() as $subsection ) {
976
-			if( $subsection instanceof EE_Form_Section_Proper ) {
975
+		foreach ($this->get_validatable_subsections() as $subsection) {
976
+			if ($subsection instanceof EE_Form_Section_Proper) {
977 977
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
978 978
 			} else {
979
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
979
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
980 980
 			}
981
-			if( $validation_errors_on_this_subsection ){
982
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
981
+			if ($validation_errors_on_this_subsection) {
982
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
983 983
 			}
984 984
 		}
985 985
 		return $validation_errors;
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Validatable.form.php 2 patches
Spacing   +15 added lines, -15 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
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  *
35 35
  * ------------------------------------------------------------------------
36 36
  */
37
-abstract class EE_Form_Section_Validatable extends EE_Form_Section_Base{
37
+abstract class EE_Form_Section_Validatable extends EE_Form_Section_Base {
38 38
 
39 39
 	/**
40 40
 	 * Array of validation errors in this section. Does not contain validation errors in subsections, however.
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * called get_validation_errors_accumulated
50 50
 	 * @return EE_Validation_Error[]
51 51
 	 */
52
-	public function get_validation_errors(){
52
+	public function get_validation_errors() {
53 53
 		return $this->_validation_errors;
54 54
 	}
55 55
 	/**
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 	 * If we want this to be customizable, we may decide to create a strategy for displaying it.
58 58
 	 * @return string
59 59
 	 */
60
-	public function get_validation_error_string(){
60
+	public function get_validation_error_string() {
61 61
 		$validation_error_messages = array();
62
-		if($this->get_validation_errors()){
63
-			foreach($this->get_validation_errors() as $validation_error){
64
-				if ( $validation_error instanceof EE_Validation_Error ) {
65
-					$validation_error_messages[] =$validation_error->getMessage();
62
+		if ($this->get_validation_errors()) {
63
+			foreach ($this->get_validation_errors() as $validation_error) {
64
+				if ($validation_error instanceof EE_Validation_Error) {
65
+					$validation_error_messages[] = $validation_error->getMessage();
66 66
 				}
67 67
 			}
68 68
 		}
69
-		return implode(", ",$validation_error_messages);
69
+		return implode(", ", $validation_error_messages);
70 70
 	}
71 71
 
72 72
 
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 * @return boolean
83 83
 	 */
84 84
 	public function is_valid() {
85
-		if(count($this->_validation_errors)){
85
+		if (count($this->_validation_errors)) {
86 86
 			return false;
87
-		}else{
87
+		} else {
88 88
 			return true;
89 89
 		}
90 90
 	}
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 * @param Exception $previous_exception if there was an exception that caused the error, that exception
110 110
 	 * @return void
111 111
 	 */
112
-	function add_validation_error( $message_or_object, $error_code = NULL, $previous_exception = NULL ){
113
-		if($message_or_object instanceof EE_Validation_Error){
114
-			$validation_error= $message_or_object;
112
+	function add_validation_error($message_or_object, $error_code = NULL, $previous_exception = NULL) {
113
+		if ($message_or_object instanceof EE_Validation_Error) {
114
+			$validation_error = $message_or_object;
115 115
 			$validation_error->set_form_section($this);
116
-		}else{
116
+		} else {
117 117
 			$validation_error = new EE_Validation_Error($message_or_object, $error_code, $this, $previous_exception);
118 118
 		}
119 119
 		$this->_validation_errors[] = $validation_error;
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -84,7 +85,7 @@  discard block
 block discarded – undo
84 85
 	public function is_valid() {
85 86
 		if(count($this->_validation_errors)){
86 87
 			return false;
87
-		}else{
88
+		} else{
88 89
 			return true;
89 90
 		}
90 91
 	}
@@ -113,7 +114,7 @@  discard block
 block discarded – undo
113 114
 		if($message_or_object instanceof EE_Validation_Error){
114 115
 			$validation_error= $message_or_object;
115 116
 			$validation_error->set_form_section($this);
116
-		}else{
117
+		} else{
117 118
 			$validation_error = new EE_Validation_Error($message_or_object, $error_code, $this, $previous_exception);
118 119
 		}
119 120
 		$this->_validation_errors[] = $validation_error;
Please login to merge, or discard this patch.