Completed
Branch BUG-8957-add-countries (49f36b)
by
unknown
33:27 queued 16:54
created
core/db_models/EEM_Ticket.model.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Ticket.class.php');
26 26
 
27 27
 class EEM_Ticket extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Ticket','event_espresso');
40
-		$this->plural_item = __('Tickets','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Ticket', 'event_espresso');
40
+		$this->plural_item = __('Tickets', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Ticket'=>array(
47
-				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')),
48
-				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'),
47
+				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')),
48
+				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'),
49 49
 				'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''),
50
-				'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ),
51
-				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
52
-				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
53
-				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ),
54
-				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ),
50
+				'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''),
51
+				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
52
+				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
53
+				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0),
54
+				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF),
55 55
 				'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0),
56 56
 				'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0),
57
-				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF),
58
-				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ),
59
-				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ),
60
-				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false),
61
-				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ),
57
+				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF),
58
+				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF),
59
+				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false),
60
+				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false),
61
+				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false),
62 62
 				'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0),
63
-				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ),
63
+				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0),
64 64
 				'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false),
65
-				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ),
66
-				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 )
65
+				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE),
66
+				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0)
67 67
 			));
68 68
 		$this->_model_relations = array(
69 69
 			'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		);
76 76
 
77 77
 		//this model is generally available for reading
78
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
78
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
79 79
 		//account for default tickets in the caps
80
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
81
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
82
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
83
-		parent::__construct( $timezone );
80
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
81
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
82
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
83
+		parent::__construct($timezone);
84 84
 	}
85 85
 
86 86
 
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_all_default_tickets() {
93 93
 		/** @type EE_Ticket[] $tickets */
94
-		$tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')) );
94
+		$tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')));
95 95
 		//we need to set the start date and end date to today's date and the start of the default dtt
96
-		return $this->_set_default_dates( $tickets );
96
+		return $this->_set_default_dates($tickets);
97 97
 	}
98 98
 
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @param EE_Ticket[] $tickets
104 104
 	 * @return EE_Ticket[]
105 105
 	 */
106
-	private function _set_default_dates( $tickets ) {
107
-		foreach ( $tickets as $ticket ) {
108
-			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) );
109
-			$ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) );
110
-			$ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) );
106
+	private function _set_default_dates($tickets) {
107
+		foreach ($tickets as $ticket) {
108
+			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true));
109
+			$ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30));
110
+			$ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone));
111 111
 		}
112 112
 
113 113
 		return $tickets;
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @param array $query_params
123 123
 	 * @return int
124 124
 	 */
125
-	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){
126
-		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params );
125
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
126
+		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params);
127 127
 	}
128 128
 
129 129
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @param EE_Ticket[] $tickets
134 134
 	 * @return void
135 135
 	 */
136
-	public function update_tickets_sold($tickets){
137
-		foreach($tickets as $ticket){
136
+	public function update_tickets_sold($tickets) {
137
+		foreach ($tickets as $ticket) {
138 138
 			/* @var  $ticket EE_Ticket */
139 139
 			$ticket->update_tickets_sold();
140 140
 		}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Text_Field.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3 3
 /**
4 4
  *
5 5
  * Class EE_Enum_Text_Field
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param mixed $default_value
24 24
 	 * @param array $allowed_enum_values  keys are values to be used in the DB, values are how they should be displayed
25 25
 	 */
26
-	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values){
26
+	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) {
27 27
 		$this->_allowed_enum_values = $allowed_enum_values;
28 28
 		parent::__construct($table_column, $nice_name, $nullable, $default_value);
29 29
 	}
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 	 * @return string
38 38
 	 * @throws EE_Error
39 39
 	 */
40
-	function prepare_for_set( $value_inputted_for_field_on_model_object ) {
41
-		if(
40
+	function prepare_for_set($value_inputted_for_field_on_model_object) {
41
+		if (
42 42
 			$value_inputted_for_field_on_model_object !== null
43
-			&& ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values )
44
-		){
45
-			if( defined( 'WP_DEBUG' ) &&  WP_DEBUG ){
43
+			&& ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)
44
+		) {
45
+			if (defined('WP_DEBUG') && WP_DEBUG) {
46 46
 				$msg = sprintf(
47
-					__('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'),
47
+					__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
48 48
 					$value_inputted_for_field_on_model_object,
49 49
 					$this->_name
50 50
 				);
51 51
 				$msg2 = sprintf(
52
-					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"','event_espresso'),
52
+					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'),
53 53
 					$this->_name,
54
-					implode( ", ", array_keys( $this->_allowed_enum_values ) ),
54
+					implode(", ", array_keys($this->_allowed_enum_values)),
55 55
 					$value_inputted_for_field_on_model_object
56 56
 				);
57
-				EE_Error::add_error( "$msg||$msg2", __FILE__, __FUNCTION__, __LINE__ );
57
+				EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__);
58 58
 			}
59 59
 			return $this->get_default_value();
60 60
 
Please login to merge, or discard this patch.
core/interfaces/EEI_Duplicatable.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
 	 *	with the exception of a particular attribute
27 27
 	 * @return object of the same class as what was called on
28 28
 	 */
29
-	public function duplicate( $options = array() );
29
+	public function duplicate($options = array());
30 30
 
31 31
 
32 32
 
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/email_main_wrapper.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
 	<!-- Facebook sharing information tags -->
8 8
 	<meta property="og:title" content="<?php echo $subject; ?>" />
9 9
 	<title><?php echo $subject; ?></title>
10
-	<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body ); ?>
10
+	<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body); ?>
11 11
 </head>
12
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body ); ?>
12
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body); ?>
13 13
 <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
14
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body ); ?>
14
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body); ?>
15 15
 <?php echo $main_body; ?>
16
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body ); ?>
16
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body); ?>
17 17
 </body>
18
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body ); ?>
18
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body); ?>
19 19
 </html>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/html_main_wrapper.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 		<!-- Primary Style Sheet -->
28 28
 		<link rel="stylesheet" type="text/css" href="<?php echo $main_css; ?>" />
29 29
 		<!-- Make sure the buttons don't print -->
30
-		<?php if ( isset( $extra_css )) : ?>
30
+		<?php if (isset($extra_css)) : ?>
31 31
 		<!-- Additional Style Sheet -->
32 32
 		<link rel="stylesheet" type="text/css" href="<?php echo $extra_css; ?>" />
33 33
 		<?php endif; ?>
34 34
 		<style type="text/css">
35 35
 		@media print{ .noPrint{ display:none !important;height:0!important; width:0!important; margin:0!important; padding:0!important; }}
36 36
 		</style>
37
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
37
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
38 38
 	</head>
39
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
39
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
40 40
 	<body>
41
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
41
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
42 42
 		<?php echo $main_body; ?>
43
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
43
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
44 44
 	</body>
45
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
45
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
46 46
 	<?php wp_footer(); ?>
47 47
 </html>
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 3 patches
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.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			if(isset($default_data[$subsection_name])){
300 300
 				if($subsection instanceof EE_Form_Input_Base){
301 301
 					$subsection->set_default($default_data[$subsection_name]);
302
-				}elseif($subsection instanceof EE_Form_Section_Proper){
302
+				} elseif($subsection instanceof EE_Form_Section_Proper){
303 303
 					$subsection->populate_defaults($default_data[$subsection_name]);
304 304
 				}
305 305
 			}
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		foreach($this->subsections() as $subsection){
626 626
 			if( $subsection instanceof EE_Form_Input_Base ){
627 627
 				$inputs[ $subsection->html_name() ] = $subsection;
628
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
628
+			} elseif($subsection instanceof EE_Form_Section_Proper ){
629 629
 				$inputs += $subsection->inputs_in_subsections();
630 630
 			}
631 631
 		}
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 	public function html_name_prefix(){
1117 1117
 		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
1118 1118
 			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
1119
-		}else{
1119
+		} else{
1120 1120
 			return $this->name();
1121 1121
 		}
1122 1122
 	}
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 				if( $subsection->form_data_present_in( $req_data ) ) {
1179 1179
 					return TRUE;
1180 1180
 				}
1181
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
1181
+			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
1182 1182
 				if( $subsection->form_data_present_in( $req_data ) ) {
1183 1183
 					return TRUE;
1184 1184
 				}
Please login to merge, or discard this patch.
Spacing   +212 added lines, -212 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) 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
 	const SUBMITTED_FORM_DATA_SSN_KEY = 'submitted_form_data';
13 13
 
@@ -71,52 +71,52 @@  discard block
 block discarded – undo
71 71
 	 *                               } @see EE_Form_Section_Validatable::__construct()
72 72
 	 * @throws \EE_Error
73 73
 	 */
74
-	public function __construct( $options_array = array() ){
75
-		$options_array = (array) apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
74
+	public function __construct($options_array = array()) {
75
+		$options_array = (array) apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
76 76
 		//call parent first, as it may be setting the name
77 77
 		parent::__construct($options_array);
78 78
 		//if they've included subsections in the constructor, add them now
79
-		if( isset( $options_array['include'] )){
79
+		if (isset($options_array['include'])) {
80 80
 			//we are going to make sure we ONLY have those subsections to include
81 81
 			//AND we are going to make sure they're in that specified order
82 82
 			$reordered_subsections = array();
83
-			foreach($options_array['include'] as $input_name){
84
-				if(isset($this->_subsections[$input_name])){
83
+			foreach ($options_array['include'] as $input_name) {
84
+				if (isset($this->_subsections[$input_name])) {
85 85
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
86 86
 				}
87 87
 			}
88 88
 			$this->_subsections = $reordered_subsections;
89 89
 		}
90
-		if(isset($options_array['exclude'])){
90
+		if (isset($options_array['exclude'])) {
91 91
 			$exclude = $options_array['exclude'];
92 92
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
93 93
 		}
94
-		if(isset($options_array['layout_strategy'])){
94
+		if (isset($options_array['layout_strategy'])) {
95 95
 			$this->_layout_strategy = $options_array['layout_strategy'];
96 96
 		}
97
-		if( ! $this->_layout_strategy){
97
+		if ( ! $this->_layout_strategy) {
98 98
 			$this->_layout_strategy = is_admin() ? new EE_Admin_Two_Column_Layout() : new EE_Two_Column_Layout();
99 99
 		}
100 100
 		$this->_layout_strategy->_construct_finalize($this);
101 101
 
102 102
 		//ok so we are definitely going to want the forms JS,
103 103
 		//so enqueue it or remember to enqueue it during wp_enqueue_scripts
104
-		if( did_action( 'wp_enqueue_scripts' )
105
-			|| did_action( 'admin_enqueue_scripts' ) ) {
104
+		if (did_action('wp_enqueue_scripts')
105
+			|| did_action('admin_enqueue_scripts')) {
106 106
 			//ok so they've constructed this object after when they should have.
107 107
 			//just enqueue the generic form scripts and initialize the form immediately in the JS
108
-			\EE_Form_Section_Proper::wp_enqueue_scripts( true );
108
+			\EE_Form_Section_Proper::wp_enqueue_scripts(true);
109 109
 			\EE_Form_Section_Proper::wp_deregister_conflicting_scripts();
110 110
 		} else {
111
-			add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
112
-			add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
113
-			add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_deregister_conflicting_scripts' ), 100 );
114
-			add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_deregister_conflicting_scripts' ), 100 );
111
+			add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
112
+			add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
113
+			add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_deregister_conflicting_scripts'), 100);
114
+			add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_deregister_conflicting_scripts'), 100);
115 115
 		}
116
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
116
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
117 117
 
118
-		if( isset( $options_array[ 'name' ] ) ) {
119
-			$this->_construct_finalize( null, $options_array[ 'name' ] );
118
+		if (isset($options_array['name'])) {
119
+			$this->_construct_finalize(null, $options_array['name']);
120 120
 		}
121 121
 	}
122 122
 
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
 	 * @param string                 $name
130 130
 	 * @throws \EE_Error
131 131
 	 */
132
-	public function _construct_finalize( $parent_form_section, $name ) {
132
+	public function _construct_finalize($parent_form_section, $name) {
133 133
 		parent::_construct_finalize($parent_form_section, $name);
134 134
 		$this->_set_default_name_if_empty();
135 135
 		$this->_set_default_html_id_if_empty();
136
-		foreach( $this->_subsections as $subsection_name => $subsection ){
137
-			if ( $subsection instanceof EE_Form_Section_Base ) {
138
-				$subsection->_construct_finalize( $this, $subsection_name );
136
+		foreach ($this->_subsections as $subsection_name => $subsection) {
137
+			if ($subsection instanceof EE_Form_Section_Base) {
138
+				$subsection->_construct_finalize($this, $subsection_name);
139 139
 			} else {
140 140
 				throw new EE_Error(
141 141
 					sprintf(
142
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
142
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
143 143
 						$subsection_name,
144 144
 						get_class($this),
145
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
145
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
146 146
 					)
147 147
 				);
148 148
 			}
149 149
 		}
150
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
150
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
151 151
 	}
152 152
 
153 153
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * Gets the layout strategy for this form section
157 157
 	 * @return EE_Form_Section_Layout_Base
158 158
 	 */
159
-	public function get_layout_strategy(){
159
+	public function get_layout_strategy() {
160 160
 		return $this->_layout_strategy;
161 161
 	}
162 162
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param EE_Form_Input_Base $input
169 169
 	 * @return string
170 170
 	 */
171
-	public function get_html_for_input($input){
171
+	public function get_html_for_input($input) {
172 172
 		return $this->_layout_strategy->layout_input($input);
173 173
 	}
174 174
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param null $form_data
182 182
 	 * @return boolean
183 183
 	 */
184
-	public function was_submitted($form_data = NULL){
184
+	public function was_submitted($form_data = NULL) {
185 185
 		return $this->form_data_present_in($form_data);
186 186
 	}
187 187
 
@@ -206,21 +206,21 @@  discard block
 block discarded – undo
206 206
 	 *                             (eg you validated the data then stored it in the DB)
207 207
 	 *                             you may want to skip this step.
208 208
 	 */
209
-	public function receive_form_submission( $req_data = null, $validate = true ){
210
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate );
211
-		if( $req_data === null ){
212
-			$req_data = array_merge( $_GET, $_POST );
209
+	public function receive_form_submission($req_data = null, $validate = true) {
210
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate);
211
+		if ($req_data === null) {
212
+			$req_data = array_merge($_GET, $_POST);
213 213
 		}
214
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this );
215
-		$this->_normalize( $req_data );
216
-		if( $validate ){
214
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this);
215
+		$this->_normalize($req_data);
216
+		if ($validate) {
217 217
 			$this->_validate();
218 218
 			//if it's invalid, we're going to want to re-display so remember what they submitted
219
-			if ( ! $this->is_valid() ) {
219
+			if ( ! $this->is_valid()) {
220 220
 				$this->store_submitted_form_data_in_session();
221 221
 			}
222 222
 		}
223
-		do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate );
223
+		do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate);
224 224
 	}
225 225
 
226 226
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	protected function store_submitted_form_data_in_session() {
235 235
 		return EE_Registry::instance()->SSN->set_session_data(
236 236
 			array(
237
-				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values( true )
237
+				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values(true)
238 238
 			)
239 239
 		);
240 240
 	}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	protected function get_submitted_form_data_from_session() {
251 251
 		$session = EE_Registry::instance()->SSN;
252
-		if( $session instanceof EE_Session ) {
252
+		if ($session instanceof EE_Session) {
253 253
 			return $session->get_session_data(
254 254
 				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY
255 255
 			);
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	protected function flush_submitted_form_data_from_session() {
269 269
 		return EE_Registry::instance()->SSN->reset_data(
270
-			array( \EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY )
270
+			array(\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY)
271 271
 		);
272 272
 	}
273 273
 
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 	 */
284 284
 	public function populate_from_session() {
285 285
 		$form_data_in_session = $this->get_submitted_form_data_from_session();
286
-		if ( empty( $form_data_in_session ) ) {
286
+		if (empty($form_data_in_session)) {
287 287
 			return false;
288 288
 		}
289
-		$this->receive_form_submission( $form_data_in_session );
289
+		$this->receive_form_submission($form_data_in_session);
290 290
 		$this->flush_submitted_form_data_from_session();
291
-		if ( $this->form_data_present_in( $form_data_in_session ) ) {
291
+		if ($this->form_data_present_in($form_data_in_session)) {
292 292
 			return true;
293 293
 		} else {
294 294
 			return false;
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 * the value being an array formatted in teh same way
306 306
 	 * @param array $default_data
307 307
 	 */
308
-	public function populate_defaults($default_data){
309
-		foreach($this->subsections() as $subsection_name => $subsection){
310
-			if(isset($default_data[$subsection_name])){
311
-				if($subsection instanceof EE_Form_Input_Base){
308
+	public function populate_defaults($default_data) {
309
+		foreach ($this->subsections() as $subsection_name => $subsection) {
310
+			if (isset($default_data[$subsection_name])) {
311
+				if ($subsection instanceof EE_Form_Input_Base) {
312 312
 					$subsection->set_default($default_data[$subsection_name]);
313
-				}elseif($subsection instanceof EE_Form_Section_Proper){
313
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
314 314
 					$subsection->populate_defaults($default_data[$subsection_name]);
315 315
 				}
316 316
 			}
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 	 * @param string $name
326 326
 	 * @return boolean
327 327
 	 */
328
-	public function subsection_exists( $name ){
329
-		return isset( $this->_subsections[ $name ] ) ? true : false;
328
+	public function subsection_exists($name) {
329
+		return isset($this->_subsections[$name]) ? true : false;
330 330
 	}
331 331
 
332 332
 
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 	 * @return EE_Form_Section_Base
345 345
 	 * @throws \EE_Error
346 346
 	 */
347
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
348
-		if( $require_construction_to_be_finalized ){
347
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
348
+		if ($require_construction_to_be_finalized) {
349 349
 			$this->ensure_construct_finalized_called();
350 350
 		}
351
-		return $this->subsection_exists( $name ) ? $this->_subsections[$name] : NULL;
351
+		return $this->subsection_exists($name) ? $this->_subsections[$name] : NULL;
352 352
 	}
353 353
 
354 354
 
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 	 * Gets all the validatable subsections of this form section
358 358
 	 * @return EE_Form_Section_Validatable[]
359 359
 	 */
360
-	public function get_validatable_subsections(){
360
+	public function get_validatable_subsections() {
361 361
 		$validatable_subsections = array();
362
-		foreach($this->subsections() as $name=>$obj){
363
-			if($obj instanceof EE_Form_Section_Validatable){
362
+		foreach ($this->subsections() as $name=>$obj) {
363
+			if ($obj instanceof EE_Form_Section_Validatable) {
364 364
 				$validatable_subsections[$name] = $obj;
365 365
 			}
366 366
 		}
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
 	 * @return EE_Form_Input_Base
381 381
 	 * @throws EE_Error
382 382
 	 */
383
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
383
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
384 384
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
385
-		if( ! $subsection instanceof EE_Form_Input_Base){
385
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
386 386
 			throw new EE_Error(
387 387
 				sprintf(
388 388
 					__(
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 						'event_espresso'
391 391
 					),
392 392
 					$name,
393
-					get_class( $this ),
394
-					$subsection ? get_class( $subsection ) : __( "NULL", 'event_espresso' )
393
+					get_class($this),
394
+					$subsection ? get_class($subsection) : __("NULL", 'event_espresso')
395 395
 				)
396 396
 			);
397 397
 		}
@@ -411,14 +411,14 @@  discard block
 block discarded – undo
411 411
 	 * @return EE_Form_Section_Proper
412 412
 	 * @throws EE_Error
413 413
 	 */
414
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
415
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
416
-		if( ! $subsection instanceof EE_Form_Section_Proper){
414
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
415
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
416
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
417 417
 			throw new EE_Error(
418 418
 				sprintf(
419
-					__( "Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso' ),
419
+					__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),
420 420
 					$name,
421
-					get_class( $this )
421
+					get_class($this)
422 422
 				)
423 423
 			);
424 424
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 * @return mixed depending on the input's type and its normalization strategy
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public function get_input_value($name){
438
+	public function get_input_value($name) {
439 439
 		$input = $this->get_input($name);
440 440
 		return $input->normalized_value();
441 441
 	}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @return boolean
449 449
 	 */
450 450
 	public function is_valid() {
451
-		if( ! $this->has_received_submission()){
451
+		if ( ! $this->has_received_submission()) {
452 452
 			throw new EE_Error(
453 453
 				sprintf(
454 454
 					__(
@@ -458,16 +458,16 @@  discard block
 block discarded – undo
458 458
 				)
459 459
 			);
460 460
 		}
461
-		if( ! parent::is_valid() ) {
461
+		if ( ! parent::is_valid()) {
462 462
 			return false;
463 463
 		}
464 464
 		// ok so no general errors to this entire form section.
465 465
 		// so let's check the subsections, but only set errors if that hasn't been done yet
466 466
 		$set_submission_errors = $this->submission_error_message() === '' ? true : false;
467
-		foreach( $this->get_validatable_subsections() as $subsection ){
468
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '' ){
469
-				if ( $set_submission_errors ) {
470
-					$this->set_submission_error_message( $subsection->get_validation_error_string() );
467
+		foreach ($this->get_validatable_subsections() as $subsection) {
468
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '') {
469
+				if ($set_submission_errors) {
470
+					$this->set_submission_error_message($subsection->get_validation_error_string());
471 471
 				}
472 472
 				return false;
473 473
 			}
@@ -481,11 +481,11 @@  discard block
 block discarded – undo
481 481
 	 * gets teh default name of this form section if none is specified
482 482
 	 * @return string
483 483
 	 */
484
-	protected function _set_default_name_if_empty(){
485
-		if( ! $this->_name ){
484
+	protected function _set_default_name_if_empty() {
485
+		if ( ! $this->_name) {
486 486
 			$classname = get_class($this);
487 487
 			$default_name = str_replace("EE_", "", $classname);
488
-			$this->_name =  $default_name;
488
+			$this->_name = $default_name;
489 489
 		}
490 490
 	}
491 491
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	 *             and get_html when you are about to display the form.
502 502
 	 * @throws \EE_Error
503 503
 	 */
504
-	public function get_html_and_js(){
504
+	public function get_html_and_js() {
505 505
 		//no doing_it_wrong yet because we ourselves are still doing it wrong...
506 506
 		//and theoretically this CAN be used properly, provided its used during "wp_enqueue_scripts"
507 507
 		$this->enqueue_js();
@@ -516,9 +516,9 @@  discard block
 block discarded – undo
516 516
 	 * @param bool $display_previously_submitted_data
517 517
 	 * @return string
518 518
 	 */
519
-	public function get_html( $display_previously_submitted_data = true ){
519
+	public function get_html($display_previously_submitted_data = true) {
520 520
 		$this->ensure_construct_finalized_called();
521
-		if ( $display_previously_submitted_data ) {
521
+		if ($display_previously_submitted_data) {
522 522
 			$this->populate_from_session();
523 523
 		}
524 524
 		return $this->_layout_strategy->layout_form();
@@ -532,9 +532,9 @@  discard block
 block discarded – undo
532 532
 	 * @return string
533 533
 	 * @throws \EE_Error
534 534
 	 */
535
-	public function enqueue_js(){
535
+	public function enqueue_js() {
536 536
 		$this->_enqueue_and_localize_form_js();
537
-		foreach( $this->subsections() as $subsection ) {
537
+		foreach ($this->subsections() as $subsection) {
538 538
 			$subsection->enqueue_js();
539 539
 		}
540 540
 	}
@@ -553,19 +553,19 @@  discard block
 block discarded – undo
553 553
 	 *                                                    to be triggered automatically or not
554 554
 	 * @return void
555 555
 	 */
556
-	public static function wp_enqueue_scripts( $init_form_validation_automatically = true ){
557
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
556
+	public static function wp_enqueue_scripts($init_form_validation_automatically = true) {
557
+		add_filter('FHEE_load_jquery_validate', '__return_true');
558 558
 		wp_register_script(
559 559
 			'ee_form_section_validation',
560
-			EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js',
561
-			array( 'jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods' ),
560
+			EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js',
561
+			array('jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods'),
562 562
 			EVENT_ESPRESSO_VERSION,
563 563
 			true
564 564
 		);
565 565
 		wp_localize_script(
566 566
 			'ee_form_section_validation',
567 567
 			'ee_form_section_validation_init',
568
-			array( 'init' => $init_form_validation_automatically ? true : false )
568
+			array('init' => $init_form_validation_automatically ? true : false)
569 569
 		);
570 570
 	}
571 571
 	
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	public static function wp_deregister_conflicting_scripts() {
577 577
 		//jquery-form (included in WP core, but deprecated) also declares some of the same methods 
578 578
 		//as jquery validate
579
-		wp_deregister_script( 'jquery-form' );
579
+		wp_deregister_script('jquery-form');
580 580
 	}
581 581
 
582 582
 
@@ -588,14 +588,14 @@  discard block
 block discarded – undo
588 588
 	 *
589 589
 	 * @throws \EE_Error
590 590
 	 */
591
-	public function _enqueue_and_localize_form_js(){
591
+	public function _enqueue_and_localize_form_js() {
592 592
 		$this->ensure_construct_finalized_called();
593 593
 		//actually, we don't want to localize just yet. There may be other forms on the page.
594 594
 		//so we need to add our form section data to a static variable accessible by all form sections
595 595
 		//and localize it just before the footer
596 596
 		$this->localize_validation_rules();
597
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
598
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
597
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
598
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
599 599
 	}
600 600
 
601 601
 
@@ -607,12 +607,12 @@  discard block
 block discarded – undo
607 607
 	 * @return void
608 608
 	 * @throws \EE_Error
609 609
 	 */
610
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
610
+	public function localize_validation_rules($return_for_subsection = FALSE) {
611 611
 		// we only want to localize vars ONCE for the entire form,
612 612
 		// so if the form section doesn't have a parent, then it must be the top dog
613
-		if ( $return_for_subsection || ! $this->parent_section() ) {
614
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
615
-				'form_section_id'=> $this->html_id( TRUE ),
613
+		if ($return_for_subsection || ! $this->parent_section()) {
614
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
615
+				'form_section_id'=> $this->html_id(TRUE),
616 616
 				'validation_rules'=> $this->get_jquery_validation_rules(),
617 617
 				'other_data' => $this->get_other_js_data(),
618 618
 				'errors'=> $this->subsection_validation_errors_by_html_name()
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 	 * @param array $form_other_js_data
629 629
 	 * @return array
630 630
 	 */
631
-	public function get_other_js_data( $form_other_js_data = array() ) {
632
-		foreach( $this->subsections() as $subsection ) {
633
-			$form_other_js_data = $subsection->get_other_js_data( $form_other_js_data );
631
+	public function get_other_js_data($form_other_js_data = array()) {
632
+		foreach ($this->subsections() as $subsection) {
633
+			$form_other_js_data = $subsection->get_other_js_data($form_other_js_data);
634 634
 		}
635 635
 		return $form_other_js_data;
636 636
 	}
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
 	 * Keys are their form names, and values are the inputs themselves
642 642
 	 * @return EE_Form_Input_Base
643 643
 	 */
644
-	public function inputs_in_subsections(){
644
+	public function inputs_in_subsections() {
645 645
 		$inputs = array();
646
-		foreach($this->subsections() as $subsection){
647
-			if( $subsection instanceof EE_Form_Input_Base ){
648
-				$inputs[ $subsection->html_name() ] = $subsection;
649
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
646
+		foreach ($this->subsections() as $subsection) {
647
+			if ($subsection instanceof EE_Form_Input_Base) {
648
+				$inputs[$subsection->html_name()] = $subsection;
649
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
650 650
 				$inputs += $subsection->inputs_in_subsections();
651 651
 			}
652 652
 		}
@@ -659,12 +659,12 @@  discard block
 block discarded – undo
659 659
 	 * and values are a string of all their validation errors
660 660
 	 * @return string[]
661 661
 	 */
662
-	public function subsection_validation_errors_by_html_name(){
662
+	public function subsection_validation_errors_by_html_name() {
663 663
 		$inputs = $this->inputs();
664 664
 		$errors = array();
665
-		foreach( $inputs as $form_input ){
666
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
667
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
665
+		foreach ($inputs as $form_input) {
666
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
667
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
668 668
 			}
669 669
 		}
670 670
 		return $errors;
@@ -676,15 +676,15 @@  discard block
 block discarded – undo
676 676
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
677 677
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
678 678
 	 */
679
-	public static function localize_script_for_all_forms(){
679
+	public static function localize_script_for_all_forms() {
680 680
 		//allow inputs and stuff to hook in their JS and stuff here
681
-		do_action( 'AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin' );
681
+		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
682 682
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
683
-		$email_validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level )
683
+		$email_validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
684 684
 			? EE_Registry::instance()->CFG->registration->email_validation_level
685 685
 			: 'wp_default';
686 686
 		EE_Form_Section_Proper::$_js_localization['email_validation_level'] = $email_validation_level;
687
-		wp_enqueue_script( 'ee_form_section_validation' );
687
+		wp_enqueue_script('ee_form_section_validation');
688 688
 		wp_localize_script(
689 689
 			'ee_form_section_validation',
690 690
 			'ee_form_section_vars',
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
 	/**
698 698
 	 * ensure_scripts_localized
699 699
 	 */
700
-	public function ensure_scripts_localized(){
701
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
700
+	public function ensure_scripts_localized() {
701
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
702 702
 			$this->_enqueue_and_localize_form_js();
703 703
 		}
704 704
 	}
@@ -710,10 +710,10 @@  discard block
 block discarded – undo
710 710
 	 * is that the key here should be the same as the custom validation rule put in the JS file
711 711
 	 * @return array keys are custom validation rules, and values are internationalized strings
712 712
 	 */
713
-	private static function _get_localized_error_messages(){
713
+	private static function _get_localized_error_messages() {
714 714
 		return array(
715 715
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
716
-			'regex' => __( 'Please check your input', 'event_espresso' ),
716
+			'regex' => __('Please check your input', 'event_espresso'),
717 717
 		);
718 718
 	}
719 719
 
@@ -743,9 +743,9 @@  discard block
 block discarded – undo
743 743
 	 *
744 744
 	 * @return array
745 745
 	 */
746
-	public function get_jquery_validation_rules(){
746
+	public function get_jquery_validation_rules() {
747 747
 		$jquery_validation_rules = array();
748
-		foreach($this->get_validatable_subsections() as $subsection){
748
+		foreach ($this->get_validatable_subsections() as $subsection) {
749 749
 			$jquery_validation_rules = array_merge(
750 750
 				$jquery_validation_rules,
751 751
 				$subsection->get_jquery_validation_rules()
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 	 * @param array $req_data like $_POST
763 763
 	 * @return void
764 764
 	 */
765
-	protected function _normalize( $req_data ) {
765
+	protected function _normalize($req_data) {
766 766
 		$this->_received_submission = true;
767 767
 		$this->_validation_errors = array();
768
-		foreach ( $this->get_validatable_subsections() as $subsection ) {
768
+		foreach ($this->get_validatable_subsections() as $subsection) {
769 769
 			try {
770
-				$subsection->_normalize( $req_data );
771
-			} catch ( EE_Validation_Error $e ) {
772
-				$subsection->add_validation_error( $e );
770
+				$subsection->_normalize($req_data);
771
+			} catch (EE_Validation_Error $e) {
772
+				$subsection->add_validation_error($e);
773 773
 			}
774 774
 		}
775 775
 	}
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 	 * calling parent::_validate() first.
787 787
 	 */
788 788
 	protected function _validate() {
789
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
790
-			if(method_exists($this,'_validate_'.$subsection_name)){
791
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
789
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
790
+			if (method_exists($this, '_validate_'.$subsection_name)) {
791
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
792 792
 			}
793 793
 			$subsection->_validate();
794 794
 		}
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 	 * Gets all the validated inputs for the form section
801 801
 	 * @return array
802 802
 	 */
803
-	public function valid_data(){
803
+	public function valid_data() {
804 804
 		$inputs = array();
805
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
806
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
807
-				$inputs[ $subsection_name ] = $subsection->valid_data();
808
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
809
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
805
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
806
+			if ($subsection instanceof EE_Form_Section_Proper) {
807
+				$inputs[$subsection_name] = $subsection->valid_data();
808
+			} else if ($subsection instanceof EE_Form_Input_Base) {
809
+				$inputs[$subsection_name] = $subsection->normalized_value();
810 810
 			}
811 811
 		}
812 812
 		return $inputs;
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 	 * Gets all the inputs on this form section
819 819
 	 * @return EE_Form_Input_Base[]
820 820
 	 */
821
-	public function inputs(){
821
+	public function inputs() {
822 822
 		$inputs = array();
823
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
824
-			if ( $subsection instanceof EE_Form_Input_Base ){
825
-				$inputs[ $subsection_name ] = $subsection;
823
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
824
+			if ($subsection instanceof EE_Form_Input_Base) {
825
+				$inputs[$subsection_name] = $subsection;
826 826
 			}
827 827
 		}
828 828
 		return $inputs;
@@ -834,10 +834,10 @@  discard block
 block discarded – undo
834 834
 	 * Gets all the subsections which are a proper form
835 835
 	 * @return EE_Form_Section_Proper[]
836 836
 	 */
837
-	public function subforms(){
837
+	public function subforms() {
838 838
 		$form_sections = array();
839
-		foreach($this->subsections() as $name=>$obj){
840
-			if($obj instanceof EE_Form_Section_Proper){
839
+		foreach ($this->subsections() as $name=>$obj) {
840
+			if ($obj instanceof EE_Form_Section_Proper) {
841 841
 				$form_sections[$name] = $obj;
842 842
 			}
843 843
 		}
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 	 * if you only want form inputs or proper form sections.
853 853
 	 * @return EE_Form_Section_Proper[]
854 854
 	 */
855
-	public function subsections(){
855
+	public function subsections() {
856 856
 		$this->ensure_construct_finalized_called();
857 857
 		return $this->_subsections;
858 858
 	}
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
 	 *                                        where keys are always subsection names and values are either
875 875
 	 *                                        the input's normalized value, or an array like the top-level array
876 876
 	 */
877
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
878
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
877
+	public function input_values($include_subform_inputs = false, $flatten = false) {
878
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
879 879
 	}
880 880
 
881 881
 	/**
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
895 895
 	 *                                        where keys are always subsection names and values are either
896 896
 	 *                                        the input's normalized value, or an array like the top-level array
897 897
 	 */
898
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
899
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
898
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
899
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
900 900
 	}
901 901
 
902 902
 	/**
@@ -914,19 +914,19 @@  discard block
 block discarded – undo
914 914
 	 *                                        where keys are always subsection names and values are either
915 915
 	 *                                        the input's normalized value, or an array like the top-level array
916 916
 	 */
917
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
917
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
918 918
 		$input_values = array();
919
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
920
-			if( $subsection instanceof EE_Form_Input_Base ) {
921
-				$input_values[ $subsection_name ] = $pretty
919
+		foreach ($this->subsections() as $subsection_name => $subsection) {
920
+			if ($subsection instanceof EE_Form_Input_Base) {
921
+				$input_values[$subsection_name] = $pretty
922 922
 					? $subsection->pretty_value()
923 923
 					: $subsection->normalized_value();
924
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
925
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
926
-				if( $flatten ) {
927
-					$input_values = array_merge( $input_values, $subform_input_values );
924
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
925
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
926
+				if ($flatten) {
927
+					$input_values = array_merge($input_values, $subform_input_values);
928 928
 				} else {
929
-					$input_values[ $subsection_name ] = $subform_input_values;
929
+					$input_values[$subsection_name] = $subform_input_values;
930 930
 				}
931 931
 			}
932 932
 		}
@@ -947,23 +947,23 @@  discard block
 block discarded – undo
947 947
 	 *                                   where keys are always subsection names and values are either
948 948
 	 *                                   the input's normalized value, or an array like the top-level array
949 949
 	 */
950
-	public function submitted_values( $include_subforms = false ) {
950
+	public function submitted_values($include_subforms = false) {
951 951
 		$submitted_values = array();
952
-		foreach( $this->subsections() as $subsection ) {
953
-			if( $subsection instanceof EE_Form_Input_Base ) {
952
+		foreach ($this->subsections() as $subsection) {
953
+			if ($subsection instanceof EE_Form_Input_Base) {
954 954
 				// is this input part of an array of inputs?
955
-				if ( strpos( $subsection->html_name(), '[' ) !== false ) {
955
+				if (strpos($subsection->html_name(), '[') !== false) {
956 956
 					$full_input_name = \EEH_Array::convert_array_values_to_keys(
957
-						explode( '[', str_replace( ']', '', $subsection->html_name() ) ),
957
+						explode('[', str_replace(']', '', $subsection->html_name())),
958 958
 						$subsection->raw_value()
959 959
 					);
960
-					$submitted_values = array_replace_recursive( $submitted_values, $full_input_name );
960
+					$submitted_values = array_replace_recursive($submitted_values, $full_input_name);
961 961
 				} else {
962
-					$submitted_values[ $subsection->html_name() ] = $subsection->raw_value();
962
+					$submitted_values[$subsection->html_name()] = $subsection->raw_value();
963 963
 				}
964
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subforms ) {
965
-				$subform_input_values = $subsection->submitted_values( $include_subforms );
966
-				$submitted_values = array_replace_recursive( $submitted_values, $subform_input_values );
964
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subforms) {
965
+				$subform_input_values = $subsection->submitted_values($include_subforms);
966
+				$submitted_values = array_replace_recursive($submitted_values, $subform_input_values);
967 967
 			}
968 968
 		}
969 969
 		return $submitted_values;
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 * @return boolean
979 979
 	 * @throws \EE_Error
980 980
 	 */
981
-	public function has_received_submission(){
981
+	public function has_received_submission() {
982 982
 		$this->ensure_construct_finalized_called();
983 983
 		return $this->_received_submission;
984 984
 	}
@@ -991,8 +991,8 @@  discard block
 block discarded – undo
991 991
 	 * @param array $inputs_to_exclude values are the input names
992 992
 	 * @return void
993 993
 	 */
994
-	public function exclude($inputs_to_exclude = array()){
995
-		foreach($inputs_to_exclude as $input_to_exclude_name){
994
+	public function exclude($inputs_to_exclude = array()) {
995
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
996 996
 			unset($this->_subsections[$input_to_exclude_name]);
997 997
 		}
998 998
 	}
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
 	 * @param array $inputs_to_hide
1004 1004
 	 * @throws \EE_Error
1005 1005
 	 */
1006
-	public function hide($inputs_to_hide= array()){
1007
-		foreach($inputs_to_hide as $input_to_hide){
1006
+	public function hide($inputs_to_hide = array()) {
1007
+		foreach ($inputs_to_hide as $input_to_hide) {
1008 1008
 			$input = $this->get_input($input_to_hide);
1009 1009
 
1010 1010
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -1034,21 +1034,21 @@  discard block
 block discarded – undo
1034 1034
 	 * @return void
1035 1035
 	 * @throws \EE_Error
1036 1036
 	 */
1037
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
1038
-		foreach( $new_subsections as $subsection_name => $subsection ){
1039
-			if( ! $subsection instanceof EE_Form_Section_Base ){
1037
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
1038
+		foreach ($new_subsections as $subsection_name => $subsection) {
1039
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
1040 1040
 				EE_Error::add_error(
1041 1041
 					sprintf(
1042 1042
 						__(
1043 1043
 							"Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.",
1044 1044
 							"event_espresso"
1045 1045
 						),
1046
-						get_class( $subsection ),
1046
+						get_class($subsection),
1047 1047
 						$subsection_name,
1048 1048
 						$this->name()
1049 1049
 					)
1050 1050
 				);
1051
-				unset( $new_subsections[ $subsection_name ] );
1051
+				unset($new_subsections[$subsection_name]);
1052 1052
 			}
1053 1053
 		}
1054 1054
 		$this->_subsections = EEH_Array::insert_into_array(
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 		);
1060 1060
 
1061 1061
 
1062
-		if( $this->_construction_finalized ){
1063
-			foreach($this->_subsections as $name => $subsection){
1062
+		if ($this->_construction_finalized) {
1063
+			foreach ($this->_subsections as $name => $subsection) {
1064 1064
 				$subsection->_construct_finalize($this, $name);
1065 1065
 			}
1066 1066
 		}
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
 	/**
1072 1072
 	 * Just gets all validatable subsections to clean their sensitive data
1073 1073
 	 */
1074
-	public function clean_sensitive_data(){
1075
-		foreach($this->get_validatable_subsections() as $subsection){
1074
+	public function clean_sensitive_data() {
1075
+		foreach ($this->get_validatable_subsections() as $subsection) {
1076 1076
 			$subsection->clean_sensitive_data();
1077 1077
 		}
1078 1078
 	}
@@ -1082,10 +1082,10 @@  discard block
 block discarded – undo
1082 1082
 	/**
1083 1083
 	 * @param string $form_submission_error_message
1084 1084
 	 */
1085
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
1086
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message )
1085
+	public function set_submission_error_message($form_submission_error_message = '') {
1086
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message)
1087 1087
 			? $form_submission_error_message
1088
-			: __( 'Form submission failed due to errors', 'event_espresso' );
1088
+			: __('Form submission failed due to errors', 'event_espresso');
1089 1089
 	}
1090 1090
 
1091 1091
 
@@ -1102,10 +1102,10 @@  discard block
 block discarded – undo
1102 1102
 	/**
1103 1103
 	 * @param string $form_submission_success_message
1104 1104
 	 */
1105
-	public function set_submission_success_message( $form_submission_success_message ) {
1106
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message )
1105
+	public function set_submission_success_message($form_submission_success_message) {
1106
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message)
1107 1107
 			? $form_submission_success_message
1108
-			: __( 'Form submitted successfully', 'event_espresso' );
1108
+			: __('Form submitted successfully', 'event_espresso');
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 	 * @return string
1129 1129
 	 * @throws \EE_Error
1130 1130
 	 */
1131
-	public function html_name_prefix(){
1132
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
1133
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
1134
-		}else{
1131
+	public function html_name_prefix() {
1132
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
1133
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
1134
+		} else {
1135 1135
 			return $this->name();
1136 1136
 		}
1137 1137
 	}
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 	 * @return string
1147 1147
 	 * @throws \EE_Error
1148 1148
 	 */
1149
-	public function name(){
1149
+	public function name() {
1150 1150
 		$this->ensure_construct_finalized_called();
1151 1151
 		return parent::name();
1152 1152
 	}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 	 * @return EE_Form_Section_Proper
1158 1158
 	 * @throws \EE_Error
1159 1159
 	 */
1160
-	public function parent_section(){
1160
+	public function parent_section() {
1161 1161
 		$this->ensure_construct_finalized_called();
1162 1162
 		return parent::parent_section();
1163 1163
 	}
@@ -1170,9 +1170,9 @@  discard block
 block discarded – undo
1170 1170
 	 * @return void
1171 1171
 	 * @throws \EE_Error
1172 1172
 	 */
1173
-	public function ensure_construct_finalized_called(){
1174
-		if( ! $this->_construction_finalized ){
1175
-			$this->_construct_finalize($this->_parent_section, $this->_name );
1173
+	public function ensure_construct_finalized_called() {
1174
+		if ( ! $this->_construction_finalized) {
1175
+			$this->_construct_finalize($this->_parent_section, $this->_name);
1176 1176
 		}
1177 1177
 	}
1178 1178
 
@@ -1184,17 +1184,17 @@  discard block
 block discarded – undo
1184 1184
 	 * @param array $req_data
1185 1185
 	 * @return boolean
1186 1186
 	 */
1187
-	public function form_data_present_in( $req_data = NULL ) {
1188
-		if( $req_data === NULL){
1187
+	public function form_data_present_in($req_data = NULL) {
1188
+		if ($req_data === NULL) {
1189 1189
 			$req_data = $_POST;
1190 1190
 		}
1191
-		foreach( $this->subsections() as $subsection ) {
1192
-			if($subsection instanceof EE_Form_Input_Base ) {
1193
-				if( $subsection->form_data_present_in( $req_data ) ) {
1191
+		foreach ($this->subsections() as $subsection) {
1192
+			if ($subsection instanceof EE_Form_Input_Base) {
1193
+				if ($subsection->form_data_present_in($req_data)) {
1194 1194
 					return TRUE;
1195 1195
 				}
1196
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
1197
-				if( $subsection->form_data_present_in( $req_data ) ) {
1196
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
1197
+				if ($subsection->form_data_present_in($req_data)) {
1198 1198
 					return TRUE;
1199 1199
 				}
1200 1200
 			}
@@ -1211,14 +1211,14 @@  discard block
 block discarded – undo
1211 1211
 	 */
1212 1212
 	public function get_validation_errors_accumulated() {
1213 1213
 		$validation_errors = $this->get_validation_errors();
1214
-		foreach($this->get_validatable_subsections() as $subsection ) {
1215
-			if( $subsection instanceof EE_Form_Section_Proper ) {
1214
+		foreach ($this->get_validatable_subsections() as $subsection) {
1215
+			if ($subsection instanceof EE_Form_Section_Proper) {
1216 1216
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
1217 1217
 			} else {
1218
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
1218
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
1219 1219
 			}
1220
-			if( $validation_errors_on_this_subsection ){
1221
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
1220
+			if ($validation_errors_on_this_subsection) {
1221
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
1222 1222
 			}
1223 1223
 		}
1224 1224
 		return $validation_errors;
@@ -1240,24 +1240,24 @@  discard block
 block discarded – undo
1240 1240
 	 * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false
1241 1241
 	 * @return EE_Form_Section_Base
1242 1242
 	 */
1243
-	public function find_section_from_path( $form_section_path ) {
1243
+	public function find_section_from_path($form_section_path) {
1244 1244
 		//check if we can find the input from purely going straight up the tree
1245
-		$input = parent::find_section_from_path( $form_section_path );
1246
-		if( $input instanceof EE_Form_Section_Base ) {
1245
+		$input = parent::find_section_from_path($form_section_path);
1246
+		if ($input instanceof EE_Form_Section_Base) {
1247 1247
 			return $input;
1248 1248
 		}
1249 1249
 
1250
-		$next_slash_pos = strpos( $form_section_path, '/' );
1251
-		if( $next_slash_pos !== false ) {
1252
-			$child_section_name = substr( $form_section_path, 0, $next_slash_pos );
1253
-			$subpath = substr( $form_section_path, $next_slash_pos + 1 );
1250
+		$next_slash_pos = strpos($form_section_path, '/');
1251
+		if ($next_slash_pos !== false) {
1252
+			$child_section_name = substr($form_section_path, 0, $next_slash_pos);
1253
+			$subpath = substr($form_section_path, $next_slash_pos + 1);
1254 1254
 		} else {
1255 1255
 			$child_section_name = $form_section_path;
1256 1256
 			$subpath = '';
1257 1257
 		}
1258
-		$child_section =  $this->get_subsection( $child_section_name );
1259
-		if ( $child_section instanceof EE_Form_Section_Base ) {
1260
-			return $child_section->find_section_from_path( $subpath );
1258
+		$child_section = $this->get_subsection($child_section_name);
1259
+		if ($child_section instanceof EE_Form_Section_Base) {
1260
+			return $child_section->find_section_from_path($subpath);
1261 1261
 		} else {
1262 1262
 			return null;
1263 1263
 		}
Please login to merge, or discard this patch.
finalize_registration/EE_SPCO_Reg_Step_Finalize_Registration.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	/**
28 28
 	 * Applies all teh individual item validation strategies on each item in the array
29 29
 	 * @param array $normalized_value
30
-	 * @return boolean
30
+	 * @return boolean|null
31 31
 	 */
32 32
 	function validate($normalized_value) {
33 33
 		if( is_array($normalized_value)){
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
 		if (
113 113
 			! (
114 114
 				$this->checkout->payment_method instanceof EE_Payment_Method
115
-		        && $this->checkout->payment_method->is_off_site()
115
+				&& $this->checkout->payment_method->is_off_site()
116 116
 			)
117 117
 		) {
118 118
 			// mark this reg step as completed
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param    EE_Checkout $checkout
23 23
 	 * @return    \EE_SPCO_Reg_Step_Finalize_Registration
24 24
 	 */
25
-	public function __construct( EE_Checkout $checkout ) {
25
+	public function __construct(EE_Checkout $checkout) {
26 26
 		$this->_slug = 'finalize_registration';
27
-		$this->_name = __( 'Finalize Registration', 'event_espresso' );
27
+		$this->_name = __('Finalize Registration', 'event_espresso');
28 28
 		$this->_submit_button_text = $this->_name;
29 29
 		$this->_template = '';
30 30
 		$this->checkout = $checkout;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function initialize_reg_step() {
49 49
 		// there's actually no reg form to process if this is the final step
50
-		if ( $this->is_current_step() ) {
50
+		if ($this->is_current_step()) {
51 51
 			$this->checkout->step = $_REQUEST['step'] = $this->slug();
52 52
 			$this->checkout->action = $_REQUEST['action'] = 'process_reg_step';
53 53
 			$this->checkout->generate_reg_form = false;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function process_reg_step() {
75 75
 		// ensure all data gets refreshed from the db
76
-		$this->checkout->refresh_all_entities( true );
76
+		$this->checkout->refresh_all_entities(true);
77 77
 		// ensures that all details and statuses for transaction, registration, and payments are updated
78 78
 		$txn_update_params = $this->_finalize_transaction();
79 79
 		// DEBUG LOG
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 			$txn_update_params
103 103
 		);
104 104
 		// check if transaction has a primary registrant and that it has a related Attendee object
105
-		if ( ! $this->_validate_primary_registrant() ) {
105
+		if ( ! $this->_validate_primary_registrant()) {
106 106
 			return false;
107 107
 		}
108 108
 		// you don't have to go home but you can't stay here !
109 109
 		$this->checkout->redirect = true;
110 110
 		$this->checkout->continue_reg = true;
111
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
111
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
112 112
 		if (
113 113
 			! (
114 114
 				$this->checkout->payment_method instanceof EE_Payment_Method
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	protected function _finalize_transaction() {
135 135
 		/** @type EE_Transaction_Processor $transaction_processor */
136
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
136
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
137 137
 		//set revisit flag in txn processor
138
-		$transaction_processor->set_revisit( $this->checkout->revisit );
138
+		$transaction_processor->set_revisit($this->checkout->revisit);
139 139
 		// at this point we'll consider a TXN to not have been abandoned
140 140
 		$this->checkout->transaction->toggle_abandoned_transaction_status();
141
-		if ( $this->checkout->cart instanceof EE_Cart ) {
141
+		if ($this->checkout->cart instanceof EE_Cart) {
142 142
 			// save TXN data to the cart
143 143
 			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn(
144 144
 				$this->checkout->transaction->ID()
145 145
 			);
146 146
 		}
147 147
 		// maybe update status, but don't save transaction just yet
148
-		$this->checkout->transaction->update_status_based_on_total_paid( false );
148
+		$this->checkout->transaction->update_status_based_on_total_paid(false);
149 149
 		// maybe send messages
150 150
 		$this->_trigger_notifications();
151 151
 		// this will result in the base session properties getting saved to the TXN_Session_data field
152 152
 		$this->checkout->transaction->set_txn_session_data(
153
-			EE_Registry::instance()->SSN->get_session_data( null, true )
153
+			EE_Registry::instance()->SSN->get_session_data(null, true)
154 154
 		);
155 155
 		// update the TXN if payment conditions have changed
156 156
 		return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 * @throws \EE_Error
173 173
 	 */
174 174
 	protected function _trigger_notifications() {
175
-		if ( $this->checkout->payment_method instanceof EE_Payment_Method ) {
176
-			$is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN );
177
-			if ( $this->checkout->payment_method->is_off_site() ) {
178
-				$gateway= $this->checkout->payment_method->type_obj()->get_gateway();
175
+		if ($this->checkout->payment_method instanceof EE_Payment_Method) {
176
+			$is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN);
177
+			if ($this->checkout->payment_method->is_off_site()) {
178
+				$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
179 179
 				if (
180 180
 					! $is_revisit
181 181
 					&& $gateway instanceof EE_Offsite_Gateway
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 					)
186 186
 				) {
187 187
 					// first time through SPCO and we are processing the payment notification NOW
188
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
188
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
189 189
 				} else {
190 190
 					// do NOT trigger notifications because this is a revisit, OR it was already done during the IPN
191
-					remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' );
191
+					remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications');
192 192
 					add_filter(
193 193
 						'FHEE__EED_Messages___maybe_registration__deliver_notifications',
194 194
 						'__return_false',
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 				}
198 198
 			} else if (
199 199
 				// if SPCO revisit and TXN status has changed due to a payment
200
-				$is_revisit && ( $this->checkout->transaction->txn_status_updated() || $this->checkout->any_reg_status_updated() )
200
+				$is_revisit && ($this->checkout->transaction->txn_status_updated() || $this->checkout->any_reg_status_updated())
201 201
 			) {
202 202
 				// send out notifications
203
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
204
-			} else if ( ! $is_revisit ) {
205
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
203
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
204
+			} else if ( ! $is_revisit) {
205
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
206 206
 			}
207 207
 		}
208 208
 	}
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 * @throws \EE_Error
217 217
 	 */
218 218
 	protected function _validate_primary_registrant() {
219
-		if ( ! $this->checkout->transaction_has_primary_registrant() ) {
219
+		if ( ! $this->checkout->transaction_has_primary_registrant()) {
220 220
 			EE_Error::add_error(
221
-				__( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ),
221
+				__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'),
222 222
 				__FILE__,
223 223
 				__FUNCTION__,
224 224
 				__LINE__
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		}
230 230
 		// setup URL for redirect
231 231
 		$this->checkout->redirect_url = add_query_arg(
232
-			array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ),
232
+			array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()),
233 233
 			$this->checkout->thank_you_page_url
234 234
 		);
235 235
 		return true;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	public function update_reg_step() {
244 244
 		EE_Error::doing_it_wrong(
245
-			__CLASS__ . '::' . __FILE__,
245
+			__CLASS__.'::'.__FILE__,
246 246
 			__(
247 247
 				'Can not call update_reg_step() on the Finalize Registration reg step.',
248 248
 				'event_espresso'
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_PMT_Base.lib.php 2 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	protected function _get_billing_values_from_form( $billing_form ){
443 443
 		if($billing_form instanceof EE_Form_Section_Proper ){
444 444
 			return $billing_form->input_pretty_values( true );
445
-		}else{
445
+		} else{
446 446
 			return NULL;
447 447
 		}
448 448
 	}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	public function supports_sending_refunds(){
551 551
 		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
552 552
 			return $this->_gateway->supports_sending_refunds();
553
-		}else{
553
+		} else{
554 554
 			return false;
555 555
 		}
556 556
 	}
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
 	public function payment_occurs(){
589 589
 		if( ! $this->_gateway){
590 590
 			return EE_PMT_Base::offline;
591
-		}elseif($this->_gateway instanceof EE_Onsite_Gateway){
591
+		} elseif($this->_gateway instanceof EE_Onsite_Gateway){
592 592
 			return EE_PMT_Base::onsite;
593
-		}elseif($this->_gateway instanceof EE_Offsite_Gateway){
593
+		} elseif($this->_gateway instanceof EE_Offsite_Gateway){
594 594
 			return EE_PMT_Base::offsite;
595
-		}else{
595
+		} else{
596 596
 			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this)));
597 597
 		}
598 598
 	}
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @since 				$VID:$
15 15
  *
16 16
  */
17
-abstract class EE_PMT_Base{
17
+abstract class EE_PMT_Base {
18 18
 
19 19
 	const onsite = 'on-site';
20 20
 	const offsite = 'off-site';
@@ -95,31 +95,31 @@  discard block
 block discarded – undo
95 95
 	 * @return EE_PMT_Base
96 96
 	 */
97 97
 	function __construct($pm_instance = NULL) {
98
-		if ( $pm_instance instanceof EE_Payment_Method ){
98
+		if ($pm_instance instanceof EE_Payment_Method) {
99 99
 			$this->set_instance($pm_instance);
100 100
 		}
101
-		if($this->_gateway){
102
-			$this->_gateway->set_payment_model( EEM_Payment::instance() );
103
-			$this->_gateway->set_payment_log( EEM_Change_Log::instance() );
104
-			$this->_gateway->set_template_helper( new EEH_Template() );
105
-			$this->_gateway->set_line_item_helper( new EEH_Line_Item() );
106
-			$this->_gateway->set_money_helper( new EEH_Money() );
101
+		if ($this->_gateway) {
102
+			$this->_gateway->set_payment_model(EEM_Payment::instance());
103
+			$this->_gateway->set_payment_log(EEM_Change_Log::instance());
104
+			$this->_gateway->set_template_helper(new EEH_Template());
105
+			$this->_gateway->set_line_item_helper(new EEH_Line_Item());
106
+			$this->_gateway->set_money_helper(new EEH_Money());
107 107
 		}
108
-		if ( ! isset( $this->_has_billing_form ) ) {
108
+		if ( ! isset($this->_has_billing_form)) {
109 109
 			// by default, On Site gateways have a billing form
110
-			if ( $this->payment_occurs() == EE_PMT_Base::onsite ) {
111
-				$this->set_has_billing_form( true );
110
+			if ($this->payment_occurs() == EE_PMT_Base::onsite) {
111
+				$this->set_has_billing_form(true);
112 112
 			} else {
113
-				$this->set_has_billing_form( false );
113
+				$this->set_has_billing_form(false);
114 114
 			}
115 115
 		}
116 116
 
117
-		if( ! $this->_pretty_name){
117
+		if ( ! $this->_pretty_name) {
118 118
 			throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso")));
119 119
 		}
120 120
 		//if the child didn't specify a default button, use the credit card one
121
-		if( $this->_default_button_url === NULL){
122
-			$this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png';
121
+		if ($this->_default_button_url === NULL) {
122
+			$this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png';
123 123
 		}
124 124
 	}
125 125
 
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	/**
129 129
 	 * @param boolean $has_billing_form
130 130
 	 */
131
-	public function set_has_billing_form( $has_billing_form ) {
132
-		$this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN );
131
+	public function set_has_billing_form($has_billing_form) {
132
+		$this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN);
133 133
 	}
134 134
 
135 135
 
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * sets the file_folder property
139 139
 	 */
140
-	protected function _set_file_folder(){
140
+	protected function _set_file_folder() {
141 141
 		$reflector = new ReflectionClass(get_class($this));
142 142
 		$fn = $reflector->getFileName();
143
-		$this->_file_folder =  dirname($fn).DS;
143
+		$this->_file_folder = dirname($fn).DS;
144 144
 	}
145 145
 
146 146
 
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	/**
149 149
 	 * sets the file URL with a trailing slash for this PMT
150 150
 	 */
151
-	protected function _set_file_url(){
152
-		$plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR);
153
-		$file_folder_fixed = str_replace('\\',DS,$this->file_folder());
154
-		$file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed);
151
+	protected function _set_file_url() {
152
+		$plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR);
153
+		$file_folder_fixed = str_replace('\\', DS, $this->file_folder());
154
+		$file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed);
155 155
 		$this->_file_url = $file_path;
156 156
 	}
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * Gets the default description on all payment methods of this type
160 160
 	 * @return string
161 161
 	 */
162
-	public function default_description(){
162
+	public function default_description() {
163 163
 		return $this->_default_description;
164 164
 	}
165 165
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * Returns the folder containing the PMT child class, with a trailing slash
170 170
 	 * @return string
171 171
 	 */
172
-	public function file_folder(){
173
-		if( ! $this->_file_folder ) {
172
+	public function file_folder() {
173
+		if ( ! $this->_file_folder) {
174 174
 			$this->_set_file_folder();
175 175
 		}
176 176
 		return $this->_file_folder;
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	/**
182 182
 	 * @return string
183 183
 	 */
184
-	public function file_url(){
185
-		if( ! $this->_file_url ) {
184
+	public function file_url() {
185
+		if ( ! $this->_file_url) {
186 186
 			$this->_set_file_url();
187 187
 		}
188 188
 		return $this->_file_url;
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 	 * Its important teh payment method instance is set before
196 196
 	 * @param EE_Payment_Method $payment_method_instance
197 197
 	 */
198
-	function set_instance($payment_method_instance){
198
+	function set_instance($payment_method_instance) {
199 199
 		$this->_pm_instance = $payment_method_instance;
200 200
 		//if they have already requested the settings form, make sure its
201 201
 		//data matches this model object
202
-		if($this->_settings_form){
202
+		if ($this->_settings_form) {
203 203
 			$this->settings_form()->populate_model_obj($payment_method_instance);
204 204
 		}
205
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
205
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
206 206
 			$this->_gateway->set_settings($payment_method_instance->settings_array());
207 207
 		}
208 208
 	}
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 	 * Gets teh form for displaying to admins where they setup the payment method
214 214
 	 * @return EE_Payment_Method_Form
215 215
 	 */
216
-	function settings_form(){
217
-		if( ! $this->_settings_form){
216
+	function settings_form() {
217
+		if ( ! $this->_settings_form) {
218 218
 			$this->_settings_form = $this->generate_new_settings_form();
219
-			$this->_settings_form->set_payment_method_type( $this );
220
-			$this->_settings_form->_construct_finalize(NULL, NULL );
219
+			$this->_settings_form->set_payment_method_type($this);
220
+			$this->_settings_form->_construct_finalize(NULL, NULL);
221 221
 			//if we have already assigned a model object to this pmt, make
222 222
 			//sure its reflected in teh form we just generated
223
-			if($this->_pm_instance){
223
+			if ($this->_pm_instance) {
224 224
 				$this->_settings_form->populate_model_obj($this->_pm_instance);
225 225
 			}
226 226
 		}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * this payment method type's settings form later in the request
247 247
 	 * @param EE_Payment_Method_Form $form
248 248
 	 */
249
-	public function set_settings_form($form){
249
+	public function set_settings_form($form) {
250 250
 		$this->_settings_form = $form;
251 251
 	}
252 252
 
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 	 * @param array $extra_args
270 270
 	 * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null
271 271
 	 */
272
-	public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){
272
+	public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) {
273 273
 		// has billing form already been regenerated ? or overwrite cache?
274
-		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){
275
-			$this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args );
274
+		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
275
+			$this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args);
276 276
 		}
277 277
 		//if we know who the attendee is, and this is a billing form
278 278
 		//that uses attendee info, populate it
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 			$transaction instanceof EE_Transaction &&
282 282
 			$transaction->primary_registration() instanceof EE_Registration &&
283 283
 			$transaction->primary_registration()->attendee() instanceof EE_Attendee
284
-		){
285
-			$this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() );
284
+		) {
285
+			$this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee());
286 286
 		}
287 287
 		return $this->_billing_form;
288 288
 	}
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 * @param \EE_Transaction $transaction
294 294
 	 * @return \EE_Billing_Info_Form
295 295
 	 */
296
-	abstract function generate_new_billing_form( EE_Transaction $transaction = NULL );
296
+	abstract function generate_new_billing_form(EE_Transaction $transaction = NULL);
297 297
 
298 298
 
299 299
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	 * @param \EE_Billing_Info_Form $billing_form
305 305
 	 * @return \EE_Billing_Info_Form
306 306
 	 */
307
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
307
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
308 308
 		return $billing_form;
309 309
 	}
310 310
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * if you have form
316 316
 	 * @param EE_Payment_Method $form
317 317
 	 */
318
-	public function set_billing_form($form){
318
+	public function set_billing_form($form) {
319 319
 		$this->_billing_form = $form;
320 320
 	}
321 321
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * Returns whether or not this payment method requires HTTPS to be used
326 326
 	 * @return boolean
327 327
 	 */
328
-	function requires_https(){
328
+	function requires_https() {
329 329
 		return $this->_requires_https;
330 330
 	}
331 331
 
@@ -343,9 +343,9 @@  discard block
 block discarded – undo
343 343
 	 * @return EE_Payment
344 344
 	 * @throws EE_Error
345 345
 	 */
346
-	function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){
346
+	function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) {
347 347
 		// @todo: add surcharge for the payment method, if any
348
-		if ( $this->_gateway ) {
348
+		if ($this->_gateway) {
349 349
 			//there is a gateway, so we're going to make a payment object
350 350
 			//but wait! do they already have a payment in progress that we thought was failed?
351 351
 			$duplicate_properties = array(
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 				'PAY_amount' 					=> $amount !== null ? $amount : $transaction->remaining(),
357 357
 				'PAY_gateway_response' 	=> null,
358 358
 			);
359
-			$payment = EEM_Payment::instance()->get_one( array( $duplicate_properties ));
359
+			$payment = EEM_Payment::instance()->get_one(array($duplicate_properties));
360 360
 			//if we didn't already have a payment in progress for the same thing,
361 361
 			//then we actually want to make a new payment
362
-			if ( ! $payment instanceof EE_Payment ){
362
+			if ( ! $payment instanceof EE_Payment) {
363 363
 				$payment = EE_Payment::new_instance(
364 364
 					array_merge(
365 365
 						$duplicate_properties,
@@ -375,10 +375,10 @@  discard block
 block discarded – undo
375 375
 			}
376 376
 			//make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it
377 377
 			$payment->save();
378
-			$billing_values = $this->_get_billing_values_from_form( $billing_info );
378
+			$billing_values = $this->_get_billing_values_from_form($billing_info);
379 379
 
380 380
 			//  Offsite Gateway
381
-			if( $this->_gateway instanceof EE_Offsite_Gateway ){
381
+			if ($this->_gateway instanceof EE_Offsite_Gateway) {
382 382
 
383 383
 				$payment = $this->_gateway->set_redirection_info(
384 384
 					$payment,
@@ -394,17 +394,17 @@  discard block
 block discarded – undo
394 394
 				);
395 395
 				$payment->save();
396 396
 			//  Onsite Gateway
397
-			} elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) {
397
+			} elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
398 398
 
399
-				$payment = $this->_gateway->do_direct_payment($payment,$billing_values);
399
+				$payment = $this->_gateway->do_direct_payment($payment, $billing_values);
400 400
 				$payment->save();
401 401
 
402 402
 			} else {
403 403
 				throw new EE_Error(
404 404
 					sprintf(
405
-						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ),
405
+						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'),
406 406
 						get_class($this),
407
-						gettype( $this->_gateway )
407
+						gettype($this->_gateway)
408 408
 					)
409 409
 				);
410 410
 			}
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 		}
427 427
 
428 428
 		// if there is billing info, clean it and save it now
429
-		if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){
430
-			$this->_save_billing_info_to_attendee( $billing_info, $transaction );
429
+		if ($billing_info instanceof EE_Billing_Attendee_Info_Form) {
430
+			$this->_save_billing_info_to_attendee($billing_info, $transaction);
431 431
 		}
432 432
 
433 433
 		return $payment;
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 	 * @param EE_Billing_Info_Form $billing_form
441 441
 	 * @return array
442 442
 	 */
443
-	protected function _get_billing_values_from_form( $billing_form ){
444
-		if($billing_form instanceof EE_Form_Section_Proper ){
445
-			return $billing_form->input_pretty_values( true );
446
-		}else{
443
+	protected function _get_billing_values_from_form($billing_form) {
444
+		if ($billing_form instanceof EE_Form_Section_Proper) {
445
+			return $billing_form->input_pretty_values(true);
446
+		} else {
447 447
 			return NULL;
448 448
 		}
449 449
 	}
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 	 * @return EE_Payment
458 458
 	 * @throws EE_Error
459 459
 	 */
460
-	public function handle_ipn($req_data,$transaction){
460
+	public function handle_ipn($req_data, $transaction) {
461 461
 		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
462
-		if( ! $this->_gateway instanceof EE_Offsite_Gateway){
463
-			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE )));
462
+		if ( ! $this->_gateway instanceof EE_Offsite_Gateway) {
463
+			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE)));
464 464
 
465 465
 		}
466
-		$payment = $this->_gateway->handle_payment_update( $req_data, $transaction );
466
+		$payment = $this->_gateway->handle_payment_update($req_data, $transaction);
467 467
 		return $payment;
468 468
 	}
469 469
 
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
 	 * @param EE_Transaction $transaction
477 477
 	 * @return boolean success
478 478
 	 */
479
-	protected function _save_billing_info_to_attendee($billing_form, $transaction){
480
-		if( ! $transaction || ! $transaction instanceof EE_Transaction){
479
+	protected function _save_billing_info_to_attendee($billing_form, $transaction) {
480
+		if ( ! $transaction || ! $transaction instanceof EE_Transaction) {
481 481
 			EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
482 482
 			return false;
483 483
 		}
484 484
 		$primary_reg = $transaction->primary_registration();
485
-		if( ! $primary_reg ){
485
+		if ( ! $primary_reg) {
486 486
 			EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
487 487
 			return false;
488 488
 		}
489 489
 		$attendee = $primary_reg->attendee();
490
-		if( ! $attendee ){
490
+		if ( ! $attendee) {
491 491
 			EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
492 492
 			return false;
493 493
 		}
494
-		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() );
494
+		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method());
495 495
 
496 496
 	}
497 497
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 * @param array $req_data
505 505
 	 * @return EE_Payment
506 506
 	 */
507
-	protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){
507
+	protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) {
508 508
 		return $transaction->last_payment();
509 509
 	}
510 510
 
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 	 * and identifies the IPN as being for this payment method (not just fo ra payment method of this type)
522 522
 	 * @throws EE_Error
523 523
 	 */
524
-	public function handle_unclaimed_ipn( $req_data = array() ){
525
-		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) ));
524
+	public function handle_unclaimed_ipn($req_data = array()) {
525
+		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this)));
526 526
 	}
527 527
 
528 528
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 * @param EE_Transaction $transaction
539 539
 	 * @return EE_Payment
540 540
 	 */
541
-	public function finalize_payment_for($transaction){
541
+	public function finalize_payment_for($transaction) {
542 542
 		return $transaction->last_payment();
543 543
 	}
544 544
 
@@ -548,10 +548,10 @@  discard block
 block discarded – undo
548 548
 	 * Whether or not this payment method's gateway supports sending refund requests
549 549
 	 * @return boolean
550 550
 	 */
551
-	public function supports_sending_refunds(){
552
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
551
+	public function supports_sending_refunds() {
552
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
553 553
 			return $this->_gateway->supports_sending_refunds();
554
-		}else{
554
+		} else {
555 555
 			return false;
556 556
 		}
557 557
 	}
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
 	 * @throws EE_Error
566 566
 	 * @return EE_Payment
567 567
 	 */
568
-	public function process_refund( EE_Payment $payment, $refund_info = array()){
569
-		if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) {
570
-			return $this->_gateway->do_direct_refund( $payment, $refund_info );
568
+	public function process_refund(EE_Payment $payment, $refund_info = array()) {
569
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
570
+			return $this->_gateway->do_direct_refund($payment, $refund_info);
571 571
 		} else {
572 572
 			throw new EE_Error(
573 573
 				sprintf(
574
-					__( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ),
575
-					get_class( $this )
574
+					__('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'),
575
+					get_class($this)
576 576
 				)
577 577
 			);
578 578
 		}
@@ -586,15 +586,15 @@  discard block
 block discarded – undo
586 586
 	 * @return string
587 587
 	 * @throws EE_Error
588 588
 	 */
589
-	public function payment_occurs(){
590
-		if( ! $this->_gateway){
589
+	public function payment_occurs() {
590
+		if ( ! $this->_gateway) {
591 591
 			return EE_PMT_Base::offline;
592
-		}elseif($this->_gateway instanceof EE_Onsite_Gateway){
592
+		}elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
593 593
 			return EE_PMT_Base::onsite;
594
-		}elseif($this->_gateway instanceof EE_Offsite_Gateway){
594
+		}elseif ($this->_gateway instanceof EE_Offsite_Gateway) {
595 595
 			return EE_PMT_Base::offsite;
596
-		}else{
597
-			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this)));
596
+		} else {
597
+			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this)));
598 598
 		}
599 599
 	}
600 600
 
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 * @param EE_Payment $payment
608 608
 	 * @return string
609 609
 	 */
610
-	public function payment_overview_content(EE_Payment $payment){
611
-		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true);
610
+	public function payment_overview_content(EE_Payment $payment) {
611
+		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true);
612 612
 	}
613 613
 
614 614
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	 *	@type array $template_args any arguments you want passed to the template file while rendering.
622 622
 	 *				Keys will be variable names and values with be their values.
623 623
 	 */
624
-	public function help_tabs_config(){
624
+	public function help_tabs_config() {
625 625
 		return array();
626 626
 	}
627 627
 
@@ -632,9 +632,9 @@  discard block
 block discarded – undo
632 632
 	 * the payment method's table's PMT_type column)
633 633
 	 * @return string
634 634
 	 */
635
-	public function system_name(){
635
+	public function system_name() {
636 636
 		$classname = get_class($this);
637
-		return str_replace("EE_PMT_",'',$classname);
637
+		return str_replace("EE_PMT_", '', $classname);
638 638
 	}
639 639
 
640 640
 
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 	 * A pretty i18n version of the PMT name
644 644
 	 * @return string
645 645
 	 */
646
-	public function pretty_name(){
646
+	public function pretty_name() {
647 647
 		return $this->_pretty_name;
648 648
 	}
649 649
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * Gets the default absolute URL to the payment method type's button
654 654
 	 * @return string
655 655
 	 */
656
-	public function default_button_url(){
656
+	public function default_button_url() {
657 657
 		return $this->_default_button_url;
658 658
 	}
659 659
 
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 * Gets the gateway used by this payment method (if any)
664 664
 	 * @return EE_Gateway
665 665
 	 */
666
-	public function get_gateway(){
666
+	public function get_gateway() {
667 667
 		return $this->_gateway;
668 668
 	}
669 669
 
@@ -672,8 +672,8 @@  discard block
 block discarded – undo
672 672
 	/**
673 673
 	 * @return string html for the link to a help tab
674 674
 	 */
675
-	public function get_help_tab_link(){
676
-		return EEH_Template::get_help_tab_link( $this->get_help_tab_name() );
675
+	public function get_help_tab_link() {
676
+		return EEH_Template::get_help_tab_link($this->get_help_tab_name());
677 677
 	}
678 678
 
679 679
 
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 	 * Returns the name of the help tab for this PMT
683 683
 	 * @return string
684 684
 	 */
685
-	public function get_help_tab_name(){
686
-		return 'ee_' . strtolower( $this->system_name() ) . '_help_tab';
685
+	public function get_help_tab_name() {
686
+		return 'ee_'.strtolower($this->system_name()).'_help_tab';
687 687
 	}
688 688
 
689 689
 	/**
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 	 * this PMT by an admin
692 692
 	 * @return string
693 693
 	 */
694
-	public function cap_name(){
695
-		return 'ee_payment_method_' . strtolower( $this->system_name() );
694
+	public function cap_name() {
695
+		return 'ee_payment_method_'.strtolower($this->system_name());
696 696
 	}
697 697
 
698 698
 	/**
@@ -704,9 +704,9 @@  discard block
 block discarded – undo
704 704
 	 * @param EE_Payment $payment
705 705
 	 * @return void
706 706
 	 */
707
-	public function update_txn_based_on_payment( $payment ){
708
-		if( $this->_gateway instanceof EE_Gateway ){
709
-			$this->_gateway->update_txn_based_on_payment( $payment );
707
+	public function update_txn_based_on_payment($payment) {
708
+		if ($this->_gateway instanceof EE_Gateway) {
709
+			$this->_gateway->update_txn_based_on_payment($payment);
710 710
 		}
711 711
 	}
712 712
 	
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 	 * @return string
722 722
 	 */
723 723
 	public function introductory_html() {
724
-		return EEH_Template::locate_template( $this->file_folder() . 'templates' . DS . strtolower( $this->system_name() ) . '_intro.template.php', array( 'pmt_obj' => $this, 'pm_instance' => $this->_pm_instance ) );
724
+		return EEH_Template::locate_template($this->file_folder().'templates'.DS.strtolower($this->system_name()).'_intro.template.php', array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance));
725 725
 	}
726 726
 
727 727
 
Please login to merge, or discard this patch.
core/libraries/template_parts/EE_Template_Part.class.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 //namespace EventEspresso\core\libraries\templates;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 /**
8 8
  * Class EE_Template_Part
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 * @param string $template
48 48
 	 * @param int    $priority
49 49
 	 */
50
-	public function __construct( $name, $label, $template, $priority = 100 ) {
51
-		$this->set_name( $name );
52
-		$this->set_label( $label );
53
-		$this->set_template( $template );
54
-		$this->set_priority( $priority );
50
+	public function __construct($name, $label, $template, $priority = 100) {
51
+		$this->set_name($name);
52
+		$this->set_label($label);
53
+		$this->set_template($template);
54
+		$this->set_priority($priority);
55 55
 	}
56 56
 
57 57
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	/**
69 69
 	 * @param mixed $name
70 70
 	 */
71
-	public function set_name( $name ) {
71
+	public function set_name($name) {
72 72
 		$this->name = $name;
73 73
 	}
74 74
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	/**
87 87
 	 * @param string $label
88 88
 	 */
89
-	public function set_label( $label ) {
89
+	public function set_label($label) {
90 90
 		$this->label = $label;
91 91
 	}
92 92
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	/**
105 105
 	 * @param string $template
106 106
 	 */
107
-	public function set_template( $template ) {
107
+	public function set_template($template) {
108 108
 		$this->template = $template;
109 109
 	}
110 110
 
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	/**
123 123
 	 * @param int $priority
124 124
 	 */
125
-	public function set_priority( $priority ) {
126
-		$this->priority = intval( $priority );
125
+	public function set_priority($priority) {
126
+		$this->priority = intval($priority);
127 127
 	}
128 128
 
129 129
 
Please login to merge, or discard this patch.