Completed
Branch BUG-7537 (60d82a)
by
unknown
113:14 queued 90:37
created
core/libraries/rest_api/changes/Changes_In_4_8_33.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 		//is for lower than 4.8.33
14 14
 		add_filter( 
15 15
 			'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
16
-			array( $this, 'remove_checkin_routes_earlier_than_4_8_33' ),
16
+			array($this, 'remove_checkin_routes_earlier_than_4_8_33'),
17 17
 			10,
18 18
 			2
19 19
 		);
20 20
 		add_filter( 
21 21
 			'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_headers_from_ee_notices__return',
22
-			array( $this, 'dont_add_headers_from_ee_notices' ),
22
+			array($this, 'dont_add_headers_from_ee_notices'),
23 23
 			10,
24 24
 			2
25 25
 		);
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param string $version
33 33
 	 * @return array like $routes_on_this_version
34 34
 	 */
35
-	public function remove_checkin_routes_earlier_than_4_8_33( $routes_on_this_version, $version ) {
36
-		if( $this->applies_to_version(  $version ) ) {
37
-			unset( $routes_on_this_version[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] );
35
+	public function remove_checkin_routes_earlier_than_4_8_33($routes_on_this_version, $version) {
36
+		if ($this->applies_to_version($version)) {
37
+			unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']);
38 38
 		}
39 39
 		return $routes_on_this_version;
40 40
 	}
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @param string $requested_version
46 46
 	 * @return array
47 47
 	 */
48
-	public function dont_add_headers_from_ee_notices( $headers_from_ee_notices, $requested_version ) {
49
-		if( $this->applies_to_version(  $requested_version ) ) {
48
+	public function dont_add_headers_from_ee_notices($headers_from_ee_notices, $requested_version) {
49
+		if ($this->applies_to_version($requested_version)) {
50 50
 			return array();
51 51
 		}
52 52
 		return $headers_from_ee_notices;
Please login to merge, or discard this patch.
core/libraries/rest_api/changes/Changes_In_Base.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @return boolean true: this class' name indicates its filters and actions
57 57
 	 * should take effect. False: this class' name indicates it shouldn't do anything
58 58
 	 */
59
-	public function applies_to_version( $requested_version ) {
60
-		if( $this->version() > $requested_version ) {
59
+	public function applies_to_version($requested_version) {
60
+		if ($this->version() > $requested_version) {
61 61
 			return true;
62 62
 		}
63 63
 		return false;
@@ -71,24 +71,24 @@  discard block
 block discarded – undo
71 71
 	 * @throws \EE_Error
72 72
 	 */
73 73
 	public function version() {
74
-		if( $this->_version === null ) {
74
+		if ($this->_version === null) {
75 75
 			$matches = array();
76 76
 			$regex = '~Changes_In_(.*)_(.*)_(.*)$~';
77 77
 			$success = preg_match(
78 78
 				$regex,
79
-				get_class( $this ),
79
+				get_class($this),
80 80
 				$matches
81 81
 			);
82
-			if( ! $success ) {
82
+			if ( ! $success) {
83 83
 				throw new \EE_Error(
84 84
 					sprintf(
85
-						__( 'The class %1$s was misnamed. It name should match the regex "%2$s"', 'event_espresso' ),
86
-						get_class( $this ),
85
+						__('The class %1$s was misnamed. It name should match the regex "%2$s"', 'event_espresso'),
86
+						get_class($this),
87 87
 						$regex
88 88
 					)
89 89
 				);
90 90
 			}
91
-			$this->_version = $matches[1] . '.' . $matches[2] . '.' . $matches[3];
91
+			$this->_version = $matches[1].'.'.$matches[2].'.'.$matches[3];
92 92
 		}
93 93
 		return $this->_version;
94 94
 	}
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/Base.php 1 patch
Spacing   +53 added lines, -53 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\rest_api\controllers;
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
 /**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	protected $_requested_version;
37 37
 
38 38
 	public function __construct() {
39
-		$this->_debug_mode = defined( 'EE_REST_API_DEBUG_MODE' ) ? EE_REST_API_DEBUG_MODE : false;
39
+		$this->_debug_mode = defined('EE_REST_API_DEBUG_MODE') ? EE_REST_API_DEBUG_MODE : false;
40 40
 	}
41 41
 
42 42
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * Sets the version the user requested
45 45
 	 * @param string $version eg '4.8'
46 46
 	 */
47
-	public function set_requested_version( $version ) {
47
+	public function set_requested_version($version) {
48 48
 		$this->_requested_version = $version;
49 49
 	}
50 50
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 * @param string $key
54 54
 	 * @param string|array $info
55 55
 	 */
56
-	protected function _set_debug_info( $key, $info ){
57
-		$this->_debug_info[ $key ] = $info;
56
+	protected function _set_debug_info($key, $info) {
57
+		$this->_debug_info[$key] = $info;
58 58
 	}
59 59
 	
60 60
 	/**
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	 * @param \WP_Error $wp_error_response
63 63
 	 * @return \WP_Error
64 64
 	 */
65
-	protected function _add_ee_errors_to_response( \WP_Error $wp_error_response ) {
65
+	protected function _add_ee_errors_to_response(\WP_Error $wp_error_response) {
66 66
 		$notices_during_checkin = \EE_Error::get_raw_notices();
67
-		if( ! empty( $notices_during_checkin[ 'errors' ] ) ) {	
68
-			foreach( $notices_during_checkin[ 'errors' ] as $error_code => $error_message ) {
67
+		if ( ! empty($notices_during_checkin['errors'])) {	
68
+			foreach ($notices_during_checkin['errors'] as $error_code => $error_message) {
69 69
 				$wp_error_response->add( 
70
-					sanitize_key( $error_code ), 
71
-					strip_tags( $error_message ) );
70
+					sanitize_key($error_code), 
71
+					strip_tags($error_message) );
72 72
 			}
73 73
 		}
74 74
 		return $wp_error_response;
@@ -86,28 +86,28 @@  discard block
 block discarded – undo
86 86
 	 * @param array|\WP_Error|\Exception $response
87 87
 	 * @return \WP_REST_Response
88 88
 	 */
89
-	public function send_response( $response ) {
90
-		if( $response instanceof \Exception ) {
91
-			$response = new \WP_Error( $response->getCode(), $response->getMessage() );
89
+	public function send_response($response) {
90
+		if ($response instanceof \Exception) {
91
+			$response = new \WP_Error($response->getCode(), $response->getMessage());
92 92
 		}
93
-		if( $response instanceof \WP_Error ) {
94
-			$response = $this->_add_ee_errors_to_response( $response );
95
-			$rest_response = $this->_create_rest_response_from_wp_error( $response );
96
-		}else{
97
-			$rest_response = new \WP_REST_Response( $response, 200 );
93
+		if ($response instanceof \WP_Error) {
94
+			$response = $this->_add_ee_errors_to_response($response);
95
+			$rest_response = $this->_create_rest_response_from_wp_error($response);
96
+		} else {
97
+			$rest_response = new \WP_REST_Response($response, 200);
98 98
 		}
99 99
 		$headers = array();
100
-		if( $this->_debug_mode && is_array( $this->_debug_info ) ) {
101
-			foreach( $this->_debug_info  as $debug_key => $debug_info ) {
102
-				if( is_array( $debug_info ) ) {
103
-					$debug_info = json_encode( $debug_info );
100
+		if ($this->_debug_mode && is_array($this->_debug_info)) {
101
+			foreach ($this->_debug_info  as $debug_key => $debug_info) {
102
+				if (is_array($debug_info)) {
103
+					$debug_info = json_encode($debug_info);
104 104
 				}
105
-				$headers[ 'X-EE4-Debug-' . ucwords( $debug_key ) ] = $debug_info;
105
+				$headers['X-EE4-Debug-'.ucwords($debug_key)] = $debug_info;
106 106
 			}
107 107
 		}
108
-		$headers = array_merge( $headers, $this->_get_headers_from_ee_notices() );
108
+		$headers = array_merge($headers, $this->_get_headers_from_ee_notices());
109 109
 		
110
-		$rest_response->set_headers( $headers );
110
+		$rest_response->set_headers($headers);
111 111
 		return $rest_response;
112 112
 	}
113 113
 	
@@ -118,31 +118,31 @@  discard block
 block discarded – undo
118 118
 	 * @param \WP_Error $wp_error
119 119
 	 * @return \WP_REST_Response
120 120
 	 */
121
-	protected function _create_rest_response_from_wp_error( \WP_Error $wp_error ) {
121
+	protected function _create_rest_response_from_wp_error(\WP_Error $wp_error) {
122 122
 		$error_data = $wp_error->get_error_data();
123
-		if ( is_array( $error_data ) && isset( $error_data['status'] ) ) {
123
+		if (is_array($error_data) && isset($error_data['status'])) {
124 124
 			$status = $error_data['status'];
125 125
 		} else {
126 126
 			$status = 500;
127 127
 		}
128 128
 
129 129
 		$errors = array();
130
-		foreach ( (array) $wp_error->errors as $code => $messages ) {
131
-			foreach ( (array) $messages as $message ) {
130
+		foreach ((array) $wp_error->errors as $code => $messages) {
131
+			foreach ((array) $messages as $message) {
132 132
 				$errors[] = array(
133 133
 					'code'    => $code,
134 134
 					'message' => $message,
135
-					'data'    => $wp_error->get_error_data( $code )
135
+					'data'    => $wp_error->get_error_data($code)
136 136
 				);
137 137
 			}
138 138
 		}
139
-		$data = isset( $errors[0] ) ? $errors[0] : array();
140
-		if ( count( $errors ) > 1 ) {
139
+		$data = isset($errors[0]) ? $errors[0] : array();
140
+		if (count($errors) > 1) {
141 141
 			// Remove the primary error.
142
-			array_shift( $errors );
142
+			array_shift($errors);
143 143
 			$data['additional_errors'] = $errors;
144 144
 		}
145
-		return new \WP_REST_Response( $data, $status );
145
+		return new \WP_REST_Response($data, $status);
146 146
 	}
147 147
 	
148 148
 	/**
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 	protected function _get_headers_from_ee_notices() {
153 153
 		$headers = array();
154 154
 		$notices = \EE_Error::get_raw_notices();
155
-		foreach( $notices as $notice_type => $sub_notices ) {
156
-			if( ! is_array( $sub_notices ) ) {
155
+		foreach ($notices as $notice_type => $sub_notices) {
156
+			if ( ! is_array($sub_notices)) {
157 157
 				continue;
158 158
 			}
159
-			foreach( $sub_notices as $notice_code => $sub_notice ) {
160
-				$headers[ 'X-EE4-Notices-' . \EEH_Inflector::humanize( $notice_type ) . '[' . $notice_code . ']' ] = strip_tags( $sub_notice );
159
+			foreach ($sub_notices as $notice_code => $sub_notice) {
160
+				$headers['X-EE4-Notices-'.\EEH_Inflector::humanize($notice_type).'['.$notice_code.']'] = strip_tags($sub_notice);
161 161
 			}
162 162
 		}
163 163
 		return apply_filters( 
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 	 * @param string $route 
176 176
 	 * @return string
177 177
 	 */
178
-	public function get_requested_version( $route ) {
178
+	public function get_requested_version($route) {
179 179
 		$matches = $this->parse_route(
180 180
 			$route,
181
-			'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . '~',
182
-			array( 'version' )
181
+			'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'~',
182
+			array('version')
183 183
 			);
184
-		if( isset( $matches[ 'version' ] ) ) {
185
-			return $matches[ 'version' ];
184
+		if (isset($matches['version'])) {
185
+			return $matches['version'];
186 186
 		} else {
187 187
 			return \EED_Core_Rest_Api::latest_rest_api_version();
188 188
 		}
@@ -207,23 +207,23 @@  discard block
 block discarded – undo
207 207
 	 * array( 'model' => 'foo', 'id' => 'bar' )
208 208
 	 * @throws \EE_Error if it couldn't be parsed
209 209
 	 */
210
-	public function parse_route( $route, $regex, $match_keys ) {
210
+	public function parse_route($route, $regex, $match_keys) {
211 211
 		$indexed_matches = array();
212
-		$success = preg_match( $regex, $route, $matches );
213
-		if(
214
-			is_array( $matches ) ) {
212
+		$success = preg_match($regex, $route, $matches);
213
+		if (
214
+			is_array($matches) ) {
215 215
 			//skip the overall regex match. Who cares
216
-			for( $i = 1; $i <= count( $match_keys ); $i++ ) {
217
-				if( ! isset( $matches[ $i ] ) ) {
216
+			for ($i = 1; $i <= count($match_keys); $i++) {
217
+				if ( ! isset($matches[$i])) {
218 218
 					$success = false;
219 219
 				} else {
220
-					$indexed_matches[ $match_keys[ $i - 1 ] ] = $matches[ $i ];
220
+					$indexed_matches[$match_keys[$i - 1]] = $matches[$i];
221 221
 				}
222 222
 			}
223 223
 		}
224
-		if( ! $success ) {
224
+		if ( ! $success) {
225 225
 			throw new \EE_Error(
226
-				__( 'We could not parse the URL. Please contact Event Espresso Support', 'event_espresso' ),
226
+				__('We could not parse the URL. Please contact Event Espresso Support', 'event_espresso'),
227 227
 				'endpoint_parsing_error'
228 228
 			);
229 229
 		}
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Meta.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api\controllers\model;
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 /**
@@ -22,20 +22,20 @@  discard block
 block discarded – undo
22 22
 	 * @param \WP_REST_Request $request
23 23
 	 * @return array|\WP_REST_Response
24 24
 	 */
25
-	public static function handle_request_models_meta( \WP_REST_Request $request ) {
25
+	public static function handle_request_models_meta(\WP_REST_Request $request) {
26 26
 		$controller = new Meta();
27
-		try{
27
+		try {
28 28
 			$matches = $controller->parse_route(
29 29
 				$request->get_route(),
30
-				'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~',
31
-				array( 'version' ) );
32
-			if( $matches instanceof \WP_REST_Response ) {
30
+				'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~',
31
+				array('version') );
32
+			if ($matches instanceof \WP_REST_Response) {
33 33
 				return $matches;
34 34
 			}
35
-			$controller->set_requested_version( $matches[ 'version' ] );
36
-			return $controller->send_response( $controller->_get_models_metadata_entity() );
37
-		} catch( \Exception $e ) {
38
-			return $controller->send_response( $e );
35
+			$controller->set_requested_version($matches['version']);
36
+			return $controller->send_response($controller->_get_models_metadata_entity());
37
+		} catch (\Exception $e) {
38
+			return $controller->send_response($e);
39 39
 		}
40 40
 	}
41 41
 
@@ -43,58 +43,58 @@  discard block
 block discarded – undo
43 43
 	 * Gets the model metadata resource entity
44 44
 	 * @return array for JSON response, describing all the models available in teh requested version
45 45
 	 */
46
-	protected function _get_models_metadata_entity(){
46
+	protected function _get_models_metadata_entity() {
47 47
 		$response = array();
48
-		foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){
49
-			$model = $this->get_model_version_info()->load_model( $model_name );
48
+		foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) {
49
+			$model = $this->get_model_version_info()->load_model($model_name);
50 50
 			$fields_json = array();
51
-			foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) {
52
-				if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) {
51
+			foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) {
52
+				if ($this->get_model_version_info()->field_is_ignored($field_obj)) {
53 53
 					continue;
54 54
 				}
55
-				if( $field_obj instanceof \EE_Boolean_Field ) {
55
+				if ($field_obj instanceof \EE_Boolean_Field) {
56 56
 					$datatype = 'Boolean';
57
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
57
+				}elseif ($field_obj->get_wpdb_data_type() == '%d') {
58 58
 					$datatype = 'Number';
59
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
59
+				}elseif ($field_name instanceof \EE_Serialized_Text_Field) {
60 60
 					$datatype = 'Object';
61
-				}else{
61
+				} else {
62 62
 					$datatype = 'String';
63 63
 				}
64 64
 				$default_value = $field_obj->get_default_value();
65
-				if( $default_value === EE_INF ) {
65
+				if ($default_value === EE_INF) {
66 66
 					$default_value = EE_INF_IN_DB;
67
-				} elseif( $field_obj instanceof \EE_Datetime_Field &&
68
-					$default_value instanceof \DateTime ) {
69
-					$default_value = $default_value->format( 'c' );
67
+				} elseif ($field_obj instanceof \EE_Datetime_Field &&
68
+					$default_value instanceof \DateTime) {
69
+					$default_value = $default_value->format('c');
70 70
 				}
71 71
 				$field_json = array(
72 72
 					'name' => $field_name,
73 73
 					'nicename' => $field_obj->get_nicename(),
74
-					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ),
75
-					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ),
76
-					'type' => str_replace('EE_', '', get_class( $field_obj ) ),
74
+					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj),
75
+					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj),
76
+					'type' => str_replace('EE_', '', get_class($field_obj)),
77 77
 					'datatype' => $datatype,
78 78
 					'nullable' => $field_obj->is_nullable(),
79 79
 					'default' => $default_value,
80 80
 					'table_alias' => $field_obj->get_table_alias(),
81 81
 					'table_column' => $field_obj->get_table_column(),
82 82
 				);
83
-				$fields_json[ $field_json[ 'name' ] ] = $field_json;
83
+				$fields_json[$field_json['name']] = $field_json;
84 84
 
85 85
 			}
86
-			$fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) );
87
-			$response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model );
86
+			$fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model));
87
+			$response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model);
88 88
 			$relations_json = array();
89
-			foreach( $model->relation_settings()  as $relation_name => $relation_obj ) {
89
+			foreach ($model->relation_settings()  as $relation_name => $relation_obj) {
90 90
 				$relation_json = array(
91 91
 					'name' => $relation_name,
92
-					'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ),
92
+					'type' => str_replace('EE_', '', get_class($relation_obj)),
93 93
 					'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false,
94 94
 				);
95
-				$relations_json[ $relation_name ] = $relation_json;
95
+				$relations_json[$relation_name] = $relation_json;
96 96
 			}
97
-			$response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model );
97
+			$response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model);
98 98
 		}
99 99
 		return $response;
100 100
 	}
@@ -104,23 +104,23 @@  discard block
 block discarded – undo
104 104
 	 * @param \WP_REST_Response $rest_response_obj
105 105
 	 * @return \WP_REST_Response
106 106
 	 */
107
-	public static function filter_ee_metadata_into_index( \WP_REST_Response $rest_response_obj ) {
107
+	public static function filter_ee_metadata_into_index(\WP_REST_Response $rest_response_obj) {
108 108
 		$response_data = $rest_response_obj->get_data();
109 109
 		$addons = array();
110
-		foreach( \EE_Registry::instance()->addons as $addon){
110
+		foreach (\EE_Registry::instance()->addons as $addon) {
111 111
 			$addon_json = array(
112 112
 				'name' => $addon->name(),
113 113
 				'version' => $addon->version()
114 114
 			);
115
-			$addons[ $addon_json[ 'name' ] ] = $addon_json;
115
+			$addons[$addon_json['name']] = $addon_json;
116 116
 		}
117
-		$response_data[ 'ee' ] = array(
117
+		$response_data['ee'] = array(
118 118
 			'version' => \EEM_System_Status::instance()->get_ee_version(),
119 119
 			'addons' => $addons,
120 120
 			'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(),
121
-			'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() )
121
+			'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served())
122 122
 		);
123
-		$rest_response_obj->set_data( $response_data );
123
+		$rest_response_obj->set_data($response_data);
124 124
 		return $rest_response_obj;
125 125
 	}
126 126
 }
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/rpc/Checkin.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 use EventEspresso\core\libraries\rest_api\controllers\Base as Base;
3 3
 use EventEspresso\core\libraries\rest_api\controllers\model\Read;
4 4
 
5
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
6
-	exit( 'No direct script access allowed' );
5
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
6
+	exit('No direct script access allowed');
7 7
 }
8 8
 
9 9
 /**
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 	 * @param \WP_REST_Request $request
25 25
 	 * @return \WP_Error|\WP_REST_Response
26 26
 	 */
27
-	public static function handle_request_toggle_checkin( \WP_REST_Request $request ) {
27
+	public static function handle_request_toggle_checkin(\WP_REST_Request $request) {
28 28
 		$controller = new Checkin();
29
-		return $controller->_create_checkin_checkout_object( $request );
29
+		return $controller->_create_checkin_checkout_object($request);
30 30
 	}
31 31
 
32 32
 
@@ -37,47 +37,47 @@  discard block
 block discarded – undo
37 37
 	 * @param \WP_REST_Request $request
38 38
 	 * @return \WP_Error|\WP_REST_Response
39 39
 	 */
40
-	protected function _create_checkin_checkout_object( \WP_REST_Request $request ) {
41
-		$reg_id = $request->get_param( 'REG_ID' );
42
-		$dtt_id = $request->get_param( 'DTT_ID' );
43
-		$force = $request->get_param( 'force' );
44
-		if( $force == 'true' ) {
40
+	protected function _create_checkin_checkout_object(\WP_REST_Request $request) {
41
+		$reg_id = $request->get_param('REG_ID');
42
+		$dtt_id = $request->get_param('DTT_ID');
43
+		$force = $request->get_param('force');
44
+		if ($force == 'true') {
45 45
 			$force = true;
46 46
 		} else {
47 47
 			$force = false;
48 48
 		}
49
-		$reg = \EEM_Registration::instance()->get_one_by_ID( $reg_id );
50
-		if( ! $reg instanceof \EE_Registration ) {
49
+		$reg = \EEM_Registration::instance()->get_one_by_ID($reg_id);
50
+		if ( ! $reg instanceof \EE_Registration) {
51 51
 			return $this->send_response(
52 52
 				new \WP_Error(
53 53
 					'rest_registration_toggle_checkin_invalid_id',
54 54
 					sprintf(
55
-						__( 'You cannot checkin registration with ID %1$s because it doesn\'t exist.', 'event_espresso' ),
55
+						__('You cannot checkin registration with ID %1$s because it doesn\'t exist.', 'event_espresso'),
56 56
 						$reg_id
57 57
 					),
58
-					array( 'status' => 422 )
58
+					array('status' => 422)
59 59
 				)
60 60
 			);
61 61
 		}
62
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id ) ) {
62
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) {
63 63
 			return $this->send_response(
64 64
 				new \WP_Error(
65 65
 					'rest_user_cannot_toggle_checkin',
66 66
 					sprintf(
67
-						__( 'You are not allowed to checkin registration with ID %1$s.', 'event_espresso' ),
67
+						__('You are not allowed to checkin registration with ID %1$s.', 'event_espresso'),
68 68
 						$reg_id
69 69
 					),
70
-					array( 'status' => 403 )
70
+					array('status' => 403)
71 71
 				)
72 72
 			);
73 73
 		}
74
-		$success = $reg->toggle_checkin_status( $dtt_id, ! $force );
75
-		if( $success === false ) {
74
+		$success = $reg->toggle_checkin_status($dtt_id, ! $force);
75
+		if ($success === false) {
76 76
 			//rely on EE_Error::add_error messages to have been added to give more data about hwy it failed
77 77
 			return $this->send_response(
78 78
 				new \WP_Error(
79 79
 					'rest_toggle_checkin_failed',
80
-					__( 'Registration checkin failed. Please see additional error data.', 'event_espresso' )
80
+					__('Registration checkin failed. Please see additional error data.', 'event_espresso')
81 81
 				)
82 82
 			);
83 83
 		}
@@ -92,28 +92,28 @@  discard block
 block discarded – undo
92 92
 				)
93 93
 			)
94 94
 		);
95
-		if( ! $checkin instanceof \EE_Checkin ) {
95
+		if ( ! $checkin instanceof \EE_Checkin) {
96 96
 			return $this->send_response(
97 97
 				new \WP_Error(
98 98
 					'rest_toggle_checkin_error',
99 99
 					sprintf(
100
-						__( 'Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.', 'event_espresso' ),
100
+						__('Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.', 'event_espresso'),
101 101
 						$reg_id,
102 102
 						$dtt_id
103 103
 					)
104 104
 				)
105 105
 			);
106 106
 		}
107
-		$requested_version = $this->get_requested_version( $request->get_route() );
107
+		$requested_version = $this->get_requested_version($request->get_route());
108 108
 		$get_request = new \WP_REST_Request(
109 109
 			'GET',
110
-			\EED_Core_Rest_Api::ee_api_namespace . $requested_version . '/checkins/' . $checkin->ID()
110
+			\EED_Core_Rest_Api::ee_api_namespace.$requested_version.'/checkins/'.$checkin->ID()
111 111
 		);
112 112
 		$get_request->set_url_params(
113 113
 			array(
114 114
 				'id' => $checkin->ID()
115 115
 			)
116 116
 		);
117
-		return Read::handle_request_get_one( $get_request );
117
+		return Read::handle_request_get_one($get_request);
118 118
 	}
119 119
 }
120 120
\ No newline at end of file
Please login to merge, or discard this patch.
core/middleware/EE_Recommended_Versions.core.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -22,35 +22,35 @@  discard block
 block discarded – undo
22 22
 	 * @param 	EE_Response $response
23 23
 	 * @return 	EE_Response
24 24
 	 */
25
-	public function handle_request( EE_Request $request, EE_Response $response ) {
25
+	public function handle_request(EE_Request $request, EE_Response $response) {
26 26
 		$this->_request = $request;
27 27
 		$this->_response = $response;
28 28
 		//$this->_response->add_output( "\n\t IN >>  " . __CLASS__ );
29 29
 		//$this->_response->set_notice( 1, 'hey look at this' );
30 30
 		// check required WP version
31
-		if ( ! $this->_minimum_wp_version_required() ) {
32
-			$this->_request->un_set( 'activate', true );
33
-			add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 );
31
+		if ( ! $this->_minimum_wp_version_required()) {
32
+			$this->_request->un_set('activate', true);
33
+			add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1);
34 34
 			//$this->_response->add_output( "\n<br />" . 'minimum_wp_version_error' );
35 35
 			$this->_response->terminate_request();
36 36
 		}
37 37
 		// check required PHP version
38
-		if ( ! $this->_minimum_php_version_required() ) {
39
-			$this->_request->un_set( 'activate', true );
40
-			add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 );
38
+		if ( ! $this->_minimum_php_version_required()) {
39
+			$this->_request->un_set('activate', true);
40
+			add_action('admin_notices', array($this, 'minimum_php_version_error'), 1);
41 41
 			//$this->_response->add_output( "\n<br />" . 'minimum_php_version_error' );
42 42
 			$this->_response->terminate_request();
43 43
 		}
44 44
 		// check recommended WP version
45
-		if ( ! $this->_minimum_wp_version_recommended() ) {
45
+		if ( ! $this->_minimum_wp_version_recommended()) {
46 46
 			$this->_display_minimum_recommended_wp_version_notice();
47 47
 		}
48 48
 		// check recommended PHP version
49
-		if ( ! $this->_minimum_php_version_recommended() ) {
49
+		if ( ! $this->_minimum_php_version_recommended()) {
50 50
 			$this->_display_minimum_recommended_php_version_notice();
51 51
 		}
52 52
 		$this->_test_for_php_version_7();
53
-		$this->_response = $this->process_request_stack( $this->_request, $this->_response );
53
+		$this->_response = $this->process_request_stack($this->_request, $this->_response);
54 54
 		//$this->_response->add_output( "\n\t OUT << " . __CLASS__ );
55 55
 		return $this->_response;
56 56
 	}
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 * @param string $min_version
65 65
 	 * @return boolean
66 66
 	 */
67
-	private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) {
67
+	private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) {
68 68
 		global $wp_version;
69
-		return version_compare( $wp_version, $min_version, '>=' ) ? true : false;
69
+		return version_compare($wp_version, $min_version, '>=') ? true : false;
70 70
 	}
71 71
 
72 72
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @return boolean
79 79
 	 */
80 80
 	private function _minimum_wp_version_required() {
81
-		return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED );
81
+		return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED);
82 82
 	}
83 83
 
84 84
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @return boolean
91 91
 	 */
92 92
 	private function _minimum_wp_version_recommended() {
93
-		return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED );
93
+		return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED);
94 94
 	}
95 95
 
96 96
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param string $min_version
103 103
 	 * @return boolean
104 104
 	 */
105
-	private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) {
106
-		return version_compare( PHP_VERSION, $min_version, '>=' ) ? true : false;
105
+	private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) {
106
+		return version_compare(PHP_VERSION, $min_version, '>=') ? true : false;
107 107
 	}
108 108
 
109 109
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @return boolean
116 116
 	 */
117 117
 	private function _minimum_php_version_required() {
118
-		return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED );
118
+		return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED);
119 119
 	}
120 120
 
121 121
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return boolean
128 128
 	 */
129 129
 	private function _minimum_php_version_recommended() {
130
-		return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED );
130
+		return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED);
131 131
 	}
132 132
 
133 133
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			<p>
145 145
 				<?php
146 146
 				printf(
147
-					__( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
147
+					__('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
148 148
 					EE_MIN_WP_VER_REQUIRED,
149 149
 					$wp_version,
150 150
 					'<br/>',
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 			<p>
170 170
 				<?php
171 171
 				printf(
172
-					__( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
172
+					__('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
173 173
 					EE_MIN_PHP_VER_REQUIRED,
174 174
 					PHP_VERSION,
175 175
 					'<br/>',
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	private function _display_minimum_recommended_wp_version_notice() {
193 193
 		global $wp_version;
194 194
 		EE_Error::add_persistent_admin_notice(
195
-			'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended',
195
+			'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended',
196 196
 			sprintf(
197
-				__( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
197
+				__('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
198 198
 				EE_MIN_WP_VER_RECOMMENDED,
199 199
 				$wp_version,
200 200
 				'<br/>',
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	private function _display_minimum_recommended_php_version_notice() {
215 215
 		EE_Error::add_persistent_admin_notice(
216
-			'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended',
216
+			'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended',
217 217
 			sprintf(
218
-				__( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
218
+				__('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
219 219
 				EE_MIN_PHP_VER_RECOMMENDED,
220 220
 				PHP_VERSION,
221 221
 				'<br/>',
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
 	 * @access private
233 233
 	 */
234 234
 	private function _test_for_php_version_7() {
235
-		if ( $this->_check_php_version( '7' ) ) {
236
-			define( 'EE_PHP_7', true );
235
+		if ($this->_check_php_version('7')) {
236
+			define('EE_PHP_7', true);
237 237
 		} else {
238
-			define( 'EE_PHP_7', false );
238
+			define('EE_PHP_7', false);
239 239
 		}
240 240
 	}
241 241
 
Please login to merge, or discard this patch.
modules/core_rest_api/EED_Core_Rest_Api.module.php 1 patch
Spacing   +82 added lines, -82 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
 /**
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Core_Rest_Api
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 	public static function set_hooks_both() {
60
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 );
61
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 );
62
-		add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 );
63
-		add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) );
60
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10);
61
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5);
62
+		add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2);
63
+		add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index'));
64 64
 	}
65 65
 
66 66
 	/**
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 
75 75
 	protected static function _set_hooks_for_changes() {
76
-		$folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false );
77
-		foreach( $folder_contents as $classname_in_namespace => $filepath ) {
76
+		$folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false);
77
+		foreach ($folder_contents as $classname_in_namespace => $filepath) {
78 78
 			//ignore the base parent class
79
-			if( $classname_in_namespace === 'Changes_In_Base' ) {
79
+			if ($classname_in_namespace === 'Changes_In_Base') {
80 80
 				continue;
81 81
 			}
82
-			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
83
-			if ( class_exists( $full_classname )) {
82
+			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace;
83
+			if (class_exists($full_classname)) {
84 84
 				$instance_of_class = new $full_classname;
85
-				if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) {
85
+				if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) {
86 86
 					$instance_of_class->set_hooks();
87 87
 				}
88 88
 			}
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	 * so we actually prefer to only do it when an EE plugin is activated or upgraded
96 96
 	 */
97 97
 	public static function register_routes() {
98
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
99
-			foreach( $relative_urls as $endpoint => $routes ) {
100
-				foreach( $routes as $route ) {
98
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
99
+			foreach ($relative_urls as $endpoint => $routes) {
100
+				foreach ($routes as $route) {
101 101
 					register_rest_route(
102 102
 						$namespace,
103 103
 						$endpoint,
104 104
 						array(
105
-							'callback' => $route[ 'callback' ],
106
-							'methods' => $route[ 'methods' ],
107
-							'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(),
105
+							'callback' => $route['callback'],
106
+							'methods' => $route['methods'],
107
+							'args' => isset($route['args']) ? $route['args'] : array(),
108 108
 						)
109 109
 					);
110 110
 				}
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	 * }
122 122
 	 */
123 123
 	public static function get_ee_route_data() {
124
-		$ee_routes = get_option( self::saved_routes_option_names, null );
125
-		if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){
124
+		$ee_routes = get_option(self::saved_routes_option_names, null);
125
+		if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) {
126 126
 			self::save_ee_routes();
127
-			$ee_routes = get_option( self::saved_routes_option_names, array() );
127
+			$ee_routes = get_option(self::saved_routes_option_names, array());
128 128
 		}
129 129
 		return $ee_routes;
130 130
 	}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @return void
136 136
 	 */
137 137
 	public static function save_ee_routes() {
138
-		if( EE_Maintenance_Mode::instance()->models_can_query() ){
138
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
139 139
 			$instance = self::instance();
140 140
 			$routes = apply_filters(
141 141
 				'EED_Core_Rest_Api__save_ee_routes__routes',
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 					$instance->_register_rpc_routes()
147 147
 				)
148 148
 			);
149
-			update_option( self::saved_routes_option_names, $routes, true );
149
+			update_option(self::saved_routes_option_names, $routes, true);
150 150
 		}
151 151
 	}
152 152
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @return array @see get_ee_route_data
156 156
 	 */
157 157
 	protected function _register_model_routes() {
158
-		EE_Registry::instance()->load_helper( 'Inflector' );
158
+		EE_Registry::instance()->load_helper('Inflector');
159 159
 		$models_to_register = apply_filters(
160 160
 			'FHEE__EED_Core_REST_API___register_model_routes',
161 161
 			EE_Registry::instance()->non_abstract_db_models
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
 		unset($models_to_register['Extra_Meta']);
165 165
 		unset($models_to_register['Extra_Join']);
166 166
 		$model_routes = array( );
167
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
167
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
168 168
 
169
-			foreach ( $models_to_register as $model_name => $model_classname ) {
169
+			foreach ($models_to_register as $model_name => $model_classname) {
170 170
 				//yes we could just register one route for ALL models, but then they wouldn't show up in the index
171
-				$ee_namespace = self::ee_api_namespace . $version;
172
-				$plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name );
173
-				$singular_model_route = $plural_model_route . '/(?P<id>\d+)' ;
174
-				$model_routes[ $ee_namespace ][ $plural_model_route ] = array(
171
+				$ee_namespace = self::ee_api_namespace.$version;
172
+				$plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);
173
+				$singular_model_route = $plural_model_route.'/(?P<id>\d+)';
174
+				$model_routes[$ee_namespace][$plural_model_route] = array(
175 175
 						array(
176 176
 							'callback' => array(
177 177
 								'EventEspresso\core\libraries\rest_api\controllers\model\Read',
178 178
 								'handle_request_get_all' ),
179 179
 							'methods' => WP_REST_Server::READABLE,
180 180
 							'hidden_endpoint' => $hidden_endpoint,
181
-							'args' => $this->_get_read_query_params( $model_name ),
181
+							'args' => $this->_get_read_query_params($model_name),
182 182
 							'_links' => array(
183
-								'self' => rest_url( $ee_namespace . $singular_model_route ),
183
+								'self' => rest_url($ee_namespace.$singular_model_route),
184 184
 							)
185 185
 						),
186 186
 //						array(
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 //							'hidden_endpoint' => $hidden_endpoint
192 192
 //						)
193 193
 					);
194
-				$model_routes[ $ee_namespace ][ $singular_model_route ] = array(
194
+				$model_routes[$ee_namespace][$singular_model_route] = array(
195 195
 						array(
196 196
 							'callback' => array(
197 197
 								'EventEspresso\core\libraries\rest_api\controllers\model\Read',
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 								'include' => array(
203 203
 									'required' => false,
204 204
 									'default' => '*',
205
-									'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ),
205
+									'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'),
206 206
 								),
207 207
 							)
208 208
 						),
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 //							),
216 216
 				);
217 217
 				//@todo: also handle  DELETE for a single item
218
-				$model = EE_Registry::instance()->load_model( $model_classname );
219
-				foreach ( $model->relation_settings() as $relation_name => $relation_obj ) {
218
+				$model = EE_Registry::instance()->load_model($model_classname);
219
+				foreach ($model->relation_settings() as $relation_name => $relation_obj) {
220 220
 					$related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name(
221 221
 						$relation_name,
222 222
 						$relation_obj
223 223
 					);
224
-					$model_routes[ $ee_namespace ][ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array(
224
+					$model_routes[$ee_namespace][$singular_model_route.'/'.$related_model_name_endpoint_part] = array(
225 225
 							array(
226 226
 								'callback' => array(
227 227
 									'EventEspresso\core\libraries\rest_api\controllers\model\Read',
228 228
 									'handle_request_get_related' ),
229 229
 								'methods' => WP_REST_Server::READABLE,
230 230
 								'hidden_endpoint' => $hidden_endpoint,
231
-								'args' => $this->_get_read_query_params( $relation_name ),
231
+								'args' => $this->_get_read_query_params($relation_name),
232 232
 							),
233 233
 //							array(
234 234
 //								'callback' => array(
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	protected function _register_rpc_routes() {
254 254
 		$routes = array();
255
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
256
-			$ee_namespace = self::ee_api_namespace . $version;
255
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
256
+			$ee_namespace = self::ee_api_namespace.$version;
257 257
 			$this_versions_routes = array();
258 258
 			//checkin endpoint
259
-			$this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array(
259
+			$this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array(
260 260
 				array(
261 261
 					'callback' => array(
262 262
 						'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
 						'force' => array(
268 268
 							'required' => false,
269 269
 							'default' => false,
270
-							'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' )
270
+							'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso')
271 271
 						)
272 272
 					)
273 273
 				)
274 274
 			);
275
-			$routes[ $ee_namespace ] = apply_filters(
275
+			$routes[$ee_namespace] = apply_filters(
276 276
 				'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
277 277
 				$this_versions_routes,
278 278
 				$version,
@@ -287,47 +287,47 @@  discard block
 block discarded – undo
287 287
 	 * @param string $model_name eg 'Event' or 'Venue'
288 288
 	 * @return array describing the args acceptable when querying this model
289 289
 	 */
290
-	protected function _get_read_query_params( $model_name ) {
291
-		$model = EE_Registry::instance()->load_model( $model_name );
290
+	protected function _get_read_query_params($model_name) {
291
+		$model = EE_Registry::instance()->load_model($model_name);
292 292
 		$default_orderby = array();
293
-		foreach( $model->get_combined_primary_key_fields() as $key_field ) {
294
-			$default_orderby[ $key_field->get_name() ] = 'ASC';
293
+		foreach ($model->get_combined_primary_key_fields() as $key_field) {
294
+			$default_orderby[$key_field->get_name()] = 'ASC';
295 295
 		}
296 296
 		return array(
297 297
 			'where' => array(
298 298
 				'required' => false,
299 299
 				'default' => array(),
300
-				'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso' ),
300
+				'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso'),
301 301
 				),
302 302
 			'limit' => array(
303 303
 				'required' => false,
304 304
 				'default' => 50,
305
-				'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso' )
305
+				'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso')
306 306
 			),
307 307
 			'order_by' => array(
308 308
 				'required' => false,
309 309
 				'default' => $default_orderby,
310
-				'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso' )
310
+				'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso')
311 311
 			),
312 312
 			'group_by' => array(
313 313
 				'required' => false,
314 314
 				'default' => null,
315
-				'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso' )
315
+				'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso')
316 316
 			),
317 317
 			'having' => array(
318 318
 				'required' => false,
319 319
 				'default' => null,
320
-				'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso' )
320
+				'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso')
321 321
 			),
322 322
 			'caps' => array(
323 323
 				'required' => false,
324 324
 				'default' => EEM_Base::caps_read,
325
-				'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso' )
325
+				'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso')
326 326
 			),
327 327
 			'include' => array(
328 328
 				'required' => false,
329 329
 				'default' => '*',
330
-				'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ),
330
+				'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'),
331 331
 			),
332 332
 		);
333 333
 	}
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 	 */
339 339
 	protected function _register_config_routes() {
340 340
 		$config_routes = array();
341
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
342
-			$config_routes[ self::ee_api_namespace . $version ][ 'config' ] = array(
341
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
342
+			$config_routes[self::ee_api_namespace.$version]['config'] = array(
343 343
 					array(
344 344
 						'callback' => array(
345 345
 							'EventEspresso\core\libraries\rest_api\controllers\config\Read',
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 */
359 359
 	protected function _register_meta_routes() {
360 360
 		$meta_routes = array();
361
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
362
-			$meta_routes[ self::ee_api_namespace . $version ][ '/resources' ] = array(
361
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
362
+			$meta_routes[self::ee_api_namespace.$version]['/resources'] = array(
363 363
 				array(
364 364
 					'callback' => array(
365 365
 						'EventEspresso\core\libraries\rest_api\controllers\model\Meta',
@@ -380,13 +380,13 @@  discard block
 block discarded – undo
380 380
 	 * @param array $route_data
381 381
 	 * @return array
382 382
 	 */
383
-	public static function hide_old_endpoints( $route_data ) {
384
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
385
-			foreach( $relative_urls as $endpoint => $routes ) {
386
-				foreach( $routes as $route ) {
387
-					if( $route[ 'hidden_endpoint' ] ) {
388
-						$full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' );
389
-						unset( $route_data[ $full_route ] );
383
+	public static function hide_old_endpoints($route_data) {
384
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
385
+			foreach ($relative_urls as $endpoint => $routes) {
386
+				foreach ($routes as $route) {
387
+					if ($route['hidden_endpoint']) {
388
+						$full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/');
389
+						unset($route_data[$full_route]);
390 390
 					}
391 391
 				}
392 392
 			}
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 	 */
424 424
 	public static function latest_rest_api_version() {
425 425
 		$versions_served = \EED_Core_Rest_Api::versions_served();
426
-		return end( array_keys( $versions_served ) );
426
+		return end(array_keys($versions_served));
427 427
 	}
428 428
 
429 429
 	/**
@@ -437,32 +437,32 @@  discard block
 block discarded – undo
437 437
 	public static function versions_served() {
438 438
 		$versions_served = array();
439 439
 		$possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
440
-		$lowest_compatible_version = end( $possibly_served_versions);
441
-		reset( $possibly_served_versions );
442
-		$versions_served_historically = array_keys( $possibly_served_versions );
443
-		$latest_version = end( $versions_served_historically );
444
-		reset( $versions_served_historically );
440
+		$lowest_compatible_version = end($possibly_served_versions);
441
+		reset($possibly_served_versions);
442
+		$versions_served_historically = array_keys($possibly_served_versions);
443
+		$latest_version = end($versions_served_historically);
444
+		reset($versions_served_historically);
445 445
 		//for each version of core we have ever served:
446
-		foreach ( $versions_served_historically as $key_versioned_endpoint ) {
446
+		foreach ($versions_served_historically as $key_versioned_endpoint) {
447 447
 			//if it's not above the current core version, and it's compatible with the current version of core
448
-			if( $key_versioned_endpoint == $latest_version ) {
448
+			if ($key_versioned_endpoint == $latest_version) {
449 449
 				//don't hide the latest version in the index
450
-				$versions_served[ $key_versioned_endpoint ] = false;
451
-			} else if(
450
+				$versions_served[$key_versioned_endpoint] = false;
451
+			} else if (
452 452
 				$key_versioned_endpoint < EED_Core_Rest_Api::core_version()
453 453
 				&& $key_versioned_endpoint >= $lowest_compatible_version
454 454
 			) {
455 455
 				//include, but hide, previous versions which are still supported
456
-				$versions_served[ $key_versioned_endpoint ] = true;
457
-			} elseif(
456
+				$versions_served[$key_versioned_endpoint] = true;
457
+			} elseif (
458 458
 				apply_filters(
459 459
 					'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
460 460
 					false,
461 461
 					$possibly_served_versions
462 462
 				)
463
-			){
463
+			) {
464 464
 				//if a version is no longer supported, don't include it in index or list of versions served
465
-				$versions_served[ $key_versioned_endpoint ] = true;
465
+				$versions_served[$key_versioned_endpoint] = true;
466 466
 			}
467 467
 		}
468 468
 		return $versions_served;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	 * @return string
476 476
 	 */
477 477
 	public static function core_version() {
478
-		return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) );
478
+		return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3)));
479 479
 	}
480 480
 
481 481
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 * @param  WP $WP
488 488
 	 * @return    void
489 489
 	 */
490
-	public function run( $WP ) {
490
+	public function run($WP) {
491 491
 
492 492
 	}
493 493
 
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_Checkout.class.php 1 patch
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 		$this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url();
243 243
 		$this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url();
244 244
 		$this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url();
245
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
245
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE);
246 246
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
247
-		$this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' ));
247
+		$this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC'));
248 248
 	}
249 249
 
250 250
 
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 	 * @return array
255 255
 	 */
256 256
 	public function any_reg_status_updated() {
257
-		foreach ( $this->reg_status_updated as $reg_status ) {
258
-			if ( $reg_status ) {
257
+		foreach ($this->reg_status_updated as $reg_status) {
258
+			if ($reg_status) {
259 259
 				return true;
260 260
 			}
261 261
 		}
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 	 * @param $REG_ID
269 269
 	 * @return array
270 270
 	 */
271
-	public function reg_status_updated( $REG_ID ) {
272
-		return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false;
271
+	public function reg_status_updated($REG_ID) {
272
+		return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false;
273 273
 	}
274 274
 
275 275
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	 * @param $REG_ID
279 279
 	 * @param $reg_status
280 280
 	 */
281
-	public function set_reg_status_updated( $REG_ID, $reg_status ) {
282
-		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
281
+	public function set_reg_status_updated($REG_ID, $reg_status) {
282
+		$this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN);
283 283
 	}
284 284
 
285 285
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * can ONLY be set by the  Finalize_Registration reg step
301 301
 	 */
302 302
 	public function set_exit_spco() {
303
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
303
+		if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
304 304
 			$this->exit_spco = true;
305 305
 		}
306 306
 	}
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function reset_for_current_request() {
319 319
 		$this->process_form_submission = FALSE;
320
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true );
320
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true);
321 321
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax;
322 322
 		$this->continue_reg = true;
323 323
 		$this->redirect = false;
324 324
 		// don't reset the cached redirect form if we're about to be asked to display it !!!
325
-		if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) {
325
+		if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') {
326 326
 			$this->redirect_form = '';
327 327
 		}
328 328
 		$this->redirect_url = '';
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param EE_SPCO_Reg_Step $reg_step_obj
340 340
 	 * @return    void
341 341
 	 */
342
-	public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) {
343
-		$this->reg_steps[ $reg_step_obj->slug()  ] = $reg_step_obj;
342
+	public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) {
343
+		$this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj;
344 344
 	}
345 345
 
346 346
 
@@ -356,22 +356,22 @@  discard block
 block discarded – undo
356 356
 	 * @param string $reg_step_slug
357 357
 	 * @return    void
358 358
 	 */
359
-	public function skip_reg_step( $reg_step_slug = '' ) {
360
-		$step_to_skip = $this->find_reg_step( $reg_step_slug );
361
-		if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) {
362
-			$step_to_skip->set_is_current_step( false );
359
+	public function skip_reg_step($reg_step_slug = '') {
360
+		$step_to_skip = $this->find_reg_step($reg_step_slug);
361
+		if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) {
362
+			$step_to_skip->set_is_current_step(false);
363 363
 			$step_to_skip->set_completed();
364 364
 			// advance to the next step
365
-			$this->set_current_step( $this->next_step->slug() );
365
+			$this->set_current_step($this->next_step->slug());
366 366
 			// also reset the step param in the request in case any other code references that directly
367
-			EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() );
367
+			EE_Registry::instance()->REQ->set('step', $this->current_step->slug());
368 368
 			// since we are skipping a step and setting the current step to be what was previously the next step,
369 369
 			// we need to check that the next step is now correct, and not still set to the current step.
370
-			if ( $this->current_step->slug() == $this->next_step->slug() ) {
370
+			if ($this->current_step->slug() == $this->next_step->slug()) {
371 371
 				// correctly setup the next step
372 372
 				$this->set_next_step();
373 373
 			}
374
-			$this->set_reg_step_initiated( $this->current_step );
374
+			$this->set_reg_step_initiated($this->current_step);
375 375
 		}
376 376
 	}
377 377
 
@@ -385,16 +385,16 @@  discard block
 block discarded – undo
385 385
 	 * @param bool   $reset whether to reset reg steps after removal
386 386
 	 * @throws EE_Error
387 387
 	 */
388
-	public function remove_reg_step( $reg_step_slug = '', $reset = true ) {
389
-		unset( $this->reg_steps[ $reg_step_slug  ] );
390
-		if ( $this->transaction instanceof EE_Transaction ) {
388
+	public function remove_reg_step($reg_step_slug = '', $reset = true) {
389
+		unset($this->reg_steps[$reg_step_slug]);
390
+		if ($this->transaction instanceof EE_Transaction) {
391 391
 			/** @type EE_Transaction_Processor $transaction_processor */
392
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
392
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
393 393
 			// now remove reg step from TXN and save
394
-			$transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug );
394
+			$transaction_processor->remove_reg_step($this->transaction, $reg_step_slug);
395 395
 			$this->transaction->save();
396 396
 		}
397
-		if ( $reset ) {
397
+		if ($reset) {
398 398
 			$this->reset_reg_steps();
399 399
 		}
400 400
 	}
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 	 * @param int    $order
410 410
 	 * @return    void
411 411
 	 */
412
-	public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) {
413
-		if ( isset( $this->reg_steps[ $reg_step_slug  ] )) {
414
-			$this->reg_steps[ $reg_step_slug ]->set_order( $order );
412
+	public function set_reg_step_order($reg_step_slug = '', $order = 100) {
413
+		if (isset($this->reg_steps[$reg_step_slug])) {
414
+			$this->reg_steps[$reg_step_slug]->set_order($order);
415 415
 		}
416 416
 	}
417 417
 
@@ -424,25 +424,25 @@  discard block
 block discarded – undo
424 424
 	 * @param string $current_step
425 425
 	 * @return    void
426 426
 	 */
427
-	public function set_current_step( $current_step ) {
427
+	public function set_current_step($current_step) {
428 428
 		// grab what step we're on
429
-		$this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps );
429
+		$this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps);
430 430
 		// verify instance
431
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step ) {
431
+		if ($this->current_step instanceof EE_SPCO_Reg_Step) {
432 432
 			// we don't want to repeat completed steps if this is the first time through SPCO
433
-			if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) {
433
+			if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) {
434 434
 				// so advance to the next step
435 435
 				$this->set_next_step();
436
-				if ( $this->next_step instanceof EE_SPCO_Reg_Step ) {
436
+				if ($this->next_step instanceof EE_SPCO_Reg_Step) {
437 437
 					// and attempt to set it as the current step
438
-					$this->set_current_step( $this->next_step->slug() );
438
+					$this->set_current_step($this->next_step->slug());
439 439
 				}
440 440
 				return;
441 441
 			}
442
-			$this->current_step->set_is_current_step( TRUE );
442
+			$this->current_step->set_is_current_step(TRUE);
443 443
 		} else {
444 444
 			EE_Error::add_error(
445
-				__( 'The current step could not be set.', 'event_espresso' ),
445
+				__('The current step could not be set.', 'event_espresso'),
446 446
 				__FILE__, __FUNCTION__, __LINE__
447 447
 			);
448 448
 		}
@@ -459,20 +459,20 @@  discard block
 block discarded – undo
459 459
 	 */
460 460
 	public function set_next_step() {
461 461
 		// set pointer to start of array
462
-		reset( $this->reg_steps );
462
+		reset($this->reg_steps);
463 463
 		// if there is more than one step
464
-		if ( count( $this->reg_steps ) > 1 ) {
464
+		if (count($this->reg_steps) > 1) {
465 465
 			// advance to the current step and set pointer
466
-			while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) {
467
-				next( $this->reg_steps );
466
+			while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') {
467
+				next($this->reg_steps);
468 468
 			}
469 469
 		}
470 470
 		// advance one more spot ( if it exists )
471
-		$this->next_step = next( $this->reg_steps );
471
+		$this->next_step = next($this->reg_steps);
472 472
 		// verify instance
473
-		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step  : NULL;
473
+		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL;
474 474
 		// then back to current step to reset
475
-		prev( $this->reg_steps );
475
+		prev($this->reg_steps);
476 476
 	}
477 477
 
478 478
 
@@ -486,8 +486,8 @@  discard block
 block discarded – undo
486 486
 	 *  @return 	EE_SPCO_Reg_Step | null
487 487
 	 */
488 488
 	public function get_next_reg_step() {
489
-		$next = next( $this->reg_steps );
490
-		prev( $this->reg_steps );
489
+		$next = next($this->reg_steps);
490
+		prev($this->reg_steps);
491 491
 		return $next instanceof EE_SPCO_Reg_Step ? $next : null;
492 492
 	}
493 493
 
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
 	 *  @return 	EE_SPCO_Reg_Step | null
503 503
 	 */
504 504
 	public function get_prev_reg_step() {
505
-		$prev = prev( $this->reg_steps );
506
-		next( $this->reg_steps );
505
+		$prev = prev($this->reg_steps);
506
+		next($this->reg_steps);
507 507
 		return $prev instanceof EE_SPCO_Reg_Step ? $prev : null;
508 508
 	}
509 509
 
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 	 * @return void
517 517
 	 */
518 518
 	public function sort_reg_steps() {
519
-		$reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' );
520
-		uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback ));
519
+		$reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback');
520
+		uasort($this->reg_steps, array($this, $reg_step_sorting_callback));
521 521
 	}
522 522
 
523 523
 
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
 	 * @param string $reg_step_slug
531 531
 	 * @return EE_SPCO_Reg_Step|null
532 532
 	 */
533
-	public function find_reg_step( $reg_step_slug = '' ) {
534
-		if ( ! empty( $reg_step_slug ) ) {
533
+	public function find_reg_step($reg_step_slug = '') {
534
+		if ( ! empty($reg_step_slug)) {
535 535
 			// copy reg step array
536 536
 			$reg_steps = $this->reg_steps;
537 537
 			// set pointer to start of array
538
-			reset( $reg_steps );
538
+			reset($reg_steps);
539 539
 			// if there is more than one step
540
-			if ( count( $reg_steps ) > 1 ) {
540
+			if (count($reg_steps) > 1) {
541 541
 				// advance to the current step and set pointer
542
-				while ( key( $reg_steps ) != $reg_step_slug && key( $reg_steps ) != '' ) {
543
-					next( $reg_steps );
542
+				while (key($reg_steps) != $reg_step_slug && key($reg_steps) != '') {
543
+					next($reg_steps);
544 544
 				}
545
-				return current( $reg_steps );
545
+				return current($reg_steps);
546 546
 			}
547 547
 		}
548 548
 		return null;
@@ -558,17 +558,17 @@  discard block
 block discarded – undo
558 558
 	 * @param EE_SPCO_Reg_Step $reg_step_B
559 559
 	 * @return array()
560 560
 	 */
561
-	public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) {
561
+	public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) {
562 562
 		// send finalize_registration step to the end of the array
563
-		if ( $reg_step_A->slug() == 'finalize_registration' ) {
563
+		if ($reg_step_A->slug() == 'finalize_registration') {
564 564
 			return 1;
565
-		} else if ( $reg_step_B->slug() == 'finalize_registration' ) {
565
+		} else if ($reg_step_B->slug() == 'finalize_registration') {
566 566
 			return -1;
567 567
 		}
568
-		if ( $reg_step_A->order() == $reg_step_B->order() ) {
568
+		if ($reg_step_A->order() == $reg_step_B->order()) {
569 569
 			return 0;
570 570
 		}
571
-		return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1;
571
+		return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1;
572 572
 	}
573 573
 
574 574
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	 * @access 	public
580 580
 	 * @param 	EE_SPCO_Reg_Step $reg_step
581 581
 	 */
582
-	public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) {
582
+	public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) {
583 583
 		// call set_reg_step_initiated ???
584 584
 		if (
585 585
 			// first time visiting SPCO ?
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
 			)
593 593
 		) {
594 594
 			/** @type EE_Transaction_Processor $transaction_processor */
595
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
595
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
596 596
 			// set the start time for this reg step
597
-			if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) {
598
-				if ( WP_DEBUG ) {
597
+			if ( ! $transaction_processor->set_reg_step_initiated($this->transaction, $reg_step->slug())) {
598
+				if (WP_DEBUG) {
599 599
 					EE_Error::add_error(
600 600
 						sprintf(
601
-							__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ),
601
+							__('The "%1$s" registration step was not initialized properly.', 'event_espresso'),
602 602
 							$reg_step->name()
603 603
 						),
604 604
 						__FILE__, __FUNCTION__, __LINE__
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
 	 * 	@return 	void
618 618
 	 */
619 619
 	public function set_reg_step_JSON_info() {
620
-		EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array();
620
+		EE_Registry::$i18n_js_strings['reg_steps'] = array();
621 621
 		// pass basic reg step data to JS
622
-		foreach ( $this->reg_steps as $reg_step ) {
623
-			EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug();
622
+		foreach ($this->reg_steps as $reg_step) {
623
+			EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug();
624 624
 		}
625 625
 		// reset reg step html
626 626
 //		$this->json_response->set_reg_step_html( '' );
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 	 */
637 637
 	public function reset_reg_steps() {
638 638
 		$this->sort_reg_steps();
639
-		$this->set_current_step( EE_Registry::instance()->REQ->get( 'step' ));
639
+		$this->set_current_step(EE_Registry::instance()->REQ->get('step'));
640 640
 		$this->set_next_step();
641 641
 		// the text that appears on the reg step form submit button
642 642
 		$this->current_step->set_submit_button_text();
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
 	 */
654 654
 	public function get_registration_time_limit() {
655 655
 
656
-		$registration_time_limit = (float)( EE_Registry::instance()	->SSN->expiration() - time() );
656
+		$registration_time_limit = (float) (EE_Registry::instance()	->SSN->expiration() - time());
657 657
 		$time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s';
658
-		$registration_time_limit = gmdate( $time_limit_format, $registration_time_limit );
658
+		$registration_time_limit = gmdate($time_limit_format, $registration_time_limit);
659 659
 		return apply_filters(
660 660
 			'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit',
661 661
 			$registration_time_limit
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		//		overpaid TXN
676 676
 		//		free TXN ( total = 0.00 )
677 677
 		// then payment required is TRUE
678
-		return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE;
678
+		return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE;
679 679
 	}
680 680
 
681 681
 
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
 	 */
689 689
 	public function initialize_txn_reg_steps_array() {
690 690
 		$txn_reg_steps_array = array();
691
-		foreach ( $this->reg_steps as $reg_step ) {
692
-			$txn_reg_steps_array[ $reg_step->slug() ] = FALSE;
691
+		foreach ($this->reg_steps as $reg_step) {
692
+			$txn_reg_steps_array[$reg_step->slug()] = FALSE;
693 693
 		}
694 694
 		return $txn_reg_steps_array;
695 695
 	}
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 	public function update_txn_reg_steps_array() {
706 706
 		$updated = FALSE;
707 707
 		/** @type EE_Transaction_Processor $transaction_processor */
708
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
709
-		foreach ( $this->reg_steps as $reg_step ) {
710
-			if ( $reg_step->completed() ) {
711
-				$updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated;
708
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
709
+		foreach ($this->reg_steps as $reg_step) {
710
+			if ($reg_step->completed()) {
711
+				$updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated;
712 712
 			}
713 713
 		}
714
-		if ( $updated ) {
714
+		if ($updated) {
715 715
 			$this->transaction->save();
716 716
 		}
717 717
 		return $updated;
@@ -726,14 +726,14 @@  discard block
 block discarded – undo
726 726
 	 * 	@return 	void
727 727
 	 */
728 728
 	public function stash_transaction_and_checkout() {
729
-		if ( ! $this->revisit ) {
729
+		if ( ! $this->revisit) {
730 730
 			$this->update_txn_reg_steps_array();
731 731
 		}
732 732
 		$this->track_transaction_and_registration_status_updates();
733 733
 		// save all data to the db, but suppress errors
734 734
 		//$this->save_all_data( FALSE );
735 735
 		// cache the checkout in the session
736
-		EE_Registry::instance()->SSN->set_checkout( $this );
736
+		EE_Registry::instance()->SSN->set_checkout($this);
737 737
 	}
738 738
 
739 739
 
@@ -749,21 +749,21 @@  discard block
 block discarded – undo
749 749
 	 */
750 750
 	public function track_transaction_and_registration_status_updates() {
751 751
 		// verify the transaction
752
-		if ( $this->transaction instanceof EE_Transaction ) {
752
+		if ($this->transaction instanceof EE_Transaction) {
753 753
 			/** @type EE_Transaction_Payments $transaction_payments */
754
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
754
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
755 755
 			/** @type EE_Transaction_Processor $transaction_processor */
756
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
756
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
757 757
 			// has there been a TXN status change during this checkout?
758
-			if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) {
758
+			if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) {
759 759
 				$this->txn_status_updated = true;
760 760
 			}
761 761
 			/** @type EE_Registration_Processor $registration_processor */
762
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
762
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
763 763
 			// grab the saved registrations from the transaction
764
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) {
765
-				if ( $registration_processor->reg_status_updated( $registration->ID() ) ) {
766
-					$this->set_reg_status_updated( $registration->ID(), true );
764
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
765
+				if ($registration_processor->reg_status_updated($registration->ID())) {
766
+					$this->set_reg_status_updated($registration->ID(), true);
767 767
 				}
768 768
 			}
769 769
 		}
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
 	 * @param 	EE_Registration 	$registration
786 786
 	 * 	@return 	bool
787 787
 	 */
788
-	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
789
-		return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE;
788
+	public function visit_allows_processing_of_this_registration(EE_Registration $registration) {
789
+		return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE;
790 790
 	}
791 791
 
792 792
 
@@ -811,18 +811,18 @@  discard block
 block discarded – undo
811 811
 	 * @param bool $show_errors
812 812
 	 * @return bool
813 813
 	 */
814
-	public function save_all_data( $show_errors = TRUE ) {
814
+	public function save_all_data($show_errors = TRUE) {
815 815
 		// verify the transaction
816
-		if ( $this->transaction instanceof EE_Transaction ) {
816
+		if ($this->transaction instanceof EE_Transaction) {
817 817
 			// save to ensure that TXN has ID
818 818
 			$this->transaction->save();
819 819
 			// grab the saved registrations from the transaction
820
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as  $registration ) {
821
-				$this->_save_registration( $registration, $show_errors );
820
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as  $registration) {
821
+				$this->_save_registration($registration, $show_errors);
822 822
 			}
823 823
 		} else {
824
-			if ( $show_errors ) {
825
-				EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
824
+			if ($show_errors) {
825
+				EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
826 826
 			}
827 827
 			return FALSE;
828 828
 		}
@@ -837,32 +837,32 @@  discard block
 block discarded – undo
837 837
 	 * @param bool $show_errors
838 838
 	 * @return void
839 839
 	 */
840
-	private function _save_registration( $registration, $show_errors = TRUE  ) {
840
+	private function _save_registration($registration, $show_errors = TRUE) {
841 841
 		// verify object
842
-		if ( $registration instanceof EE_Registration ) {
842
+		if ($registration instanceof EE_Registration) {
843 843
 			// should this registration be processed during this visit ?
844
-			if ( $this->visit_allows_processing_of_this_registration( $registration ) ) {
844
+			if ($this->visit_allows_processing_of_this_registration($registration)) {
845 845
 				//set TXN ID
846
-				if ( ! $registration->transaction_ID() ) {
847
-					$registration->set_transaction_id( $this->transaction->ID() );
846
+				if ( ! $registration->transaction_ID()) {
847
+					$registration->set_transaction_id($this->transaction->ID());
848 848
 				}
849 849
 				// verify and save the attendee
850
-				$this->_save_registration_attendee( $registration, $show_errors );
850
+				$this->_save_registration_attendee($registration, $show_errors);
851 851
 				// save answers to reg form questions
852
-				$this->_save_registration_answers( $registration, $show_errors );
852
+				$this->_save_registration_answers($registration, $show_errors);
853 853
 				// save changes
854 854
 				$registration->save();
855 855
 				// update txn cache
856
-				if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) {
857
-					if ( $show_errors ) {
858
-						EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
856
+				if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) {
857
+					if ($show_errors) {
858
+						EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
859 859
 					}
860 860
 				}
861 861
 			}
862 862
 		} else {
863
-			if ( $show_errors ) {
863
+			if ($show_errors) {
864 864
 				EE_Error::add_error(
865
-					__( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ),
865
+					__('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'),
866 866
 					__FILE__, __FUNCTION__, __LINE__
867 867
 				);
868 868
 			}
@@ -878,26 +878,26 @@  discard block
 block discarded – undo
878 878
 	 * @param bool $show_errors
879 879
 	 * @return void
880 880
 	 */
881
-	private function _save_registration_attendee( $registration, $show_errors = TRUE ) {
882
-		if ( $registration->attendee() instanceof EE_Attendee ) {
881
+	private function _save_registration_attendee($registration, $show_errors = TRUE) {
882
+		if ($registration->attendee() instanceof EE_Attendee) {
883 883
 			// save so that ATT has ID
884 884
 			$registration->attendee()->save();
885
-			if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) {
886
-				if ( $show_errors ) {
885
+			if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) {
886
+				if ($show_errors) {
887 887
 					EE_Error::add_error(
888
-						__( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ),
888
+						__('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'),
889 889
 						__FILE__, __FUNCTION__, __LINE__
890 890
 					);
891 891
 				}
892 892
 			}
893 893
 		} else {
894
-			if ( $show_errors ) {
894
+			if ($show_errors) {
895 895
 				ob_start();
896
-				var_dump( $registration->attendee() );
896
+				var_dump($registration->attendee());
897 897
 				EE_Error::add_error(
898 898
 					sprintf(
899 899
 						'%1$s||%1$s $attendee = %2$s',
900
-						__( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ),
900
+						__('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'),
901 901
 						ob_get_clean()
902 902
 					),
903 903
 					__FILE__, __FUNCTION__, __LINE__
@@ -915,25 +915,25 @@  discard block
 block discarded – undo
915 915
 	 * @param bool $show_errors
916 916
 	 * @return void
917 917
 	 */
918
-	private function _save_registration_answers( $registration, $show_errors = TRUE ) {
918
+	private function _save_registration_answers($registration, $show_errors = TRUE) {
919 919
 		// now save the answers
920
-		foreach ( $registration->answers() as $cache_key => $answer ) {
920
+		foreach ($registration->answers() as $cache_key => $answer) {
921 921
 			// verify object
922
-			if ( $answer instanceof EE_Answer ) {
923
-				$answer->set_registration( $registration->ID() );
922
+			if ($answer instanceof EE_Answer) {
923
+				$answer->set_registration($registration->ID());
924 924
 				$answer->save();
925
-				if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) {
926
-					if ( $show_errors ) {
925
+				if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) {
926
+					if ($show_errors) {
927 927
 						EE_Error::add_error(
928
-							__( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ),
928
+							__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'),
929 929
 							__FILE__, __FUNCTION__, __LINE__
930 930
 						);
931 931
 					}
932 932
 				}
933 933
 			} else {
934
-				if ( $show_errors ) {
934
+				if ($show_errors) {
935 935
 					EE_Error::add_error(
936
-						__( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ),
936
+						__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'),
937 937
 						__FILE__, __FUNCTION__, __LINE__
938 938
 					);
939 939
 				}
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 	 * @param bool $from_db
952 952
 	 * @return bool
953 953
 	 */
954
-	public function refresh_all_entities( $from_db = false ) {
954
+	public function refresh_all_entities($from_db = false) {
955 955
 		$from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db;
956 956
 		//$this->log(
957 957
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -972,11 +972,11 @@  discard block
 block discarded – undo
972 972
 	 */
973 973
 	protected function refresh_from_db() {
974 974
 		// verify the transaction
975
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
975
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
976 976
 			// pull fresh TXN data from the db
977
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() );
977
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID());
978 978
 			// update EE_Checkout's cached primary_attendee object
979
-			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction );
979
+			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction);
980 980
 			// update EE_Checkout's cached payment object
981 981
 			$payment = $this->transaction->last_payment();
982 982
 			$this->payment = $payment instanceof EE_Payment ? $payment : $this->payment;
@@ -984,15 +984,15 @@  discard block
 block discarded – undo
984 984
 			$payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null;
985 985
 			$this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method;
986 986
 			//now refresh the cart, based on the TXN
987
-			$this->cart = EE_Cart::get_cart_from_txn( $this->transaction );
987
+			$this->cart = EE_Cart::get_cart_from_txn($this->transaction);
988 988
 			// verify and update the cart because inaccurate totals are not so much fun
989
-			if ( $this->cart instanceof EE_Cart ) {
989
+			if ($this->cart instanceof EE_Cart) {
990 990
 				$this->cart->get_grand_total()->recalculate_total_including_taxes();
991 991
 			} else {
992
-				$this->cart = EE_Registry::instance()->load_core( 'Cart' );
992
+				$this->cart = EE_Registry::instance()->load_core('Cart');
993 993
 			}
994 994
 		} else {
995
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
995
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
996 996
 			return FALSE;
997 997
 		}
998 998
 		return TRUE;
@@ -1006,24 +1006,24 @@  discard block
 block discarded – undo
1006 1006
 	 * @param   EE_Transaction $transaction
1007 1007
 	 * @return  EE_Attendee | null
1008 1008
 	 */
1009
-	protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) {
1009
+	protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) {
1010 1010
 
1011 1011
 		$primary_attendee_obj = null;
1012 1012
 		// grab the saved registrations from the transaction
1013
-		foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) {
1013
+		foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) {
1014 1014
 			// verify object
1015
-			if ( $registration instanceof EE_Registration ) {
1015
+			if ($registration instanceof EE_Registration) {
1016 1016
 				$attendee = $registration->attendee();
1017 1017
 				// verify object
1018
-				if ( $attendee instanceof EE_Attendee  ) {
1018
+				if ($attendee instanceof EE_Attendee) {
1019 1019
 					// maybe cache primary_attendee_obj ?
1020
-					if ( $registration->is_primary_registrant() ) {
1020
+					if ($registration->is_primary_registrant()) {
1021 1021
 						$primary_attendee_obj = $attendee;
1022 1022
 					}
1023 1023
 				}
1024 1024
 			} else {
1025 1025
 				EE_Error::add_error(
1026
-						__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1026
+						__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1027 1027
 						__FILE__, __FUNCTION__, __LINE__
1028 1028
 				);
1029 1029
 			}
@@ -1043,43 +1043,43 @@  discard block
 block discarded – undo
1043 1043
 	 */
1044 1044
 	protected function refresh_entity_map() {
1045 1045
 		// verify the transaction
1046
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1046
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1047 1047
 			// never cache payment info
1048
-			$this->transaction->clear_cache( 'Payment' );
1048
+			$this->transaction->clear_cache('Payment');
1049 1049
 			/** @type EE_Transaction_Processor $transaction_processor */
1050
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1050
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1051 1051
 			// is the Payment Options Reg Step completed ?
1052
-			if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) {
1052
+			if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) {
1053 1053
 				// then check for payments and update TXN accordingly
1054 1054
 				/** @type EE_Transaction_Payments $transaction_payments */
1055
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1056
-				$transaction_payments->calculate_total_payments_and_update_status( $this->transaction );
1055
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1056
+				$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
1057 1057
 			}
1058 1058
 			// grab the saved registrations from the transaction
1059
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) {
1060
-				$this->_refresh_registration( $reg_cache_ID, $registration );
1059
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) {
1060
+				$this->_refresh_registration($reg_cache_ID, $registration);
1061 1061
 			}
1062 1062
 			// make sure our cached TXN is added to the model entity mapper
1063
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction );
1063
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
1064 1064
 
1065 1065
 		} else {
1066
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1066
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1067 1067
 			return FALSE;
1068 1068
 		}
1069 1069
 		// verify and update the cart because inaccurate totals are not so much fun
1070
-		if ( $this->cart instanceof EE_Cart ) {
1070
+		if ($this->cart instanceof EE_Cart) {
1071 1071
 			$grand_total = $this->cart->get_grand_total();
1072
-			if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) {
1072
+			if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
1073 1073
 				$grand_total->recalculate_total_including_taxes();
1074 1074
 				$grand_total = $grand_total->get_model()->refresh_entity_map_with(
1075 1075
 					$this->cart->get_grand_total()->ID(),
1076 1076
 					$this->cart->get_grand_total()
1077 1077
 				);
1078 1078
 			}
1079
-			if ( $grand_total instanceof EE_Line_Item ) {
1080
-				$this->cart = EE_Cart::instance( $grand_total );
1079
+			if ($grand_total instanceof EE_Line_Item) {
1080
+				$this->cart = EE_Cart::instance($grand_total);
1081 1081
 			} else {
1082
-				EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1082
+				EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1083 1083
 				return false;
1084 1084
 			}
1085 1085
 		}
@@ -1095,19 +1095,19 @@  discard block
 block discarded – undo
1095 1095
 	 * @param 	EE_Registration 	$registration
1096 1096
 	 * @return void
1097 1097
 	 */
1098
-	protected function _refresh_registration( $reg_cache_ID, $registration ) {
1098
+	protected function _refresh_registration($reg_cache_ID, $registration) {
1099 1099
 
1100 1100
 		// verify object
1101
-		if ( $registration instanceof EE_Registration ) {
1101
+		if ($registration instanceof EE_Registration) {
1102 1102
 			// update the entity mapper attendee
1103
-			$this->_refresh_registration_attendee( $registration );
1103
+			$this->_refresh_registration_attendee($registration);
1104 1104
 			// update the entity mapper answers for reg form questions
1105
-			$this->_refresh_registration_answers( $registration );
1105
+			$this->_refresh_registration_answers($registration);
1106 1106
 			// make sure the cached registration is added to the model entity mapper
1107
-			$registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration );
1107
+			$registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration);
1108 1108
 		} else {
1109 1109
 			EE_Error::add_error(
1110
-				__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1110
+				__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1111 1111
 				__FILE__, __FUNCTION__, __LINE__
1112 1112
 			);
1113 1113
 		}
@@ -1121,15 +1121,15 @@  discard block
 block discarded – undo
1121 1121
 	 * @param 	EE_Registration 	$registration
1122 1122
 	 * @return void
1123 1123
 	 */
1124
-	protected function _refresh_registration_attendee( $registration ) {
1124
+	protected function _refresh_registration_attendee($registration) {
1125 1125
 
1126 1126
 		$attendee = $registration->attendee();
1127 1127
 		// verify object
1128
-		if ( $attendee instanceof EE_Attendee && $attendee->ID() ) {
1128
+		if ($attendee instanceof EE_Attendee && $attendee->ID()) {
1129 1129
 			// make sure the cached attendee is added to the model entity mapper
1130
-			$registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee );
1130
+			$registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
1131 1131
 			// maybe cache primary_attendee_obj ?
1132
-			if ( $registration->is_primary_registrant() ) {
1132
+			if ($registration->is_primary_registrant()) {
1133 1133
 				$this->primary_attendee_obj = $attendee;
1134 1134
 			}
1135 1135
 		}
@@ -1143,19 +1143,19 @@  discard block
 block discarded – undo
1143 1143
 	 * @param 	EE_Registration 	$registration
1144 1144
 	 * @return void
1145 1145
 	 */
1146
-	protected function _refresh_registration_answers( $registration ) {
1146
+	protected function _refresh_registration_answers($registration) {
1147 1147
 
1148 1148
 		// now update the answers
1149
-		foreach ( $registration->answers() as $cache_key => $answer ) {
1149
+		foreach ($registration->answers() as $cache_key => $answer) {
1150 1150
 			// verify object
1151
-			if ( $answer instanceof EE_Answer ) {
1152
-				if ( $answer->ID() ) {
1151
+			if ($answer instanceof EE_Answer) {
1152
+				if ($answer->ID()) {
1153 1153
 					// make sure the cached answer is added to the model entity mapper
1154
-					$answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer );
1154
+					$answer->get_model()->refresh_entity_map_with($answer->ID(), $answer);
1155 1155
 				}
1156 1156
 			} else {
1157 1157
 				EE_Error::add_error(
1158
-					__( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1158
+					__('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1159 1159
 					__FILE__, __FUNCTION__, __LINE__
1160 1160
 				);
1161 1161
 			}
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 	 * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object
1171 1171
 	 */
1172 1172
 	function __wakeup() {
1173
-		foreach ( $this->reg_steps as $reg_step ) {
1173
+		foreach ($this->reg_steps as $reg_step) {
1174 1174
 			$reg_step->checkout = $this;
1175 1175
 		}
1176 1176
 	}
@@ -1186,11 +1186,11 @@  discard block
 block discarded – undo
1186 1186
 	 * @param array $info
1187 1187
 	 * @param bool $display_request
1188 1188
 	 */
1189
-	function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) {
1190
-		if ( WP_DEBUG && false ) {
1191
-			$debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() );
1189
+	function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) {
1190
+		if (WP_DEBUG && false) {
1191
+			$debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array());
1192 1192
 			$default_data = array(
1193
-				$class 		=> $func . '() : ' . $line,
1193
+				$class 		=> $func.'() : '.$line,
1194 1194
 				'request->step' 		=> $this->step,
1195 1195
 				'request->action' 	=> $this->action,
1196 1196
 				'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ?
@@ -1202,24 +1202,24 @@  discard block
 block discarded – undo
1202 1202
 				'reg_url_link' => $this->reg_url_link,
1203 1203
 				'REQ' => $display_request ? $_REQUEST : '',
1204 1204
 			);
1205
-			if ( $this->transaction instanceof EE_Transaction ) {
1206
-				$default_data[ 'TXN_status' ] 		= $this->transaction->status_ID();
1207
-				$default_data[ 'TXN_reg_steps' ] 	= $this->transaction->reg_steps();
1208
-				foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) {
1209
-					$default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID();
1205
+			if ($this->transaction instanceof EE_Transaction) {
1206
+				$default_data['TXN_status'] = $this->transaction->status_ID();
1207
+				$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
1208
+				foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
1209
+					$default_data['registrations'][$REG_ID] = $registration->status_ID();
1210 1210
 				}
1211
-				if ( $this->transaction->ID() ) {
1212
-					$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
1211
+				if ($this->transaction->ID()) {
1212
+					$TXN_ID = 'EE_Transaction: '.$this->transaction->ID();
1213 1213
 					// don't serialize objects
1214
-					$info = $this->_strip_objects( $info );
1215
-					if ( ! isset( $debug_data[ $TXN_ID ] ) ) {
1216
-						$debug_data[ $TXN_ID ] = array();
1214
+					$info = $this->_strip_objects($info);
1215
+					if ( ! isset($debug_data[$TXN_ID])) {
1216
+						$debug_data[$TXN_ID] = array();
1217 1217
 					}
1218
-					$debug_data[ $TXN_ID ][ microtime() ] = array_merge(
1218
+					$debug_data[$TXN_ID][microtime()] = array_merge(
1219 1219
 						$default_data,
1220 1220
 						$info
1221 1221
 					);
1222
-					update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data );
1222
+					update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data);
1223 1223
 				}
1224 1224
 			}
1225 1225
 		}
@@ -1232,23 +1232,23 @@  discard block
 block discarded – undo
1232 1232
 	 * @param array $info
1233 1233
 	 * @return array
1234 1234
 	 */
1235
-	function _strip_objects( $info = array() ) {
1236
-		foreach ( $info as $key => $value ) {
1237
-			if ( is_array( $value )) {
1238
-				$info[ $key ] = $this->_strip_objects( $value );
1239
-			} else if ( is_object( $value ) ) {
1240
-				$object_class = get_class( $value );
1241
-				$info[ $object_class ] = array();
1242
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0;
1243
-				if ( method_exists( $value, 'status' ) ) {
1244
-					$info[ $object_class ][ 'status' ] = $value->status();
1245
-				} else if ( method_exists( $value, 'status_ID' ) ) {
1246
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
1235
+	function _strip_objects($info = array()) {
1236
+		foreach ($info as $key => $value) {
1237
+			if (is_array($value)) {
1238
+				$info[$key] = $this->_strip_objects($value);
1239
+			} else if (is_object($value)) {
1240
+				$object_class = get_class($value);
1241
+				$info[$object_class] = array();
1242
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0;
1243
+				if (method_exists($value, 'status')) {
1244
+					$info[$object_class]['status'] = $value->status();
1245
+				} else if (method_exists($value, 'status_ID')) {
1246
+					$info[$object_class]['status'] = $value->status_ID();
1247 1247
 				}
1248
-				unset( $info[ $key ] );
1248
+				unset($info[$key]);
1249 1249
 			}
1250 1250
 		}
1251
-		return (array)$info;
1251
+		return (array) $info;
1252 1252
 	}
1253 1253
 
1254 1254
 
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 1 patch
Spacing   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-		add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) );
32
-		add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
33
-		add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
34
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
35
-		add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
36
-		add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) );
37
-		add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
31
+		add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters'));
32
+		add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
33
+		add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
34
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
35
+		add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
36
+		add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details'));
37
+		add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
38 38
 		);
39
-		add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 );
39
+		add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1);
40 40
 	}
41 41
 
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * 	ajax switch_spco_billing_form
46 46
 	 */
47 47
 	public static function switch_spco_billing_form() {
48
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
48
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * 	ajax save_payer_details
55 55
 	 */
56 56
 	public static function save_payer_details() {
57
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
57
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
58 58
 	}
59 59
 
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 	ajax get_transaction_details
64 64
 	 */
65 65
 	public static function get_transaction_details() {
66
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
66
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
67 67
 	}
68 68
 
69 69
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @param    EE_Checkout $checkout
92 92
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
93 93
 	 */
94
-	public function __construct( EE_Checkout $checkout ) {
94
+	public function __construct(EE_Checkout $checkout) {
95 95
 		$this->_slug = 'payment_options';
96 96
 		$this->_name = __('Payment Options', 'event_espresso');
97
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
97
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
98 98
 		$this->checkout = $checkout;
99 99
 		$this->_reset_success_message();
100
-		$this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
100
+		$this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
101 101
 	}
102 102
 
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param null $line_item_display
116 116
 	 */
117
-	public function set_line_item_display( $line_item_display ) {
117
+	public function set_line_item_display($line_item_display) {
118 118
 		$this->line_item_display = $line_item_display;
119 119
 	}
120 120
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return void
126 126
 	 */
127 127
 	public function translate_js_strings() {
128
-		EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' );
129
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' );
130
-		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' );
128
+		EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso');
129
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso');
130
+		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso');
131 131
 	}
132 132
 
133 133
 
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 			// 	$ 0.00 transactions (no payment required)
157 157
 			! $this->checkout->payment_required()
158 158
 			// but do NOT remove if current action being called belongs to this reg step
159
-			&& ! is_callable( array( $this, $this->checkout->action ) )
159
+			&& ! is_callable(array($this, $this->checkout->action))
160 160
 			&& ! $this->completed()
161 161
 		) {
162 162
 			// and if so, then we no longer need the Payment Options step
163
-			if ( $this->is_current_step() ) {
163
+			if ($this->is_current_step()) {
164 164
 				$this->checkout->generate_reg_form = false;
165 165
 			}
166
-			$this->checkout->remove_reg_step( $this->_slug );
166
+			$this->checkout->remove_reg_step($this->_slug);
167 167
 			// DEBUG LOG
168 168
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
169 169
 			return false;
170 170
 		}
171 171
 		// load EEM_Payment_Method
172
-		EE_Registry::instance()->load_model( 'Payment_Method' );
172
+		EE_Registry::instance()->load_model('Payment_Method');
173 173
 		// get all active payment methods
174 174
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
175 175
 			$this->checkout->transaction, EEM_Payment_Method::scope_cart
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return bool
184 184
 	 */
185 185
 	public function generate_reg_form() {
186
-		EE_Registry::instance()->load_helper( 'HTML' );
186
+		EE_Registry::instance()->load_helper('HTML');
187 187
 		// reset in case someone changes their mind
188 188
 		$this->_reset_selected_method_of_payment();
189 189
 		// set some defaults
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
 		$sold_out_events = array();
195 195
 		$reg_count = 0;
196 196
 		// loop thru registrations to gather info
197
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
198
-		foreach ( $registrations as $registration ) {
197
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
198
+		foreach ($registrations as $registration) {
199 199
 			/** @var $registration EE_Registration */
200 200
 			$reg_count++;
201 201
 			// if returning registrant is Approved then do NOT do this
202
-			if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) {
203
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) {
202
+			if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) {
203
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
204 204
 					// add event to list of events that are sold out
205
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
205
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
206 206
 					do_action(
207 207
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
208 208
 						$registration->event(),
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 					);
211 211
 				}
212 212
 				// event requires admin approval
213
-				if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) {
213
+				if ($registration->status_ID() == EEM_Registration::status_id_not_approved) {
214 214
 					// add event to list of events with pre-approval reg status
215
-					$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
215
+					$registrations_requiring_pre_approval[$registration->ID()] = $registration;
216 216
 					do_action(
217 217
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
218 218
 						$registration->event(),
@@ -221,29 +221,29 @@  discard block
 block discarded – undo
221 221
 				}
222 222
 			}
223 223
 			// are they allowed to pay now and is there monies owing?
224
-			if ( $registration->owes_monies_and_can_pay() ) {
225
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
224
+			if ($registration->owes_monies_and_can_pay()) {
225
+				$registrations_requiring_payment[$registration->ID()] = $registration;
226 226
 				do_action(
227 227
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
228 228
 					$registration->event(),
229 229
 					$this
230 230
 				);
231
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
232
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
231
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
232
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
233 233
 			}
234 234
 		}
235 235
 		$subsections = array();
236 236
 		// now decide which template to load
237
-		if ( ! empty( $sold_out_events )) {
238
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
237
+		if ( ! empty($sold_out_events)) {
238
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
239 239
 		}
240
-		if ( ! empty( $registrations_requiring_pre_approval )) {
241
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
240
+		if ( ! empty($registrations_requiring_pre_approval)) {
241
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
242 242
 		}
243
-		if ( ! empty( $registrations_for_free_events ) ) {
244
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
243
+		if ( ! empty($registrations_for_free_events)) {
244
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
245 245
 		}
246
-		if ( ! empty( $registrations_requiring_payment ) ) {
246
+		if ( ! empty($registrations_requiring_payment)) {
247 247
 			// autoload Line_Item_Display classes
248 248
 			EEH_Autoloader::register_line_item_filter_autoloaders();
249 249
 			$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 				$this->checkout->cart->get_grand_total()
255 255
 			);
256 256
 			$filtered_line_item_tree = $line_item_filter_processor->process();
257
-			if ( $this->checkout->amount_owing > 0 ) {
257
+			if ($this->checkout->amount_owing > 0) {
258 258
 				EEH_Autoloader::register_line_item_display_autoloaders();
259
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
260
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
259
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
260
+				$subsections['payment_options'] = $this->_display_payment_options(
261 261
 					$this->line_item_display->display_line_item(
262 262
 						$filtered_line_item_tree,
263
-						array( 'registrations' => $registrations )
263
+						array('registrations' => $registrations)
264 264
 					)
265 265
 				);
266 266
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
267
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
267
+				$this->_apply_registration_payments_to_amount_owing($registrations);
268 268
 			}
269 269
 		} else {
270 270
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
298 298
 	 * @return \EE_Line_Item_Filter_Collection
299 299
 	 */
300
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
300
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
301 301
 		$line_item_filter_collection->add(
302 302
 			new EE_Billable_Line_Item_Filter(
303 303
 				EE_Registry::instance()->SSN->checkout()->transaction->registrations(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 				)
306 306
 			)
307 307
 		);
308
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
308
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
309 309
 		return $line_item_filter_collection;
310 310
 	}
311 311
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @return void
320 320
 	 */
321 321
 	protected function _hide_reg_step_submit_button_if_revisit() {
322
-		if ( $this->checkout->revisit ) {
323
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
322
+		if ($this->checkout->revisit) {
323
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
324 324
 		}
325 325
 	}
326 326
 
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 	 * @param \EE_Event[] $sold_out_events_array
332 332
 	 * @return \EE_Form_Section_Proper
333 333
 	 */
334
-	private function _sold_out_events( $sold_out_events_array = array() ) {
334
+	private function _sold_out_events($sold_out_events_array = array()) {
335 335
 		// set some defaults
336 336
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
337 337
 		$sold_out_events = '';
338
-		foreach ( $sold_out_events_array as $sold_out_event ) {
339
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
338
+		foreach ($sold_out_events_array as $sold_out_event) {
339
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
340 340
 		}
341 341
 		return new EE_Form_Section_Proper(
342 342
 			array(
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 				),
349 349
 				'layout_strategy'		=> new EE_Template_Layout(
350 350
 					array(
351
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
351
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
352 352
 						'template_args'  				=> apply_filters(
353 353
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
354 354
 							array(
355 355
 								'sold_out_events' 			=> $sold_out_events,
356 356
 								'sold_out_events_msg' 	=> apply_filters(
357 357
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
358
-									__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' )
358
+									__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso')
359 359
 								)
360 360
 							)
361 361
 						)
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 	 * @param array $registrations_requiring_pre_approval
373 373
 	 * @return \EE_Form_Section_Proper
374 374
 	 */
375
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
375
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
376 376
 		$events_requiring_pre_approval = '';
377
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
378
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
379
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
380
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
377
+		foreach ($registrations_requiring_pre_approval as $registration) {
378
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
379
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
380
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
381 381
 					)
382
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
382
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
383 383
 				);
384 384
 			}
385 385
 		}
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 				),
392 392
 				'layout_strategy'		=> new EE_Template_Layout(
393 393
 					array(
394
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
394
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
395 395
 						'template_args'  				=> apply_filters(
396 396
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
397 397
 							array(
398
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
398
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
399 399
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
400 400
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
401
-									__( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
401
+									__('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
402 402
 								)
403 403
 							)
404 404
 						),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @param \EE_Event[] $registrations_for_free_events
417 417
 	 * @return \EE_Form_Section_Proper
418 418
 	 */
419
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
419
+	private function _no_payment_required($registrations_for_free_events = array()) {
420 420
 		// set some defaults
421 421
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
422 422
 		// generate no_payment_required form
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 				),
429 429
 				'layout_strategy' 	=> new EE_Template_Layout(
430 430
 					array(
431
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
431
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
432 432
 						'template_args'  				=> apply_filters(
433 433
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
434 434
 							array(
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 								'registrations' => array(),
437 437
 								'ticket_count' 	=> array(),
438 438
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
439
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
439
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
440 440
 							)
441 441
 						),
442 442
 					)
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @param string $transaction_details
454 454
 	 * @return \EE_Form_Section_Proper
455 455
 	 */
456
-	private function _display_payment_options( $transaction_details = '' ) {
456
+	private function _display_payment_options($transaction_details = '') {
457 457
 		// has method_of_payment been set by no-js user?
458 458
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
459 459
 		// build payment options form
@@ -465,20 +465,20 @@  discard block
 block discarded – undo
465 465
 						'before_payment_options' => apply_filters(
466 466
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
467 467
 							new EE_Form_Section_Proper(
468
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
468
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
469 469
 							)
470 470
 						),
471 471
 						'payment_options' => $this->_setup_payment_options(),
472 472
 						'after_payment_options' => apply_filters(
473 473
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
474 474
 							new EE_Form_Section_Proper(
475
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
475
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
476 476
 							)
477 477
 						),
478 478
 						'default_hidden_inputs' => $this->reg_step_hidden_inputs(),
479
-						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs( FALSE )
479
+						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs(FALSE)
480 480
 					),
481
-					'layout_strategy'	=> new EE_Template_Layout( array(
481
+					'layout_strategy'	=> new EE_Template_Layout(array(
482 482
 							'layout_template_file' 	=> $this->_template,
483 483
 							'template_args'  				=> apply_filters(
484 484
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	 * @param bool $no_payment_required
503 503
 	 * @return \EE_Form_Section_Proper
504 504
 	 */
505
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
505
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
506 506
 
507 507
 		return new EE_Form_Section_Proper(
508 508
 			array(
509
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
509
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
510 510
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
511 511
 				'subsections' 		=> array(
512 512
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -539,16 +539,16 @@  discard block
 block discarded – undo
539 539
 	 * @access    protected
540 540
 	 * @return    void
541 541
 	 */
542
-	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
542
+	protected function _apply_registration_payments_to_amount_owing($registrations) {
543 543
 		$payments = array();
544
-		foreach ( $registrations as $registration ) {
545
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
544
+		foreach ($registrations as $registration) {
545
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
546 546
 				$payments = $payments + $registration->registration_payments();
547 547
 			}
548 548
 		}
549
-		if ( ! empty( $payments ) ) {
550
-			foreach ( $payments as $payment ) {
551
-				if ( $payment instanceof EE_Registration_Payment ) {
549
+		if ( ! empty($payments)) {
550
+			foreach ($payments as $payment) {
551
+				if ($payment instanceof EE_Registration_Payment) {
552 552
 					$this->checkout->amount_owing -= $payment->amount();
553 553
 				}
554 554
 			}
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 	 * @param 	bool $force_reset
564 564
 	 * @return 	void
565 565
 	 */
566
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
567
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
568
-		if ( $reset_payment_method ) {
566
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
567
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
568
+		if ($reset_payment_method) {
569 569
 			$this->checkout->selected_method_of_payment = NULL;
570 570
 			$this->checkout->payment_method = NULL;
571 571
 			$this->checkout->billing_form = NULL;
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 	 * @param string $selected_method_of_payment
585 585
 	 * 	@return 		EE_Billing_Info_Form
586 586
 	 */
587
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
588
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
587
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
588
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
590 590
 	}
591 591
 
592 592
 
@@ -599,40 +599,40 @@  discard block
 block discarded – undo
599 599
 		// load payment method classes
600 600
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
601 601
 		// switch up header depending on number of available payment methods
602
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
603
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
604
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
602
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
603
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
604
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
605 605
 		$available_payment_methods = array(
606 606
 			// display the "Payment Method" header
607 607
 			'payment_method_header' => new EE_Form_Section_HTML(
608
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
608
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
609 609
 			)
610 610
 		);
611 611
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
612 612
 		$available_payment_method_options = array();
613 613
 		$default_payment_method_option = array();
614 614
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
615
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
615
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
616 616
 		// loop through payment methods
617
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
618
-			if ( $payment_method instanceof EE_Payment_Method ) {
619
-				$payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' );
617
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
618
+			if ($payment_method instanceof EE_Payment_Method) {
619
+				$payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img');
620 620
 				// check if any payment methods are set as default
621 621
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
622
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
622
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
623 623
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
624 624
 					$this->_save_selected_method_of_payment();
625
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
625
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
626 626
 				} else {
627
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
627
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
628 628
 				}
629
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
629
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
630 630
 			}
631 631
 		}
632 632
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
633 633
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
634 634
 		// now generate the actual form  inputs
635
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
635
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
636 636
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
637 637
 
638 638
 		// build the available payment methods form
@@ -652,19 +652,19 @@  discard block
 block discarded – undo
652 652
 	 * @return EE_Payment_Method[]
653 653
 	 */
654 654
 	protected function _get_available_payment_methods() {
655
-		if ( ! empty( $this->checkout->available_payment_methods )) {
655
+		if ( ! empty($this->checkout->available_payment_methods)) {
656 656
 			return $this->checkout->available_payment_methods;
657 657
 		}
658 658
 		$available_payment_methods = array();
659 659
 		// load EEM_Payment_Method
660
-		EE_Registry::instance()->load_model( 'Payment_Method' );
660
+		EE_Registry::instance()->load_model('Payment_Method');
661 661
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
662 662
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
663 663
 		// get all active payment methods
664
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
665
-		foreach ( $payment_methods as $payment_method ) {
666
-			if ( $payment_method instanceof EE_Payment_Method ) {
667
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
664
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
665
+		foreach ($payment_methods as $payment_method) {
666
+			if ($payment_method instanceof EE_Payment_Method) {
667
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
668 668
 			}
669 669
 		}
670 670
 		return $available_payment_methods;
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
 	 * @param 	array $available_payment_method_options
681 681
 	 * @return 	\EE_Form_Section_Proper
682 682
 	 */
683
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
683
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
684 684
 		// generate inputs
685 685
 		return new EE_Form_Section_Proper(
686 686
 			array(
687 687
 				'html_id' 				=> 'ee-available-payment-method-inputs',
688 688
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
689 689
 				'subsections' 		=> array(
690
-					'' => new EE_Radio_Button_Input (
690
+					'' => new EE_Radio_Button_Input(
691 691
 						$available_payment_method_options,
692 692
 						array(
693 693
 							'html_name' 				=> 'selected_method_of_payment',
@@ -711,36 +711,36 @@  discard block
 block discarded – undo
711 711
 	 * @param 	EE_Payment_Method $payment_method
712 712
 	 * @return 	\EE_Form_Section_Proper
713 713
 	 */
714
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
714
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
715 715
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
716 716
 		// generate the billing form for payment method
717
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
717
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
718 718
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
719 719
 		// it's all in the details
720
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
720
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
721 721
 		// add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
722
-		if ( $payment_method->description() ) {
722
+		if ($payment_method->description()) {
723 723
 			$payment_method_info = $payment_method->description();
724
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
725
-			$payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
724
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
725
+			$payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
726 726
 		} else {
727
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
727
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
728 728
 		}
729
-		$info_html .= EEH_HTML::p (
730
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
729
+		$info_html .= EEH_HTML::p(
730
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
731 731
 			'',
732 732
 			'spco-payment-method-desc ee-attention'
733 733
 		);
734 734
 
735 735
 		return new EE_Form_Section_Proper(
736 736
 			array(
737
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
737
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
738 738
 				'html_class' 			=> 'spco-payment-method-info-dv',
739 739
 				// only display the selected or default PM
740 740
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
741 741
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
742 742
 				'subsections' 			=> array(
743
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
743
+					'info' 					=> new EE_Form_Section_HTML($info_html),
744 744
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
745 745
 				)
746 746
 			)
@@ -758,12 +758,12 @@  discard block
 block discarded – undo
758 758
 	 */
759 759
 	public function get_billing_form_html_for_payment_method() {
760 760
 		// how have they chosen to pay?
761
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
761
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
762 762
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
763
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
763
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
764 764
 			return FALSE;
765 765
 		}
766
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
766
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
767 767
             EE_Error::add_success(
768 768
                 apply_filters(
769 769
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -772,20 +772,20 @@  discard block
 block discarded – undo
772 772
             );
773 773
         }
774 774
 		// now generate billing form for selected method of payment
775
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
775
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
776 776
 		// fill form with attendee info if applicable
777
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
778
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
777
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
778
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
779 779
 		}
780 780
 		// and debug content
781
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
782
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
781
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
782
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
783 783
 		}
784 784
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
785
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
785
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
786 786
 		// localize validation rules for main form
787 787
 		$this->checkout->current_step->reg_form->localize_validation_rules();
788
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
788
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
789 789
 		return TRUE;
790 790
 	}
791 791
 
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
 	 * @param EE_Payment_Method $payment_method
799 799
 	 * @return \EE_Billing_Info_Form
800 800
 	 */
801
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
802
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
803
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
804
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
805
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
801
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
802
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
803
+		if ($billing_form instanceof EE_Billing_Info_Form) {
804
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
805
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
806 806
                     EE_Error::add_success(
807 807
                         apply_filters(
808 808
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
809
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
809
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
810 810
                         )
811 811
                     );
812 812
                 }
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	 * @param string 		$request_param
832 832
 	 * @return NULL|string
833 833
 	 */
834
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
834
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
835 835
 		// is selected_method_of_payment set in the request ?
836
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
837
-		if ( $selected_method_of_payment ) {
836
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
837
+		if ($selected_method_of_payment) {
838 838
 			// sanitize it
839
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
840
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
839
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
840
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
841 841
 			// store it in the session so that it's available for all subsequent requests including AJAX
842
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
842
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
843 843
 		} else {
844 844
 			// or is is set in the session ?
845
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
845
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
846 846
 		}
847 847
 		// do ya really really gotta have it?
848
-		if ( empty( $selected_method_of_payment ) && $required ) {
848
+		if (empty($selected_method_of_payment) && $required) {
849 849
 			EE_Error::add_error(
850 850
 				sprintf(
851
-					__( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ),
851
+					__('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'),
852 852
 					'<br/>',
853 853
 					'<br/>',
854
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
854
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
855 855
 				),
856 856
 				__FILE__, __FUNCTION__, __LINE__
857 857
 			);
@@ -877,37 +877,37 @@  discard block
 block discarded – undo
877 877
 	 * @return string
878 878
 	 */
879 879
 	public function switch_payment_method() {
880
-		if ( ! $this->_verify_payment_method_is_set() ) {
880
+		if ( ! $this->_verify_payment_method_is_set()) {
881 881
 			return FALSE;
882 882
 		}
883
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
883
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
884 884
 			EE_Error::add_success(
885 885
 				apply_filters(
886 886
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
887
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
887
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
888 888
 				)
889 889
 			);
890 890
 		}
891 891
 		// generate billing form for selected method of payment if it hasn't been done already
892
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
893
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
892
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
893
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
894 894
 		}
895 895
 		// fill form with attendee info if applicable
896
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
897
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
896
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
897
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
898 898
 		}
899 899
 		// and debug content
900
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
901
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
900
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
901
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
902 902
 		}
903 903
 		// get html and validation rules for form
904
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
905
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
904
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
905
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
906 906
 			// localize validation rules for main form
907
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
908
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
907
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
908
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
909 909
 		} else {
910
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
910
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
911 911
 		}
912 912
 		//prevents advancement to next step
913 913
 		$this->checkout->continue_reg = FALSE;
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	protected function _verify_payment_method_is_set() {
924 924
 		// generate billing form for selected method of payment if it hasn't been done already
925
-		if ( empty( $this->checkout->selected_method_of_payment )) {
925
+		if (empty($this->checkout->selected_method_of_payment)) {
926 926
 			// how have they chosen to pay?
927
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
927
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
928 928
 		}
929 929
 		// verify payment method
930
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
930
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
931 931
 			// get payment method for selected method of payment
932 932
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
933 933
 		}
@@ -947,23 +947,23 @@  discard block
 block discarded – undo
947 947
 	 * @return void
948 948
 	 */
949 949
 	public function save_payer_details_via_ajax() {
950
-		if ( ! $this->_verify_payment_method_is_set() ) {
950
+		if ( ! $this->_verify_payment_method_is_set()) {
951 951
 			return;
952 952
 		}
953 953
 		// generate billing form for selected method of payment if it hasn't been done already
954
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
955
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
954
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
955
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
956 956
 		}
957 957
 		// generate primary attendee from payer info if applicable
958 958
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
959 959
 			$attendee = $this->_create_attendee_from_request_data();
960
-			if ( $attendee instanceof EE_Attendee ) {
961
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
962
-					if ( $registration->is_primary_registrant() ) {
960
+			if ($attendee instanceof EE_Attendee) {
961
+				foreach ($this->checkout->transaction->registrations() as $registration) {
962
+					if ($registration->is_primary_registrant()) {
963 963
 						$this->checkout->primary_attendee_obj = $attendee;
964
-						$registration->_add_relation_to( $attendee, 'Attendee' );
965
-						$registration->set_attendee_id( $attendee->ID() );
966
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
964
+						$registration->_add_relation_to($attendee, 'Attendee');
965
+						$registration->set_attendee_id($attendee->ID());
966
+						$registration->update_cache_after_object_save('Attendee', $attendee);
967 967
 					}
968 968
 				}
969 969
 			}
@@ -976,56 +976,56 @@  discard block
 block discarded – undo
976 976
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
977 977
 	 * @return \EE_Attendee
978 978
 	 */
979
-	protected function _create_attendee_from_request_data(){
979
+	protected function _create_attendee_from_request_data() {
980 980
 		// get State ID
981
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
982
-		if ( ! empty( $STA_ID )) {
981
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
982
+		if ( ! empty($STA_ID)) {
983 983
 			// can we get state object from name ?
984
-			EE_Registry::instance()->load_model( 'State' );
985
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
986
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
984
+			EE_Registry::instance()->load_model('State');
985
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
986
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
987 987
 		}
988 988
 		// get Country ISO
989
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
990
-		if ( ! empty( $CNT_ISO )) {
989
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
990
+		if ( ! empty($CNT_ISO)) {
991 991
 			// can we get country object from name ?
992
-			EE_Registry::instance()->load_model( 'Country' );
993
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
994
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
992
+			EE_Registry::instance()->load_model('Country');
993
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
994
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
995 995
 		}
996 996
 		// grab attendee data
997 997
 		$attendee_data = array(
998
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
999
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1000
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1001
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1002
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1003
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
998
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
999
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1000
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1001
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1002
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1003
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1004 1004
 			'STA_ID' 				=> $STA_ID,
1005 1005
 			'CNT_ISO' 			=> $CNT_ISO,
1006
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1007
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1006
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1007
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1008 1008
 		);
1009 1009
 		// validate the email address since it is the most important piece of info
1010
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
1011
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1010
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
1011
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1012 1012
 		}
1013 1013
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1014
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
1015
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1014
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
1015
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1016 1016
 				'ATT_fname' => $attendee_data['ATT_fname'],
1017 1017
 				'ATT_lname' => $attendee_data['ATT_lname'],
1018 1018
 				'ATT_email' => $attendee_data['ATT_email']
1019 1019
 			));
1020
-			if ( $existing_attendee instanceof EE_Attendee ) {
1020
+			if ($existing_attendee instanceof EE_Attendee) {
1021 1021
 				return $existing_attendee;
1022 1022
 			}
1023 1023
 		}
1024 1024
 		// no existing attendee? kk let's create a new one
1025 1025
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1026
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
-		return EE_Attendee::new_instance( $attendee_data );
1026
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
+		return EE_Attendee::new_instance($attendee_data);
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1045,22 +1045,22 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	public function process_reg_step() {
1047 1047
 		// how have they chosen to pay?
1048
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1048
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1049 1049
 		// choose your own adventure based on method_of_payment
1050
-		switch(  $this->checkout->selected_method_of_payment ) {
1050
+		switch ($this->checkout->selected_method_of_payment) {
1051 1051
 
1052 1052
 			case 'events_sold_out' :
1053 1053
 				$this->checkout->redirect = TRUE;
1054 1054
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1055
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1055
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1056 1056
 				// mark this reg step as completed
1057 1057
 				$this->set_completed();
1058 1058
 				return FALSE;
1059 1059
 				break;
1060 1060
 
1061 1061
 			case 'payments_closed' :
1062
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1063
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1062
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1063
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1064 1064
 				}
1065 1065
 				// mark this reg step as completed
1066 1066
 				$this->set_completed();
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
 				break;
1069 1069
 
1070 1070
 			case 'no_payment_required' :
1071
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1072
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1071
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1072
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1073 1073
 				}
1074 1074
 				// mark this reg step as completed
1075 1075
 				$this->set_completed();
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
 			default:
1080 1080
 				$payment_successful = $this->_process_payment();
1081
-				if ( $payment_successful ) {
1081
+				if ($payment_successful) {
1082 1082
 					$this->checkout->continue_reg = true;
1083
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1083
+					$this->_maybe_set_completed($this->checkout->payment_method);
1084 1084
 				} else {
1085 1085
 					$this->checkout->continue_reg = false;
1086 1086
 				}
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 	 * @param \EE_Payment_Method $payment_method
1099 1099
 	 * @return void
1100 1100
 	 */
1101
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1102
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1101
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1102
+		switch ($payment_method->type_obj()->payment_occurs()) {
1103 1103
 			case EE_PMT_Base::offsite :
1104 1104
 				break;
1105 1105
 			case EE_PMT_Base::onsite :
@@ -1122,15 +1122,15 @@  discard block
 block discarded – undo
1122 1122
 	public function update_reg_step() {
1123 1123
 		$success = TRUE;
1124 1124
 		// if payment required
1125
-		if ( $this->checkout->transaction->total() > 0 ) {
1126
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1125
+		if ($this->checkout->transaction->total() > 0) {
1126
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1127 1127
 			// attempt payment via payment method
1128 1128
 			$success = $this->process_reg_step();
1129 1129
 		}
1130
-		if ( $success && ! $this->checkout->redirect ) {
1131
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1130
+		if ($success && ! $this->checkout->redirect) {
1131
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1132 1132
 			 // set return URL
1133
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1133
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1134 1134
 		}
1135 1135
 		return $success;
1136 1136
 	}
@@ -1150,24 +1150,24 @@  discard block
 block discarded – undo
1150 1150
 		// clear any previous errors related to not selecting a payment method
1151 1151
 //		EE_Error::overwrite_errors();
1152 1152
 		// ya gotta make a choice man
1153
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1154
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1153
+		if (empty($this->checkout->selected_method_of_payment)) {
1154
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1155 1155
 			return FALSE;
1156 1156
 		}
1157 1157
 		// get EE_Payment_Method object
1158
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1158
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1159 1159
 			return FALSE;
1160 1160
 		}
1161 1161
 		// setup billing form
1162
-		if ( $this->checkout->payment_method->is_on_site() ) {
1163
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1162
+		if ($this->checkout->payment_method->is_on_site()) {
1163
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1164 1164
 			// bad billing form ?
1165
-			if ( ! $this->_billing_form_is_valid() ) {
1165
+			if ( ! $this->_billing_form_is_valid()) {
1166 1166
 				return FALSE;
1167 1167
 			}
1168 1168
 		}
1169 1169
 		// ensure primary registrant has been fully processed
1170
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1170
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1171 1171
 			return FALSE;
1172 1172
 		}
1173 1173
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1175,24 +1175,24 @@  discard block
 block discarded – undo
1175 1175
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1176 1176
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1177 1177
 		// attempt payment
1178
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1178
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1179 1179
 		// process results
1180
-		$payment = $this->_validate_payment( $payment );
1181
-		$payment = $this->_post_payment_processing( $payment );
1180
+		$payment = $this->_validate_payment($payment);
1181
+		$payment = $this->_post_payment_processing($payment);
1182 1182
 		// verify payment
1183
-		if ( $payment instanceof EE_Payment ) {
1183
+		if ($payment instanceof EE_Payment) {
1184 1184
 			// store that for later
1185 1185
 			$this->checkout->payment = $payment;
1186 1186
 			/** @type EE_Transaction_Processor $transaction_processor */
1187
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1187
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1188 1188
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1189
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1190
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1189
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1190
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1191 1191
 				return true;
1192 1192
 			} else {
1193 1193
 				return false;
1194 1194
 			}
1195
-		} else if ( $payment === true ) {
1195
+		} else if ($payment === true) {
1196 1196
 			// please note that offline payment methods will NOT make a payment,
1197 1197
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1198 1198
 			$this->checkout->payment = $payment;
@@ -1211,10 +1211,10 @@  discard block
 block discarded – undo
1211 1211
 	 * @return bool
1212 1212
 	 */
1213 1213
 	public function redirect_form() {
1214
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1214
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1215 1215
 		$html = $payment_method_billing_info->get_html_and_js();
1216 1216
 		$html .= $this->checkout->redirect_form;
1217
-		EE_Registry::instance()->REQ->add_output( $html );
1217
+		EE_Registry::instance()->REQ->add_output($html);
1218 1218
 		return TRUE;
1219 1219
 	}
1220 1220
 
@@ -1227,36 +1227,36 @@  discard block
 block discarded – undo
1227 1227
 	 * @return bool
1228 1228
 	 */
1229 1229
 	private function _billing_form_is_valid() {
1230
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1230
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1231 1231
 			return TRUE;
1232 1232
 		}
1233
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1234
-			if ( $this->checkout->billing_form->was_submitted() ) {
1233
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1234
+			if ($this->checkout->billing_form->was_submitted()) {
1235 1235
 				$this->checkout->billing_form->receive_form_submission();
1236
-				if ( $this->checkout->billing_form->is_valid() ) {
1236
+				if ($this->checkout->billing_form->is_valid()) {
1237 1237
 					return TRUE;
1238 1238
 				}
1239 1239
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1240 1240
 				$error_strings = array();
1241
-				foreach( $validation_errors as $validation_error ){
1242
-					if( $validation_error instanceof EE_Validation_Error ){
1241
+				foreach ($validation_errors as $validation_error) {
1242
+					if ($validation_error instanceof EE_Validation_Error) {
1243 1243
 						$form_section = $validation_error->get_form_section();
1244
-						if( $form_section instanceof EE_Form_Input_Base ){
1244
+						if ($form_section instanceof EE_Form_Input_Base) {
1245 1245
 							$label = $form_section->html_label_text();
1246
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1246
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1247 1247
 							$label = $form_section->name();
1248
-						}else{
1249
-							$label = __( 'Validation Error', 'event_espresso' );
1248
+						} else {
1249
+							$label = __('Validation Error', 'event_espresso');
1250 1250
 						}
1251
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1251
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1252 1252
 					}
1253 1253
 				}
1254
-				EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings )  ), __FILE__, __FUNCTION__, __LINE__ );
1254
+				EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__);
1255 1255
 			} else {
1256
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1256
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1257 1257
 			}
1258 1258
 		} else {
1259
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1259
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1260 1260
 		}
1261 1261
 		return FALSE;
1262 1262
 	}
@@ -1274,9 +1274,9 @@  discard block
 block discarded – undo
1274 1274
 	 */
1275 1275
 		private function _setup_primary_registrant_prior_to_payment() {
1276 1276
 			// check if transaction has a primary registrant and that it has a related Attendee object
1277
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1277
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1278 1278
 				// need to at least gather some primary registrant data before attempting payment
1279
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1279
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1280 1280
 					return FALSE;
1281 1281
 				}
1282 1282
 			}
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
 			// grab the primary_registration object
1285 1285
 			$primary_registration = $this->checkout->transaction->primary_registration();
1286 1286
 			/** @type EE_Transaction_Processor $transaction_processor */
1287
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1287
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1288 1288
 			// at this point we'll consider a TXN to not have been failed
1289
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1289
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1290 1290
 			// save the TXN ( which clears cached copy of primary_registration)
1291 1291
 			$this->checkout->transaction->save();
1292 1292
 			// grab TXN ID and save it to the primary_registration
1293
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1293
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1294 1294
 			// save what we have so far
1295 1295
 			$primary_registration->save();
1296 1296
 			return TRUE;
@@ -1307,41 +1307,41 @@  discard block
 block discarded – undo
1307 1307
 		private function _capture_primary_registration_data_from_billing_form() {
1308 1308
 			// convert billing form data into an attendee
1309 1309
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1310
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1310
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1311 1311
 				EE_Error::add_error(
1312 1312
 					sprintf(
1313
-						__( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1313
+						__('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1314 1314
 						'<br/>',
1315
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1315
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1316 1316
 					), __FILE__, __FUNCTION__, __LINE__
1317 1317
 				);
1318 1318
 				return FALSE;
1319 1319
 			}
1320 1320
 			$primary_registration = $this->checkout->transaction->primary_registration();
1321
-			if ( ! $primary_registration instanceof EE_Registration ) {
1321
+			if ( ! $primary_registration instanceof EE_Registration) {
1322 1322
 				EE_Error::add_error(
1323 1323
 					sprintf(
1324
-						__( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1324
+						__('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1325 1325
 						'<br/>',
1326
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1326
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1327 1327
 					), __FILE__, __FUNCTION__, __LINE__
1328 1328
 				);
1329 1329
 				return FALSE;
1330 1330
 			}
1331
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1331
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1332 1332
 				EE_Error::add_error(
1333 1333
 					sprintf(
1334
-						__( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1334
+						__('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1335 1335
 						'<br/>',
1336
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1336
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1337 1337
 					), __FILE__, __FUNCTION__, __LINE__
1338 1338
 				);
1339 1339
 				return FALSE;
1340 1340
 			}
1341 1341
 			/** @type EE_Registration_Processor $registration_processor */
1342
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1342
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1343 1343
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1344
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1344
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1345 1345
 
1346 1346
 			return TRUE;
1347 1347
 		}
@@ -1357,35 +1357,35 @@  discard block
 block discarded – undo
1357 1357
 	 */
1358 1358
 		private function _get_payment_method_for_selected_method_of_payment() {
1359 1359
 			// get EE_Payment_Method object
1360
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1361
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1360
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1361
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1362 1362
 			} else {
1363 1363
 				// load EEM_Payment_Method
1364
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1364
+				EE_Registry::instance()->load_model('Payment_Method');
1365 1365
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1366 1366
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1367
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1367
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1368 1368
 			}
1369 1369
 			// verify $payment_method
1370
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1370
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1371 1371
 				// not a payment
1372 1372
 				EE_Error::add_error(
1373 1373
 					sprintf(
1374
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1374
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1375 1375
 						'<br/>',
1376
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1376
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1377 1377
 					), __FILE__, __FUNCTION__, __LINE__
1378 1378
 				);
1379 1379
 				return NULL;
1380 1380
 			}
1381 1381
 			// and verify it has a valid Payment_Method Type object
1382
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1382
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1383 1383
 				// not a payment
1384 1384
 				EE_Error::add_error(
1385 1385
 					sprintf(
1386
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1386
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1387 1387
 						'<br/>',
1388
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1388
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1389 1389
 					), __FILE__, __FUNCTION__, __LINE__
1390 1390
 				);
1391 1391
 				return NULL;
@@ -1404,30 +1404,30 @@  discard block
 block discarded – undo
1404 1404
 	 * 	@type 	EE_Payment_Method $payment_method
1405 1405
 	 * 	@return 	mixed	EE_Payment | boolean
1406 1406
 	 */
1407
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1408
-		$payment =NULL;
1407
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1408
+		$payment = NULL;
1409 1409
 		$this->checkout->transaction->save();
1410
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1411
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1410
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1411
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1412 1412
 			return FALSE;
1413 1413
 		}
1414 1414
 		try {
1415
-			$payment_processor->set_revisit( $this->checkout->revisit );
1415
+			$payment_processor->set_revisit($this->checkout->revisit);
1416 1416
 			// generate payment object
1417 1417
 			$payment = $payment_processor->process_payment(
1418 1418
 				$payment_method,
1419 1419
 				$this->checkout->transaction,
1420 1420
 				$this->checkout->amount_owing,
1421 1421
 				$this->checkout->billing_form,
1422
-				$this->_get_return_url( $payment_method ),
1422
+				$this->_get_return_url($payment_method),
1423 1423
 				'CART',
1424 1424
 				$this->checkout->admin_request,
1425 1425
 				TRUE,
1426 1426
 				$this->reg_step_url()
1427 1427
 			);
1428 1428
 
1429
-		} catch( Exception $e ) {
1430
-			$this->_handle_payment_processor_exception( $e );
1429
+		} catch (Exception $e) {
1430
+			$this->_handle_payment_processor_exception($e);
1431 1431
 		}
1432 1432
 		return $payment;
1433 1433
 	}
@@ -1441,12 +1441,12 @@  discard block
 block discarded – undo
1441 1441
 	 * @param \Exception $e
1442 1442
 	 * @return void
1443 1443
 	 */
1444
-	protected function _handle_payment_processor_exception( Exception $e ) {
1444
+	protected function _handle_payment_processor_exception(Exception $e) {
1445 1445
 		EE_Error::add_error(
1446 1446
 			sprintf(
1447
-				__( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ),
1447
+				__('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'),
1448 1448
 				'<br/>',
1449
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1449
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1450 1450
 				$e->getMessage(),
1451 1451
 				$e->getFile(),
1452 1452
 				$e->getLine()
@@ -1463,9 +1463,9 @@  discard block
 block discarded – undo
1463 1463
 	 * @param \EE_Payment_Method $payment_method
1464 1464
 	 * @return string
1465 1465
 	 */
1466
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1466
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1467 1467
 		$return_url = '';
1468
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1468
+		switch ($payment_method->type_obj()->payment_occurs()) {
1469 1469
 
1470 1470
 			case EE_PMT_Base::offsite :
1471 1471
 				$return_url = add_query_arg(
@@ -1496,18 +1496,18 @@  discard block
 block discarded – undo
1496 1496
 	 * @param EE_Payment $payment
1497 1497
 	 * @return EE_Payment | FALSE
1498 1498
 	 */
1499
-	private function _validate_payment( $payment = NULL ) {
1500
-		if (  $this->checkout->payment_method->is_off_line() ) {
1499
+	private function _validate_payment($payment = NULL) {
1500
+		if ($this->checkout->payment_method->is_off_line()) {
1501 1501
 			return TRUE;
1502 1502
 		}
1503 1503
 		// verify payment object
1504
-		if ( ! $payment instanceof EE_Payment ) {
1504
+		if ( ! $payment instanceof EE_Payment) {
1505 1505
 			// not a payment
1506 1506
 			EE_Error::add_error(
1507 1507
 				sprintf(
1508
-					__( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1508
+					__('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1509 1509
 					'<br/>',
1510
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1510
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1511 1511
 				), __FILE__, __FUNCTION__, __LINE__
1512 1512
 			);
1513 1513
 			return FALSE;
@@ -1524,23 +1524,23 @@  discard block
 block discarded – undo
1524 1524
 	 * @param EE_Payment $payment
1525 1525
 	 * @return bool
1526 1526
 	 */
1527
-	private function _post_payment_processing( $payment = NULL ) {
1527
+	private function _post_payment_processing($payment = NULL) {
1528 1528
 		// On-Site payment?
1529
-		if ( $this->checkout->payment_method->is_on_site() ) {
1530
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1529
+		if ($this->checkout->payment_method->is_on_site()) {
1530
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1531 1531
 				//$this->_setup_redirect_for_next_step();
1532 1532
 				$this->checkout->continue_reg = false;
1533 1533
 			}
1534 1534
 			// Off-Site payment?
1535
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1535
+		} else if ($this->checkout->payment_method->is_off_site()) {
1536 1536
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1537
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1538
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
1537
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1538
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
1539 1539
 				$this->checkout->redirect = TRUE;
1540 1540
 				$this->checkout->redirect_form = $payment->redirect_form();
1541
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1541
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1542 1542
 				// set JSON response
1543
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1543
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1544 1544
 				// set cron job for finalizing the TXN
1545 1545
 				// in case the user does not return from the off-site gateway
1546 1546
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1548,21 +1548,21 @@  discard block
 block discarded – undo
1548 1548
 					$this->checkout->transaction->ID()
1549 1549
 				);
1550 1550
 				// and lastly, let's bump the payment status to pending
1551
-				$payment->set_status( EEM_Payment::status_id_pending );
1551
+				$payment->set_status(EEM_Payment::status_id_pending);
1552 1552
 				$payment->save();
1553 1553
 			} else {
1554 1554
 				// not a payment
1555 1555
 				$this->checkout->continue_reg = false;
1556 1556
 				EE_Error::add_error(
1557 1557
 					sprintf(
1558
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1558
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1559 1559
 						'<br/>',
1560
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1560
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1561 1561
 					), __FILE__, __FUNCTION__, __LINE__
1562 1562
 				);
1563 1563
 			}
1564 1564
 			// Off-Line payment?
1565
-		} else if ( $payment === TRUE ) {
1565
+		} else if ($payment === TRUE) {
1566 1566
 			//$this->_setup_redirect_for_next_step();
1567 1567
 			return TRUE;
1568 1568
 		} else {
@@ -1598,65 +1598,65 @@  discard block
 block discarded – undo
1598 1598
 	 * @return bool
1599 1599
 	 * @throws \EE_Error
1600 1600
 	 */
1601
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1601
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1602 1602
 		// off-line payment? carry on
1603
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1603
+		if ($payment_occurs == EE_PMT_Base::offline) {
1604 1604
 			return true;
1605 1605
 		}
1606 1606
 		// verify payment validity
1607
-		if ( $payment instanceof EE_Payment ) {
1608
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
1607
+		if ($payment instanceof EE_Payment) {
1608
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
1609 1609
 			$msg = $payment->gateway_response();
1610 1610
 			// check results
1611
-			switch ( $payment->status() ) {
1611
+			switch ($payment->status()) {
1612 1612
 
1613 1613
 				// good payment
1614 1614
 				case EEM_Payment::status_id_approved :
1615
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1615
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1616 1616
 					return TRUE;
1617 1617
 					break;
1618 1618
 
1619 1619
 				// slow payment
1620 1620
 				case EEM_Payment::status_id_pending :
1621
-					if ( empty( $msg )) {
1622
-						$msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' );
1621
+					if (empty($msg)) {
1622
+						$msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso');
1623 1623
 					}
1624
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1624
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1625 1625
 					return TRUE;
1626 1626
 					break;
1627 1627
 
1628 1628
 				// don't wanna payment
1629 1629
 				case EEM_Payment::status_id_cancelled :
1630
-					if ( empty( $msg )) {
1630
+					if (empty($msg)) {
1631 1631
 						$msg = _n(
1632 1632
 							'Payment cancelled. Please try again.',
1633 1633
 							'Payment cancelled. Please try again or select another method of payment.',
1634
-							count( $this->checkout->available_payment_methods ),
1634
+							count($this->checkout->available_payment_methods),
1635 1635
 							'event_espresso'
1636 1636
 						);
1637 1637
 					}
1638
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1638
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1639 1639
 					return FALSE;
1640 1640
 					break;
1641 1641
 
1642 1642
 				// not enough payment
1643 1643
 				case EEM_Payment::status_id_declined :
1644
-					if ( empty( $msg )) {
1644
+					if (empty($msg)) {
1645 1645
 						$msg = _n(
1646 1646
 							'We\'re sorry but your payment was declined. Please try again.',
1647 1647
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1648
-							count( $this->checkout->available_payment_methods ),
1648
+							count($this->checkout->available_payment_methods),
1649 1649
 							'event_espresso'
1650 1650
 						);
1651 1651
 					}
1652
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1652
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1653 1653
 					return FALSE;
1654 1654
 					break;
1655 1655
 
1656 1656
 				// bad payment
1657 1657
 				case EEM_Payment::status_id_failed :
1658
-					if ( ! empty( $msg ) ) {
1659
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1658
+					if ( ! empty($msg)) {
1659
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1660 1660
 						return false;
1661 1661
 					}
1662 1662
 					// default to error below
@@ -1666,14 +1666,14 @@  discard block
 block discarded – undo
1666 1666
 		}
1667 1667
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1668 1668
 		// the payment processing is just running slower than the registrant's request
1669
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1669
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1670 1670
 			return true;
1671 1671
 		}
1672 1672
 		EE_Error::add_error(
1673 1673
 				sprintf(
1674
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1674
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1675 1675
 					'<br/>',
1676
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1676
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1677 1677
 				),
1678 1678
 				__FILE__, __FUNCTION__, __LINE__
1679 1679
 			);
@@ -1706,13 +1706,13 @@  discard block
 block discarded – undo
1706 1706
 	public function process_gateway_response() {
1707 1707
 		$payment = null;
1708 1708
 		// how have they chosen to pay?
1709
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1709
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1710 1710
 		// get EE_Payment_Method object
1711
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1711
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1712 1712
 			$this->checkout->continue_reg = false;
1713 1713
 			return false;
1714 1714
 		}
1715
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1715
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1716 1716
 			return false;
1717 1717
 		}
1718 1718
 		$this->_validate_offsite_return();
@@ -1726,23 +1726,23 @@  discard block
 block discarded – undo
1726 1726
 		//	true
1727 1727
 		//);
1728 1728
 		// verify TXN
1729
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1729
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1730 1730
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1731
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1731
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1732 1732
 				$this->checkout->continue_reg = false;
1733 1733
 				return false;
1734 1734
 			}
1735
-			$payment = $this->_process_off_site_payment( $gateway );
1736
-			$payment = $this->_process_cancelled_payments( $payment );
1737
-			$payment = $this->_validate_payment( $payment );
1735
+			$payment = $this->_process_off_site_payment($gateway);
1736
+			$payment = $this->_process_cancelled_payments($payment);
1737
+			$payment = $this->_validate_payment($payment);
1738 1738
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1739
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1739
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1740 1740
 				//$this->_setup_redirect_for_next_step();
1741 1741
 				// store that for later
1742 1742
 				$this->checkout->payment = $payment;
1743 1743
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
1744 1744
 				// because we will complete this step during the IPN processing then
1745
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) {
1745
+				if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) {
1746 1746
 					$this->set_completed();
1747 1747
 				}
1748 1748
 				return true;
@@ -1765,19 +1765,19 @@  discard block
 block discarded – undo
1765 1765
 	 * @return bool
1766 1766
 	 */
1767 1767
 	private function _validate_offsite_return() {
1768
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1769
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1768
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1769
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1770 1770
 			// Houston... we might have a problem
1771 1771
 			$invalid_TXN = false;
1772 1772
 			// first gather some info
1773
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1773
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1774 1774
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1775 1775
 			// let's start by retrieving the cart for this TXN
1776
-			$cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction );
1777
-			if ( $cart instanceof EE_Cart ) {
1776
+			$cart = EE_Cart::get_cart_from_txn($this->checkout->transaction);
1777
+			if ($cart instanceof EE_Cart) {
1778 1778
 				// verify that the current cart has tickets
1779 1779
 				$tickets = $cart->get_tickets();
1780
-				if ( empty( $tickets ) ) {
1780
+				if (empty($tickets)) {
1781 1781
 					$invalid_TXN = true;
1782 1782
 				}
1783 1783
 			} else {
@@ -1785,39 +1785,39 @@  discard block
 block discarded – undo
1785 1785
 			}
1786 1786
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1787 1787
 			// validate current Session ID and compare against valid TXN session ID
1788
-			if ( EE_Session::instance()->id() === null ) {
1788
+			if (EE_Session::instance()->id() === null) {
1789 1789
 				$invalid_TXN = true;
1790
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1790
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1791 1791
 				// WARNING !!!
1792 1792
 				// this could be PayPal sending back duplicate requests (ya they do that)
1793 1793
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1794 1794
 				// so now we need to determine if this current TXN looks valid or not
1795 1795
 				/** @type EE_Transaction_Processor $transaction_processor */
1796
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1796
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1797 1797
 				// has this step even been started ?
1798
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1798
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1799 1799
 				) {
1800 1800
 					// really? you're half way through this reg step, but you never started it ?
1801 1801
 					$invalid_TXN = true;
1802 1802
 				}
1803 1803
 			}
1804
-			if ( $invalid_TXN ) {
1804
+			if ($invalid_TXN) {
1805 1805
 				// is the valid TXN completed ?
1806
-				if ( $valid_TXN instanceof EE_Transaction ) {
1806
+				if ($valid_TXN instanceof EE_Transaction) {
1807 1807
 					/** @type EE_Transaction_Processor $transaction_processor */
1808
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1808
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1809 1809
 					// has this step even been started ?
1810
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1811
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1810
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1811
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1812 1812
 						// so it **looks** like this is a double request from PayPal
1813 1813
 						// so let's try to pick up where we left off
1814 1814
 						$this->checkout->transaction = $valid_TXN;
1815
-						$this->checkout->refresh_all_entities( true );
1815
+						$this->checkout->refresh_all_entities(true);
1816 1816
 						return;
1817 1817
 					}
1818 1818
 				}
1819 1819
 				// you appear to be lost?
1820
-				$this->_redirect_wayward_request( $primary_registrant );
1820
+				$this->_redirect_wayward_request($primary_registrant);
1821 1821
 			}
1822 1822
 		}
1823 1823
 	}
@@ -1831,16 +1831,16 @@  discard block
 block discarded – undo
1831 1831
 	 * @param \EE_Registration $primary_registrant
1832 1832
 	 * @return bool
1833 1833
 	 */
1834
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1835
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1834
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1835
+		if ( ! $primary_registrant instanceof EE_Registration) {
1836 1836
 			// try redirecting based on the current TXN
1837 1837
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1838
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1838
+			if ( ! $primary_registrant instanceof EE_Registration) {
1839 1839
 				EE_Error::add_error(
1840 1840
 					sprintf(
1841
-						__( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1841
+						__('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1842 1842
 						'<br/>',
1843
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1843
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1844 1844
 					),
1845 1845
 					__FILE__, __FUNCTION__, __LINE__
1846 1846
 				);
@@ -1868,16 +1868,16 @@  discard block
 block discarded – undo
1868 1868
 	 * @param \EE_Offsite_Gateway $gateway
1869 1869
 	 * @return \EE_Payment
1870 1870
 	 */
1871
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1871
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1872 1872
 		try {
1873 1873
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1874
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1874
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1875 1875
 				$payment = $this->checkout->transaction->last_payment();
1876 1876
 				//$payment_source = 'last_payment';
1877 1877
 			} else {
1878 1878
 				// get payment details and process results
1879 1879
 				/** @type EE_Payment_Processor $payment_processor */
1880
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1880
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1881 1881
 				$payment = $payment_processor->process_ipn(
1882 1882
 					$_REQUEST,
1883 1883
 					$this->checkout->transaction,
@@ -1887,14 +1887,14 @@  discard block
 block discarded – undo
1887 1887
 				);
1888 1888
 				//$payment_source = 'process_ipn';
1889 1889
 			}
1890
-		} catch ( Exception $e ) {
1890
+		} catch (Exception $e) {
1891 1891
 			// let's just eat the exception and try to move on using any previously set payment info
1892 1892
 			$payment = $this->checkout->transaction->last_payment();
1893 1893
 			//$payment_source = 'last_payment after Exception';
1894 1894
 			// but if we STILL don't have a payment object
1895
-			if ( ! $payment instanceof EE_Payment ) {
1895
+			if ( ! $payment instanceof EE_Payment) {
1896 1896
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1897
-				$this->_handle_payment_processor_exception( $e );
1897
+				$this->_handle_payment_processor_exception($e);
1898 1898
 			}
1899 1899
 		}
1900 1900
 		// DEBUG LOG
@@ -1918,13 +1918,13 @@  discard block
 block discarded – undo
1918 1918
 	 * @param EE_Payment $payment
1919 1919
 	 * @return EE_Payment | FALSE
1920 1920
 	 */
1921
-	private function _process_cancelled_payments( $payment = NULL ) {
1921
+	private function _process_cancelled_payments($payment = NULL) {
1922 1922
 		if (
1923
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
1923
+			isset($_REQUEST['ee_cancel_payment'])
1924 1924
 			&& $payment instanceof EE_Payment
1925 1925
 			&& $payment->status() == EEM_Payment::status_id_failed
1926 1926
 		) {
1927
-			$payment->set_status( EEM_Payment::status_id_cancelled );
1927
+			$payment->set_status(EEM_Payment::status_id_cancelled);
1928 1928
 		}
1929 1929
 		return $payment;
1930 1930
 	}
@@ -1941,23 +1941,23 @@  discard block
 block discarded – undo
1941 1941
 	public function get_transaction_details_for_gateways() {
1942 1942
 		$txn_details = array();
1943 1943
 		// ya gotta make a choice man
1944
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1944
+		if (empty($this->checkout->selected_method_of_payment)) {
1945 1945
 			$txn_details = array(
1946
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
1946
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
1947 1947
 			);
1948 1948
 		}
1949 1949
 		// get EE_Payment_Method object
1950 1950
 		if (
1951
-			empty( $txn_details ) &&
1951
+			empty($txn_details) &&
1952 1952
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
1953 1953
 		) {
1954 1954
 			$txn_details = array(
1955 1955
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
1956
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
1956
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
1957 1957
 			);
1958 1958
 		}
1959
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
1960
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
1959
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
1960
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
1961 1961
 			$txn_details = array(
1962 1962
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
1963 1963
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
1969 1969
 				'payment_amount' => $this->checkout->amount_owing,
1970 1970
 				'return_url' 				=> $return_url,
1971
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
1971
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
1972 1972
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
1973 1973
 					array(
1974 1974
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 				)
1978 1978
 			);
1979 1979
 		}
1980
-		echo json_encode( $txn_details );
1980
+		echo json_encode($txn_details);
1981 1981
 		exit();
1982 1982
 	}
1983 1983
 
Please login to merge, or discard this patch.