Completed
Branch BUG-9548-transaction-completio... (b1c41e)
by
unknown
519:42 queued 503:28
created
core/services/address/formatters/NullAddressFormatter.php 1 patch
Spacing   +3 added lines, -3 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\services\address\formatters;
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
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string $CNT_ISO
29 29
 	 * @return string
30 30
 	 */
31
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
31
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
32 32
 		return null;
33 33
 	}
34 34
 
Please login to merge, or discard this patch.
core/services/address/formatters/AddressFormatter.php 1 patch
Spacing   +5 added lines, -5 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\services\address\formatters;
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
 
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 		// swap address part placeholders for the real text
42 42
 		$formatted_address = str_replace(
43 43
 		// find
44
-			array( '{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}' ),
44
+			array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'),
45 45
 			// replace
46
-			array( $address, $address2, $city, $state, $zip, $country ),
46
+			array($address, $address2, $city, $state, $zip, $country),
47 47
 			// string
48 48
 			$formatted_address
49 49
 		);
50 50
 		// remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks
51
-		return preg_replace( '/%+/', $sub, trim( $formatted_address, '%' ) );
51
+		return preg_replace('/%+/', $sub, trim($formatted_address, '%'));
52 52
 	}
53 53
 
54 54
 
Please login to merge, or discard this patch.
core/services/address/formatters/MultiLineAddressFormatter.php 1 patch
Spacing   +4 added lines, -4 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\services\address\formatters;
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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param string $CNT_ISO
30 30
 	 * @return string
31 31
 	 */
32
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
32
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
33 33
 		$address_formats = apply_filters(
34 34
 			'FHEE__EE_MultiLine_Address_Formatter__address_formats',
35 35
 			array(
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 			)
41 41
 		);
42 42
 		// if the incoming country has a set format, use that, else use the default
43
-		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ]
43
+		$formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO]
44 44
 			: $address_formats['ZZ'];
45 45
 		return $this->parse_formatted_address(
46 46
 			$address,
Please login to merge, or discard this patch.
core/services/address/formatters/InlineAddressFormatter.php 1 patch
Spacing   +4 added lines, -4 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\services\address\formatters;
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
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string $CNT_ISO
29 29
 	 * @return string
30 30
 	 */
31
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
31
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
32 32
 		$address_formats = apply_filters(
33 33
 			'FHEE__EE_Inline_Address_Formatter__address_formats',
34 34
 			array(
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			)
40 40
 		);
41 41
 		// if the incoming country has a set format, use that, else use the default
42
-		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ]
42
+		$formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO]
43 43
 			: $address_formats['ZZZ'];
44 44
 		return $this->parse_formatted_address(
45 45
 			$address,
Please login to merge, or discard this patch.
core/EE_Log.core.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  *
4 4
  * Class EE_Log
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return EE_Log
63 63
 	 */
64 64
 	public static function instance() {
65
-		if ( ! self::$_instance instanceof EE_Log ) {
65
+		if ( ! self::$_instance instanceof EE_Log) {
66 66
 			self::$_instance = new self();
67 67
 		}
68 68
 		return self::$_instance;
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	private function __construct() {
76 76
 
77
-		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) {
77
+		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) {
78 78
 			return;
79 79
 		}
80 80
 
81
-		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS;
81
+		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS;
82 82
 		$this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name();
83 83
 		$this->_log = '';
84 84
 		$this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name();
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 		$this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url;
87 87
 		$this->_remote_log = '';
88 88
 
89
-		add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 );
90
-		add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 );
91
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
92
-			add_action( 'shutdown', array( $this, 'write_log' ), 9999 );
89
+		add_action('admin_init', array($this, 'verify_filesystem'), -10);
90
+		add_action('AHEE_log', array($this, 'log'), 10, 4);
91
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
92
+			add_action('shutdown', array($this, 'write_log'), 9999);
93 93
 			// if WP_DEBUG
94
-			add_action( 'shutdown', array( $this, 'write_debug' ), 9999 );
94
+			add_action('shutdown', array($this, 'write_debug'), 9999);
95 95
 		}
96
-		if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) {
97
-			add_action( 'shutdown', array( $this, 'send_log' ), 9999 );
96
+		if (EE_Registry::instance()->CFG->admin->use_remote_logging) {
97
+			add_action('shutdown', array($this, 'send_log'), 9999);
98 98
 		}
99 99
 
100 100
 	}
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function verify_filesystem() {
110 110
 		try {
111
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file );
112
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file );
113
-			EEH_File::add_htaccess_deny_from_all( $this->_logs_folder );
114
-		} catch( EE_Error $e ){
115
-			EE_Error::add_error( sprintf( __(  'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
111
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file);
112
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file);
113
+			EEH_File::add_htaccess_deny_from_all($this->_logs_folder);
114
+		} catch (EE_Error $e) {
115
+			EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
116 116
 			return;
117 117
 		}
118 118
 	}
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @param string $type
130 130
 	 * @return string
131 131
 	 */
132
-	private function _format_message( $file = '', $function = '', $message = '', $type = '' ) {
133
-		$msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
134
-		$msg .= '[' . current_time( 'mysql' ) . '] ';
135
-		$msg .= ! empty( $file ) ? basename( $file ) : '';
136
-		$msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : '';
137
-		$msg .= ! empty( $function ) ? $function . '()' : '';
132
+	private function _format_message($file = '', $function = '', $message = '', $type = '') {
133
+		$msg = '----------------------------------------------------------------------------------------'.PHP_EOL;
134
+		$msg .= '['.current_time('mysql').'] ';
135
+		$msg .= ! empty($file) ? basename($file) : '';
136
+		$msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
137
+		$msg .= ! empty($function) ? $function.'()' : '';
138 138
 		$msg .= PHP_EOL;
139
-		$type = ! empty( $type ) ? $type : 'log message';
140
-		$msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
139
+		$type = ! empty($type) ? $type : 'log message';
140
+		$msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : '';
141 141
 		return $msg;
142 142
 	}
143 143
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param string $message
153 153
 	 * @param string $type
154 154
 	 */
155
-	public function log( $file = '', $function = '', $message = '', $type = '' ) {
156
-		$this->_log .= $this->_format_message( $file, $function, $message, $type );
155
+	public function log($file = '', $function = '', $message = '', $type = '') {
156
+		$this->_log .= $this->_format_message($file, $function, $message, $type);
157 157
 	}
158 158
 
159 159
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	public function write_log() {
166 166
 		try {
167 167
 			//get existing log file and append new log info
168
-			$this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log;
169
-			EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' );
170
-		} catch( EE_Error $e ){
171
-			EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
168
+			$this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log;
169
+			EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log');
170
+		} catch (EE_Error $e) {
171
+			EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
172 172
 			return;
173 173
 		}
174 174
 	}
@@ -181,31 +181,31 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function send_log() {
183 183
 
184
-		if ( empty( $this->_remote_logging_url )) {
184
+		if (empty($this->_remote_logging_url)) {
185 185
 			return;
186 186
 		}
187 187
 
188
-		$data = 'domain=' . $_SERVER['HTTP_HOST'];
189
-		$data .= '&ip=' . $_SERVER['SERVER_ADDR'];
190
-		$data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE'];
191
-		$data .= '&time=' . time();
192
-		$data .= '&remote_log=' . $this->_log;
193
-		$data .= '&request_array=' . json_encode( $_REQUEST );
188
+		$data = 'domain='.$_SERVER['HTTP_HOST'];
189
+		$data .= '&ip='.$_SERVER['SERVER_ADDR'];
190
+		$data .= '&server_type='.$_SERVER['SERVER_SOFTWARE'];
191
+		$data .= '&time='.time();
192
+		$data .= '&remote_log='.$this->_log;
193
+		$data .= '&request_array='.json_encode($_REQUEST);
194 194
 		$data .= '&action=save';
195 195
 
196
-		if ( defined( 'EELOGGING_PASS' )) {
197
-			$data .= '&pass=' . EELOGGING_PASS;
196
+		if (defined('EELOGGING_PASS')) {
197
+			$data .= '&pass='.EELOGGING_PASS;
198 198
 		}
199
-		if ( defined( 'EELOGGING_KEY' )) {
200
-			$data .= '&key=' . EELOGGING_KEY;
199
+		if (defined('EELOGGING_KEY')) {
200
+			$data .= '&key='.EELOGGING_KEY;
201 201
 		}
202 202
 
203
-		$c = curl_init( $this->_remote_logging_url );
204
-		curl_setopt( $c, CURLOPT_POST, TRUE );
205
-		curl_setopt( $c, CURLOPT_POSTFIELDS, $data );
206
-		curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE );
207
-		curl_exec( $c );
208
-		curl_close( $c );
203
+		$c = curl_init($this->_remote_logging_url);
204
+		curl_setopt($c, CURLOPT_POST, TRUE);
205
+		curl_setopt($c, CURLOPT_POSTFIELDS, $data);
206
+		curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
207
+		curl_exec($c);
208
+		curl_close($c);
209 209
 	}
210 210
 
211 211
 
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
 	 * previous entries are overwritten
217 217
 	 */
218 218
 	public function write_debug() {
219
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
219
+		if (defined('WP_DEBUG') && WP_DEBUG) {
220 220
 			$this->_debug_log = '';
221
-			foreach ( $_GET as $key => $value ) {
222
-				$this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
221
+			foreach ($_GET as $key => $value) {
222
+				$this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
223 223
 			}
224
-			foreach ( $_POST as $key => $value ) {
225
-				$this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
224
+			foreach ($_POST as $key => $value) {
225
+				$this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
226 226
 			}
227 227
 			try {
228
-				EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' );
229
-			} catch( EE_Error $e ){
230
-				EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
228
+				EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log');
229
+			} catch (EE_Error $e) {
230
+				EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
231 231
 				return;
232 232
 			}
233 233
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * __clone
240 240
 	 */
241 241
 	public function __clone() {
242
-		trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR );
242
+		trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR);
243 243
 	}
244 244
 
245 245
 
Please login to merge, or discard this patch.
core/business/EE_Processor_Base.class.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @param boolean $IPN
34 34
 	 */
35
-	public static function set_IPN( $IPN ) {
36
-		self::$IPN = filter_var( $IPN, FILTER_VALIDATE_BOOLEAN );
35
+	public static function set_IPN($IPN) {
36
+		self::$IPN = filter_var($IPN, FILTER_VALIDATE_BOOLEAN);
37 37
 	}
38 38
 
39 39
 
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param bool $revisit
45 45
 	 * @return void
46 46
 	 */
47
-	public function set_revisit( $revisit = false ) {
48
-		$this->_revisit = filter_var( $revisit, FILTER_VALIDATE_BOOLEAN );
47
+	public function set_revisit($revisit = false) {
48
+		$this->_revisit = filter_var($revisit, FILTER_VALIDATE_BOOLEAN);
49 49
 	}
50 50
 
51 51
 
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	 * @param array $info
61 61
 	 * @param bool $display_request
62 62
 	 */
63
-	protected function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) {
64
-		if ( WP_DEBUG && false ) {
65
-			if ( $transaction instanceof EE_Transaction ) {
63
+	protected function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) {
64
+		if (WP_DEBUG && false) {
65
+			if ($transaction instanceof EE_Transaction) {
66 66
 				// don't serialize objects
67
-				$info = EEH_Debug_Tools::strip_objects( $info );
68
-				if ( $transaction->ID() ) {
69
-					$info[ 'TXN_status' ] = $transaction->status_ID();
70
-					$info[ 'TXN_reg_steps' ] = $transaction->reg_steps();
71
-					$index = 'EE_Transaction: ' . $transaction->ID();
72
-					EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index );
67
+				$info = EEH_Debug_Tools::strip_objects($info);
68
+				if ($transaction->ID()) {
69
+					$info['TXN_status'] = $transaction->status_ID();
70
+					$info['TXN_reg_steps'] = $transaction->reg_steps();
71
+					$index = 'EE_Transaction: '.$transaction->ID();
72
+					EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
73 73
 				}
74 74
 			}
75 75
 		}
Please login to merge, or discard this patch.
core/business/EE_Registration_Processor.class.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Registration_Processor
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public static function instance() {
62 62
 		// check if class object is instantiated
63
-		if ( ! self::$_instance instanceof EE_Registration_Processor ) {
63
+		if ( ! self::$_instance instanceof EE_Registration_Processor) {
64 64
 			self::$_instance = new self();
65 65
 		}
66 66
 		return self::$_instance;
@@ -96,37 +96,37 @@  discard block
 block discarded – undo
96 96
 	 * @return \EE_Registration | null
97 97
 	 * @throws \EE_Error
98 98
 	 */
99
-	public function generate_ONE_registration_from_line_item( EE_Line_Item $line_item, EE_Transaction $transaction, $att_nmbr = 1, $total_ticket_count = 1 ) {
99
+	public function generate_ONE_registration_from_line_item(EE_Line_Item $line_item, EE_Transaction $transaction, $att_nmbr = 1, $total_ticket_count = 1) {
100 100
 		// grab the related ticket object for this line_item
101 101
 		$ticket = $line_item->ticket();
102
-		if ( ! $ticket instanceof EE_Ticket ) {
103
-			EE_Error::add_error( sprintf( __( "Line item %s did not contain a valid ticket", "event_espresso" ), $line_item->ID() ), __FILE__, __FUNCTION__, __LINE__ );
102
+		if ( ! $ticket instanceof EE_Ticket) {
103
+			EE_Error::add_error(sprintf(__("Line item %s did not contain a valid ticket", "event_espresso"), $line_item->ID()), __FILE__, __FUNCTION__, __LINE__);
104 104
 			return null;
105 105
 		}
106
-		$first_datetime = $ticket->get_first_related( 'Datetime' );
107
-		if ( ! $first_datetime instanceof EE_Datetime ) {
108
-			EE_Error::add_error( sprintf( __( "The ticket (%s) is not associated with any valid datetimes.", "event_espresso" ), $ticket->name() ), __FILE__, __FUNCTION__, __LINE__ );
106
+		$first_datetime = $ticket->get_first_related('Datetime');
107
+		if ( ! $first_datetime instanceof EE_Datetime) {
108
+			EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__);
109 109
 			return null;
110 110
 		}
111
-		$event = $first_datetime->get_first_related( 'Event' );
112
-		if ( ! $event instanceof EE_Event ) {
113
-			EE_Error::add_error( sprintf( __( "The ticket (%s) is not associated with a valid event.", "event_espresso" ), $ticket->name() ), __FILE__, __FUNCTION__, __LINE__ );
111
+		$event = $first_datetime->get_first_related('Event');
112
+		if ( ! $event instanceof EE_Event) {
113
+			EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with a valid event.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__);
114 114
 			return null;
115 115
 		}
116
-		$reg_url_link = $this->generate_reg_url_link( $att_nmbr, $line_item );
116
+		$reg_url_link = $this->generate_reg_url_link($att_nmbr, $line_item);
117 117
 
118
-		if( $this->_reg_final_price_per_tkt_line_item === null ) {
119
-			$this->_reg_final_price_per_tkt_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() );
118
+		if ($this->_reg_final_price_per_tkt_line_item === null) {
119
+			$this->_reg_final_price_per_tkt_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item());
120 120
 		}
121 121
 		//ok now find this new registration's final price
122
-		if( isset( $this->_reg_final_price_per_tkt_line_item[ $line_item->ID() ] ) ) {
123
-			$final_price = $this->_reg_final_price_per_tkt_line_item[ $line_item->ID() ] ;
124
-		}else{
125
-			$message = sprintf( __( 'The ticket line item (ID:%1$d) had no entry in the reg_final_price_per_tkt_line_item array.', 'event_espresso' ), $line_item->ID() );
126
-			if( WP_DEBUG ){
127
-				throw new EE_Error( $message );
128
-			}else{
129
-				EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message );
122
+		if (isset($this->_reg_final_price_per_tkt_line_item[$line_item->ID()])) {
123
+			$final_price = $this->_reg_final_price_per_tkt_line_item[$line_item->ID()];
124
+		} else {
125
+			$message = sprintf(__('The ticket line item (ID:%1$d) had no entry in the reg_final_price_per_tkt_line_item array.', 'event_espresso'), $line_item->ID());
126
+			if (WP_DEBUG) {
127
+				throw new EE_Error($message);
128
+			} else {
129
+				EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
130 130
 			}
131 131
 			$final_price = $ticket->get_ticket_total_with_taxes();
132 132
 
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 				'REG_url_link'    => $reg_url_link
147 147
 			)
148 148
 		);
149
-		$registration->set_reg_code( $this->generate_reg_code( $registration ) );
149
+		$registration->set_reg_code($this->generate_reg_code($registration));
150 150
 		$registration->save();
151
-		$registration->_add_relation_to( $event, 'Event', array(), $event->ID() );
152
-		$registration->_add_relation_to( $line_item->ticket(), 'Ticket', array(), $line_item->ticket()->ID() );
153
-		$transaction->_add_relation_to( $registration, 'Registration' );
151
+		$registration->_add_relation_to($event, 'Event', array(), $event->ID());
152
+		$registration->_add_relation_to($line_item->ticket(), 'Ticket', array(), $line_item->ticket()->ID());
153
+		$transaction->_add_relation_to($registration, 'Registration');
154 154
 		return $registration;
155 155
 	}
156 156
 
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 	 * @param EE_Line_Item | string $item
164 164
 	 * @return string
165 165
 	 */
166
-	public function generate_reg_url_link( $att_nmbr, $item ) {
166
+	public function generate_reg_url_link($att_nmbr, $item) {
167 167
 		$reg_url_link = $item instanceof EE_Line_Item ? $item->code() : $item;
168
-		$reg_url_link = $att_nmbr . '-' . md5( $reg_url_link . microtime() );
168
+		$reg_url_link = $att_nmbr.'-'.md5($reg_url_link.microtime());
169 169
 		return $reg_url_link;
170 170
 	}
171 171
 
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 	 * @param \EE_Registration $registration
178 178
 	 * @return string
179 179
 	 */
180
-	public function generate_reg_code( EE_Registration $registration ) {
180
+	public function generate_reg_code(EE_Registration $registration) {
181 181
 	// figure out where to start parsing the reg code
182
-		$chars = strpos( $registration->reg_url_link(), '-' ) + 5;
182
+		$chars = strpos($registration->reg_url_link(), '-') + 5;
183 183
 		// TXN_ID + TKT_ID + first 3 and last 3 chars of reg_url_link
184 184
 		$new_reg_code = array(
185 185
 			$registration->transaction_ID(),
186 186
 			$registration->ticket_ID(),
187
-			substr( $registration->reg_url_link(), 0, $chars )
187
+			substr($registration->reg_url_link(), 0, $chars)
188 188
 		);
189 189
 		// now put it all together
190
-		$new_reg_code = implode( '-', $new_reg_code );
191
-		return apply_filters( 'FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', $new_reg_code, $registration );
190
+		$new_reg_code = implode('-', $new_reg_code);
191
+		return apply_filters('FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', $new_reg_code, $registration);
192 192
 	}
193 193
 
194 194
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 * @param int $REG_ID
198 198
 	 * @return string
199 199
 	 */
200
-	public function old_reg_status( $REG_ID ) {
201
-		return isset( $this->_old_reg_status[ $REG_ID ] ) ? $this->_old_reg_status[ $REG_ID ] : null;
200
+	public function old_reg_status($REG_ID) {
201
+		return isset($this->_old_reg_status[$REG_ID]) ? $this->_old_reg_status[$REG_ID] : null;
202 202
 	}
203 203
 
204 204
 
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 * @param int $REG_ID
208 208
 	 * @param string $old_reg_status
209 209
 	 */
210
-	public function set_old_reg_status( $REG_ID, $old_reg_status ) {
210
+	public function set_old_reg_status($REG_ID, $old_reg_status) {
211 211
 		// only set the first time
212
-		if ( ! isset( $this->_old_reg_status[ $REG_ID ] ) ) {
213
-			$this->_old_reg_status[ $REG_ID ] = $old_reg_status;
212
+		if ( ! isset($this->_old_reg_status[$REG_ID])) {
213
+			$this->_old_reg_status[$REG_ID] = $old_reg_status;
214 214
 		}
215 215
 	}
216 216
 
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @param int $REG_ID
221 221
 	 * @return string
222 222
 	 */
223
-	public function new_reg_status( $REG_ID ) {
224
-		return isset( $this->_new_reg_status[ $REG_ID ] ) ? $this->_new_reg_status[ $REG_ID ] : null;
223
+	public function new_reg_status($REG_ID) {
224
+		return isset($this->_new_reg_status[$REG_ID]) ? $this->_new_reg_status[$REG_ID] : null;
225 225
 	}
226 226
 
227 227
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 	 * @param int $REG_ID
231 231
 	 * @param string $new_reg_status
232 232
 	 */
233
-	public function set_new_reg_status( $REG_ID, $new_reg_status ) {
234
-		$this->_new_reg_status[ $REG_ID ] = $new_reg_status;
233
+	public function set_new_reg_status($REG_ID, $new_reg_status) {
234
+		$this->_new_reg_status[$REG_ID] = $new_reg_status;
235 235
 	}
236 236
 
237 237
 
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 	 * @param int $REG_ID
243 243
 	 * @return bool
244 244
 	 */
245
-	public function reg_status_updated( $REG_ID ) {
246
-		return $this->new_reg_status( $REG_ID ) !== $this->old_reg_status( $REG_ID ) ? true : false;
245
+	public function reg_status_updated($REG_ID) {
246
+		return $this->new_reg_status($REG_ID) !== $this->old_reg_status($REG_ID) ? true : false;
247 247
 	}
248 248
 
249 249
 
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
 	 * @param bool 	$save TRUE will save the registration if the status is updated, FALSE will leave that up to client code
258 258
 	 * 	@return boolean
259 259
 	 */
260
-	public function manually_update_registration_status( EE_Registration $registration, $new_reg_status = '', $save = true ) {
260
+	public function manually_update_registration_status(EE_Registration $registration, $new_reg_status = '', $save = true) {
261 261
 		// set initial REG_Status
262
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
262
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
263 263
 		// set incoming REG_Status
264
-		$this->set_new_reg_status( $registration->ID(), $new_reg_status );
264
+		$this->set_new_reg_status($registration->ID(), $new_reg_status);
265 265
 		// toggle reg status but only if it has changed and the user can do so
266 266
 		if (
267
-			$this->reg_status_updated( $registration->ID() ) &&
268
-			EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registration', 'toggle_registration_status', $registration->ID() )
267
+			$this->reg_status_updated($registration->ID()) &&
268
+			EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'toggle_registration_status', $registration->ID())
269 269
 		) {
270 270
 			// change status to new value
271
-			if ( $registration->set_status( $this->new_reg_status( $registration->ID() ) )) {
272
-				if ( $save ) {
271
+			if ($registration->set_status($this->new_reg_status($registration->ID()))) {
272
+				if ($save) {
273 273
 					$registration->save();
274 274
 				}
275 275
 			}
@@ -290,30 +290,30 @@  discard block
 block discarded – undo
290 290
 	 * @return void
291 291
 	 * @throws \EE_Error
292 292
 	 */
293
-	public function toggle_incomplete_registration_status_to_default( EE_Registration $registration, $save = TRUE ) {
293
+	public function toggle_incomplete_registration_status_to_default(EE_Registration $registration, $save = TRUE) {
294 294
 		$existing_reg_status = $registration->status_ID();
295 295
 		// set initial REG_Status
296
-		$this->set_old_reg_status( $registration->ID(), $existing_reg_status );
296
+		$this->set_old_reg_status($registration->ID(), $existing_reg_status);
297 297
 		// is the registration currently incomplete ?
298
-		if ( $registration->status_ID() === EEM_Registration::status_id_incomplete ) {
298
+		if ($registration->status_ID() === EEM_Registration::status_id_incomplete) {
299 299
 			// grab default reg status for the event, if set
300 300
 			$event_default_registration_status = $registration->event()->default_registration_status();
301 301
 			// if no default reg status is set for the event, then use the global value
302
-			$STS_ID = ! empty( $event_default_registration_status )
302
+			$STS_ID = ! empty($event_default_registration_status)
303 303
 				? $event_default_registration_status
304 304
 				: EE_Registry::instance()->CFG->registration->default_STS_ID;
305 305
 			// if the event default reg status is approved, then downgrade temporarily to payment pending to ensure that payments are triggered
306 306
 			$STS_ID = $STS_ID === EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $STS_ID;
307 307
 			// set incoming REG_Status
308
-			$this->set_new_reg_status( $registration->ID(), $STS_ID );
309
-			$registration->set_status( $STS_ID );
310
-			if ( $save ) {
308
+			$this->set_new_reg_status($registration->ID(), $STS_ID);
309
+			$registration->set_status($STS_ID);
310
+			if ($save) {
311 311
 				$registration->save();
312 312
 			}
313 313
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
314
-			if ( ! EE_Processor_Base::$IPN ) {
314
+			if ( ! EE_Processor_Base::$IPN) {
315 315
 				// otherwise, send out notifications
316
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
316
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
317 317
 			}
318 318
 			// DEBUG LOG
319 319
 			//$this->log(
@@ -337,25 +337,25 @@  discard block
 block discarded – undo
337 337
 	 * @param bool 	$save TRUE will save the registration if the status is updated, FALSE will leave that up to client code
338 338
 	 * @return boolean
339 339
 	 */
340
-	public function toggle_registration_status_for_default_approved_events( EE_Registration $registration, $save = TRUE ) {
340
+	public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) {
341 341
 		// set initial REG_Status
342
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
342
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
343 343
 		// if not already, toggle reg status to approved IF the event default reg status is approved
344 344
 		if (
345 345
 			$registration->status_ID() !== EEM_Registration::status_id_approved &&
346 346
 			$registration->event()->default_registration_status() == EEM_Registration::status_id_approved
347 347
 		) {
348 348
 			// set incoming REG_Status
349
-			$this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved );
349
+			$this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved);
350 350
 			// toggle status to approved
351
-			$registration->set_status( EEM_Registration::status_id_approved );
352
-			if ( $save ) {
351
+			$registration->set_status(EEM_Registration::status_id_approved);
352
+			if ($save) {
353 353
 				$registration->save();
354 354
 			}
355 355
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
356
-			if ( ! EE_Processor_Base::$IPN ) {
356
+			if ( ! EE_Processor_Base::$IPN) {
357 357
 				// otherwise, send out notifications
358
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
358
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
359 359
 			}
360 360
 			// DEBUG LOG
361 361
 			//$this->log(
@@ -383,19 +383,19 @@  discard block
 block discarded – undo
383 383
 	 * @return bool
384 384
 	 * @throws \EE_Error
385 385
 	 */
386
-	public function toggle_registration_status_if_no_monies_owing( EE_Registration $registration, $save = TRUE, $additional_details = array() ) {
386
+	public function toggle_registration_status_if_no_monies_owing(EE_Registration $registration, $save = TRUE, $additional_details = array()) {
387 387
 		// set initial REG_Status
388
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
388
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
389 389
 		//EEH_Debug_Tools::printr( $additional_details, '$additional_details', __FILE__, __LINE__ );
390 390
 		// was a payment just made ?
391 391
 		if (
392
-			isset( $additional_details[ 'payment_updates' ], $additional_details[ 'last_payment' ] ) &&
393
-			$additional_details[ 'payment_updates' ] &&
394
-			$additional_details[ 'last_payment' ] instanceof EE_Payment
392
+			isset($additional_details['payment_updates'], $additional_details['last_payment']) &&
393
+			$additional_details['payment_updates'] &&
394
+			$additional_details['last_payment'] instanceof EE_Payment
395 395
 		) {
396
-			$payment = $additional_details[ 'last_payment' ];
396
+			$payment = $additional_details['last_payment'];
397 397
 			$total_paid = 0;
398
-			foreach ( self::$_amount_paid as $reg => $amount_paid ) {
398
+			foreach (self::$_amount_paid as $reg => $amount_paid) {
399 399
 				$total_paid += $amount_paid;
400 400
 			}
401 401
 		} else {
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 					$registration->transaction()->is_completed() ||
420 420
 					$registration->transaction()->is_overpaid() ||
421 421
 					$registration->transaction()->is_free() ||
422
-					apply_filters( 'FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration )
422
+					apply_filters('FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration)
423 423
 				) || (
424 424
 					$payment instanceof EE_Payment &&
425 425
 					$payment->is_approved() &&
426 426
 					// this specific registration has not yet been paid for
427
-					! isset( self::$_amount_paid[ $registration->ID() ] ) &&
427
+					! isset(self::$_amount_paid[$registration->ID()]) &&
428 428
 					// payment amount, less what we have already attributed to other registrations, is greater than this reg's final price
429 429
 					$payment->amount() - $total_paid >= $registration->final_price()
430 430
 				)
431 431
 			)
432 432
 		) {
433 433
 			// mark as paid
434
-			self::$_amount_paid[ $registration->ID() ] = $registration->final_price();
434
+			self::$_amount_paid[$registration->ID()] = $registration->final_price();
435 435
 			// track new REG_Status
436
-			$this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved );
436
+			$this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved);
437 437
 			// toggle status to approved
438
-			$registration->set_status( EEM_Registration::status_id_approved );
439
-			if ( $save ) {
438
+			$registration->set_status(EEM_Registration::status_id_approved);
439
+			if ($save) {
440 440
 				$registration->save();
441 441
 			}
442 442
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
443
-			if ( ! EE_Processor_Base::$IPN ) {
443
+			if ( ! EE_Processor_Base::$IPN) {
444 444
 				// otherwise, send out notifications
445
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
445
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
446 446
 			}
447 447
 			// DEBUG LOG
448 448
 			//$this->log(
@@ -468,19 +468,19 @@  discard block
 block discarded – undo
468 468
 	 * @param array 	$additional_details
469 469
 	 * @return void
470 470
 	 */
471
-	public function trigger_registration_update_notifications( $registration, $additional_details = array() ) {
471
+	public function trigger_registration_update_notifications($registration, $additional_details = array()) {
472 472
 		try {
473
-			if ( ! $registration instanceof EE_Registration ) {
474
-				throw new EE_Error( __( 'An invalid registration was received.', 'event_espresso' ) );
473
+			if ( ! $registration instanceof EE_Registration) {
474
+				throw new EE_Error(__('An invalid registration was received.', 'event_espresso'));
475 475
 			}
476
-			EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $registration->transaction(), $additional_details ), false, 'EE_Transaction: ' . $registration->transaction()->ID() );
476
+			EEH_Debug_Tools::log(__CLASS__, __FUNCTION__, __LINE__, array($registration->transaction(), $additional_details), false, 'EE_Transaction: '.$registration->transaction()->ID());
477 477
 			do_action(
478 478
 				'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
479 479
 				$registration,
480 480
 				$additional_details
481 481
 			);
482
-		} catch( Exception $e ) {
483
-			EE_Error::add_error( $e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine() );
482
+		} catch (Exception $e) {
483
+			EE_Error::add_error($e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine());
484 484
 		}
485 485
 	}
486 486
 
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 	 * @param array 	$additional_details
494 494
 	 * @return bool
495 495
 	 */
496
-	public function update_registration_after_checkout_or_payment(  EE_Registration $registration, $additional_details = array() ) {
496
+	public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) {
497 497
 		// set initial REG_Status
498
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
498
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
499 499
 
500 500
 		// if the registration status gets updated, then save the registration
501
-		if ( $this->toggle_registration_status_for_default_approved_events( $registration, false ) || $this->toggle_registration_status_if_no_monies_owing( $registration, false, $additional_details )) {
501
+		if ($this->toggle_registration_status_for_default_approved_events($registration, false) || $this->toggle_registration_status_if_no_monies_owing($registration, false, $additional_details)) {
502 502
 			$registration->save();
503 503
 		}
504 504
 
505 505
 		// set new  REG_Status
506
-		$this->set_new_reg_status( $registration->ID(), $registration->status_ID() );
507
-		return $this->reg_status_updated( $registration->ID() ) && $this->new_reg_status( $registration->ID() ) == EEM_Registration::status_id_approved ? true : false;
506
+		$this->set_new_reg_status($registration->ID(), $registration->status_ID());
507
+		return $this->reg_status_updated($registration->ID()) && $this->new_reg_status($registration->ID()) == EEM_Registration::status_id_approved ? true : false;
508 508
 	}
509 509
 
510 510
 	/**
@@ -514,19 +514,19 @@  discard block
 block discarded – undo
514 514
 	 * @param boolean $save_regs whether to immediately save registrations in this function or not
515 515
 	 * @return void
516 516
 	 */
517
-	public function update_registration_final_prices( $transaction, $save_regs = true ) {
518
-		$reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() );
519
-		foreach( $transaction->registrations() as $registration ) {
520
-			$line_item = EEM_Line_Item::instance()->get_line_item_for_registration( $registration );
521
-			if( isset( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ) ) {
522
-				$registration->set_final_price( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] );
523
-				if( $save_regs ) {
517
+	public function update_registration_final_prices($transaction, $save_regs = true) {
518
+		$reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item());
519
+		foreach ($transaction->registrations() as $registration) {
520
+			$line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration);
521
+			if (isset($reg_final_price_per_ticket_line_item[$line_item->ID()])) {
522
+				$registration->set_final_price($reg_final_price_per_ticket_line_item[$line_item->ID()]);
523
+				if ($save_regs) {
524 524
 					$registration->save();
525 525
 				}
526 526
 			}
527 527
 		}
528 528
 		//and make sure there's no rounding problem
529
-		$this->fix_reg_final_price_rounding_issue( $transaction );
529
+		$this->fix_reg_final_price_rounding_issue($transaction);
530 530
 	}
531 531
 
532 532
 	/**
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 	 * @param EE_Transaction $transaction
543 543
 	 * @return boolean success verifying that there is NO difference after this method is done
544 544
 	 */
545
-	public function fix_reg_final_price_rounding_issue( $transaction ) {
545
+	public function fix_reg_final_price_rounding_issue($transaction) {
546 546
 		$reg_final_price_sum = EEM_Registration::instance()->sum(
547 547
 			array(
548 548
 				array(
@@ -551,9 +551,9 @@  discard block
 block discarded – undo
551 551
 			),
552 552
 			'REG_final_price'
553 553
 		);
554
-		$diff =  $transaction->total() - floatval( $reg_final_price_sum );
554
+		$diff = $transaction->total() - floatval($reg_final_price_sum);
555 555
 		//ok then, just grab one of the registrations
556
-		if( $diff != 0 ) {
556
+		if ($diff != 0) {
557 557
 			$a_reg = EEM_Registration::instance()->get_one(
558 558
 					array(
559 559
 						array(
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 					));
563 563
 			$success = $a_reg instanceof EE_Registration ? $a_reg->save(
564 564
 				array(
565
-					'REG_final_price' => ( $a_reg->final_price() + $diff )
565
+					'REG_final_price' => ($a_reg->final_price() + $diff)
566 566
 				)
567 567
 			) : false;
568 568
 			return $success ? true : false;
Please login to merge, or discard this patch.
core/business/EE_Transaction_Payments.class.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Transaction_Payments
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public static function instance() {
46 46
 		// check if class object is instantiated
47
-		if ( ! self::$_instance instanceof EE_Transaction_Payments ) {
47
+		if ( ! self::$_instance instanceof EE_Transaction_Payments) {
48 48
 			self::$_instance = new self();
49 49
 		}
50 50
 		return self::$_instance;
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	/**
73 73
 	 * @param string $old_txn_status
74 74
 	 */
75
-	public function set_old_txn_status( $old_txn_status ) {
75
+	public function set_old_txn_status($old_txn_status) {
76 76
 		// only set the first time
77
-		if ( $this->_old_txn_status === null ) {
77
+		if ($this->_old_txn_status === null) {
78 78
 			$this->_old_txn_status = $old_txn_status;
79 79
 		}
80 80
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	/**
94 94
 	 * @param string $new_txn_status
95 95
 	 */
96
-	public function set_new_txn_status( $new_txn_status ) {
96
+	public function set_new_txn_status($new_txn_status) {
97 97
 		$this->_new_txn_status = $new_txn_status;
98 98
 	}
99 99
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @return bool
106 106
 	 */
107 107
 	public function txn_status_updated() {
108
-		return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null  ? true : false;
108
+		return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false;
109 109
 	}
110 110
 
111 111
 
@@ -125,22 +125,22 @@  discard block
 block discarded – undo
125 125
 	 * @return    boolean        whether the TXN was saved
126 126
 	 * @throws \EE_Error
127 127
 	 */
128
-	public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){
128
+	public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) {
129 129
 		// verify transaction
130
-		if ( ! $transaction instanceof EE_Transaction ) {
131
-			EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
130
+		if ( ! $transaction instanceof EE_Transaction) {
131
+			EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
132 132
 			return false;
133 133
 		}
134 134
 		// set incoming TXN_Status
135
-		$this->set_old_txn_status( $transaction->status_ID() );
135
+		$this->set_old_txn_status($transaction->status_ID());
136 136
 		// calculate total paid
137
-		$total_paid = $this->recalculate_total_payments_for_transaction( $transaction );
137
+		$total_paid = $this->recalculate_total_payments_for_transaction($transaction);
138 138
 		// if total paid has changed
139
-		if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) {
140
-			$transaction->set_paid( $total_paid );
139
+		if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) {
140
+			$transaction->set_paid($total_paid);
141 141
 			// maybe update status, and make sure to save transaction if not done already
142
-			if ( ! $this->update_transaction_status_based_on_total_paid( $transaction, $update_txn )) {
143
-				if ( $update_txn ) {
142
+			if ( ! $this->update_transaction_status_based_on_total_paid($transaction, $update_txn)) {
143
+				if ($update_txn) {
144 144
 					return $transaction->save() ? true : false;
145 145
 				}
146 146
 			} else {
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 	 * @return float|false   float on success, false on fail
165 165
 	 * @throws \EE_Error
166 166
 	 */
167
-	public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) {
167
+	public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) {
168 168
 		// verify transaction
169
-		if ( ! $transaction instanceof EE_Transaction ) {
170
-			EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
169
+		if ( ! $transaction instanceof EE_Transaction) {
170
+			EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
171 171
 			return false;
172 172
 		}
173 173
 		// ensure Payment model is loaded
174
-		EE_Registry::instance()->load_model( 'Payment' );
174
+		EE_Registry::instance()->load_model('Payment');
175 175
 		// calls EEM_Base::sum()
176 176
 		return EEM_Payment::instance()->sum(
177 177
 			// query params
178
-			array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )),
178
+			array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)),
179 179
 			// field to sum
180 180
 			'PAY_amount'
181 181
 		);
@@ -191,36 +191,36 @@  discard block
 block discarded – undo
191 191
 	 * @return 	boolean 	 	whether the TXN was saved
192 192
 	 * @throws \EE_Error
193 193
 	 */
194
-	public function update_transaction_status_based_on_total_paid( EE_Transaction $transaction, $update_txn = TRUE ) {
194
+	public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = TRUE) {
195 195
 		// verify transaction
196
-		if ( ! $transaction instanceof EE_Transaction ) {
196
+		if ( ! $transaction instanceof EE_Transaction) {
197 197
 			EE_Error::add_error(
198
-				__( 'Please provide a valid EE_Transaction object.', 'event_espresso' ),
198
+				__('Please provide a valid EE_Transaction object.', 'event_espresso'),
199 199
 				__FILE__, __FUNCTION__, __LINE__
200 200
 			);
201 201
 			return FALSE;
202 202
 		}
203 203
 		// set incoming TXN_Status
204
-		$this->set_old_txn_status( $transaction->status_ID() );
204
+		$this->set_old_txn_status($transaction->status_ID());
205 205
 		// set transaction status based on comparison of TXN_paid vs TXN_total
206
-		if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total(), '>' ) ){
206
+		if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '>')) {
207 207
 			$new_txn_status = EEM_Transaction::overpaid_status_code;
208
-		} else if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total() ) ) {
208
+		} else if (EEH_Money::compare_floats($transaction->paid(), $transaction->total())) {
209 209
 			$new_txn_status = EEM_Transaction::complete_status_code;
210
-		} else if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total(), '<' ) ) {
210
+		} else if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '<')) {
211 211
 			$new_txn_status = EEM_Transaction::incomplete_status_code;
212 212
 		} else {
213 213
 			EE_Error::add_error(
214
-				__( 'The total paid calculation for this transaction is inaccurate.', 'event_espresso' ),
214
+				__('The total paid calculation for this transaction is inaccurate.', 'event_espresso'),
215 215
 				__FILE__, __FUNCTION__, __LINE__
216 216
 			);
217 217
 			return FALSE;
218 218
 		}
219
-		if ( $new_txn_status !== $transaction->status_ID() ) {
219
+		if ($new_txn_status !== $transaction->status_ID()) {
220 220
 			// set incoming TXN_Status
221
-			$this->set_new_txn_status( $new_txn_status );
222
-			$transaction->set_status( $new_txn_status );
223
-			if ( $update_txn ) {
221
+			$this->set_new_txn_status($new_txn_status);
222
+			$transaction->set_status($new_txn_status);
223
+			if ($update_txn) {
224 224
 				return $transaction->save() ? TRUE : FALSE;
225 225
 			}
226 226
 		}
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 * @return boolean
239 239
 	 * @throws \EE_Error
240 240
 	 */
241
-	public function delete_payment_and_update_transaction( EE_Payment $payment ) {
241
+	public function delete_payment_and_update_transaction(EE_Payment $payment) {
242 242
 		// verify payment
243
-		if ( ! $payment instanceof EE_Payment ) {
244
-			EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
243
+		if ( ! $payment instanceof EE_Payment) {
244
+			EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
245 245
 			return false;
246 246
 		}
247
-		if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) {
247
+		if ( ! $this->delete_registration_payments_and_update_registrations($payment)) {
248 248
 			return false;
249 249
 		}
250
-		if ( ! $payment->delete() ) {
251
-			EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
250
+		if ( ! $payment->delete()) {
251
+			EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
252 252
 			return false;
253 253
 		}
254 254
 
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
 			|| $TXN_status === EEM_Transaction::failed_status_code
260 260
 			|| $payment->amount() === 0
261 261
 		) {
262
-			EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) );
262
+			EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso'));
263 263
 			return true;
264 264
 		}
265 265
 
266 266
 
267 267
 		//if this fails, that just means that the transaction didn't get its status changed and/or updated.
268 268
 		//however the payment was still deleted.
269
-		if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) {
269
+		if ( ! $this->calculate_total_payments_and_update_status($transaction)) {
270 270
 
271 271
 			EE_Error::add_attention(
272 272
 				__(
@@ -300,28 +300,28 @@  discard block
 block discarded – undo
300 300
 	 * @return bool
301 301
 	 * @throws \EE_Error
302 302
 	 */
303
-	public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) {
303
+	public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) {
304 304
 		$save_payment = false;
305
-		$reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) );
306
-		$registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params );
307
-		if ( ! empty( $registration_payments )) {
308
-			foreach ( $registration_payments as $registration_payment ) {
309
-				if ( $registration_payment instanceof EE_Registration_Payment ) {
305
+		$reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID()));
306
+		$registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params);
307
+		if ( ! empty($registration_payments)) {
308
+			foreach ($registration_payments as $registration_payment) {
309
+				if ($registration_payment instanceof EE_Registration_Payment) {
310 310
 					$amount_paid = $registration_payment->amount();
311 311
 					$registration = $registration_payment->registration();
312
-					if ( $registration instanceof EE_Registration ) {
313
-						$registration->set_paid( $registration->paid() - $amount_paid );
314
-						if ( $registration->save() ) {
315
-							if ( $registration_payment->delete() ) {
316
-								$registration->_remove_relation_to( $payment, 'Payment' );
317
-								$payment->_remove_relation_to( $registration, 'Registration' );
312
+					if ($registration instanceof EE_Registration) {
313
+						$registration->set_paid($registration->paid() - $amount_paid);
314
+						if ($registration->save()) {
315
+							if ($registration_payment->delete()) {
316
+								$registration->_remove_relation_to($payment, 'Payment');
317
+								$payment->_remove_relation_to($registration, 'Registration');
318 318
 							}
319 319
 							$save_payment = true;
320 320
 						}
321 321
 					} else {
322 322
 						EE_Error::add_error(
323 323
 							sprintf(
324
-								__( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ),
324
+								__('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'),
325 325
 								$registration_payment->ID()
326 326
 							),
327 327
 							__FILE__, __FUNCTION__, __LINE__
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 				} else {
332 332
 					EE_Error::add_error(
333 333
 						sprintf(
334
-							__( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ),
334
+							__('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'),
335 335
 							$payment->ID()
336 336
 						),
337 337
 						__FILE__, __FUNCTION__, __LINE__
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				}
341 341
 			}
342 342
 		}
343
-		if ( $save_payment ) {
343
+		if ($save_payment) {
344 344
 			$payment->save();
345 345
 		}
346 346
 		return true;
Please login to merge, or discard this patch.
core/EE_Load_Textdomain.core.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	public static function load_textdomain() {
40 40
 		self::_maybe_get_langfile();
41 41
 		//now load the textdomain
42
-		if ( ! empty( self::$_lang ) && is_readable( EE_LANGUAGES_SAFE_DIR . 'event_espresso-' . self::$_lang . '.mo' ) ) {
42
+		if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event_espresso-'.self::$_lang.'.mo')) {
43 43
 			load_plugin_textdomain('event_espresso', FALSE, EE_LANGUAGES_SAFE_LOC);
44
-		} else if ( ! empty( self::$_lang ) && is_readable( EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo' ) ) {
45
-			load_textdomain( 'event_espresso', EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo'  );
44
+		} else if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo')) {
45
+			load_textdomain('event_espresso', EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo');
46 46
 		} else {
47
-			load_plugin_textdomain( 'event_espresso', FALSE, dirname( EE_PLUGIN_BASENAME ) . '/languages/');
47
+			load_plugin_textdomain('event_espresso', FALSE, dirname(EE_PLUGIN_BASENAME).'/languages/');
48 48
 		}
49 49
 	}
50 50
 
@@ -59,24 +59,24 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	private static function _maybe_get_langfile() {
61 61
 		self::$_lang = get_locale();
62
-		if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) )
62
+		if ($has_check = get_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION) || empty(self::$_lang))
63 63
 			return;
64 64
 
65 65
 		//if lang is en_US or empty then lets just get out.  (Event Espresso core is en_US)
66
-		if ( empty( self::$_lang ) || self::$_lang == 'en_US' )
66
+		if (empty(self::$_lang) || self::$_lang == 'en_US')
67 67
 			return;
68 68
 
69 69
 		//made it here so let's get the file from the github repo
70 70
 		$sideloader_args = array(
71
-			'_upload_to' => EE_PLUGIN_DIR_PATH . 'languages/',
72
-			'_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.mo?raw=true',
73
-			'_new_file_name' => 'event_espresso-' . self::$_lang . '.mo'
71
+			'_upload_to' => EE_PLUGIN_DIR_PATH.'languages/',
72
+			'_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-'.self::$_lang.'.mo?raw=true',
73
+			'_new_file_name' => 'event_espresso-'.self::$_lang.'.mo'
74 74
 			);
75 75
 
76 76
 
77
-		$sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, FALSE );
77
+		$sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, FALSE);
78 78
 
79 79
 		$sideloader->sideload();
80
-		update_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION, 1 );
80
+		update_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION, 1);
81 81
 	}
82 82
 } //end EE_Load_Textdomain
Please login to merge, or discard this patch.