Completed
Branch ENH-9001-hhvm-max-input-vars (e4c045)
by
unknown
470:04 queued 455:45
created
espresso.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -27,18 +27,18 @@  discard block
 block discarded – undo
27 27
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 28
  */
29 29
 /**
30
- * Event Espresso
31
- *
32
- * Event Registration and Management Plugin for WordPress
33
- *
34
- * @package 	Event Espresso
35
- * @author 		Seth Shoultes
36
- * @copyright 	(c) 2008-2014 Event Espresso  All Rights Reserved.
37
- * @license 	{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
38
- * @link 		{@link http://www.eventespresso.com}
39
- * @since 		4.0
40
- *
41
- */
30
+	 * Event Espresso
31
+	 *
32
+	 * Event Registration and Management Plugin for WordPress
33
+	 *
34
+	 * @package 	Event Espresso
35
+	 * @author 		Seth Shoultes
36
+	 * @copyright 	(c) 2008-2014 Event Espresso  All Rights Reserved.
37
+	 * @license 	{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
38
+	 * @link 		{@link http://www.eventespresso.com}
39
+	 * @since 		4.0
40
+	 *
41
+	 */
42 42
 
43 43
 if ( function_exists( 'espresso_version' ) ) {
44 44
 
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
 
236 236
 if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
237 237
 	/**
238
-	*    deactivate_plugin
239
-	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
240
-	*
241
-	* @access public
242
-	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
243
-	* @return    void
244
-	*/
238
+	 *    deactivate_plugin
239
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
240
+	 *
241
+	 * @access public
242
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
243
+	 * @return    void
244
+	 */
245 245
 	function espresso_deactivate_plugin( $plugin_basename = '' ) {
246 246
 		if ( ! function_exists( 'deactivate_plugins' ) ) {
247 247
 			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  *
41 41
  */
42 42
 
43
-if ( function_exists( 'espresso_version' ) ) {
43
+if (function_exists('espresso_version')) {
44 44
 
45 45
 	/**
46 46
 	 *    espresso_duplicate_plugin_error
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
 	function espresso_duplicate_plugin_error() {
50 50
 		?>
51 51
 		<div class="error">
52
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
52
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
53 53
 		</div>
54 54
 		<?php
55
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
55
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
56 56
 	}
57
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
57
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
58 58
 
59 59
 } else {
60 60
 
@@ -69,98 +69,98 @@  discard block
 block discarded – undo
69 69
 	}
70 70
 
71 71
 	// define versions
72
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
73
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.0' );
74
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.1' );
75
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
76
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
77
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
78
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
72
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
73
+	define('EE_MIN_WP_VER_REQUIRED', '4.0');
74
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.1');
75
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
76
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
77
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
78
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
79 79
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
80
-	if ( ! defined( 'DS' ) ) {
81
-		define( 'DS', '/' );
80
+	if ( ! defined('DS')) {
81
+		define('DS', '/');
82 82
 	}
83
-	if ( ! defined( 'PS' ) ) {
84
-		define( 'PS', PATH_SEPARATOR );
83
+	if ( ! defined('PS')) {
84
+		define('PS', PATH_SEPARATOR);
85 85
 	}
86
-	if ( ! defined( 'SP' ) ) {
87
-		define( 'SP', ' ' );
86
+	if ( ! defined('SP')) {
87
+		define('SP', ' ');
88 88
 	}
89
-	if ( ! defined( 'EENL' ) ) {
90
-		define( 'EENL', "\n" );
89
+	if ( ! defined('EENL')) {
90
+		define('EENL', "\n");
91 91
 	}
92
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
92
+	define('EE_SUPPORT_EMAIL', '[email protected]');
93 93
 	// define the plugin directory and URL
94
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
95
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
96
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
94
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
95
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
96
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
97 97
 	// main root folder paths
98
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
99
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
100
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
101
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
102
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
103
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
104
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
105
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
98
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
99
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
100
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
101
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
102
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
103
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
104
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
105
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
106 106
 	// core system paths
107
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
108
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
109
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
110
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
111
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
112
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
113
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
114
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
115
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
116
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
117
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
118
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
107
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
108
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
109
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
110
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
111
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
112
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
113
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
114
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
115
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
116
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
117
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
118
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
119 119
 	// gateways
120
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
121
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
120
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
121
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
122 122
 	// asset URL paths
123
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
124
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
125
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
126
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
127
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
128
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
123
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
124
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
125
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
126
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
127
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
128
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
129 129
 	// define upload paths
130 130
 	$uploads = wp_upload_dir();
131 131
 	// define the uploads directory and URL
132
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
133
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
132
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
133
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
134 134
 	// define the templates directory and URL
135
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
136
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
135
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
136
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
137 137
 	// define the gateway directory and URL
138
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
139
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
138
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
139
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
140 140
 	// languages folder/path
141
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
142
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
141
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
142
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
143 143
 	//check for dompdf fonts in uploads
144
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
145
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
144
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
145
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
146 146
 	}
147 147
 	//ajax constants
148
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
149
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
148
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
149
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
150 150
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
151 151
 	//you're better to use this than its straight value (currently -1) in case you ever
152 152
 	//want to change its default value! or find when -1 means infinity
153
-	define( 'EE_INF_IN_DB', -1 );
154
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
153
+	define('EE_INF_IN_DB', -1);
154
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
155 155
 
156 156
 	/**
157 157
 	 *    espresso_plugin_activation
158 158
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
159 159
 	 */
160 160
 	function espresso_plugin_activation() {
161
-		update_option( 'ee_espresso_activation', true );
161
+		update_option('ee_espresso_activation', true);
162 162
 	}
163
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
163
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
164 164
 
165 165
 
166 166
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		//	}
175 175
 		//
176 176
 	}
177
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
177
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
178 178
 
179 179
 
180 180
 
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	function espresso_load_error_handling() {
186 186
 		// load debugging tools
187
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
188
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
187
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
188
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
189 189
 			EEH_Debug_Tools::instance();
190 190
 		}
191 191
 		// load error handling
192
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
193
-			require_once( EE_CORE . 'EE_Error.core.php' );
192
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
193
+			require_once(EE_CORE.'EE_Error.core.php');
194 194
 		} else {
195
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
195
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
196 196
 		}
197 197
 	}
198 198
 
@@ -206,25 +206,25 @@  discard block
 block discarded – undo
206 206
 	 * @param    string $full_path_to_file
207 207
 	 * @throws    EE_Error
208 208
 	 */
209
-	function espresso_load_required( $classname, $full_path_to_file ) {
209
+	function espresso_load_required($classname, $full_path_to_file) {
210 210
 		static $error_handling_loaded = false;
211
-		if ( ! $error_handling_loaded ) {
211
+		if ( ! $error_handling_loaded) {
212 212
 			espresso_load_error_handling();
213 213
 			$error_handling_loaded = true;
214 214
 		}
215
-		if ( is_readable( $full_path_to_file ) ) {
216
-			require_once( $full_path_to_file );
215
+		if (is_readable($full_path_to_file)) {
216
+			require_once($full_path_to_file);
217 217
 		} else {
218
-			throw new EE_Error ( sprintf(
219
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
218
+			throw new EE_Error(sprintf(
219
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
220 220
 				$classname
221
-			) );
221
+			));
222 222
 		}
223 223
 	}
224 224
 
225
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
226
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
227
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
225
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
226
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
227
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
228 228
 	new EE_Bootstrap();
229 229
 
230 230
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 
235 235
 
236
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
236
+if ( ! function_exists('espresso_deactivate_plugin')) {
237 237
 	/**
238 238
 	*    deactivate_plugin
239 239
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
243 243
 	* @return    void
244 244
 	*/
245
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
246
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
247
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
245
+	function espresso_deactivate_plugin($plugin_basename = '') {
246
+		if ( ! function_exists('deactivate_plugins')) {
247
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
248 248
 		}
249
-		unset( $_GET[ 'activate' ] );
250
-		unset( $_REQUEST[ 'activate' ] );
251
-		deactivate_plugins( $plugin_basename );
249
+		unset($_GET['activate']);
250
+		unset($_REQUEST['activate']);
251
+		deactivate_plugins($plugin_basename);
252 252
 	}
253 253
 }
254 254
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EE_PMT_Aim.pm.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_PMT_Aim extends EE_PMT_Base{
28
+class EE_PMT_Aim extends EE_PMT_Base {
29 29
 
30 30
 
31 31
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		require_once($this->file_folder().'EEG_Aim.gateway.php');
38 38
 		$this->_gateway = new EEG_AIM();
39 39
 		$this->_pretty_name = __("Authorize.net AIM", 'event_espresso');
40
-		$this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' );
40
+		$this->_default_description = __('Please provide the following billing information.', 'event_espresso');
41 41
 		$this->_requires_https = true;
42 42
 		parent::__construct($pm_instance);
43 43
 	}
@@ -47,60 +47,60 @@  discard block
 block discarded – undo
47 47
 	 * @param \EE_Transaction $transaction
48 48
 	 * @return EE_Billing_Info_Form
49 49
 	 */
50
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
51
-		$billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array(
50
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
51
+		$billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array(
52 52
 			'name'=>'AIM_Form',
53 53
 			'subsections'=>array(
54 54
 				'credit_card'=>new EE_Credit_Card_Input(array(
55 55
 					'required'=>true,
56
-					'html_label_text' => __( 'Card Number', 'event_espresso' )
56
+					'html_label_text' => __('Card Number', 'event_espresso')
57 57
 				)),
58 58
 				'exp_month'=>new EE_Credit_Card_Month_Input(true, array(
59 59
 					'required'=>true,
60
-					'html_label_text' => __( 'Expiry Month', 'event_espresso' )
60
+					'html_label_text' => __('Expiry Month', 'event_espresso')
61 61
 				)),
62
-				'exp_year'=>new EE_Credit_Card_Year_Input( array( 
62
+				'exp_year'=>new EE_Credit_Card_Year_Input(array( 
63 63
 					'required'=>true,
64
-					'html_label_text' => __( 'Expiry Year', 'event_espresso' ) 
64
+					'html_label_text' => __('Expiry Year', 'event_espresso') 
65 65
 				)),
66
-				'cvv'=>new EE_CVV_Input( array(
66
+				'cvv'=>new EE_CVV_Input(array(
67 67
 					'required'=>true,
68
-					'html_label_text' => __( 'CVV', 'event_espresso' ) ) ),
68
+					'html_label_text' => __('CVV', 'event_espresso') )),
69 69
 			)
70 70
 		));
71
-		$billing_form->add_subsections( array(
72
-			'company' => new EE_Text_Input( array(
71
+		$billing_form->add_subsections(array(
72
+			'company' => new EE_Text_Input(array(
73 73
 				'html_label_text' => __('Company', 'event_espresso')
74 74
 			))
75
-		), 'email', false );
75
+		), 'email', false);
76 76
 		$billing_form->add_subsections( 
77 77
 				array(
78
-					'fax' => new EE_Text_Input( array(
78
+					'fax' => new EE_Text_Input(array(
79 79
 						'html_label_text' => __('Fax', 'event_espresso')
80 80
 					))
81 81
 				), 
82 82
 				'phone', 
83 83
 				false );
84 84
 		$settings_form = $this->settings_form();
85
-		if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) {
86
-				$billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() );
85
+		if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) {
86
+				$billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value());
87 87
 		}
88
-		if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) {
88
+		if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) {
89 89
 			$required_inputs = array_merge( 
90 90
 					array(
91 91
 						'credit_card',
92 92
 						'exp_month',
93 93
 						'exp_year' ),
94
-					$settings_form->get_input( 'required_billing_inputs' )->normalized_value() );
95
-			foreach( $billing_form->inputs() as $input_name => $input ) {
96
-				if( in_array( $input_name, $required_inputs ) ) {
97
-					$input->set_required( true );
94
+					$settings_form->get_input('required_billing_inputs')->normalized_value() );
95
+			foreach ($billing_form->inputs() as $input_name => $input) {
96
+				if (in_array($input_name, $required_inputs)) {
97
+					$input->set_required(true);
98 98
 				} else {
99
-					$input->set_required( false );
99
+					$input->set_required(false);
100 100
 				}
101 101
 			}
102 102
 		}
103
-		return $this->apply_billing_form_debug_settings( $billing_form );
103
+		return $this->apply_billing_form_debug_settings($billing_form);
104 104
 	}
105 105
 
106 106
 
@@ -112,19 +112,19 @@  discard block
 block discarded – undo
112 112
 	 * @param \EE_Billing_Info_Form $billing_form
113 113
 	 * @return \EE_Billing_Info_Form
114 114
 	 */
115
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
116
-		if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) {
117
-			$billing_form->get_input( 'credit_card' )->set_default( '4007000000027' );
118
-			$billing_form->get_input( 'exp_year' )->set_default( '2020' );
119
-			if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) {
120
-				$billing_form->get_input( 'cvv' )->set_default(( '123' ));
115
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
116
+		if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) {
117
+			$billing_form->get_input('credit_card')->set_default('4007000000027');
118
+			$billing_form->get_input('exp_year')->set_default('2020');
119
+			if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) {
120
+				$billing_form->get_input('cvv')->set_default(('123'));
121 121
 			}
122 122
 			$billing_form->add_subsections(
123
-				array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ),
123
+				array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()),
124 124
 				'credit_card'
125 125
 			);
126 126
 			$billing_form->add_subsections(
127
-				array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )),
127
+				array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')),
128 128
 				'first_name'
129 129
 			);
130 130
 		}
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 				'extra_meta_inputs'=>array(
145 145
 					'login_id'=>new EE_Text_Input(
146 146
 						array(
147
-							'html_label_text'=>  sprintf( __("Authorize.net API Login ID %s", "event_espresso"),  $this->get_help_tab_link() ),
147
+							'html_label_text'=>  sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()),
148 148
 							'required' => true )
149 149
 					),
150 150
 					'transaction_key'=>new EE_Text_Input(
151 151
 						array(
152
-							'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ),
152
+							'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()),
153 153
 							'required' => true )
154 154
 					),
155 155
 					'test_transactions'=>new EE_Yes_No_Input(
156 156
 						array(
157
-							'html_label_text'=>  sprintf( __("Send test transactions? %s", 'event_espresso'),  $this->get_help_tab_link() ),
157
+							'html_label_text'=>  sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()),
158 158
 							'html_help_text'=>  __("Send test transactions, even to live server", 'event_espresso'),
159 159
 							'default' => false,
160 160
 							'required' => true
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 					'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( 
164 164
 							$billing_input_names,
165 165
 					array( 
166
-						'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'),  $this->get_help_tab_link() ),
166
+						'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()),
167 167
 						'default' => array(
168 168
 							'company',
169 169
 							'fax',
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 					'required_billing_inputs' => new EE_Checkbox_Multi_Input( 
173 173
 							$billing_input_names,
174 174
 							array(
175
-								'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'),  $this->get_help_tab_link() ),
175
+								'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()),
176 176
 								'default' => array_diff(
177
-											array_keys( $billing_input_names ),
178
-											array( 'address2', 'phone', 'company', 'fax' )
177
+											array_keys($billing_input_names),
178
+											array('address2', 'phone', 'company', 'fax')
179 179
 								),
180 180
 								'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso')
181 181
 							)),
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function billing_input_names() {
193 193
 		return array(
194
-			'first_name' => __( 'First Name', 'event_espresso' ),
194
+			'first_name' => __('First Name', 'event_espresso'),
195 195
 			'last_name' => __('Last Name', 'event_espresso'),
196
-			'email' => __( 'Email', 'event_espresso' ),
197
-			'company' => __( 'Company', 'event_espresso' ),
196
+			'email' => __('Email', 'event_espresso'),
197
+			'company' => __('Company', 'event_espresso'),
198 198
 			'address' => __('Address', 'event_espresso'),
199 199
 			'address2' => __('Address2', 'event_espresso'),
200 200
 			'city' => __('City', 'event_espresso'),
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			'country' => __('Country', 'event_espresso'),
203 203
 			'zip' =>  __('Zip', 'event_espresso'),
204 204
 			'phone' => __('Phone', 'event_espresso'),
205
-			'fax' => __( 'Fax', 'event_espresso' ),
205
+			'fax' => __('Fax', 'event_espresso'),
206 206
 			'cvv' => __('CVV', 'event_espresso')
207 207
 		);
208 208
 	}
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 	 * @param type $billing_form
214 214
 	 * @return array
215 215
 	 */
216
-	protected function _get_billing_values_from_form( $billing_form ){
216
+	protected function _get_billing_values_from_form($billing_form) {
217 217
 		$all_billing_values_empty = array();
218
-		foreach( array_keys( $this->billing_input_names() ) as $input_name ) {
219
-			$all_billing_values_empty[ $input_name ] = '';
218
+		foreach (array_keys($this->billing_input_names()) as $input_name) {
219
+			$all_billing_values_empty[$input_name] = '';
220 220
 		}
221 221
 		return array_merge(
222 222
 				$all_billing_values_empty,
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @see EE_PMT_Base::help_tabs_config()
232 232
 	 * @return array
233 233
 	 */
234
-	public function help_tabs_config(){
234
+	public function help_tabs_config() {
235 235
 		return array(
236 236
 			$this->get_help_tab_name() => array(
237 237
 				'title' => __('Authorize.net AIM Settings', 'event_espresso'),
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 2 patches
Spacing   +136 added lines, -136 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
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *@return EE_Payment_Processor
43 43
 	 */
44 44
 	private function __construct() {
45
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
+		do_action('AHEE__EE_Payment_Processor__construct');
46 46
 	}
47 47
 
48 48
 
@@ -64,42 +64,42 @@  discard block
 block discarded – undo
64 64
 	 * @param string 	       						$cancel_url 	URL to return to if off-site payments are cancelled
65 65
 	 * @return EE_Payment
66 66
 	 */
67
-	public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '' ) {
68
-		if( $amount < 0 ) {
67
+	public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '') {
68
+		if ($amount < 0) {
69 69
 			throw new EE_Error( 
70 70
 					sprintf(
71
-							__( 'Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso' ),
71
+							__('Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso'),
72 72
 							$amount,
73 73
 							$transaction->ID() ) );
74 74
 		}
75 75
 		// verify payment method
76
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
76
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
77 77
 		// verify transaction
78
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
79
-		$transaction->set_payment_method_ID( $payment_method->ID() );
78
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
79
+		$transaction->set_payment_method_ID($payment_method->ID());
80 80
 		// verify payment method type
81
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ){
81
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
82 82
 			$payment = $payment_method->type_obj()->process_payment(
83 83
 				$transaction,
84
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
84
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
85 85
 				$billing_form,
86 86
 				$return_url,
87
-				add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
87
+				add_query_arg(array('ee_cancel_payment' => true), $return_url),
88 88
 				$method,
89 89
 				$by_admin
90 90
 			);
91 91
 			// check if payment method uses an off-site gateway
92
-			if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) {
92
+			if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) {
93 93
 				// don't process payments for off-site gateways yet because no payment has occurred yet
94
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
94
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
95 95
 			}
96 96
 			return $payment;
97 97
 		} else {
98 98
 			EE_Error::add_error(
99 99
 				sprintf(
100
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
100
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
101 101
 					'<br/>',
102
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
102
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
103 103
 				), __FILE__, __FUNCTION__, __LINE__
104 104
 			);
105 105
 			return NULL;
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	 * @throws EE_Error
116 116
 	 * @return string
117 117
 	 */
118
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
118
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
119 119
 		/** @type EE_Transaction $transaction */
120
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
120
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
121 121
 		$primary_reg = $transaction->primary_registration();
122
-		if( ! $primary_reg instanceof EE_Registration ){
123
-			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID()));
122
+		if ( ! $primary_reg instanceof EE_Registration) {
123
+			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID()));
124 124
 		}
125
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
125
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
126 126
 		$url = add_query_arg(
127 127
 			array(
128 128
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -149,81 +149,81 @@  discard block
 block discarded – undo
149 149
 	 * @throws Exception
150 150
 	 * @return EE_Payment
151 151
 	 */
152
-	public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){
153
-		$_req_data = $this->_remove_unusable_characters( $_req_data );
154
-		EE_Registry::instance()->load_model( 'Change_Log' );
155
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
156
-		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
157
-			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
158
-		}elseif( $payment_method instanceof EE_Payment ){
152
+	public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) {
153
+		$_req_data = $this->_remove_unusable_characters($_req_data);
154
+		EE_Registry::instance()->load_model('Change_Log');
155
+		EE_Processor_Base::set_IPN($separate_IPN_request);
156
+		if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) {
157
+			$obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc')));
158
+		}elseif ($payment_method instanceof EE_Payment) {
159 159
 			$obj_for_log = $payment_method;
160
-		}elseif( $transaction instanceof EE_Transaction ){
160
+		}elseif ($transaction instanceof EE_Transaction) {
161 161
 			$obj_for_log = $transaction;
162
-		}else{
162
+		} else {
163 163
 			$obj_for_log = null;
164 164
 		}
165 165
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
166
-		try{
166
+		try {
167 167
 			/**
168 168
 			 * @var EE_Payment $payment
169 169
 			 */
170 170
 			$payment = NULL;
171
-			if($transaction && $payment_method){
171
+			if ($transaction && $payment_method) {
172 172
 				/** @type EE_Transaction $transaction */
173 173
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
174 174
 				/** @type EE_Payment_Method $payment_method */
175 175
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
176
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
177
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
176
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
177
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
178 178
 						$log->set_object($payment);
179 179
 				} else {
180 180
 					// not a payment
181 181
 					EE_Error::add_error(
182 182
 						sprintf(
183
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
183
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
184 184
 							'<br/>',
185
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
185
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
186 186
 						),
187 187
 						__FILE__, __FUNCTION__, __LINE__
188 188
 					);
189 189
 				}
190
-			}else{
190
+			} else {
191 191
 				//that's actually pretty ok. The IPN just wasn't able
192 192
 				//to identify which transaction or payment method this was for
193 193
 				// give all active payment methods a chance to claim it
194 194
 				$active_pms = EEM_Payment_Method::instance()->get_all_active();
195
-				foreach( $active_pms as $payment_method ){
196
-					try{
197
-						$payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
195
+				foreach ($active_pms as $payment_method) {
196
+					try {
197
+						$payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
198 198
 						EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment);
199 199
 						break;
200
-					} catch( EE_Error $e ) {
200
+					} catch (EE_Error $e) {
201 201
 						//that's fine- it apparently couldn't handle the IPN
202 202
 					}
203 203
 				}
204 204
 
205 205
 			}
206 206
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
207
-			if( $payment instanceof EE_Payment){
207
+			if ($payment instanceof EE_Payment) {
208 208
 				$payment->save();
209 209
 				//  update the TXN
210
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
211
-			}else{
210
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
211
+			} else {
212 212
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
213
-				if($payment_method){
213
+				if ($payment_method) {
214 214
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
215
-				}elseif($transaction){
215
+				}elseif ($transaction) {
216 216
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
217 217
 				}
218 218
 			}
219 219
 			return $payment;
220 220
 
221
-		} catch( EE_Error $e ) {
221
+		} catch (EE_Error $e) {
222 222
 			do_action(
223 223
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
224
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
225
-					print_r( $transaction, TRUE ),
226
-					print_r( $_req_data, TRUE ),
224
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
225
+					print_r($transaction, TRUE),
226
+					print_r($_req_data, TRUE),
227 227
 					$e->getMessage()
228 228
 				)
229 229
 			);
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
 	 * @param array $request_data
238 238
 	 * @return array|string
239 239
 	 */
240
-	protected function _remove_unusable_characters( $request_data ) {
241
-		if( is_array( $request_data ) ) {
240
+	protected function _remove_unusable_characters($request_data) {
241
+		if (is_array($request_data)) {
242 242
 			$return_data = array();
243
-			foreach( $request_data as $key => $value ) {
244
-				$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
243
+			foreach ($request_data as $key => $value) {
244
+				$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
245 245
 			}
246
-		}else{
247
-			$return_data =  preg_replace('/[^[:print:]]/', '', $request_data);
246
+		} else {
247
+			$return_data = preg_replace('/[^[:print:]]/', '', $request_data);
248 248
 		}
249 249
 		return $return_data;
250 250
 	}
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
 	 * @return EE_Payment
267 267
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs
268 268
 	 */
269
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
269
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
270 270
 		/** @var $transaction EE_Transaction */
271
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
271
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
272 272
 		$last_payment_method = $transaction->payment_method();
273
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
274
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
275
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
273
+		if ($last_payment_method instanceof EE_Payment_Method) {
274
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
275
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
276 276
 			return $payment;
277 277
 		} else {
278 278
 			return NULL;
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 * @internal param float $amount
290 290
 	 * @return EE_Payment
291 291
 	 */
292
-	public function process_refund( EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array() ){
293
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
294
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
295
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
292
+	public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) {
293
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
294
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
295
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
296 296
 		}
297 297
 		return $payment_to_refund;
298 298
 	}
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 	 *                        TXN is locked before updating
335 335
 	 * @throws \EE_Error
336 336
 	 */
337
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
337
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
338 338
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
339 339
 		/** @type EE_Transaction $transaction */
340
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
340
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
341 341
 		// can we freely update the TXN at this moment?
342
-		if ( $IPN && $transaction->is_locked() ) {
342
+		if ($IPN && $transaction->is_locked()) {
343 343
 			// don't update the transaction at this exact moment
344 344
 			// because the TXN is active in another request
345 345
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -349,40 +349,40 @@  discard block
 block discarded – undo
349 349
 			);
350 350
 		} else {
351 351
 			// verify payment and that it has been saved
352
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
353
-				if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){
354
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
352
+			if ($payment instanceof EE_Payment && $payment->ID()) {
353
+				if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) {
354
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
355 355
 					// update TXN registrations with payment info
356
-					$this->process_registration_payments( $transaction, $payment );
356
+					$this->process_registration_payments($transaction, $payment);
357 357
 				}
358 358
 				$do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action;
359 359
 			} else {
360 360
 				// send out notifications
361
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
361
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
362 362
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
363 363
 			}
364 364
 			// if this is an IPN, then we want to know the initial TXN status prior to updating the TXN
365 365
 			// so that we know whether the status has changed and notifications should be triggered
366
-			if ( $IPN ) {
366
+			if ($IPN) {
367 367
 				/** @type EE_Transaction_Processor $transaction_processor */
368
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
369
-				$transaction_processor->set_old_txn_status( $transaction->status_ID() );
368
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
369
+				$transaction_processor->set_old_txn_status($transaction->status_ID());
370 370
 			}
371
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
371
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
372 372
 				/** @type EE_Transaction_Payments $transaction_payments */
373
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
373
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
374 374
 				// set new value for total paid
375
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
375
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
376 376
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
377
-				if ( $update_txn ) {
378
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
377
+				if ($update_txn) {
378
+					$this->_post_payment_processing($transaction, $payment, $IPN);
379 379
 				}
380 380
 			}
381 381
 			// granular hook for others to use.
382
-			do_action( $do_action, $transaction, $payment );
383
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
382
+			do_action($do_action, $transaction, $payment);
383
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
384 384
 			//global hook for others to use.
385
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
385
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
386 386
 		}
387 387
 	}
388 388
 
@@ -396,25 +396,25 @@  discard block
 block discarded – undo
396 396
 	 * @param EE_Registration[] $registrations
397 397
 	 * @throws \EE_Error
398 398
 	 */
399
-	public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) {
399
+	public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) {
400 400
 		// only process if payment was successful
401
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
401
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
402 402
 			return;
403 403
 		}
404 404
 		//EEM_Registration::instance()->show_next_x_db_queries();
405
-		if ( empty( $registrations )) {
405
+		if (empty($registrations)) {
406 406
 			// find registrations with monies owing that can receive a payment
407
-			$registrations = $transaction->registrations( array(
407
+			$registrations = $transaction->registrations(array(
408 408
 				array(
409 409
 					// only these reg statuses can receive payments
410
-					'STS_ID'  => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
411
-					'REG_final_price'  => array( '!=', 0 ),
412
-					'REG_final_price*' => array( '!=', 'REG_paid', true ),
410
+					'STS_ID'  => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
411
+					'REG_final_price'  => array('!=', 0),
412
+					'REG_final_price*' => array('!=', 'REG_paid', true),
413 413
 				)
414
-			) );
414
+			));
415 415
 		}
416 416
 		// still nothing ??!??
417
-		if ( empty( $registrations )) {
417
+		if (empty($registrations)) {
418 418
 			return;
419 419
 		}
420 420
 		// todo: break out the following logic into a separate strategy class
@@ -426,28 +426,28 @@  discard block
 block discarded – undo
426 426
 
427 427
 		$refund = $payment->is_a_refund();
428 428
 		// how much is available to apply to registrations?
429
-		$available_payment_amount = abs( $payment->amount() );
430
-		foreach ( $registrations as $registration ) {
431
-			if ( $registration instanceof EE_Registration ) {
429
+		$available_payment_amount = abs($payment->amount());
430
+		foreach ($registrations as $registration) {
431
+			if ($registration instanceof EE_Registration) {
432 432
 				// nothing left?
433
-				if ( $available_payment_amount <= 0 ) {
433
+				if ($available_payment_amount <= 0) {
434 434
 					break;
435 435
 				}
436
-				if ( $refund ) {
437
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
436
+				if ($refund) {
437
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
438 438
 				} else {
439
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
439
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
440 440
 				}
441 441
 			}
442 442
 		}
443
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
443
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
444 444
 			EE_Error::add_attention(
445 445
 				sprintf(
446
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
447
-					EEH_Template::format_currency( $available_payment_amount ),
448
-					implode( ', ',  array_keys( $registrations ) ),
446
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
447
+					EEH_Template::format_currency($available_payment_amount),
448
+					implode(', ', array_keys($registrations)),
449 449
 					'<br/>',
450
-					EEH_Template::format_currency( $payment->amount() )
450
+					EEH_Template::format_currency($payment->amount())
451 451
 				),
452 452
 				__FILE__, __FUNCTION__, __LINE__
453 453
 			);
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
 	 * @param float $available_payment_amount
465 465
 	 * @return float
466 466
 	 */
467
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
467
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
468 468
 		$owing = $registration->final_price() - $registration->paid();
469
-		if ( $owing > 0 ) {
469
+		if ($owing > 0) {
470 470
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
471
-			$payment_amount = min( $available_payment_amount, $owing );
471
+			$payment_amount = min($available_payment_amount, $owing);
472 472
 			// update $available_payment_amount
473 473
 			$available_payment_amount = $available_payment_amount - $payment_amount;
474 474
 			//calculate and set new REG_paid
475
-			$registration->set_paid( $registration->paid() + $payment_amount );
475
+			$registration->set_paid($registration->paid() + $payment_amount);
476 476
 			// now save it
477
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
477
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
478 478
 		}
479 479
 		return $available_payment_amount;
480 480
 	}
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 	 * @param float $payment_amount
490 490
 	 * @return float
491 491
 	 */
492
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
492
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
493 493
 		// find any existing reg payment records for this registration and payment
494 494
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
495
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
495
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
496 496
 		);
497 497
 		// if existing registration payment exists
498
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
498
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
499 499
 			// then update that record
500
-			$existing_reg_payment->set_amount( $payment_amount );
500
+			$existing_reg_payment->set_amount($payment_amount);
501 501
 			$existing_reg_payment->save();
502 502
 		} else {
503 503
 			// or add new relation between registration and payment and set amount
504
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
504
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
505 505
 			// make it stick
506 506
 			$registration->save();
507 507
 		}
@@ -517,21 +517,21 @@  discard block
 block discarded – undo
517 517
 	 * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER
518 518
 	 * @return float
519 519
 	 */
520
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
520
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
521 521
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
522
-		if ( $registration->paid() > 0 ) {
522
+		if ($registration->paid() > 0) {
523 523
 			// ensure $available_refund_amount is NOT negative
524
-			$available_refund_amount = abs( $available_refund_amount );
524
+			$available_refund_amount = abs($available_refund_amount);
525 525
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
526
-			$refund_amount = min( $available_refund_amount, $registration->paid() );
526
+			$refund_amount = min($available_refund_amount, $registration->paid());
527 527
 			// update $available_payment_amount
528 528
 			$available_refund_amount = $available_refund_amount - $refund_amount;
529 529
 			//calculate and set new REG_paid
530
-			$registration->set_paid( $registration->paid() - $refund_amount );
530
+			$registration->set_paid($registration->paid() - $refund_amount);
531 531
 			// convert payment amount back to a negative value for storage in the db
532
-			$refund_amount = abs( $refund_amount ) * -1;
532
+			$refund_amount = abs($refund_amount) * -1;
533 533
 			// now save it
534
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
534
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
535 535
 		}
536 536
 		return $available_refund_amount;
537 537
 	}
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
 	 * @param EE_Payment     $payment
550 550
 	 * @param bool           $IPN
551 551
 	 */
552
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
552
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
553 553
 
554 554
 		/** @type EE_Transaction_Processor $transaction_processor */
555
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
555
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
556 556
 		// is the Payment Options Reg Step completed ?
557
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
557
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
558 558
 		// DEBUG LOG
559 559
 		//$this->log(
560 560
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
 		// if the Payment Options Reg Step is completed...
568 568
 		$revisit = $payment_options_step_completed === true ? true : false;
569 569
 		// then this is kinda sorta a revisit with regards to payments at least
570
-		$transaction_processor->set_revisit( $revisit );
570
+		$transaction_processor->set_revisit($revisit);
571 571
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
572 572
 		if (
573 573
 			$IPN &&
574 574
 			$payment_options_step_completed !== true &&
575
-			( $payment->is_approved() || $payment->is_pending() )
575
+			($payment->is_approved() || $payment->is_pending())
576 576
 		) {
577
-			$payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' );
577
+			$payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options');
578 578
 		}
579 579
 		// DEBUG LOG
580 580
 		//$this->log(
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
 		//	)
587 587
 		//);
588 588
 		/** @type EE_Transaction_Payments $transaction_payments */
589
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
589
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
590 590
 		// maybe update status, but don't save transaction just yet
591
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
591
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
592 592
 		// check if 'finalize_registration' step has been completed...
593
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
593
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
594 594
 		// DEBUG LOG
595 595
 		//$this->log(
596 596
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -601,9 +601,9 @@  discard block
 block discarded – undo
601 601
 		//	)
602 602
 		//);
603 603
 		//  if this is an IPN and the final step has not been initiated
604
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
604
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
605 605
 			// and if it hasn't already been set as being started...
606
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
606
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
607 607
 			// DEBUG LOG
608 608
 			//$this->log(
609 609
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 		}
617 617
 		$transaction->save();
618 618
 		// because the above will return false if the final step was not fully completed, we need to check again...
619
-		if ( $IPN && $finalized !== false ) {
619
+		if ($IPN && $finalized !== false) {
620 620
 			// and if we are all good to go, then send out notifications
621
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
621
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
622 622
 			// DEBUG LOG
623 623
 			//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
624 624
 			//ok, now process the transaction according to the payment
625
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
625
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
626 626
 		}
627 627
 		// DEBUG LOG
628 628
 		//$this->log(
Please login to merge, or discard this patch.
Indentation   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 EE_Registry::instance()->load_class( 'Processor_Base' );
3 3
 /**
4
- *
5
- * EE_Payment_Processor
6
- *
7
- * Class for handling processing of payments for transactions.
8
- *
9
- * @package			Event Espresso
10
- * @subpackage		core/libraries/payment_methods
11
- * @author			Mike Nelson
12
- *
13
- */
4
+	 *
5
+	 * EE_Payment_Processor
6
+	 *
7
+	 * Class for handling processing of payments for transactions.
8
+	 *
9
+	 * @package			Event Espresso
10
+	 * @subpackage		core/libraries/payment_methods
11
+	 * @author			Mike Nelson
12
+	 *
13
+	 */
14 14
 class EE_Payment_Processor extends EE_Processor_Base {
15 15
 	/**
16
-     * 	@var EE_Payment_Processor $_instance
16
+	 * 	@var EE_Payment_Processor $_instance
17 17
 	 * 	@access 	private
18
-     */
18
+	 */
19 19
 	private static $_instance = NULL;
20 20
 
21 21
 
@@ -48,9 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
 
50 50
 	/**
51
-
52 51
 	 * Using the selected gateway, processes the payment for that transaction, and updates the transaction appropriately.
53
- 	 * Saves the payment that is generated
52
+	 * Saves the payment that is generated
54 53
 	 *
55 54
 	 * @param EE_Payment_Method 	$payment_method
56 55
 	 * @param EE_Transaction 				$transaction
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime.class.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                             		    date_format and the second value is the time format
75 75
 	 * @return EE_Datetime
76 76
 	 */
77
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
78
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
79
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
77
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
78
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
79
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
80 80
 	}
81 81
 
82 82
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *                          		the website will be used.
88 88
 	 * @return EE_Datetime
89 89
 	 */
90
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
91
-		return new self( $props_n_values, TRUE, $timezone );
90
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
91
+		return new self($props_n_values, TRUE, $timezone);
92 92
 	}
93 93
 
94 94
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * @param $name
98 98
 	 */
99
-	public function set_name( $name ) {
100
-		$this->set( 'DTT_name', $name );
99
+	public function set_name($name) {
100
+		$this->set('DTT_name', $name);
101 101
 	}
102 102
 
103 103
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @param $description
107 107
 	 */
108
-	public function set_description( $description ) {
109
-		$this->set( 'DTT_description', $description );
108
+	public function set_description($description) {
109
+		$this->set('DTT_description', $description);
110 110
 	}
111 111
 
112 112
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @access        public
120 120
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
121 121
 	 */
122
-	public function set_start_date( $date ) {
123
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
122
+	public function set_start_date($date) {
123
+		$this->_set_date_for($date, 'DTT_EVT_start');
124 124
 	}
125 125
 
126 126
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @access        public
134 134
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
135 135
 	 */
136
-	public function set_start_time( $time ) {
137
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
136
+	public function set_start_time($time) {
137
+		$this->_set_time_for($time, 'DTT_EVT_start');
138 138
 	}
139 139
 
140 140
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @access        public
148 148
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
149 149
 	 */
150
-	public function set_end_date( $date ) {
151
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
150
+	public function set_end_date($date) {
151
+		$this->_set_date_for($date, 'DTT_EVT_end');
152 152
 	}
153 153
 
154 154
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	 * @access        public
162 162
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
163 163
 	 */
164
-	public function set_end_time( $time ) {
165
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
164
+	public function set_end_time($time) {
165
+		$this->_set_time_for($time, 'DTT_EVT_end');
166 166
 	}
167 167
 
168 168
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @access        public
176 176
 	 * @param        int $reg_limit
177 177
 	 */
178
-	public function set_reg_limit( $reg_limit ) {
179
-		$this->set( 'DTT_reg_limit', $reg_limit );
178
+	public function set_reg_limit($reg_limit) {
179
+		$this->set('DTT_reg_limit', $reg_limit);
180 180
 	}
181 181
 
182 182
 
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	 * @access        public
188 188
 	 * @param        int $sold
189 189
 	 */
190
-	public function set_sold( $sold ) {
190
+	public function set_sold($sold) {
191 191
 		// sold can not go below zero
192
-		$sold = max( 0, $sold );
193
-		$this->set( 'DTT_sold', $sold );
192
+		$sold = max(0, $sold);
193
+		$this->set('DTT_sold', $sold);
194 194
 	}
195 195
 
196 196
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * increments sold by amount passed by $qty
200 200
 	 * @param int $qty
201 201
 	 */
202
-	function increase_sold( $qty = 1 ) {
202
+	function increase_sold($qty = 1) {
203 203
 		$sold = $this->sold() + $qty;
204
-		$this->set_sold( $sold );
204
+		$this->set_sold($sold);
205 205
 	}
206 206
 
207 207
 
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	 * decrements (subtracts) sold amount passed by $qty
211 211
 	 * @param int $qty
212 212
 	 */
213
-	function decrease_sold( $qty = 1 ) {
213
+	function decrease_sold($qty = 1) {
214 214
 		$sold = $this->sold() - $qty;
215
-		$this->set_sold( $sold );
215
+		$this->set_sold($sold);
216 216
 	}
217 217
 
218 218
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @return string
223 223
 	 */
224 224
 	public function name() {
225
-		return $this->get( 'DTT_name' );
225
+		return $this->get('DTT_name');
226 226
 	}
227 227
 
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return string
233 233
 	 */
234 234
 	public function description() {
235
-		return $this->get( 'DTT_description' );
235
+		return $this->get('DTT_description');
236 236
 	}
237 237
 
238 238
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * @return boolean          TRUE if is primary, FALSE if not.
243 243
 	 */
244 244
 	public function is_primary() {
245
-		return $this->get( 'DTT_is_primary' );
245
+		return $this->get('DTT_is_primary');
246 246
 	}
247 247
 
248 248
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return int         The order of the datetime for this event.
253 253
 	 */
254 254
 	public function order() {
255
-		return $this->get( 'DTT_order' );
255
+		return $this->get('DTT_order');
256 256
 	}
257 257
 
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return int
263 263
 	 */
264 264
 	public function parent() {
265
-		return $this->get( 'DTT_parent' );
265
+		return $this->get('DTT_parent');
266 266
 	}
267 267
 
268 268
 
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
279 279
 	 * @return    string|bool|void  string on success, FALSE on fail
280 280
 	 */
281
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
281
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
282 282
 		$field_name = "DTT_EVT_{$start_or_end}";
283
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
284
-		if ( ! $echo ) {
283
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
284
+		if ( ! $echo) {
285 285
 			return $dtt;
286 286
 		}
287 287
 		return '';
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
298 298
 	 * @return        mixed        string on success, FALSE on fail
299 299
 	 */
300
-	public function start_date( $dt_frmt = NULL ) {
301
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
300
+	public function start_date($dt_frmt = NULL) {
301
+		return $this->_show_datetime('D', 'start', $dt_frmt);
302 302
 	}
303 303
 
304 304
 
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 	 * Echoes start_date()
308 308
 	 * @param string $dt_frmt
309 309
 	 */
310
-	public function e_start_date( $dt_frmt = NULL ) {
311
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
310
+	public function e_start_date($dt_frmt = NULL) {
311
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
312 312
 	}
313 313
 
314 314
 
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
322 322
 	 * @return        mixed        string on success, FALSE on fail
323 323
 	 */
324
-	public function end_date( $dt_frmt = NULL ) {
325
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
324
+	public function end_date($dt_frmt = NULL) {
325
+		return $this->_show_datetime('D', 'end', $dt_frmt);
326 326
 	}
327 327
 
328 328
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	 * Echoes the end date. See end_date()
332 332
 	 * @param string $dt_frmt
333 333
 	 */
334
-	public function e_end_date( $dt_frmt = NULL ) {
335
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
334
+	public function e_end_date($dt_frmt = NULL) {
335
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
336 336
 	}
337 337
 
338 338
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
346 346
 	 * @return        mixed        string on success, FALSE on fail
347 347
 	 */
348
-	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
349
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
350
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
351
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
352
-		return $start != $end ? $start . $conjunction . $end : $start;
348
+	public function date_range($dt_frmt = NULL, $conjunction = ' - ') {
349
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
350
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
351
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
352
+		return $start != $end ? $start.$conjunction.$end : $start;
353 353
 	}
354 354
 
355 355
 
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 * @param null   $dt_frmt
359 359
 	 * @param string $conjunction
360 360
 	 */
361
-	public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
362
-		echo $this->date_range( $dt_frmt, $conjunction );
361
+	public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') {
362
+		echo $this->date_range($dt_frmt, $conjunction);
363 363
 	}
364 364
 
365 365
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
372 372
 	 * @return        mixed        string on success, FALSE on fail
373 373
 	 */
374
-	public function start_time( $tm_format = NULL ) {
375
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
374
+	public function start_time($tm_format = NULL) {
375
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
376 376
 	}
377 377
 
378 378
 
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 	/**
381 381
 	 * @param null $tm_format
382 382
 	 */
383
-	public function e_start_time( $tm_format = NULL ) {
384
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
383
+	public function e_start_time($tm_format = NULL) {
384
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
385 385
 	}
386 386
 
387 387
 
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
394 394
 	 * @return        mixed        string on success, FALSE on fail
395 395
 	 */
396
-	public function end_time( $tm_format = NULL ) {
397
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
396
+	public function end_time($tm_format = NULL) {
397
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
398 398
 	}
399 399
 
400 400
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	/**
403 403
 	 * @param null $tm_format
404 404
 	 */
405
-	public function e_end_time( $tm_format = NULL ) {
406
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
405
+	public function e_end_time($tm_format = NULL) {
406
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
407 407
 	}
408 408
 
409 409
 
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
417 417
 	 * @return        mixed        string on success, FALSE on fail
418 418
 	 */
419
-	public function time_range( $tm_format = NULL, $conjunction = ' - ' ) {
420
-		$tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
419
+	public function time_range($tm_format = NULL, $conjunction = ' - ') {
420
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
421 421
 
422
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
423
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
424
-		return $start != $end ? $start . $conjunction . $end : $start;
422
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
423
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
424
+		return $start != $end ? $start.$conjunction.$end : $start;
425 425
 	}
426 426
 
427 427
 
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 	 * @param null   $tm_format
431 431
 	 * @param string $conjunction
432 432
 	 */
433
-	public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) {
434
-		echo $this->time_range( $tm_format, $conjunction );
433
+	public function e_time_range($tm_format = NULL, $conjunction = ' - ') {
434
+		echo $this->time_range($tm_format, $conjunction);
435 435
 	}
436 436
 
437 437
 
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
445 445
 	 * @return 	mixed 	string on success, FALSE on fail
446 446
 	 */
447
-	public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) {
448
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
447
+	public function start_date_and_time($dt_format = NULL, $tm_format = NULL) {
448
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
449 449
 	}
450 450
 
451 451
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @param null $dt_frmt
455 455
 	 * @param null $tm_format
456 456
 	 */
457
-	public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) {
458
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
457
+	public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) {
458
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
459 459
 	}
460 460
 
461 461
 
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 * @param bool   $round_up
470 470
 	 * @return float|int|mixed
471 471
 	 */
472
-	public function length( $units = 'seconds', $round_up = FALSE ) {
473
-		$start = $this->get_raw( 'DTT_EVT_start' );
474
-		$end = $this->get_raw( 'DTT_EVT_end' );
472
+	public function length($units = 'seconds', $round_up = FALSE) {
473
+		$start = $this->get_raw('DTT_EVT_start');
474
+		$end = $this->get_raw('DTT_EVT_end');
475 475
 		$length_in_units = $end - $start;
476
-		switch ( $units ) {
476
+		switch ($units) {
477 477
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
478 478
 			/** @noinspection PhpMissingBreakStatementInspection */
479 479
 			case 'days':
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 				$length_in_units /= 60;
487 487
 			case 'seconds':
488 488
 			default:
489
-				$length_in_units = ceil( $length_in_units );
489
+				$length_in_units = ceil($length_in_units);
490 490
 		}
491
-		if ( $round_up ) {
492
-			$length_in_units = max( $length_in_units, 1 );
491
+		if ($round_up) {
492
+			$length_in_units = max($length_in_units, 1);
493 493
 		}
494 494
 		return $length_in_units;
495 495
 	}
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param bool | string 	$tm_format - string representation of time format defaults to 'g:i a'
505 505
 	 * @return 	mixed        		string on success, FALSE on fail
506 506
 	 */
507
-	public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
508
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
507
+	public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
508
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
509 509
 	}
510 510
 
511 511
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * @param bool $dt_frmt
515 515
 	 * @param bool $tm_format
516 516
 	 */
517
-	public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
518
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
517
+	public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
518
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
519 519
 	}
520 520
 
521 521
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return        int
528 528
 	 */
529 529
 	public function start() {
530
-		return $this->get_raw( 'DTT_EVT_start' );
530
+		return $this->get_raw('DTT_EVT_start');
531 531
 	}
532 532
 
533 533
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @return        int
540 540
 	 */
541 541
 	public function end() {
542
-		return $this->get_raw( 'DTT_EVT_end' );
542
+		return $this->get_raw('DTT_EVT_end');
543 543
 	}
544 544
 
545 545
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * @return        mixed        int on success, FALSE on fail
552 552
 	 */
553 553
 	public function reg_limit() {
554
-		return $this->get_raw( 'DTT_reg_limit' );
554
+		return $this->get_raw('DTT_reg_limit');
555 555
 	}
556 556
 
557 557
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @return        mixed        int on success, FALSE on fail
564 564
 	 */
565 565
 	public function sold() {
566
-		return $this->get_raw( 'DTT_sold' );
566
+		return $this->get_raw('DTT_sold');
567 567
 	}
568 568
 
569 569
 
@@ -592,15 +592,15 @@  discard block
 block discarded – undo
592 592
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
593 593
 	 * @return 	int
594 594
 	 */
595
-	public function spaces_remaining( $consider_tickets = FALSE ) {
595
+	public function spaces_remaining($consider_tickets = FALSE) {
596 596
 		// tickets remaining available for purchase
597 597
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
598 598
 		$dtt_remaining = $this->reg_limit() - $this->sold();
599
-		if ( ! $consider_tickets ) {
599
+		if ( ! $consider_tickets) {
600 600
 			return $dtt_remaining;
601 601
 		}
602 602
 		$tickets_remaining = $this->tickets_remaining();
603
-		return min( $dtt_remaining, $tickets_remaining );
603
+		return min($dtt_remaining, $tickets_remaining);
604 604
 	}
605 605
 
606 606
 
@@ -611,19 +611,19 @@  discard block
 block discarded – undo
611 611
 	 * @param array $query_params like EEM_Base::get_all's
612 612
 	 * @return int
613 613
 	 */
614
-	public function tickets_remaining( $query_params = array() ) {
614
+	public function tickets_remaining($query_params = array()) {
615 615
 		$sum = 0;
616
-		$tickets = $this->tickets( $query_params );
617
-		if ( ! empty( $tickets ) ) {
618
-			foreach ( $tickets as $ticket ) {
619
-				if ( $ticket instanceof EE_Ticket ) {
616
+		$tickets = $this->tickets($query_params);
617
+		if ( ! empty($tickets)) {
618
+			foreach ($tickets as $ticket) {
619
+				if ($ticket instanceof EE_Ticket) {
620 620
 					// get the actual amount of tickets that can be sold
621
-					$qty = $ticket->qty( 'saleable' );
622
-					if ( $qty === EE_INF ) {
621
+					$qty = $ticket->qty('saleable');
622
+					if ($qty === EE_INF) {
623 623
 						return EE_INF;
624 624
 					}
625 625
 					// no negative ticket quantities plz
626
-					if ( $qty > 0 ) {
626
+					if ($qty > 0) {
627 627
 						$sum += $qty;
628 628
 					}
629 629
 				}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 * @param array $query_params like EEM_Base::get_all's
641 641
 	 * @return int
642 642
 	 */
643
-	public function sum_tickets_initially_available( $query_params = array() ) {
644
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
643
+	public function sum_tickets_initially_available($query_params = array()) {
644
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
645 645
 	}
646 646
 
647 647
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @return int
654 654
 	 */
655 655
 	public function total_tickets_available_at_this_datetime() {
656
-		return $this->spaces_remaining( true );
656
+		return $this->spaces_remaining(true);
657 657
 	}
658 658
 
659 659
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @return boolean
665 665
 	 */
666 666
 	public function is_upcoming() {
667
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
667
+		return ($this->get_raw('DTT_EVT_start') > time());
668 668
 	}
669 669
 
670 670
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @return boolean
675 675
 	 */
676 676
 	public function is_active() {
677
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
677
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
678 678
 	}
679 679
 
680 680
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	 * @return boolean
685 685
 	 */
686 686
 	public function is_expired() {
687
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
687
+		return ($this->get_raw('DTT_EVT_end') < time());
688 688
 	}
689 689
 
690 690
 
@@ -695,16 +695,16 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	public function get_active_status() {
697 697
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
698
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
698
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
699 699
 			return EE_Datetime::sold_out;
700 700
 		}
701
-		if ( $this->is_expired() ) {
701
+		if ($this->is_expired()) {
702 702
 			return EE_Datetime::expired;
703 703
 		}
704
-		if ( $this->is_upcoming() ) {
704
+		if ($this->is_upcoming()) {
705 705
 			return EE_Datetime::upcoming;
706 706
 		}
707
-		if ( $this->is_active() ) {
707
+		if ($this->is_active()) {
708 708
 			return EE_Datetime::active;
709 709
 		}
710 710
 		return NULL;
@@ -718,24 +718,24 @@  discard block
 block discarded – undo
718 718
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
719 719
 	 * @return string
720 720
 	 */
721
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
722
-		if ( $use_dtt_name ) {
721
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
722
+		if ($use_dtt_name) {
723 723
 			$dtt_name = $this->name();
724
-			if ( !empty( $dtt_name ) ) {
724
+			if ( ! empty($dtt_name)) {
725 725
 				return $dtt_name;
726 726
 			}
727 727
 		}
728 728
 		//first condition is to see if the months are different
729
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
730
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
729
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
730
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
731 731
 			//next condition is if its the same month but different day
732 732
 		}
733 733
 		else {
734
-			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
735
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
734
+			if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) {
735
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
736 736
 			}
737 737
 			else {
738
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
738
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
739 739
 			}
740 740
 		}
741 741
 		return $display_date;
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 *@param array $query_params see EEM_Base::get_all()
750 750
 	 * @return EE_Ticket[]
751 751
 	 */
752
-	public function tickets( $query_params = array() ) {
753
-		return $this->get_many_related( 'Ticket', $query_params );
752
+	public function tickets($query_params = array()) {
753
+		return $this->get_many_related('Ticket', $query_params);
754 754
 	}
755 755
 
756 756
 
@@ -760,21 +760,21 @@  discard block
 block discarded – undo
760 760
 	 * @param array $query_params like EEM_Base::get_all's
761 761
 	 * @return EE_Ticket[]
762 762
 	 */
763
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
763
+	public function ticket_types_available_for_purchase($query_params = array()) {
764 764
 		// first check if datetime is valid
765
-		if ( !( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
765
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
766 766
 			return array();
767 767
 		}
768
-		if ( empty( $query_params ) ) {
768
+		if (empty($query_params)) {
769 769
 			$query_params = array(
770 770
 				array(
771
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
772
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
771
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
772
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
773 773
 					'TKT_deleted'    => false
774 774
 				)
775 775
 			);
776 776
 		}
777
-		return $this->tickets( $query_params );
777
+		return $this->tickets($query_params);
778 778
 	}
779 779
 
780 780
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 	 * @return EE_Event
785 785
 	 */
786 786
 	public function event() {
787
-		return $this->get_first_related( 'Event' );
787
+		return $this->get_first_related('Event');
788 788
 	}
789 789
 
790 790
 
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	public function update_sold() {
798 798
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
799
-			array( array(
799
+			array(array(
800 800
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
801 801
 				'REG_deleted' 				=> 0,
802 802
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
803
-			) )
803
+			))
804 804
 		);
805
-		$this->set( 'DTT_sold', $count_regs_for_this_datetime );
805
+		$this->set('DTT_sold', $count_regs_for_this_datetime);
806 806
 		$this->save();
807 807
 		return $count_regs_for_this_datetime;
808 808
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket.class.php 1 patch
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 *                             		    date_format and the second value is the time format
67 67
 	 * @return EE_Ticket
68 68
 	 */
69
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
70
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
71
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
69
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
70
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
71
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
72 72
 	}
73 73
 
74 74
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 *                          		the website will be used.
80 80
 	 * @return EE_Ticket
81 81
 	 */
82
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
83
-		return new self( $props_n_values, TRUE, $timezone );
82
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
83
+		return new self($props_n_values, TRUE, $timezone);
84 84
 	}
85 85
 
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return bool
90 90
 	 */
91 91
 	public function parent() {
92
-		return $this->get( 'TKT_parent' );
92
+		return $this->get('TKT_parent');
93 93
 	}
94 94
 
95 95
 
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 	 * @param  int $DTT_ID the primary key for a particular datetime
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function available( $DTT_ID = 0 ) {
102
+	public function available($DTT_ID = 0) {
103 103
 		// are we checking availability for a particular datetime ?
104
-		if ( $DTT_ID ) {
104
+		if ($DTT_ID) {
105 105
 			// get that datetime object
106
-			$datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
106
+			$datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
107 107
 			// if  ticket sales for this datetime have exceeded the reg limit...
108
-			if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) {
108
+			if ($datetime instanceof EE_Datetime && $datetime->sold_out()) {
109 109
 				return FALSE;
110 110
 			}
111 111
 		}
@@ -120,21 +120,21 @@  discard block
 block discarded – undo
120 120
 	 * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const
121 121
 	 * @return mixed(int|string) status int if the display string isn't requested
122 122
 	 */
123
-	public function ticket_status( $display = FALSE ) {
124
-		if ( ! $this->is_remaining() ) {
125
-			return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out;
123
+	public function ticket_status($display = FALSE) {
124
+		if ( ! $this->is_remaining()) {
125
+			return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out;
126 126
 		}
127
-		if ( $this->get( 'TKT_deleted' ) ) {
128
-			return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived;
127
+		if ($this->get('TKT_deleted')) {
128
+			return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived;
129 129
 		}
130
-		if ( $this->is_expired() ) {
131
-			return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired;
130
+		if ($this->is_expired()) {
131
+			return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired;
132 132
 		}
133
-		if ( $this->is_pending() ) {
134
-			return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending;
133
+		if ($this->is_pending()) {
134
+			return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending;
135 135
 		}
136
-		if ( $this->is_on_sale() ) {
137
-			return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale;
136
+		if ($this->is_on_sale()) {
137
+			return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale;
138 138
 		}
139 139
 		return '';
140 140
 	}
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	 * @param  int $DTT_ID if an int above 0 is included here then we get a specific dtt.
149 149
 	 * @return boolean         true = tickets remaining, false not.
150 150
 	 */
151
-	public function is_remaining( $DTT_ID = 0 ) {
152
-		$num_remaining = $this->remaining( $DTT_ID );
153
-		if ( $num_remaining === 0 ) {
151
+	public function is_remaining($DTT_ID = 0) {
152
+		$num_remaining = $this->remaining($DTT_ID);
153
+		if ($num_remaining === 0) {
154 154
 			return FALSE;
155 155
 		}
156
-		if ( $num_remaining > 0 && $num_remaining < $this->min() ) {
156
+		if ($num_remaining > 0 && $num_remaining < $this->min()) {
157 157
 			return FALSE;
158 158
 		}
159 159
 		return TRUE;
@@ -167,25 +167,25 @@  discard block
 block discarded – undo
167 167
 	 *                     all related datetimes
168 168
 	 * @return int
169 169
 	 */
170
-	public function remaining( $DTT_ID = 0 ) {
170
+	public function remaining($DTT_ID = 0) {
171 171
 		// are we checking availability for a particular datetime ?
172
-		if ( $DTT_ID ) {
172
+		if ($DTT_ID) {
173 173
 			// get array with the one requested datetime
174
-			$datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
174
+			$datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
175 175
 		} else {
176 176
 			// we need to check availability of ALL datetimes
177
-			$datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
177
+			$datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
178 178
 		}
179 179
 		//		d( $datetimes );
180 180
 		// if datetime reg limit is not unlimited
181
-		if ( ! empty( $datetimes ) ) {
181
+		if ( ! empty($datetimes)) {
182 182
 			// although TKT_qty and $datetime->spaces_remaining() could both be EE_INF
183 183
 			// we only need to check for EE_INF explicitly if we want to optimize.
184 184
 			// because EE_INF - x = EE_INF; and min(x,EE_INF) = x;
185 185
 			$tickets_remaining = $this->qty() - $this->sold();
186
-			foreach ( $datetimes as $datetime ) {
187
-				if ( $datetime instanceof EE_Datetime ) {
188
-					$tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() );
186
+			foreach ($datetimes as $datetime) {
187
+				if ($datetime instanceof EE_Datetime) {
188
+					$tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining());
189 189
 				}
190 190
 			}
191 191
 			return $tickets_remaining;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @return int
201 201
 	 */
202 202
 	function min() {
203
-		return $this->get( 'TKT_min' );
203
+		return $this->get('TKT_min');
204 204
 	}
205 205
 
206 206
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @return boolean
211 211
 	 */
212 212
 	public function is_expired() {
213
-		return ( $this->get_raw( 'TKT_end_date' ) < time() );
213
+		return ($this->get_raw('TKT_end_date') < time());
214 214
 	}
215 215
 
216 216
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 * @return boolean
221 221
 	 */
222 222
 	public function is_pending() {
223
-		return ( $this->get_raw( 'TKT_start_date' ) > time() );
223
+		return ($this->get_raw('TKT_start_date') > time());
224 224
 	}
225 225
 
226 226
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * @return boolean
231 231
 	 */
232 232
 	public function is_on_sale() {
233
-		return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() );
233
+		return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time());
234 234
 	}
235 235
 
236 236
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 * @param string 	$conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
242 242
 	 * @return array
243 243
 	 */
244
-	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
245
-		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : '';
246
-		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : '';
244
+	public function date_range($dt_frmt = '', $conjunction = ' - ') {
245
+		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : '';
246
+		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : '';
247 247
 
248
-		return $first_date && $last_date ? $first_date . $conjunction  . $last_date : '';
248
+		return $first_date && $last_date ? $first_date.$conjunction.$last_date : '';
249 249
 	}
250 250
 
251 251
 
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 	 * @return EE_Datetime
256 256
 	 */
257 257
 	public function first_datetime() {
258
-		$datetimes = $this->datetimes( array( 'limit' => 1 ) );
259
-		return reset( $datetimes );
258
+		$datetimes = $this->datetimes(array('limit' => 1));
259
+		return reset($datetimes);
260 260
 	}
261 261
 
262 262
 
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 	 * @param array $query_params see EEM_Base::get_all()
268 268
 	 * @return EE_Datetime[]
269 269
 	 */
270
-	public function datetimes( $query_params = array() ) {
271
-		if ( ! isset( $query_params[ 'order_by' ] ) ) {
272
-			$query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC';
270
+	public function datetimes($query_params = array()) {
271
+		if ( ! isset($query_params['order_by'])) {
272
+			$query_params['order_by']['DTT_order'] = 'ASC';
273 273
 		}
274
-		return $this->get_many_related( 'Datetime', $query_params );
274
+		return $this->get_many_related('Datetime', $query_params);
275 275
 	}
276 276
 
277 277
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @return EE_Datetime
282 282
 	 */
283 283
 	public function last_datetime() {
284
-		$datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) );
285
-		return end( $datetimes );
284
+		$datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC')));
285
+		return end($datetimes);
286 286
 	}
287 287
 
288 288
 
@@ -296,22 +296,22 @@  discard block
 block discarded – undo
296 296
 	 * @param  int    $dtt_id [optional] include the dtt_id with $what = 'datetime'.
297 297
 	 * @return mixed (array|int)          how many tickets have sold
298 298
 	 */
299
-	public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) {
299
+	public function tickets_sold($what = 'ticket', $dtt_id = NULL) {
300 300
 		$total = 0;
301 301
 		$tickets_sold = $this->_all_tickets_sold();
302
-		switch ( $what ) {
302
+		switch ($what) {
303 303
 			case 'ticket' :
304
-				return $tickets_sold[ 'ticket' ];
304
+				return $tickets_sold['ticket'];
305 305
 				break;
306 306
 			case 'datetime' :
307
-				if ( empty( $tickets_sold[ 'datetime' ] ) ) {
307
+				if (empty($tickets_sold['datetime'])) {
308 308
 					return $total;
309 309
 				}
310
-				if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) {
311
-					EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
310
+				if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) {
311
+					EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
312 312
 					return $total;
313 313
 				}
314
-				return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ];
314
+				return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id];
315 315
 				break;
316 316
 			default:
317 317
 				return $total;
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 	 * @return EE_Ticket[]
326 326
 	 */
327 327
 	protected function _all_tickets_sold() {
328
-		$datetimes = $this->get_many_related( 'Datetime' );
328
+		$datetimes = $this->get_many_related('Datetime');
329 329
 		$tickets_sold = array();
330
-		if ( ! empty( $datetimes ) ) {
331
-			foreach ( $datetimes as $datetime ) {
332
-				$tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' );
330
+		if ( ! empty($datetimes)) {
331
+			foreach ($datetimes as $datetime) {
332
+				$tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold');
333 333
 			}
334 334
 		}
335 335
 		//Tickets sold
336
-		$tickets_sold[ 'ticket' ] = $this->sold();
336
+		$tickets_sold['ticket'] = $this->sold();
337 337
 		return $tickets_sold;
338 338
 	}
339 339
 
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	 * @param  bool $return_array whether to return as an array indexed by price id or just the object.
347 347
 	 * @return EE_Price
348 348
 	 */
349
-	public function base_price( $return_array = FALSE ) {
350
-		$_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price );
351
-		return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) );
349
+	public function base_price($return_array = FALSE) {
350
+		$_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price);
351
+		return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where));
352 352
 	}
353 353
 
354 354
 
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 	 * @return EE_Price[]
361 361
 	 */
362 362
 	public function price_modifiers() {
363
-		$query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) );
364
-		return $this->prices( $query_params );
363
+		$query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax))));
364
+		return $this->prices($query_params);
365 365
 	}
366 366
 
367 367
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param array $query_params like EEM_Base::get_all
372 372
 	 * @return EE_Price[]
373 373
 	 */
374
-	public function prices( $query_params = array() ) {
375
-		return $this->get_many_related( 'Price', $query_params );
374
+	public function prices($query_params = array()) {
375
+		return $this->get_many_related('Price', $query_params);
376 376
 	}
377 377
 
378 378
 
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 	 * @param array $query_params see EEM_Base::get_all()
383 383
 	 * @return EE_Datetime_Ticket
384 384
 	 */
385
-	public function datetime_tickets( $query_params = array() ) {
386
-		return $this->get_many_related( 'Datetime_Ticket', $query_params );
385
+	public function datetime_tickets($query_params = array()) {
386
+		return $this->get_many_related('Datetime_Ticket', $query_params);
387 387
 	}
388 388
 
389 389
 
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param boolean $show_deleted
395 395
 	 * @return EE_Datetime[]
396 396
 	 */
397
-	public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) {
398
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted );
397
+	public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) {
398
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted);
399 399
 	}
400 400
 
401 401
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * @return string
406 406
 	 */
407 407
 	function ID() {
408
-		return $this->get( 'TKT_ID' );
408
+		return $this->get('TKT_ID');
409 409
 	}
410 410
 
411 411
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * @return EE_Ticket_Template
430 430
 	 */
431 431
 	public function template() {
432
-		return $this->get_first_related( 'Ticket_Template' );
432
+		return $this->get_first_related('Ticket_Template');
433 433
 	}
434 434
 
435 435
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @return bool
449 449
 	 */
450 450
 	public function ticket_price() {
451
-		return $this->get( 'TKT_price' );
451
+		return $this->get('TKT_price');
452 452
 	}
453 453
 
454 454
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @return mixed
458 458
 	 */
459 459
 	public function pretty_price() {
460
-		return $this->get_pretty( 'TKT_price' );
460
+		return $this->get_pretty('TKT_price');
461 461
 	}
462 462
 
463 463
 
@@ -476,17 +476,17 @@  discard block
 block discarded – undo
476 476
 	 * @param bool $no_cache
477 477
 	 * @return float
478 478
 	 */
479
-	public function get_ticket_total_with_taxes( $no_cache = FALSE ) {
480
-		if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) {
479
+	public function get_ticket_total_with_taxes($no_cache = FALSE) {
480
+		if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) {
481 481
 			$this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin();
482 482
 		}
483
-		return (float)$this->_ticket_total_with_taxes;
483
+		return (float) $this->_ticket_total_with_taxes;
484 484
 	}
485 485
 
486 486
 
487 487
 
488 488
 	public function ensure_TKT_Price_correct() {
489
-		$this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) );
489
+		$this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this));
490 490
 		$this->save();
491 491
 	}
492 492
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return float
497 497
 	 */
498 498
 	public function get_ticket_subtotal() {
499
-		return EE_Taxes::get_subtotal_for_admin( $this );
499
+		return EE_Taxes::get_subtotal_for_admin($this);
500 500
 	}
501 501
 
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @return float
507 507
 	 */
508 508
 	public function get_ticket_taxes_total_for_admin() {
509
-		return EE_Taxes::get_total_taxes_for_admin( $this );
509
+		return EE_Taxes::get_total_taxes_for_admin($this);
510 510
 	}
511 511
 
512 512
 
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 	 * @param string $name
517 517
 	 * @return boolean
518 518
 	 */
519
-	function set_name( $name ) {
520
-		$this->set( 'TKT_name', $name );
519
+	function set_name($name) {
520
+		$this->set('TKT_name', $name);
521 521
 	}
522 522
 
523 523
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return string
528 528
 	 */
529 529
 	function description() {
530
-		return $this->get( 'TKT_description' );
530
+		return $this->get('TKT_description');
531 531
 	}
532 532
 
533 533
 
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 	 * @param string $description
538 538
 	 * @return boolean
539 539
 	 */
540
-	function set_description( $description ) {
541
-		$this->set( 'TKT_description', $description );
540
+	function set_description($description) {
541
+		$this->set('TKT_description', $description);
542 542
 	}
543 543
 
544 544
 
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
 	 * @param string $tm_frmt
550 550
 	 * @return string
551 551
 	 */
552
-	function start_date( $dt_frmt = '', $tm_frmt = '' ) {
553
-		return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt );
552
+	function start_date($dt_frmt = '', $tm_frmt = '') {
553
+		return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt);
554 554
 	}
555 555
 
556 556
 
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 	 * @param string $start_date
561 561
 	 * @return void
562 562
 	 */
563
-	function set_start_date( $start_date ) {
564
-		$this->_set_date_time( 'B', $start_date, 'TKT_start_date' );
563
+	function set_start_date($start_date) {
564
+		$this->_set_date_time('B', $start_date, 'TKT_start_date');
565 565
 	}
566 566
 
567 567
 
@@ -572,8 +572,8 @@  discard block
 block discarded – undo
572 572
 	 * @param string $tm_frmt
573 573
 	 * @return string
574 574
 	 */
575
-	function end_date( $dt_frmt = '', $tm_frmt = '' ) {
576
-		return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt );
575
+	function end_date($dt_frmt = '', $tm_frmt = '') {
576
+		return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt);
577 577
 	}
578 578
 
579 579
 
@@ -583,8 +583,8 @@  discard block
 block discarded – undo
583 583
 	 * @param string $end_date
584 584
 	 * @return void
585 585
 	 */
586
-	function set_end_date( $end_date ) {
587
-		$this->_set_date_time( 'B', $end_date, 'TKT_end_date' );
586
+	function set_end_date($end_date) {
587
+		$this->_set_date_time('B', $end_date, 'TKT_end_date');
588 588
 	}
589 589
 
590 590
 
@@ -596,8 +596,8 @@  discard block
 block discarded – undo
596 596
 	 *
597 597
 	 * @param string $time a string representation of the sell until time (ex 9am or 7:30pm)
598 598
 	 */
599
-	function set_end_time( $time ) {
600
-		$this->_set_time_for( $time, 'TKT_end_date' );
599
+	function set_end_time($time) {
600
+		$this->_set_time_for($time, 'TKT_end_date');
601 601
 	}
602 602
 
603 603
 
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 * @param int $min
608 608
 	 * @return boolean
609 609
 	 */
610
-	function set_min( $min ) {
611
-		$this->set( 'TKT_min', $min );
610
+	function set_min($min) {
611
+		$this->set('TKT_min', $min);
612 612
 	}
613 613
 
614 614
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 * @return int
619 619
 	 */
620 620
 	function max() {
621
-		return $this->get( 'TKT_max' );
621
+		return $this->get('TKT_max');
622 622
 	}
623 623
 
624 624
 
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
 	 * @param int $max
629 629
 	 * @return boolean
630 630
 	 */
631
-	function set_max( $max ) {
632
-		$this->set( 'TKT_max', $max );
631
+	function set_max($max) {
632
+		$this->set('TKT_max', $max);
633 633
 	}
634 634
 
635 635
 
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 	 * @param float $price
640 640
 	 * @return boolean
641 641
 	 */
642
-	function set_price( $price ) {
643
-		$this->set( 'TKT_price', $price );
642
+	function set_price($price) {
643
+		$this->set('TKT_price', $price);
644 644
 	}
645 645
 
646 646
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * @return int
651 651
 	 */
652 652
 	function sold() {
653
-		return $this->get_raw( 'TKT_sold' );
653
+		return $this->get_raw('TKT_sold');
654 654
 	}
655 655
 
656 656
 
@@ -660,10 +660,10 @@  discard block
 block discarded – undo
660 660
 	 * @param int $qty
661 661
 	 * @return boolean
662 662
 	 */
663
-	function increase_sold( $qty = 1 ) {
663
+	function increase_sold($qty = 1) {
664 664
 		$sold = $this->sold() + $qty;
665
-		$this->_increase_sold_for_datetimes( $qty );
666
-		return $this->set_sold( $sold );
665
+		$this->_increase_sold_for_datetimes($qty);
666
+		return $this->set_sold($sold);
667 667
 	}
668 668
 
669 669
 
@@ -673,12 +673,12 @@  discard block
 block discarded – undo
673 673
 	 * @param int $qty
674 674
 	 * @return boolean
675 675
 	 */
676
-	protected function _increase_sold_for_datetimes( $qty = 1 ) {
676
+	protected function _increase_sold_for_datetimes($qty = 1) {
677 677
 		$datetimes = $this->datetimes();
678
-		if ( is_array( $datetimes ) ) {
679
-			foreach ( $datetimes as $datetime ) {
680
-				if ( $datetime instanceof EE_Datetime ) {
681
-					$datetime->increase_sold( $qty );
678
+		if (is_array($datetimes)) {
679
+			foreach ($datetimes as $datetime) {
680
+				if ($datetime instanceof EE_Datetime) {
681
+					$datetime->increase_sold($qty);
682 682
 					$datetime->save();
683 683
 				}
684 684
 			}
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
 	 * @param int $sold
693 693
 	 * @return boolean
694 694
 	 */
695
-	function set_sold( $sold ) {
695
+	function set_sold($sold) {
696 696
 		// sold can not go below zero
697
-		$sold = max( 0, $sold );
698
-		$this->set( 'TKT_sold', $sold );
697
+		$sold = max(0, $sold);
698
+		$this->set('TKT_sold', $sold);
699 699
 	}
700 700
 
701 701
 
@@ -705,10 +705,10 @@  discard block
 block discarded – undo
705 705
 	 * @param int $qty
706 706
 	 * @return boolean
707 707
 	 */
708
-	function decrease_sold( $qty = 1 ) {
708
+	function decrease_sold($qty = 1) {
709 709
 		$sold = $this->sold() - $qty;
710
-		$this->_decrease_sold_for_datetimes( $qty );
711
-		return $this->set_sold( $sold );
710
+		$this->_decrease_sold_for_datetimes($qty);
711
+		return $this->set_sold($sold);
712 712
 	}
713 713
 
714 714
 
@@ -719,12 +719,12 @@  discard block
 block discarded – undo
719 719
 	* @param int $qty
720 720
 	* @return boolean
721 721
 	*/
722
-	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
722
+	protected function _decrease_sold_for_datetimes($qty = 1) {
723 723
 		$datetimes = $this->datetimes();
724
-		if ( is_array( $datetimes ) ) {
725
-			foreach ( $datetimes as $datetime ) {
726
-				if ( $datetime instanceof EE_Datetime ) {
727
-					$datetime->decrease_sold( $qty );
724
+		if (is_array($datetimes)) {
725
+			foreach ($datetimes as $datetime) {
726
+				if ($datetime instanceof EE_Datetime) {
727
+					$datetime->decrease_sold($qty);
728 728
 					$datetime->save();
729 729
 				}
730 730
 			}
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @return int
747 747
 	 */
748
-	function qty( $context = '' ) {
749
-		switch ( $context ) {
748
+	function qty($context = '') {
749
+		switch ($context) {
750 750
 			case 'reg_limit' :
751 751
 				return $this->real_quantity_on_ticket();
752 752
 			case 'saleable' :
753
-				return $this->real_quantity_on_ticket( 'saleable' );
753
+				return $this->real_quantity_on_ticket('saleable');
754 754
 			default:
755
-				return $this->get_raw( 'TKT_qty' );
755
+				return $this->get_raw('TKT_qty');
756 756
 		}
757 757
 	}
758 758
 
@@ -769,38 +769,38 @@  discard block
 block discarded – undo
769 769
 	 *
770 770
 	 * @return int
771 771
 	 */
772
-	function real_quantity_on_ticket( $context = 'reg_limit' ) {
772
+	function real_quantity_on_ticket($context = 'reg_limit') {
773 773
 		// start with the original db value for ticket quantity
774
-		$raw = $this->get_raw( 'TKT_qty' );
774
+		$raw = $this->get_raw('TKT_qty');
775 775
 		// return immediately if it's zero
776
-		if ( $raw === 0 ) {
776
+		if ($raw === 0) {
777 777
 			return $raw;
778 778
 		}
779 779
 		// ensure qty doesn't exceed raw value for THIS ticket
780
-		$qty = min( EE_INF, $raw );
780
+		$qty = min(EE_INF, $raw);
781 781
 		// NOW that we know the  maximum number of tickets available for the ticket
782 782
 		// we need to calculate the maximum number of tickets available for the datetime
783 783
 		// without really factoring this ticket into the calculations
784 784
 		$datetimes = $this->datetimes();
785
-		foreach ( $datetimes as $datetime ) {
786
-			if ( $datetime instanceof EE_Datetime ) {
785
+		foreach ($datetimes as $datetime) {
786
+			if ($datetime instanceof EE_Datetime) {
787 787
 				// initialize with no restrictions for each datetime
788 788
 				// but adjust datetime qty based on datetime reg limit
789
-				$datetime_qty = min( EE_INF, $datetime->reg_limit() );
789
+				$datetime_qty = min(EE_INF, $datetime->reg_limit());
790 790
 				// if we want the actual saleable amount, then we need to consider OTHER ticket sales
791 791
 				// for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in)
792
-				if ( $context == 'saleable' ) {
793
-					$datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 );
792
+				if ($context == 'saleable') {
793
+					$datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0);
794 794
 					$datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0;
795 795
 				}
796
-				$qty = min( $datetime_qty, $qty );
796
+				$qty = min($datetime_qty, $qty);
797 797
 			}
798 798
 
799 799
 		}
800 800
 		// we need to factor in the details for this specific ticket
801
-		if ( $qty > 0 && $context == 'saleable' ) {
801
+		if ($qty > 0 && $context == 'saleable') {
802 802
 			// and subtract the sales for THIS ticket
803
-			$qty = max( $qty - $this->sold(), 0 );
803
+			$qty = max($qty - $this->sold(), 0);
804 804
 			//echo '&nbsp; $qty: ' . $qty . "<br />";
805 805
 		}
806 806
 		//echo '$qty: ' . $qty . "<br />";
@@ -816,14 +816,14 @@  discard block
 block discarded – undo
816 816
 	 * @return bool
817 817
 	 * @throws \EE_Error
818 818
 	 */
819
-	function set_qty( $qty ) {
819
+	function set_qty($qty) {
820 820
 		$datetimes = $this->datetimes();
821
-		foreach ( $datetimes as $datetime ) {
822
-			if ( $datetime instanceof EE_Datetime ) {
823
-				$qty = min( $qty, $datetime->reg_limit() );
821
+		foreach ($datetimes as $datetime) {
822
+			if ($datetime instanceof EE_Datetime) {
823
+				$qty = min($qty, $datetime->reg_limit());
824 824
 			}
825 825
 		}
826
-		$this->set( 'TKT_qty', $qty );
826
+		$this->set('TKT_qty', $qty);
827 827
 	}
828 828
 
829 829
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	 * @return int
834 834
 	 */
835 835
 	function uses() {
836
-		return $this->get( 'TKT_uses' );
836
+		return $this->get('TKT_uses');
837 837
 	}
838 838
 
839 839
 
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
 	 * @param int $uses
844 844
 	 * @return boolean
845 845
 	 */
846
-	function set_uses( $uses ) {
847
-		$this->set( 'TKT_uses', $uses );
846
+	function set_uses($uses) {
847
+		$this->set('TKT_uses', $uses);
848 848
 	}
849 849
 
850 850
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 	 * @return boolean
855 855
 	 */
856 856
 	public function required() {
857
-		return $this->get( 'TKT_required' );
857
+		return $this->get('TKT_required');
858 858
 	}
859 859
 
860 860
 
@@ -864,8 +864,8 @@  discard block
 block discarded – undo
864 864
 	 * @param boolean $required
865 865
 	 * @return boolean
866 866
 	 */
867
-	public function set_required( $required ) {
868
-		$this->set( 'TKT_required', $required );
867
+	public function set_required($required) {
868
+		$this->set('TKT_required', $required);
869 869
 	}
870 870
 
871 871
 
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 	 * @return boolean
876 876
 	 */
877 877
 	function taxable() {
878
-		return $this->get( 'TKT_taxable' );
878
+		return $this->get('TKT_taxable');
879 879
 	}
880 880
 
881 881
 
@@ -885,8 +885,8 @@  discard block
 block discarded – undo
885 885
 	 * @param boolean $taxable
886 886
 	 * @return boolean
887 887
 	 */
888
-	function set_taxable( $taxable ) {
889
-		$this->set( 'TKT_taxable', $taxable );
888
+	function set_taxable($taxable) {
889
+		$this->set('TKT_taxable', $taxable);
890 890
 	}
891 891
 
892 892
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 	 * @return boolean
897 897
 	 */
898 898
 	function is_default() {
899
-		return $this->get( 'TKT_is_default' );
899
+		return $this->get('TKT_is_default');
900 900
 	}
901 901
 
902 902
 
@@ -906,8 +906,8 @@  discard block
 block discarded – undo
906 906
 	 * @param boolean $is_default
907 907
 	 * @return boolean
908 908
 	 */
909
-	function set_is_default( $is_default ) {
910
-		$this->set( 'TKT_is_default', $is_default );
909
+	function set_is_default($is_default) {
910
+		$this->set('TKT_is_default', $is_default);
911 911
 	}
912 912
 
913 913
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	 * @return int
918 918
 	 */
919 919
 	function order() {
920
-		return $this->get( 'TKT_order' );
920
+		return $this->get('TKT_order');
921 921
 	}
922 922
 
923 923
 
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
 	 * @param int $order
928 928
 	 * @return boolean
929 929
 	 */
930
-	function set_order( $order ) {
931
-		$this->set( 'TKT_order', $order );
930
+	function set_order($order) {
931
+		$this->set('TKT_order', $order);
932 932
 	}
933 933
 
934 934
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 	 * @return int
939 939
 	 */
940 940
 	function row() {
941
-		return $this->get( 'TKT_row' );
941
+		return $this->get('TKT_row');
942 942
 	}
943 943
 
944 944
 
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 	 * @param int $row
949 949
 	 * @return boolean
950 950
 	 */
951
-	function set_row( $row ) {
952
-		$this->set( 'TKT_row', $row );
951
+	function set_row($row) {
952
+		$this->set('TKT_row', $row);
953 953
 	}
954 954
 
955 955
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 	 * @return boolean
960 960
 	 */
961 961
 	function deleted() {
962
-		return $this->get( 'TKT_deleted' );
962
+		return $this->get('TKT_deleted');
963 963
 	}
964 964
 
965 965
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
 	 * @param boolean $deleted
970 970
 	 * @return boolean
971 971
 	 */
972
-	function set_deleted( $deleted ) {
973
-		$this->set( 'TKT_deleted', $deleted );
972
+	function set_deleted($deleted) {
973
+		$this->set('TKT_deleted', $deleted);
974 974
 	}
975 975
 
976 976
 
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 	 * @return int
981 981
 	 */
982 982
 	function parent_ID() {
983
-		return $this->get( 'TKT_parent' );
983
+		return $this->get('TKT_parent');
984 984
 	}
985 985
 
986 986
 
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
 	 * @param int $parent
991 991
 	 * @return boolean
992 992
 	 */
993
-	function set_parent_ID( $parent ) {
994
-		$this->set( 'TKT_parent', $parent );
993
+	function set_parent_ID($parent) {
994
+		$this->set('TKT_parent', $parent);
995 995
 	}
996 996
 
997 997
 
@@ -1002,10 +1002,10 @@  discard block
 block discarded – undo
1002 1002
 	 */
1003 1003
 	function name_and_info() {
1004 1004
 		$times = array();
1005
-		foreach ( $this->datetimes() as $datetime ) {
1005
+		foreach ($this->datetimes() as $datetime) {
1006 1006
 			$times[] = $datetime->start_date_and_time();
1007 1007
 		}
1008
-		return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price();
1008
+		return $this->name()." @ ".implode(", ", $times)." for ".$this->price();
1009 1009
 	}
1010 1010
 
1011 1011
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 * @return string
1016 1016
 	 */
1017 1017
 	function name() {
1018
-		return $this->get( 'TKT_name' );
1018
+		return $this->get('TKT_name');
1019 1019
 	}
1020 1020
 
1021 1021
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 	 * @return float
1026 1026
 	 */
1027 1027
 	function price() {
1028
-		return $this->get( 'TKT_price' );
1028
+		return $this->get('TKT_price');
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
 	 * @param array $query_params like EEM_Base::get_all's
1036 1036
 	 * @return EE_Registration[]
1037 1037
 	 */
1038
-	public function registrations( $query_params = array() ) {
1039
-		return $this->get_many_related( 'Registration', $query_params );
1038
+	public function registrations($query_params = array()) {
1039
+		return $this->get_many_related('Registration', $query_params);
1040 1040
 	}
1041 1041
 
1042 1042
 
@@ -1047,8 +1047,8 @@  discard block
 block discarded – undo
1047 1047
 	 * @return int
1048 1048
 	 */
1049 1049
 	public function update_tickets_sold() {
1050
-		$count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) );
1051
-		$this->set_sold( $count_regs_for_this_ticket );
1050
+		$count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0)));
1051
+		$this->set_sold($count_regs_for_this_ticket);
1052 1052
 		$this->save();
1053 1053
 		return $count_regs_for_this_ticket;
1054 1054
 	}
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 	 * @param array $query_params like EEM_Base::get_all's
1061 1061
 	 * @return int
1062 1062
 	 */
1063
-	public function count_registrations( $query_params = array() ) {
1063
+	public function count_registrations($query_params = array()) {
1064 1064
 		return $this->count_related('Registration', $query_params);
1065 1065
 	}
1066 1066
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	public function get_related_event() {
1086 1086
 		//get one datetime to use for getting the event
1087 1087
 		$datetime = $this->first_datetime();
1088
-		if ( $datetime instanceof EE_Datetime ) {
1088
+		if ($datetime instanceof EE_Datetime) {
1089 1089
 			return $datetime->event();
1090 1090
 		}
1091 1091
 		return null;
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket.model.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Ticket.class.php');
26 26
 
27 27
 class EEM_Ticket extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Ticket','event_espresso');
40
-		$this->plural_item = __('Tickets','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Ticket', 'event_espresso');
40
+		$this->plural_item = __('Tickets', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Ticket'=>array(
47
-				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')),
48
-				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'),
47
+				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')),
48
+				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'),
49 49
 				'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''),
50
-				'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ),
51
-				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ),
52
-				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ),
53
-				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ),
54
-				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ),
50
+				'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''),
51
+				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone),
52
+				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone),
53
+				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0),
54
+				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF),
55 55
 				'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0),
56 56
 				'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0),
57
-				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF),
58
-				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ),
59
-				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ),
60
-				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false),
61
-				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ),
57
+				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF),
58
+				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF),
59
+				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false),
60
+				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false),
61
+				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false),
62 62
 				'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0),
63
-				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ),
63
+				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0),
64 64
 				'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false),
65
-				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ),
66
-				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 )
65
+				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE),
66
+				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0)
67 67
 			));
68 68
 		$this->_model_relations = array(
69 69
 			'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		);
76 76
 
77 77
 		//this model is generally available for reading
78
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
78
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
79 79
 		//account for default tickets in the caps
80
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
81
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
82
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
83
-		parent::__construct( $timezone );
80
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
81
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
82
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
83
+		parent::__construct($timezone);
84 84
 	}
85 85
 
86 86
 
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_all_default_tickets() {
93 93
 		/** @type EE_Ticket[] $tickets */
94
-		$tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')) );
94
+		$tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')));
95 95
 		//we need to set the start date and end date to today's date and the start of the default dtt
96
-		return $this->_set_default_dates( $tickets );
96
+		return $this->_set_default_dates($tickets);
97 97
 	}
98 98
 
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @param EE_Ticket[] $tickets
104 104
 	 * @return EE_Ticket[]
105 105
 	 */
106
-	private function _set_default_dates( $tickets ) {
107
-		foreach ( $tickets as $ticket ) {
108
-			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) );
109
-			$ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) );
110
-			$ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) );
106
+	private function _set_default_dates($tickets) {
107
+		foreach ($tickets as $ticket) {
108
+			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true));
109
+			$ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30));
110
+			$ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone));
111 111
 		}
112 112
 
113 113
 		return $tickets;
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @param array $query_params
123 123
 	 * @return int
124 124
 	 */
125
-	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){
126
-		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params );
125
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
126
+		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params);
127 127
 	}
128 128
 
129 129
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @param EE_Ticket[] $tickets
134 134
 	 * @return void
135 135
 	 */
136
-	public function update_tickets_sold($tickets){
137
-		foreach($tickets as $ticket){
136
+	public function update_tickets_sold($tickets) {
137
+		foreach ($tickets as $ticket) {
138 138
 			/* @var  $ticket EE_Ticket */
139 139
 			$ticket->update_tickets_sold();
140 140
 		}
Please login to merge, or discard this patch.
modules/ticket_selector/templates/ticket_selector_chart.template.php 1 patch
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -8,32 +8,32 @@  discard block
 block discarded – undo
8 8
 
9 9
 $row = 1;
10 10
 $max = 1;
11
-$ticket_count = count( $tickets );
11
+$ticket_count = count($tickets);
12 12
 
13
-if ( ! $ticket_count ) {
13
+if ( ! $ticket_count) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 $required_ticket_sold_out = FALSE;
18
-$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
18
+$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
19 19
 ob_start();
20 20
 
21
-foreach ( $tickets as $TKT_ID => $ticket ) {
22
-	if ( $ticket instanceof EE_Ticket ) {
21
+foreach ($tickets as $TKT_ID => $ticket) {
22
+	if ($ticket instanceof EE_Ticket) {
23 23
 		//	d( $ticket );
24
-		$max =$ticket->max();
24
+		$max = $ticket->max();
25 25
 		$min = 0;
26 26
 		$remaining = $ticket->remaining();
27
-		if ( $ticket->is_on_sale() && $ticket->is_remaining() ) {
27
+		if ($ticket->is_on_sale() && $ticket->is_remaining()) {
28 28
 			// offer the number of $tickets_remaining or $max_atndz, whichever is smaller
29
-			$max = min( $remaining, $max_atndz );
29
+			$max = min($remaining, $max_atndz);
30 30
 			// but... we also want to restrict the number of tickets by the ticket max setting,
31 31
 			// however, the max still can't be higher than what was just set above
32
-			$max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max;
32
+			$max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max;
33 33
 			// and we also want to restrict the minimum number of tickets by the ticket min setting
34 34
 			$min = $ticket->min() > 0 ? $ticket->min() : 0;
35 35
 			// and if the ticket is required, then make sure that min qty is at least 1
36
-			$min = $ticket->required() ? max( $min, 1 ) : $min;
36
+			$min = $ticket->required() ? max($min, 1) : $min;
37 37
 		} else {
38 38
 			// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
39 39
 			$required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out;
@@ -42,40 +42,40 @@  discard block
 block discarded – undo
42 42
 		$ticket_price = $ticket->get_ticket_total_with_taxes();
43 43
 		$ticket_bundle = FALSE;
44 44
 		// for ticket bundles, set min and max qty the same
45
-		if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) {
45
+		if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) {
46 46
 			$ticket_price = $ticket_price * $ticket->min();
47 47
 			$ticket_bundle = TRUE;
48 48
 		}
49
-		$ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket );
49
+		$ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket);
50 50
 		// if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well.
51 51
 		// tickets that go on sale at a later date than the required ticket  will NOT be affected
52 52
 		$tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status();
53 53
 		$tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status;
54 54
 		// check ticket status
55
-		switch ( $tkt_status ) {
55
+		switch ($tkt_status) {
56 56
 			// sold_out
57 57
 			case EE_Ticket::sold_out :
58
-				$ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>';
58
+				$ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>';
59 59
 				$status_class = 'ticket-sales-sold-out lt-grey-text';
60 60
 			break;
61 61
 			// expired
62 62
 			case EE_Ticket::expired :
63
-				$ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>';
63
+				$ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>';
64 64
 				$status_class = 'ticket-sales-expired lt-grey-text';
65 65
 			break;
66 66
 			// archived
67 67
 			case EE_Ticket::archived :
68
-				$ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>';
68
+				$ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>';
69 69
 				$status_class = 'archived-ticket hidden';
70 70
 			break;
71 71
 			// pending
72 72
 			case EE_Ticket::pending :
73
-				$ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>';
73
+				$ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>';
74 74
 				$status_class = 'ticket-pending';
75 75
 			break;
76 76
 			// onsale
77 77
 			case EE_Ticket::onsale :
78
-				$ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>';
78
+				$ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>';
79 79
 				$status_class = 'ticket-on-sale';
80 80
 			break;
81 81
 		}
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 		 *
91 91
 		 * @var string|bool
92 92
 		 */
93
-		if ( false !== ( $new_row_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
93
+		if (false !== ($new_row_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
94 94
 			echo $new_row_content;
95 95
 			continue;
96 96
 		}
97 97
 	?>
98
-				<tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>">
98
+				<tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>">
99 99
 		<?php
100 100
 		/**
101 101
 		 * Allow plugins to hook in and abort the generation and display of the contents of this
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
 		 *
108 108
 		 * @var string|bool
109 109
 		 */
110
-		if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
110
+		if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
111 111
 			echo $new_row_cells_content;
112 112
 			echo '</tr>';
113 113
 			continue;
114 114
 		}
115 115
 		?>
116 116
 					<td class="tckt-slctr-tbl-td-name">
117
-						<b><?php echo $ticket->get_pretty('TKT_name');?></b>
118
-						<?php if ( $template_settings->show_ticket_details ) : ?>
119
-							<a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>">
120
-								<?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), '&nbsp;' ); ?>
117
+						<b><?php echo $ticket->get_pretty('TKT_name'); ?></b>
118
+						<?php if ($template_settings->show_ticket_details) : ?>
119
+							<a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>">
120
+								<?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), '&nbsp;'); ?>
121 121
 							</a>
122
-							<a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;">
123
-								<?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), '&nbsp;' ); ?>
122
+							<a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;">
123
+								<?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), '&nbsp;'); ?>
124 124
 							</a>
125 125
 						<?php endif; //end show details check ?>
126
-					<?php if ( $ticket->required() ) { ?>
127
-						<p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p>
126
+					<?php if ($ticket->required()) { ?>
127
+						<p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p>
128 128
 					<?php } ?>
129 129
 					<?php
130 130
 //	echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>';
@@ -138,63 +138,63 @@  discard block
 block discarded – undo
138 138
 //	echo '<br/><b> $ticket->required() : ' .  $ticket->uses() . '</b>';
139 139
 					?>
140 140
 					</td>
141
-					<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
142
-					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?>&nbsp;<span class="smaller-text no-bold"><?php
143
-						if ( $ticket_bundle ) {
144
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' ));
141
+					<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
142
+					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?>&nbsp;<span class="smaller-text no-bold"><?php
143
+						if ($ticket_bundle) {
144
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso'));
145 145
 						} else {
146
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' ));
146
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso'));
147 147
 						}?></span>&nbsp;</td>
148 148
 					<?php } ?>
149 149
 					<td class="tckt-slctr-tbl-td-qty cntr">
150 150
 					<?php
151 151
 					$hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE;
152 152
 					// sold out or other status ?
153
-					if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) {
153
+					if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) {
154 154
 					?>
155
-						<span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold&nbsp;Out', 'event_espresso' ));?></span>
155
+						<span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold&nbsp;Out', 'event_espresso')); ?></span>
156 156
 					<?php
157
-					} else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) {
157
+					} else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) {
158 158
 						echo $ticket_status;
159
-					} else if ( $tkt_status == EE_Ticket::pending ) {
159
+					} else if ($tkt_status == EE_Ticket::pending) {
160 160
 					?>
161 161
 					<div class="ticket-pending-pg">
162
-						<span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes&nbsp;On&nbsp;Sale', 'event_espresso' )); ?></span><br/>
163
-						<span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span>
162
+						<span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes&nbsp;On&nbsp;Sale', 'event_espresso')); ?></span><br/>
163
+						<span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span>
164 164
 					</div>
165 165
 					<?php
166 166
 					// min qty purchasable is less than tickets available
167
-					} else if ( $ticket->min() > $remaining ) {
167
+					} else if ($ticket->min() > $remaining) {
168 168
 					?>
169 169
 					<div class="archived-ticket-pg">
170
-						<span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/>
170
+						<span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/>
171 171
 					</div>
172 172
 					<?php
173 173
 					// if only one attendee is allowed to register at a time
174
-					} else if ( $max_atndz  == 1 ) {
174
+					} else if ($max_atndz == 1) {
175 175
 						// display submit button since we have tickets available
176
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
176
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
177 177
 				?>
178
-					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?>  title=""/>
178
+					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?>  title=""/>
179 179
 			<?php
180 180
 						$hidden_input_qty = FALSE;
181 181
 
182
-					} else if ( $max_atndz  == 0 ) {
183
-						echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>';
184
-					} elseif ( $max > 0 ) {
182
+					} else if ($max_atndz == 0) {
183
+						echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>';
184
+					} elseif ($max > 0) {
185 185
 						// display submit button since we have tickets available
186
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
186
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
187 187
 
188 188
 				?>
189
-					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title="">
189
+					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title="">
190 190
 					<?php
191 191
 						// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
192
-						if ( ! $ticket->required() && $min !== 0 ) {
192
+						if ( ! $ticket->required() && $min !== 0) {
193 193
 					?>
194 194
 						<option value="0">&nbsp;0&nbsp;</option>
195 195
 					<?php }
196 196
 						// offer ticket quantities from the min to the max
197
-						for ( $i = $min; $i <= $max; $i++) {
197
+						for ($i = $min; $i <= $max; $i++) {
198 198
 					?>
199 199
 						<option value="<?php echo $i; ?>">&nbsp;<?php echo $i; ?>&nbsp;</option>
200 200
 					<?php } ?>
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
 					}
206 206
 					// depending on group reg we need to change the format for qty
207
-					if ( $hidden_input_qty ) {
207
+					if ($hidden_input_qty) {
208 208
 					?>
209 209
 					<input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" />
210 210
 					<?php
@@ -214,33 +214,33 @@  discard block
 block discarded – undo
214 214
 
215 215
 					</td>
216 216
 				</tr>
217
-				<?php if ( $template_settings->show_ticket_details ) : ?>
218
-					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>">
217
+				<?php if ($template_settings->show_ticket_details) : ?>
218
+					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>">
219 219
 						<td class="tckt-slctr-tkt-details-td" colspan="3" >
220
-							<div id="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
220
+							<div id="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
221 221
 
222 222
 								<section class="tckt-slctr-tkt-details-sctn">
223
-									<h3><?php _e( 'Details', 'event_espresso' ); ?></h3>
223
+									<h3><?php _e('Details', 'event_espresso'); ?></h3>
224 224
 									<p><?php echo $ticket->description(); ?></p>
225 225
 
226
-									<?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
226
+									<?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
227 227
 									<section class="tckt-slctr-tkt-price-sctn">
228
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5>
228
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5>
229 229
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
230 230
 											<table class="tckt-slctr-tkt-details-tbl">
231 231
 												<thead>
232 232
 													<tr>
233
-														<th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th>
234
-														<th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th>
235
-														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th>
233
+														<th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th>
234
+														<th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th>
235
+														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th>
236 236
 													</tr>
237 237
 												</thead>
238 238
 												<tbody>
239
-										<?php if ( $ticket->base_price() instanceof EE_Price ) { ?>
239
+										<?php if ($ticket->base_price() instanceof EE_Price) { ?>
240 240
 													<tr>
241
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
242
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
243
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
241
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
242
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
243
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
244 244
 													</tr>
245 245
 													<?php
246 246
 															$running_total = $ticket->base_price()->amount();
@@ -248,44 +248,44 @@  discard block
 block discarded – undo
248 248
 															$running_total = 0;
249 249
 														}
250 250
 														// now add price modifiers
251
-														foreach ( $ticket->price_modifiers() as $price_mod ) { ?>
251
+														foreach ($ticket->price_modifiers() as $price_mod) { ?>
252 252
 													<tr>
253
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
254
-													<?php if ( $price_mod->is_percent() ) { ?>
255
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
253
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
254
+													<?php if ($price_mod->is_percent()) { ?>
255
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
256 256
 														<?php
257
-															$new_sub_total = $running_total * ( $price_mod->amount() / 100 );
257
+															$new_sub_total = $running_total * ($price_mod->amount() / 100);
258 258
 															$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
259 259
 														?>
260 260
 													<?php } else { ?>
261 261
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
262
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
262
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
263 263
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
264 264
 													<?php } ?>
265
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td>
265
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td>
266 266
 														<?php $running_total += $new_sub_total; ?>
267 267
 													</tr>
268 268
 												<?php } ?>
269
-												<?php if ( $ticket->taxable() ) { ?>
269
+												<?php if ($ticket->taxable()) { ?>
270 270
 													<?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?>
271 271
 													<tr>
272
-														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td>
273
-														<td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency( $running_total ); ?></b></td>
272
+														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td>
273
+														<td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency($running_total); ?></b></td>
274 274
 													</tr>
275 275
 
276
-													<?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?>
276
+													<?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?>
277 277
 													<tr>
278
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
279
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
280
-														<?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?>
281
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td>
278
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
279
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
280
+														<?php $tax_amount = $running_total * ($tax->amount() / 100); ?>
281
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td>
282 282
 														<?php $running_total += $tax_amount; ?>
283 283
 													</tr>
284 284
 													<?php } ?>
285 285
 												<?php } ?>
286 286
 													<tr>
287
-														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td>
288
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td>
287
+														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td>
288
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
289 289
 													</tr>
290 290
 												</tbody>
291 291
 											</table>
@@ -295,106 +295,106 @@  discard block
 block discarded – undo
295 295
 									<?php } ?>
296 296
 
297 297
 									<section class="tckt-slctr-tkt-sale-dates-sctn">
298
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5>
299
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/>
300
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date',  $time_format ) ; ?><br/>
301
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/>
298
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5>
299
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/>
300
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/>
301
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/>
302 302
 									</section>
303 303
 									<br/>
304 304
 
305
-									<?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?>
305
+									<?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?>
306 306
 
307
-									<?php if ( $ticket->min() &&$ticket->max() ) { ?>
307
+									<?php if ($ticket->min() && $ticket->max()) { ?>
308 308
 									<section class="tckt-slctr-tkt-quantities-sctn">
309
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5>
310
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/>
311
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
312
-										<?php if ( $ticket->min() > $remaining ) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/>
309
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5>
310
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/>
311
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
312
+										<?php if ($ticket->min() > $remaining) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/>
313 313
 										<?php //$max = min( $max, $max_atndz );?>
314
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/>
314
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/>
315 315
 									</section>
316 316
 									<br/>
317 317
 									<?php } ?>
318 318
 
319
-									<?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?>
319
+									<?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?>
320 320
 									<section class="tckt-slctr-tkt-uses-sctn">
321
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5>
321
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5>
322 322
 										<span class="drk-grey-text small-text no-bold"> - <?php
323 323
 											echo apply_filters(
324 324
 												'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
325 325
 												sprintf(
326
-													__( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ),
326
+													__('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'),
327 327
 													'<br/>',
328 328
 													'<strong>',
329 329
 													'</strong>'
330 330
 												)
331 331
 											);
332 332
 											?></span><br/>
333
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php  echo $ticket->uses();?><br/>
333
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php  echo $ticket->uses(); ?><br/>
334 334
 									</section>
335 335
 									<?php } ?>
336 336
 
337 337
 									<?php
338
-									$datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE );
338
+									$datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE);
339 339
 									$chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
340
-									if ( ! empty( $datetimes )) { ?>
340
+									if ( ! empty($datetimes)) { ?>
341 341
 									<section class="tckt-slctr-tkt-datetimes-sctn">
342
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5>
343
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span>
342
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5>
343
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span>
344 344
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
345 345
 											<table class="tckt-slctr-tkt-details-tbl">
346 346
 												<thead>
347 347
 													<tr>
348 348
 														<th class="tckt-slctr-tkt-details-date-th">
349
-															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span>
349
+															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span>
350 350
 														</th>
351 351
 														<th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
352
-															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span>
352
+															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span>
353 353
 														</th>
354
-														<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
354
+														<?php if ($template_settings->show_ticket_sale_columns) : ?>
355 355
 															<th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
356
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span>
356
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span>
357 357
 															</th>
358 358
 															<th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
359
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span>
359
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span>
360 360
 															</th>
361 361
 															<th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
362
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span>
362
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span>
363 363
 															</th>
364 364
 															<th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
365
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span>
365
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span>
366 366
 															</th>
367 367
 														<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
368 368
 													</tr>
369 369
 												</thead>
370 370
 												<tbody>
371 371
 											<?php
372
-												foreach ( $datetimes as $datetime ) {
373
-													if ( $datetime instanceof EE_Datetime ) {
372
+												foreach ($datetimes as $datetime) {
373
+													if ($datetime instanceof EE_Datetime) {
374 374
 											?>
375 375
 
376 376
 												<tr>
377
-													<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text">
377
+													<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text">
378 378
 														<?php $datetime_name = $datetime->name(); ?>
379
-														<?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?>
380
-														<?php echo $datetime->date_range( $date_format, __( ' to  ', 'event_espresso' )); ?>
379
+														<?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?>
380
+														<?php echo $datetime->date_range($date_format, __(' to  ', 'event_espresso')); ?>
381 381
 													</td>
382
-													<td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text">
383
-														<?php echo $datetime->time_range( $time_format, __( ' to  ', 'event_espresso' )); ?>
382
+													<td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text">
383
+														<?php echo $datetime->time_range($time_format, __(' to  ', 'event_espresso')); ?>
384 384
 													</td>
385
-													<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
386
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text">
385
+													<?php if ($template_settings->show_ticket_sale_columns) : ?>
386
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text">
387 387
 															<?php echo $ticket->sold(); ?>
388 388
 														</td>
389
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text">
390
-															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?>
389
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text">
390
+															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?>
391 391
 														</td>
392
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text">
392
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text">
393 393
 															<?php echo $datetime->sold(); ?>
394 394
 														</td>
395
-												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold&nbsp;Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?>
396
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text">
397
-															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?>
395
+												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold&nbsp;Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?>
396
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text">
397
+															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?>
398 398
 														</td>
399 399
 													<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
400 400
 												</tr>
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 							</div>
413 413
 						</td>
414 414
 					</tr>
415
-				<?php endif;  //end template_settings->show_ticket_details check?>
415
+				<?php endif; //end template_settings->show_ticket_details check?>
416 416
 	<?php
417 417
 			$row++;
418 418
 		}
@@ -421,32 +421,32 @@  discard block
 block discarded – undo
421 421
 $ticket_row_html = ob_get_clean();
422 422
 // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector
423 423
 $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false;
424
-$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID );
424
+$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID);
425 425
 //EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ );
426 426
 //EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ );
427 427
 //EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ );
428 428
 //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ );
429 429
 remove_filter(
430 430
 	'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
431
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
431
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
432 432
 );
433 433
 remove_filter(
434 434
 	'FHEE__EE_Ticket_Selector__after_view_details_btn',
435
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
435
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
436 436
 );
437
-if ( ! $hide_ticket_selector ) {
437
+if ( ! $hide_ticket_selector) {
438 438
 ?>
439 439
 <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv">
440 440
 
441
-	<?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?>
441
+	<?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?>
442 442
 
443 443
 	<table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl">
444 444
 		<thead>
445 445
 			<tr>
446 446
 				<th scope="col" class="ee-ticket-selector-ticket-details-th">
447
-					<?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?>
447
+					<?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?>
448 448
 				</th>
449
-				<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
449
+				<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
450 450
 				<th scope="col" class="ee-ticket-selector-ticket-price-th cntr">
451 451
 					<?php
452 452
 						/**
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 						 * @param string 'Price' The translatable text to display in the table header for price
458 458
 						 * @param int $EVT_ID The Event ID
459 459
 						 */
460
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) );
460
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID));
461 461
 					?>
462 462
 				</th>
463 463
 				<?php } ?>
@@ -471,24 +471,24 @@  discard block
 block discarded – undo
471 471
 						* @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
472 472
 						* @param int $EVT_ID The Event ID
473 473
 						*/
474
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) );
474
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID));
475 475
 					?>
476 476
 				</th>
477 477
 			</tr>
478 478
 		</thead>
479 479
 		<tbody>
480
-			<?php echo $ticket_row_html;?>
480
+			<?php echo $ticket_row_html; ?>
481 481
 		</tbody>
482 482
 	</table>
483 483
 
484 484
 	<input type="hidden" name="noheader" value="true" />
485
-	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" />
485
+	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" />
486 486
 	<input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" />
487 487
 	<input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" />
488 488
 	<input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" />
489 489
 
490 490
 <?php
491
-if ( $max_atndz > 0 && ! $hide_ticket_selector ) {
491
+if ($max_atndz > 0 && ! $hide_ticket_selector) {
492 492
 	echo apply_filters(
493 493
 		'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
494 494
 		''
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 }
497 497
 ?>
498 498
 
499
-	<?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?>
499
+	<?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?>
500 500
 
501 501
 </div>
502
-<?php } else if ( isset( $TKT_ID ) ) { ?>
502
+<?php } else if (isset($TKT_ID)) { ?>
503 503
 <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/>
504 504
 <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/>
505 505
 <input type="hidden" name="noheader" value="true"/>
@@ -508,27 +508,27 @@  discard block
 block discarded – undo
508 508
 <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/>
509 509
 <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/>
510 510
 <?php
511
-	if ( $ticket instanceof EE_Ticket ) {
512
-		do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event );
511
+	if ($ticket instanceof EE_Ticket) {
512
+		do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
513 513
 		$ticket_description = $ticket->description();
514 514
 ?>
515 515
 <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv">
516 516
 	<div class="no-tkt-slctr-ticket-content-dv">
517 517
 		<h5><?php echo $ticket->name(); ?></h5>
518
-		<?php if ( ! empty( $ticket_description ) ) { ?>
518
+		<?php if ( ! empty($ticket_description)) { ?>
519 519
 		<p><?php echo $ticket_description; ?></p>
520 520
 		<?php } ?>
521 521
 	</div>
522 522
 <?php
523 523
 		add_filter(
524 524
 			'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
525
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
525
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
526 526
 		);
527 527
 		add_filter(
528 528
 			'FHEE__EE_Ticket_Selector__after_view_details_btn',
529
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
529
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
530 530
 		);
531
-		do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event );
531
+		do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
532 532
 	}
533 533
 }
534 534
 ?>
Please login to merge, or discard this patch.
core/db_classes/EE_Transaction.class.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * @subpackage 	includes/classes/EE_Transaction.class.php
27 27
  * @author 				Brent Christensen
28 28
  */
29
-class EE_Transaction extends EE_Base_Class implements EEI_Transaction{
29
+class EE_Transaction extends EE_Base_Class implements EEI_Transaction {
30 30
 
31 31
 
32 32
 	/**
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 *                             		    date_format and the second value is the time format
39 39
 	 * @return EE_Transaction
40 40
 	 */
41
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
42
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
43
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
41
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
42
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
43
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
44 44
 	}
45 45
 
46 46
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 *                          		the website will be used.
52 52
 	 * @return EE_Attendee
53 53
 	 */
54
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
55
-		return new self( $props_n_values, TRUE, $timezone );
54
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
55
+		return new self($props_n_values, TRUE, $timezone);
56 56
 	}
57 57
 
58 58
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @return 	void
68 68
 	 */
69 69
 	public function lock() {
70
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
71
-		$locked_transactions[ $this->ID() ] = true;
72
-		update_option( 'ee_locked_transactions', $locked_transactions );
70
+		$locked_transactions = get_option('ee_locked_transactions', array());
71
+		$locked_transactions[$this->ID()] = true;
72
+		update_option('ee_locked_transactions', $locked_transactions);
73 73
 	}
74 74
 
75 75
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 	 * @return 	void
84 84
 	 */
85 85
 	public function unlock() {
86
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
87
-		unset( $locked_transactions[ $this->ID() ] );
88
-		update_option( 'ee_locked_transactions', $locked_transactions );
86
+		$locked_transactions = get_option('ee_locked_transactions', array());
87
+		unset($locked_transactions[$this->ID()]);
88
+		update_option('ee_locked_transactions', $locked_transactions);
89 89
 	}
90 90
 
91 91
 	/**
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @return boolean
103 103
 	 */
104 104
 	public function is_locked() {
105
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
106
-		return isset( $locked_transactions[ $this->ID() ] ) ? true : false;
105
+		$locked_transactions = get_option('ee_locked_transactions', array());
106
+		return isset($locked_transactions[$this->ID()]) ? true : false;
107 107
 	}
108 108
 
109 109
 
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @access        public
115 115
 	 * @param        float $total total value of transaction
116 116
 	 */
117
-	public function set_total( $total = 0.00 ) {
118
-		$this->set( 'TXN_total', $total );
117
+	public function set_total($total = 0.00) {
118
+		$this->set('TXN_total', $total);
119 119
 	}
120 120
 
121 121
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @access        public
127 127
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
128 128
 	 */
129
-	public function set_paid( $total_paid = 0.00 ) {
130
-		$this->set( 'TXN_paid', $total_paid );
129
+	public function set_paid($total_paid = 0.00) {
130
+		$this->set('TXN_paid', $total_paid);
131 131
 	}
132 132
 
133 133
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @access        public
139 139
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
140 140
 	 */
141
-	public function set_status( $status = '' ) {
142
-		$this->set( 'STS_ID', $status );
141
+	public function set_status($status = '') {
142
+		$this->set('STS_ID', $status);
143 143
 	}
144 144
 
145 145
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @access        public
151 151
 	 * @param        string $hash_salt required for some payment gateways
152 152
 	 */
153
-	public function set_hash_salt( $hash_salt = '' ) {
154
-		$this->set( 'TXN_hash_salt', $hash_salt );
153
+	public function set_hash_salt($hash_salt = '') {
154
+		$this->set('TXN_hash_salt', $hash_salt);
155 155
 	}
156 156
 
157 157
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * Sets TXN_reg_steps array
161 161
 	 * @param array $txn_reg_steps
162 162
 	 */
163
-	function set_reg_steps( $txn_reg_steps ) {
164
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
163
+	function set_reg_steps($txn_reg_steps) {
164
+		$this->set('TXN_reg_steps', $txn_reg_steps);
165 165
 	}
166 166
 
167 167
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @return array
172 172
 	 */
173 173
 	function reg_steps() {
174
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
175
-		return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array();
174
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
175
+		return is_array($TXN_reg_steps) ? $TXN_reg_steps : array();
176 176
 	}
177 177
 
178 178
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @return string of transaction's total cost, with currency symbol and decimal
183 183
 	 */
184 184
 	public function pretty_total() {
185
-		return $this->get_pretty( 'TXN_total' );
185
+		return $this->get_pretty('TXN_total');
186 186
 	}
187 187
 
188 188
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @return string
193 193
 	 */
194 194
 	public function pretty_paid() {
195
-		return $this->get_pretty( 'TXN_paid' );
195
+		return $this->get_pretty('TXN_paid');
196 196
 	}
197 197
 
198 198
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @return float amount remaining
205 205
 	 */
206 206
 	public function remaining() {
207
-		return (float)( $this->total() - $this->paid() );
207
+		return (float) ($this->total() - $this->paid());
208 208
 	}
209 209
 
210 210
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * @return float
216 216
 	 */
217 217
 	public function total() {
218
-		return $this->get( 'TXN_total' );
218
+		return $this->get('TXN_total');
219 219
 	}
220 220
 
221 221
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @return float
227 227
 	 */
228 228
 	public function paid() {
229
-		return $this->get( 'TXN_paid' );
229
+		return $this->get('TXN_paid');
230 230
 	}
231 231
 
232 232
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	 * @access        public
237 237
 	 */
238 238
 	public function get_cart_session() {
239
-		$session_data = $this->get( 'TXN_session_data' );
240
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL;
239
+		$session_data = $this->get('TXN_session_data');
240
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL;
241 241
 	}
242 242
 
243 243
 
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 	 * @access        public
248 248
 	 */
249 249
 	public function session_data() {
250
-		$session_data = $this->get( 'TXN_session_data' );
251
-		if ( empty( $session_data ) ) {
252
-			$session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() );
250
+		$session_data = $this->get('TXN_session_data');
251
+		if (empty($session_data)) {
252
+			$session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array());
253 253
 		}
254 254
 		return $session_data;
255 255
 	}
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	 * @access        public
263 263
 	 * @param        EE_Session|array $session_data
264 264
 	 */
265
-	public function set_txn_session_data( $session_data ) {
266
-		if ( $session_data instanceof EE_Session ) {
267
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
265
+	public function set_txn_session_data($session_data) {
266
+		if ($session_data instanceof EE_Session) {
267
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
268 268
 		} else {
269
-			$this->set( 'TXN_session_data', $session_data );
269
+			$this->set('TXN_session_data', $session_data);
270 270
 		}
271 271
 	}
272 272
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @access        public
278 278
 	 */
279 279
 	public function hash_salt_() {
280
-		return $this->get( 'TXN_hash_salt' );
280
+		return $this->get('TXN_hash_salt');
281 281
 	}
282 282
 
283 283
 
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 	 * @param 	boolean 	$gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied
298 298
 	 * @return 	string | int
299 299
 	 */
300
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
301
-		if ( $format ) {
302
-			return $this->get_pretty( 'TXN_timestamp' );
303
-		} else if ( $gmt ) {
304
-			return $this->get_raw( 'TXN_timestamp' );
300
+	public function datetime($format = FALSE, $gmt = FALSE) {
301
+		if ($format) {
302
+			return $this->get_pretty('TXN_timestamp');
303
+		} else if ($gmt) {
304
+			return $this->get_raw('TXN_timestamp');
305 305
 		} else {
306
-			return $this->get( 'TXN_timestamp' );
306
+			return $this->get('TXN_timestamp');
307 307
 		}
308 308
 	}
309 309
 
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 	 * @param        boolean $get_cached   TRUE to retrieve cached registrations or FALSE to pull from the db
316 316
 	 * @return EE_Registration[]
317 317
 	 */
318
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
319
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params;
318
+	public function registrations($query_params = array(), $get_cached = FALSE) {
319
+		$query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params;
320 320
 		$query_params = $get_cached ? array() : $query_params;
321
-		return $this->get_many_related( 'Registration', $query_params );
321
+		return $this->get_many_related('Registration', $query_params);
322 322
 	}
323 323
 
324 324
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
330 330
 	 */
331 331
 	public function attendees() {
332
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
332
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
333 333
 	}
334 334
 
335 335
 
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param array $query_params like EEM_Base::get_all
340 340
 	 * @return EE_Payment[]
341 341
 	 */
342
-	public function payments( $query_params = array() ) {
343
-		return $this->get_many_related( 'Payment', $query_params );
342
+	public function payments($query_params = array()) {
343
+		return $this->get_many_related('Payment', $query_params);
344 344
 	}
345 345
 
346 346
 
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 	 * @return EE_Payment[]
351 351
 	 */
352 352
 	public function approved_payments() {
353
-		EE_Registry::instance()->load_model( 'Payment' );
354
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
353
+		EE_Registry::instance()->load_model('Payment');
354
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
355 355
 	}
356 356
 
357 357
 
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
 	 * @param bool $show_icons
362 362
 	 * @return string
363 363
 	 */
364
-	public function e_pretty_status( $show_icons = FALSE ) {
365
-		echo $this->pretty_status( $show_icons );
364
+	public function e_pretty_status($show_icons = FALSE) {
365
+		echo $this->pretty_status($show_icons);
366 366
 	}
367 367
 
368 368
 
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	 * @param bool $show_icons
373 373
 	 * @return string
374 374
 	 */
375
-	public function pretty_status( $show_icons = FALSE ) {
376
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
375
+	public function pretty_status($show_icons = FALSE) {
376
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
377 377
 		$icon = '';
378
-		switch ( $this->status_ID() ) {
378
+		switch ($this->status_ID()) {
379 379
 			case EEM_Transaction::complete_status_code:
380 380
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
381 381
 				break;
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
393 393
 				break;
394 394
 		}
395
-		return $icon . $status[ $this->status_ID() ];
395
+		return $icon.$status[$this->status_ID()];
396 396
 	}
397 397
 
398 398
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 * @access        public
403 403
 	 */
404 404
 	public function status_ID() {
405
-		return $this->get( 'STS_ID' );
405
+		return $this->get('STS_ID');
406 406
 	}
407 407
 
408 408
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @return boolean
413 413
 	 */
414 414
 	public function is_free() {
415
-		return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE;
415
+		return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE;
416 416
 	}
417 417
 
418 418
 
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 	 * @access public
481 481
 	 * @return string
482 482
 	 */
483
-	public function invoice_url( $type = 'html' ) {
483
+	public function invoice_url($type = 'html') {
484 484
 		$REG = $this->primary_registration();
485
-		if ( ! $REG instanceof EE_Registration ) {
485
+		if ( ! $REG instanceof EE_Registration) {
486 486
 			return '';
487 487
 		}
488
-		return $REG->invoice_url( $type );
488
+		return $REG->invoice_url($type);
489 489
 	}
490 490
 
491 491
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 * @return EE_Registration
496 496
 	 */
497 497
 	public function primary_registration() {
498
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
498
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
499 499
 	}
500 500
 
501 501
 
@@ -505,12 +505,12 @@  discard block
 block discarded – undo
505 505
 	 * @param string $type 'pdf' or 'html' (default is 'html')
506 506
 	 * @return string
507 507
 	 */
508
-	public function receipt_url( $type = 'html' ) {
508
+	public function receipt_url($type = 'html') {
509 509
 		$REG = $this->primary_registration();
510
-		if ( ! $REG instanceof EE_Registration ) {
510
+		if ( ! $REG instanceof EE_Registration) {
511 511
 			return '';
512 512
 		}
513
-		return $REG->receipt_url( $type );
513
+		return $REG->receipt_url($type);
514 514
 	}
515 515
 
516 516
 
@@ -535,15 +535,15 @@  discard block
 block discarded – undo
535 535
 	 * @deprecated
536 536
 	 * @return boolean
537 537
 	 */
538
-	public function update_based_on_payments(){
538
+	public function update_based_on_payments() {
539 539
 		EE_Error::doing_it_wrong(
540
-			__CLASS__ . '::' . __FUNCTION__,
541
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
540
+			__CLASS__.'::'.__FUNCTION__,
541
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
542 542
 			'4.6.0'
543 543
 		);
544 544
 		/** @type EE_Transaction_Processor $transaction_processor */
545
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
546
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this );
545
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
546
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this);
547 547
 	}
548 548
 
549 549
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 * @return string
553 553
 	 */
554 554
 	public function gateway_response_on_transaction() {
555
-		$payment = $this->get_first_related( 'Payment' );
555
+		$payment = $this->get_first_related('Payment');
556 556
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
557 557
 	}
558 558
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @return EE_Status
564 564
 	 */
565 565
 	public function status_obj() {
566
-		return $this->get_first_related( 'Status' );
566
+		return $this->get_first_related('Status');
567 567
 	}
568 568
 
569 569
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @param array $query_params like EEM_Base::get_all
574 574
 	 * @return EE_Extra_Meta
575 575
 	 */
576
-	public function extra_meta( $query_params = array() ) {
577
-		return $this->get_many_related( 'Extra_Meta', $query_params );
576
+	public function extra_meta($query_params = array()) {
577
+		return $this->get_many_related('Extra_Meta', $query_params);
578 578
 	}
579 579
 
580 580
 
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @param EE_Registration $registration
585 585
 	 * @return EE_Base_Class the relation was added to
586 586
 	 */
587
-	public function add_registration( EE_Registration $registration ) {
588
-		return $this->_add_relation_to( $registration, 'Registration' );
587
+	public function add_registration(EE_Registration $registration) {
588
+		return $this->_add_relation_to($registration, 'Registration');
589 589
 	}
590 590
 
591 591
 
@@ -596,8 +596,8 @@  discard block
 block discarded – undo
596 596
 	 * @param int $registration_or_id
597 597
 	 * @return EE_Base_Class that was removed from being related
598 598
 	 */
599
-	public function remove_registration_with_id( $registration_or_id ) {
600
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
599
+	public function remove_registration_with_id($registration_or_id) {
600
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
601 601
 	}
602 602
 
603 603
 
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	 * @return EE_Line_Item[]
608 608
 	 */
609 609
 	public function items_purchased() {
610
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
610
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
611 611
 	}
612 612
 
613 613
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 	 * @param EE_Line_Item $line_item
618 618
 	 * @return EE_Base_Class the relation was added to
619 619
 	 */
620
-	public function add_line_item( EE_Line_Item $line_item ) {
621
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
620
+	public function add_line_item(EE_Line_Item $line_item) {
621
+		return $this->_add_relation_to($line_item, 'Line_Item');
622 622
 	}
623 623
 
624 624
 
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
 	 * @param array $query_params
629 629
 	 * @return EE_Line_Item[]
630 630
 	 */
631
-	public function line_items( $query_params = array() ) {
632
-		return $this->get_many_related( 'Line_Item', $query_params );
631
+	public function line_items($query_params = array()) {
632
+		return $this->get_many_related('Line_Item', $query_params);
633 633
 	}
634 634
 
635 635
 
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	 * @return EE_Line_Item[]
640 640
 	 */
641 641
 	public function tax_items() {
642
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
642
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
643 643
 	}
644 644
 
645 645
 
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
 	 * @return EE_Line_Item
651 651
 	 */
652 652
 	public function total_line_item() {
653
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
654
-		if( ! $item ){
655
-			EE_Registry::instance()->load_helper( 'Line_Item' );
656
-			$item = EEH_Line_Item::create_total_line_item( $this );
653
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
654
+		if ( ! $item) {
655
+			EE_Registry::instance()->load_helper('Line_Item');
656
+			$item = EEH_Line_Item::create_total_line_item($this);
657 657
 		}
658 658
 		return $item;
659 659
 	}
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 */
668 668
 	public function tax_total() {
669 669
 		$tax_line_item = $this->tax_total_line_item();
670
-		if ( $tax_line_item ) {
670
+		if ($tax_line_item) {
671 671
 			return $tax_line_item->total();
672 672
 		} else {
673 673
 			return 0;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * @return EE_Line_Item
682 682
 	 */
683 683
 	public function tax_total_line_item() {
684
-		return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() );
684
+		return EEH_Line_Item::get_taxes_subtotal($this->total_line_item());
685 685
 	}
686 686
 
687 687
 
@@ -690,20 +690,20 @@  discard block
 block discarded – undo
690 690
 	 *  Gets the array of billing info for the gateway and for this transaction's primary registration's attendee.
691 691
 	 * @return EE_Form_Section_Proper
692 692
 	 */
693
-	public function billing_info(){
693
+	public function billing_info() {
694 694
 		$payment_method = $this->payment_method();
695
-		if ( !$payment_method){
695
+		if ( ! $payment_method) {
696 696
 			EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
697 697
 			return false;
698 698
 		}
699 699
 		$primary_reg = $this->primary_registration();
700
-		if ( ! $primary_reg ) {
701
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
700
+		if ( ! $primary_reg) {
701
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
702 702
 			return FALSE;
703 703
 		}
704 704
 		$attendee = $primary_reg->attendee();
705
-		if ( ! $attendee ) {
706
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
705
+		if ( ! $attendee) {
706
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
707 707
 			return FALSE;
708 708
 		}
709 709
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -738,15 +738,15 @@  discard block
 block discarded – undo
738 738
 	 * offline ones, dont' create payments)
739 739
 	 * @return EE_Payment_Method
740 740
 	 */
741
-	function payment_method(){
741
+	function payment_method() {
742 742
 		$pm = $this->get_first_related('Payment_Method');
743
-		if( $pm instanceof EE_Payment_Method ){
743
+		if ($pm instanceof EE_Payment_Method) {
744 744
 			return $pm;
745
-		}else{
745
+		} else {
746 746
 			$last_payment = $this->last_payment();
747
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
747
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
748 748
 				return $last_payment->payment_method();
749
-			}else{
749
+			} else {
750 750
 				return NULL;
751 751
 			}
752 752
 		}
@@ -757,15 +757,15 @@  discard block
 block discarded – undo
757 757
 	 * @return EE_Payment
758 758
 	 */
759 759
 	public function last_payment() {
760
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
760
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
761 761
 	}
762 762
 
763 763
 	/**
764 764
 	 * Gets all the line items which are unrelated to tickets on this transaction
765 765
 	 * @return EE_Line_Item[]
766 766
 	 */
767
-	public function non_ticket_line_items(){
768
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
767
+	public function non_ticket_line_items() {
768
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
769 769
 	}
770 770
 
771 771
 
Please login to merge, or discard this patch.
core/helpers/EEH_Line_Item.helper.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- *
4
- * EEH_Line_Item
5
- *
6
- * This should be the main class which is aware of the line item tree structure, and
7
- * should take care of common operations like inserting items into it, updating
8
- * items in it based on what the line items are for, and removed line items.
9
- * All this logic was originally contained in EE_Cart, but because there are
10
- * actually other places that need to modify the record of what was purchased
11
- * (eg when a PayPal IPN is received, if PayPal changes the taxes, we need to update the line items;
12
- * or admin-side cancellations etc).
13
- * Generally all these functions will first take the total line item and figure things out from there
14
- *
15
- * @package			Event Espresso
16
- * @subpackage
17
- * @author				Mike Nelson
18
- *
19
- */
3
+	 *
4
+	 * EEH_Line_Item
5
+	 *
6
+	 * This should be the main class which is aware of the line item tree structure, and
7
+	 * should take care of common operations like inserting items into it, updating
8
+	 * items in it based on what the line items are for, and removed line items.
9
+	 * All this logic was originally contained in EE_Cart, but because there are
10
+	 * actually other places that need to modify the record of what was purchased
11
+	 * (eg when a PayPal IPN is received, if PayPal changes the taxes, we need to update the line items;
12
+	 * or admin-side cancellations etc).
13
+	 * Generally all these functions will first take the total line item and figure things out from there
14
+	 *
15
+	 * @package			Event Espresso
16
+	 * @subpackage
17
+	 * @author				Mike Nelson
18
+	 *
19
+	 */
20 20
 class EEH_Line_Item {
21 21
 
22 22
 	//other functions: cancel ticket purchase
@@ -468,15 +468,15 @@  discard block
 block discarded – undo
468 468
 	}
469 469
 
470 470
 	/**
471
-	  * Given the grand total line item and a ticket, finds the event sub-total
472
-	  * line item the ticket's purchase should be added onto
473
-	  *
474
-	  * @access public
475
-	  * @param EE_Line_Item $grand_total the grand total line item
476
-	  * @param EE_Ticket $ticket
477
-	  * @throws \EE_Error
478
-	  * @return EE_Line_Item
479
-	  */
471
+	 * Given the grand total line item and a ticket, finds the event sub-total
472
+	 * line item the ticket's purchase should be added onto
473
+	 *
474
+	 * @access public
475
+	 * @param EE_Line_Item $grand_total the grand total line item
476
+	 * @param EE_Ticket $ticket
477
+	 * @throws \EE_Error
478
+	 * @return EE_Line_Item
479
+	 */
480 480
 	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
481 481
 		$first_datetime = $ticket->first_datetime();
482 482
 		if( ! $first_datetime instanceof EE_Datetime ){
@@ -685,21 +685,21 @@  discard block
 block discarded – undo
685 685
 	 * @return EE_Line_Item the new tax line item created
686 686
 	 */
687 687
 	public static function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false ){
688
-            $tax_subtotal = self::get_taxes_subtotal( $total_line_item );
689
-            $taxable_total = $total_line_item->taxable_total();
690
-
691
-            if( $add_to_existing_line_item ) {
692
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
693
-                EEM_Line_Item::instance()->delete( array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) ) );
694
-            } else {
695
-                $new_tax = null;
696
-                $tax_subtotal->delete_children_line_items();
697
-            }
698
-            if( $new_tax ) {
699
-                $new_tax->set_total( $new_tax->total() + $amount );
700
-                $new_tax->set_percent( $taxable_total ? ( $new_tax->total() ) / $taxable_total * 100 : 0 );
701
-            } else {
702
-                //no existing tax item. Create it
688
+			$tax_subtotal = self::get_taxes_subtotal( $total_line_item );
689
+			$taxable_total = $total_line_item->taxable_total();
690
+
691
+			if( $add_to_existing_line_item ) {
692
+				$new_tax = $tax_subtotal->get_child_line_item( $code );
693
+				EEM_Line_Item::instance()->delete( array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) ) );
694
+			} else {
695
+				$new_tax = null;
696
+				$tax_subtotal->delete_children_line_items();
697
+			}
698
+			if( $new_tax ) {
699
+				$new_tax->set_total( $new_tax->total() + $amount );
700
+				$new_tax->set_percent( $taxable_total ? ( $new_tax->total() ) / $taxable_total * 100 : 0 );
701
+			} else {
702
+				//no existing tax item. Create it
703 703
 				$new_tax = EE_Line_Item::new_instance( array(
704 704
 					'TXN_ID'      => $total_line_item->TXN_ID(),
705 705
 					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
@@ -712,16 +712,16 @@  discard block
 block discarded – undo
712 712
 				) );
713 713
 			}
714 714
 
715
-            $new_tax = apply_filters(
715
+			$new_tax = apply_filters(
716 716
 				'FHEE__EEH_Line_Item__set_total_tax_to__new_tax_subtotal',
717 717
 				$new_tax,
718 718
 				$total_line_item
719
-            );
720
-            $new_tax->save();
721
-            $tax_subtotal->set_total( $new_tax->total() );
722
-            $tax_subtotal->save();
723
-            $total_line_item->recalculate_total_including_taxes();
724
-            return $new_tax;
719
+			);
720
+			$new_tax->save();
721
+			$tax_subtotal->set_total( $new_tax->total() );
722
+			$tax_subtotal->save();
723
+			$total_line_item->recalculate_total_including_taxes();
724
+			return $new_tax;
725 725
 	}
726 726
 
727 727
 
Please login to merge, or discard this patch.
Spacing   +293 added lines, -293 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
  * EEH_Line_Item
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 * @param boolean $code if set to a value, ensures there is only one line item with that code
41 41
 	 * @return boolean success
42 42
 	 */
43
-	public static function add_unrelated_item( EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL  ){
44
-		$items_subtotal = self::get_pre_tax_subtotal( $parent_line_item );
43
+	public static function add_unrelated_item(EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL) {
44
+		$items_subtotal = self::get_pre_tax_subtotal($parent_line_item);
45 45
 		$line_item = EE_Line_Item::new_instance(array(
46 46
 			'LIN_name' => $name,
47 47
 			'LIN_desc' => $description,
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			'LIN_quantity' => $quantity,
50 50
 			'LIN_percent' => null,
51 51
 			'LIN_is_taxable' => $taxable,
52
-			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count( $items_subtotal->children() ) : 0,
53
-			'LIN_total' => floatval( $unit_price ) * intval( $quantity ),
52
+			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0,
53
+			'LIN_total' => floatval($unit_price) * intval($quantity),
54 54
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
55 55
 			'LIN_code' => $code,
56 56
 		));
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			$line_item,
60 60
 			$parent_line_item
61 61
 		);
62
-		return self::add_item( $parent_line_item, $line_item );
62
+		return self::add_item($parent_line_item, $line_item);
63 63
 	}
64 64
 
65 65
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param boolean      $taxable
81 81
 	 * @return boolean success
82 82
 	 */
83
-	public static function add_percentage_based_item( EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE ){
83
+	public static function add_percentage_based_item(EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE) {
84 84
 		$line_item = EE_Line_Item::new_instance(array(
85 85
 			'LIN_name' => $name,
86 86
 			'LIN_desc' => $description,
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			'LIN_percent' => $percentage_amount,
89 89
 			'LIN_quantity' => NULL,
90 90
 			'LIN_is_taxable' => $taxable,
91
-			'LIN_total' => floatval( $percentage_amount * ( $parent_line_item->total() / 100 )),
91
+			'LIN_total' => floatval($percentage_amount * ($parent_line_item->total() / 100)),
92 92
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
93 93
 			'LIN_parent' => $parent_line_item->ID()
94 94
 		));
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			'FHEE__EEH_Line_Item__add_percentage_based_item__line_item',
97 97
 			$line_item
98 98
 		);
99
-		return self::add_item( $parent_line_item, $line_item );
99
+		return self::add_item($parent_line_item, $line_item);
100 100
 	}
101 101
 
102 102
 
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 	 * @return \EE_Line_Item
118 118
 	 * @throws \EE_Error
119 119
 	 */
120
-	public static function add_ticket_purchase( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ){
121
-		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) {
122
-			throw new EE_Error( sprintf( __( 'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) );
120
+	public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
121
+		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
122
+			throw new EE_Error(sprintf(__('A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso'), $ticket->ID(), $total_line_item->ID()));
123 123
 		}
124 124
 		// either increment the qty for an existing ticket
125
-		$line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty );
125
+		$line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
126 126
 		// or add a new one
127
-		if ( ! $line_item instanceof EE_Line_Item ) {
128
-			$line_item = self::create_ticket_line_item( $total_line_item, $ticket, $qty );
127
+		if ( ! $line_item instanceof EE_Line_Item) {
128
+			$line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
129 129
 		}
130 130
 		$total_line_item->recalculate_total_including_taxes();
131 131
 		return $line_item;
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
 	 * @return \EE_Line_Item
142 142
 	 * @throws \EE_Error
143 143
 	 */
144
-	public static function increment_ticket_qty_if_already_in_cart( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
144
+	public static function increment_ticket_qty_if_already_in_cart(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
145 145
 		$line_item = null;
146
-		if ( $total_line_item instanceof EE_Line_Item && $total_line_item->is_total() ) {
147
-			$ticket_line_items = EEH_Line_Item::get_ticket_line_items( $total_line_item );
148
-			foreach ( (array)$ticket_line_items as $ticket_line_item ) {
149
-				if ( $ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_ID() == $ticket->ID() ) {
146
+		if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
147
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
148
+			foreach ((array) $ticket_line_items as $ticket_line_item) {
149
+				if ($ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_ID() == $ticket->ID()) {
150 150
 					$line_item = $ticket_line_item;
151 151
 					break;
152 152
 				}
153 153
 			}
154 154
 		}
155
-		if ( $line_item instanceof EE_Line_Item ) {
156
-			EEH_Line_Item::increment_quantity( $line_item, $qty );
155
+		if ($line_item instanceof EE_Line_Item) {
156
+			EEH_Line_Item::increment_quantity($line_item, $qty);
157 157
 			return $line_item;
158 158
 		}
159 159
 		return null;
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
 	 * @param int $qty
167 167
 	 * @return void
168 168
 	 */
169
-	public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) {
170
-		if( ! $line_item->is_percent() ) {
169
+	public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) {
170
+		if ( ! $line_item->is_percent()) {
171 171
 			$qty += $line_item->quantity();
172
-			$line_item->set_quantity( $qty );
173
-			$line_item->set_total( $line_item->unit_price() * $qty );
172
+			$line_item->set_quantity($qty);
173
+			$line_item->set_total($line_item->unit_price() * $qty);
174 174
 		}
175
-		foreach( $line_item->children() as $child ) {
176
-			if( $child->is_sub_line_item() ) {
177
-				EEH_Line_Item::update_quantity( $child, $line_item->quantity() );
175
+		foreach ($line_item->children() as $child) {
176
+			if ($child->is_sub_line_item()) {
177
+				EEH_Line_Item::update_quantity($child, $line_item->quantity());
178 178
 			}
179 179
 		}
180 180
 	}
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 	 * @param EE_Line_Item $line_item
186 186
 	 * @param int $new_quantity
187 187
 	 */
188
-	public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) {
189
-		if( ! $line_item->is_percent() ) {
190
-			$line_item->set_quantity( $new_quantity );
191
-			$line_item->set_total( $line_item->unit_price() * $new_quantity );
188
+	public static function update_quantity(EE_Line_Item $line_item, $new_quantity) {
189
+		if ( ! $line_item->is_percent()) {
190
+			$line_item->set_quantity($new_quantity);
191
+			$line_item->set_total($line_item->unit_price() * $new_quantity);
192 192
 		}
193
-		foreach( $line_item->children() as $child ) {
194
-			if( $child->is_sub_line_item() ) {
195
-				EEH_Line_Item::update_quantity( $child, $new_quantity );
193
+		foreach ($line_item->children() as $child) {
194
+			if ($child->is_sub_line_item()) {
195
+				EEH_Line_Item::update_quantity($child, $new_quantity);
196 196
 			}
197 197
 		}
198 198
 	}
@@ -207,45 +207,45 @@  discard block
 block discarded – undo
207 207
 	 * @return \EE_Line_Item
208 208
 	 * @throws \EE_Error
209 209
 	 */
210
-	public static function create_ticket_line_item( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
210
+	public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
211 211
 		$datetimes = $ticket->datetimes();
212
-		$first_datetime = reset( $datetimes );
213
-		if( $first_datetime instanceof EE_Datetime &&
214
-				$first_datetime->event() instanceof EE_Event ) {
212
+		$first_datetime = reset($datetimes);
213
+		if ($first_datetime instanceof EE_Datetime &&
214
+				$first_datetime->event() instanceof EE_Event) {
215 215
 			$first_datetime_name = $first_datetime->event()->name();
216 216
 		} else {
217
-			$first_datetime_name = __( 'Event', 'event_espresso' );
217
+			$first_datetime_name = __('Event', 'event_espresso');
218 218
 		}
219
-		$event = sprintf( _x( '(For %1$s)', '(For Event Name)', 'event_espresso' ), $first_datetime_name );
219
+		$event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
220 220
 		// get event subtotal line
221
-		$events_sub_total = self::get_event_line_item_for_ticket( $total_line_item, $ticket );
222
-		if ( ! $events_sub_total instanceof EE_Line_Item ) {
223
-			throw new EE_Error( sprintf( __( 'There is no events sub-total for ticket %s on total line item %d', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) );
221
+		$events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
222
+		if ( ! $events_sub_total instanceof EE_Line_Item) {
223
+			throw new EE_Error(sprintf(__('There is no events sub-total for ticket %s on total line item %d', 'event_espresso'), $ticket->ID(), $total_line_item->ID()));
224 224
 		}
225 225
 		// add $ticket to cart
226
-		$line_item = EE_Line_Item::new_instance( array(
226
+		$line_item = EE_Line_Item::new_instance(array(
227 227
 			'LIN_name'       	=> $ticket->name(),
228
-			'LIN_desc'       		=> $ticket->description() != '' ? $ticket->description() . ' ' . $event : $event,
228
+			'LIN_desc'       		=> $ticket->description() != '' ? $ticket->description().' '.$event : $event,
229 229
 			'LIN_unit_price' 	=> $ticket->price(),
230 230
 			'LIN_quantity'   	=> $qty,
231 231
 			'LIN_is_taxable' 	=> $ticket->taxable(),
232
-			'LIN_order'      	=> count( $events_sub_total->children() ),
232
+			'LIN_order'      	=> count($events_sub_total->children()),
233 233
 			'LIN_total'      		=> $ticket->price() * $qty,
234 234
 			'LIN_type'       		=> EEM_Line_Item::type_line_item,
235 235
 			'OBJ_ID'         		=> $ticket->ID(),
236 236
 			'OBJ_type'       	=> 'Ticket'
237
-		) );
237
+		));
238 238
 		$line_item = apply_filters(
239 239
 			'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
240 240
 			$line_item
241 241
 		);
242
-		$events_sub_total->add_child_line_item( $line_item );
242
+		$events_sub_total->add_child_line_item($line_item);
243 243
 		//now add the sub-line items
244 244
 		$running_total_for_ticket = 0;
245
-		foreach ( $ticket->prices( array( 'order_by' => array( 'PRC_order' => 'ASC' ) ) ) as $price ) {
245
+		foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
246 246
 			$sign = $price->is_discount() ? -1 : 1;
247 247
 			$price_total = $price->is_percent() ? $running_total_for_ticket * $price->amount() / 100 : $price->amount() * $qty;
248
-			$sub_line_item = EE_Line_Item::new_instance( array(
248
+			$sub_line_item = EE_Line_Item::new_instance(array(
249 249
 				'LIN_name'       	=> $price->name(),
250 250
 				'LIN_desc'       		=> $price->desc(),
251 251
 				'LIN_quantity'   	=> $price->is_percent() ? null : $qty,
@@ -255,18 +255,18 @@  discard block
 block discarded – undo
255 255
 				'LIN_type'       		=> EEM_Line_Item::type_sub_line_item,
256 256
 				'OBJ_ID'         		=> $price->ID(),
257 257
 				'OBJ_type'       	=> 'Price'
258
-			) );
258
+			));
259 259
 			$sub_line_item = apply_filters(
260 260
 				'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
261 261
 				$sub_line_item
262 262
 			);
263
-			if ( $price->is_percent() ) {
264
-				$sub_line_item->set_percent( $sign * $price->amount() );
263
+			if ($price->is_percent()) {
264
+				$sub_line_item->set_percent($sign * $price->amount());
265 265
 			} else {
266
-				$sub_line_item->set_unit_price( $sign * $price->amount() );
266
+				$sub_line_item->set_unit_price($sign * $price->amount());
267 267
 			}
268 268
 			$running_total_for_ticket += $price_total;
269
-			$line_item->add_child_line_item( $sub_line_item );
269
+			$line_item->add_child_line_item($sub_line_item);
270 270
 		}
271 271
 		return $line_item;
272 272
 	}
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 	 * @param EE_Line_Item $item to be added
285 285
 	 * @return boolean
286 286
 	 */
287
-	public static function add_item( EE_Line_Item $total_line_item, EE_Line_Item $item ){
288
-		$pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item );
289
-		if ( $pre_tax_subtotal instanceof EE_Line_Item ){
287
+	public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) {
288
+		$pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
289
+		if ($pre_tax_subtotal instanceof EE_Line_Item) {
290 290
 			$success = $pre_tax_subtotal->add_child_line_item($item);
291
-		}else{
291
+		} else {
292 292
 			return FALSE;
293 293
 		}
294 294
 		$total_line_item->recalculate_total_including_taxes();
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
303 303
 	 *	@return \EE_Line_Item
304 304
 	 */
305
-	public static function get_pre_tax_subtotal( EE_Line_Item $total_line_item ){
306
-		$pre_tax_subtotal = $total_line_item->get_child_line_item( 'pre-tax-subtotal' );
307
-		return $pre_tax_subtotal instanceof EE_Line_Item ? $pre_tax_subtotal : self::create_pre_tax_subtotal( $total_line_item );
305
+	public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item) {
306
+		$pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
307
+		return $pre_tax_subtotal instanceof EE_Line_Item ? $pre_tax_subtotal : self::create_pre_tax_subtotal($total_line_item);
308 308
 	}
309 309
 
310 310
 
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
315 315
 	 * @return \EE_Line_Item
316 316
 	 */
317
-	public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){
318
-		$taxes = $total_line_item->get_child_line_item( 'taxes' );
319
-		return $taxes ? $taxes : self::create_taxes_subtotal( $total_line_item );
317
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item) {
318
+		$taxes = $total_line_item->get_child_line_item('taxes');
319
+		return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
320 320
 	}
321 321
 
322 322
 
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
 	 * @param EE_Transaction $transaction
328 328
 	 * @return void
329 329
 	 */
330
-	public static function set_TXN_ID( EE_Line_Item $line_item, $transaction = NULL ){
331
-		if( $transaction ){
330
+	public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = NULL) {
331
+		if ($transaction) {
332 332
 			/** @type EEM_Transaction $EEM_Transaction */
333
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
334
-			$transaction = $EEM_Transaction->ensure_is_ID( $transaction );
335
-			$line_item->set_TXN_ID( $transaction );
333
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
334
+			$transaction = $EEM_Transaction->ensure_is_ID($transaction);
335
+			$line_item->set_TXN_ID($transaction);
336 336
 		}
337 337
 	}
338 338
 
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 	 * @param EE_Transaction $transaction
346 346
 	 * @return \EE_Line_Item of type total
347 347
 	 */
348
-	public static function create_total_line_item( $transaction = NULL ){
349
-		$total_line_item = EE_Line_Item::new_instance( array(
348
+	public static function create_total_line_item($transaction = NULL) {
349
+		$total_line_item = EE_Line_Item::new_instance(array(
350 350
 			'LIN_code'	=> 'total',
351 351
 			'LIN_name'	=> __('Grand Total', 'event_espresso'),
352 352
 			'LIN_type'	=> EEM_Line_Item::type_total,
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 			'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
357 357
 			$total_line_item
358 358
 		);
359
-		self::set_TXN_ID( $total_line_item, $transaction );
360
-		self::create_pre_tax_subtotal( $total_line_item, $transaction );
361
-		self::create_taxes_subtotal( $total_line_item, $transaction );
359
+		self::set_TXN_ID($total_line_item, $transaction);
360
+		self::create_pre_tax_subtotal($total_line_item, $transaction);
361
+		self::create_taxes_subtotal($total_line_item, $transaction);
362 362
 		return $total_line_item;
363 363
 	}
364 364
 
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 	 * @param EE_Transaction $transaction
371 371
 	 * @return EE_Line_Item
372 372
 	 */
373
-	protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
374
-		$pre_tax_line_item = EE_Line_Item::new_instance( array(
373
+	protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
374
+		$pre_tax_line_item = EE_Line_Item::new_instance(array(
375 375
 			'LIN_code' 	=> 'pre-tax-subtotal',
376
-			'LIN_name' 	=> __( 'Pre-Tax Subtotal', 'event_espresso' ),
376
+			'LIN_name' 	=> __('Pre-Tax Subtotal', 'event_espresso'),
377 377
 			'LIN_type' 	=> EEM_Line_Item::type_sub_total
378
-		) );
378
+		));
379 379
 		$pre_tax_line_item = apply_filters(
380 380
 			'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
381 381
 			$pre_tax_line_item
382 382
 		);
383
-		self::set_TXN_ID( $pre_tax_line_item, $transaction );
384
-		$total_line_item->add_child_line_item( $pre_tax_line_item );
385
-		self::create_event_subtotal( $pre_tax_line_item, $transaction );
383
+		self::set_TXN_ID($pre_tax_line_item, $transaction);
384
+		$total_line_item->add_child_line_item($pre_tax_line_item);
385
+		self::create_event_subtotal($pre_tax_line_item, $transaction);
386 386
 		return $pre_tax_line_item;
387 387
 	}
388 388
 
@@ -395,21 +395,21 @@  discard block
 block discarded – undo
395 395
 	 * @param EE_Transaction $transaction
396 396
 	 * @return EE_Line_Item
397 397
 	 */
398
-	protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
398
+	protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
399 399
 		$tax_line_item = EE_Line_Item::new_instance(array(
400 400
 			'LIN_code'	=> 'taxes',
401 401
 			'LIN_name' 	=> __('Taxes', 'event_espresso'),
402 402
 			'LIN_type'	=> EEM_Line_Item::type_tax_sub_total,
403
-			'LIN_order' => 1000,//this should always come last
403
+			'LIN_order' => 1000, //this should always come last
404 404
 		));
405 405
 		$tax_line_item = apply_filters(
406 406
 			'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
407 407
 			$tax_line_item
408 408
 		);
409
-		self::set_TXN_ID( $tax_line_item, $transaction );
410
-		$total_line_item->add_child_line_item( $tax_line_item );
409
+		self::set_TXN_ID($tax_line_item, $transaction);
410
+		$total_line_item->add_child_line_item($tax_line_item);
411 411
 		//and lastly, add the actual taxes
412
-		self::apply_taxes( $total_line_item );
412
+		self::apply_taxes($total_line_item);
413 413
 		return $tax_line_item;
414 414
 	}
415 415
 
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
 	 * @param EE_Event $event
423 423
 	 * @return EE_Line_Item
424 424
 	 */
425
-	public static function create_event_subtotal( EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL ){
425
+	public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL) {
426 426
 		$event_line_item = EE_Line_Item::new_instance(array(
427
-			'LIN_code'	=> self::get_event_code( $event ),
428
-			'LIN_name' 	=> self::get_event_name( $event ),
429
-			'LIN_desc' 	=> self::get_event_desc( $event ),
427
+			'LIN_code'	=> self::get_event_code($event),
428
+			'LIN_name' 	=> self::get_event_name($event),
429
+			'LIN_desc' 	=> self::get_event_desc($event),
430 430
 			'LIN_type'	=> EEM_Line_Item::type_sub_total,
431 431
 			'OBJ_type' 	=> 'Event',
432 432
 			'OBJ_ID' 		=>  $event instanceof EE_Event ? $event->ID() : 0
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 			'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
436 436
 			$event_line_item
437 437
 		);
438
-		self::set_TXN_ID( $event_line_item, $transaction );
439
-		$pre_tax_line_item->add_child_line_item( $event_line_item );
438
+		self::set_TXN_ID($event_line_item, $transaction);
439
+		$pre_tax_line_item->add_child_line_item($event_line_item);
440 440
 		return $event_line_item;
441 441
 	}
442 442
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	 * @param EE_Event $event
446 446
 	 * @return string
447 447
 	 */
448
-	public static function get_event_code( $event ) {
449
-		return 'event-' . ( $event instanceof EE_Event ? $event->ID() : '0' );
448
+	public static function get_event_code($event) {
449
+		return 'event-'.($event instanceof EE_Event ? $event->ID() : '0');
450 450
 	}
451 451
 
452 452
 	/**
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @param EE_Event $event
455 455
 	 * @return string
456 456
 	 */
457
-	public static function get_event_name( $event ) {
458
-		return $event instanceof EE_Event ? $event->name() : __( 'Event', 'event_espresso' );
457
+	public static function get_event_name($event) {
458
+		return $event instanceof EE_Event ? $event->name() : __('Event', 'event_espresso');
459 459
 	}
460 460
 
461 461
 	/**
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	 * @param EE_Event $event
464 464
 	 * @return string
465 465
 	 */
466
-	public static function get_event_desc( $event ) {
466
+	public static function get_event_desc($event) {
467 467
 		return $event instanceof EE_Event ? $event->short_description() : '';
468 468
 	}
469 469
 
@@ -477,16 +477,16 @@  discard block
 block discarded – undo
477 477
 	  * @throws \EE_Error
478 478
 	  * @return EE_Line_Item
479 479
 	  */
480
-	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
480
+	public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket) {
481 481
 		$first_datetime = $ticket->first_datetime();
482
-		if( ! $first_datetime instanceof EE_Datetime ){
483
-			throw new EE_Error( sprintf( __( 'The supplied ticket (ID %d) has no datetimes', 'event_espresso' ), $ticket->ID() ) );
482
+		if ( ! $first_datetime instanceof EE_Datetime) {
483
+			throw new EE_Error(sprintf(__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'), $ticket->ID()));
484 484
 		}
485 485
 		$event = $first_datetime->event();
486
-		if ( ! $event instanceof EE_Event ) {
487
-			throw new EE_Error( sprintf( __( 'The supplied ticket (ID %d) has no event data associated with it.','event_espresso' ), $ticket->ID() ) );
486
+		if ( ! $event instanceof EE_Event) {
487
+			throw new EE_Error(sprintf(__('The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso'), $ticket->ID()));
488 488
 		}
489
-		return EEH_Line_Item::get_event_line_item( $grand_total, $event );
489
+		return EEH_Line_Item::get_event_line_item($grand_total, $event);
490 490
 	}
491 491
 
492 492
 	/**
@@ -495,31 +495,31 @@  discard block
 block discarded – undo
495 495
 	 * @param EE_Event $event
496 496
 	 * @return EE_Line_Item for the event subtotal which is a child of $grand_total
497 497
 	 */
498
-	public static function get_event_line_item( EE_Line_Item $grand_total, $event ) {
498
+	public static function get_event_line_item(EE_Line_Item $grand_total, $event) {
499 499
 		/** @type EE_Event $event */
500
-		$event = EEM_Event::instance()->ensure_is_obj( $event, true );
500
+		$event = EEM_Event::instance()->ensure_is_obj($event, true);
501 501
 		$event_line_item = NULL;
502 502
 		$found = false;
503
-		foreach ( EEH_Line_Item::get_event_subtotals( $grand_total ) as $event_line_item ) {
503
+		foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
504 504
 			// default event subtotal, we should only ever find this the first time this method is called
505
-			if ( ! $event_line_item->OBJ_ID() ) {
505
+			if ( ! $event_line_item->OBJ_ID()) {
506 506
 				// let's use this! but first... set the event details
507
-				EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
507
+				EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
508 508
 				$found = true;
509 509
 				break;
510
-			} else if ( $event_line_item->OBJ_ID() === $event->ID() ) {
510
+			} else if ($event_line_item->OBJ_ID() === $event->ID()) {
511 511
 				// found existing line item for this event in the cart, so break out of loop and use this one
512 512
 				$found = true;
513 513
 				break;
514 514
 			}
515 515
 		}
516
-		if ( ! $found ) {
516
+		if ( ! $found) {
517 517
 			//there is no event sub-total yet, so add it
518
-			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total );
518
+			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
519 519
 			// create a new "event" subtotal below that
520
-			$event_line_item = EEH_Line_Item::create_event_subtotal( $pre_tax_subtotal, null, $event );
520
+			$event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
521 521
 			// and set the event details
522
-			EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
522
+			EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
523 523
 		}
524 524
 		return $event_line_item;
525 525
 	}
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
 	 * @param EE_Transaction $transaction
534 534
 	 * @return EE_Line_Item
535 535
 	 */
536
-	public static function set_event_subtotal_details( EE_Line_Item $event_line_item, EE_Event $event, $transaction = NULL ){
537
-		if ( $event instanceof EE_Event ) {
538
-			$event_line_item->set_code( self::get_event_code( $event ) );
539
-			$event_line_item->set_name( self::get_event_name( $event ) );
540
-			$event_line_item->set_desc( self::get_event_desc( $event ) );
541
-			$event_line_item->set_OBJ_ID( $event->ID() );
536
+	public static function set_event_subtotal_details(EE_Line_Item $event_line_item, EE_Event $event, $transaction = NULL) {
537
+		if ($event instanceof EE_Event) {
538
+			$event_line_item->set_code(self::get_event_code($event));
539
+			$event_line_item->set_name(self::get_event_name($event));
540
+			$event_line_item->set_desc(self::get_event_desc($event));
541
+			$event_line_item->set_OBJ_ID($event->ID());
542 542
 		}
543
-		self::set_TXN_ID( $event_line_item, $transaction );
543
+		self::set_TXN_ID($event_line_item, $transaction);
544 544
 	}
545 545
 
546 546
 
@@ -551,19 +551,19 @@  discard block
 block discarded – undo
551 551
 	 * any old taxes are removed
552 552
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
553 553
 	 */
554
-	public static function apply_taxes( EE_Line_Item $total_line_item ){
554
+	public static function apply_taxes(EE_Line_Item $total_line_item) {
555 555
 		/** @type EEM_Price $EEM_Price */
556
-		$EEM_Price = EE_Registry::instance()->load_model( 'Price' );
556
+		$EEM_Price = EE_Registry::instance()->load_model('Price');
557 557
 		// get array of taxes via Price Model
558 558
 		$ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
559
-		ksort( $ordered_taxes );
560
-		$taxes_line_item = self::get_taxes_subtotal( $total_line_item );
559
+		ksort($ordered_taxes);
560
+		$taxes_line_item = self::get_taxes_subtotal($total_line_item);
561 561
 		//just to be safe, remove its old tax line items
562 562
 		$taxes_line_item->delete_children_line_items();
563 563
 		//loop thru taxes
564
-		foreach ( $ordered_taxes as $order => $taxes ) {
565
-			foreach ( $taxes as $tax ) {
566
-				if ( $tax instanceof EE_Price ) {
564
+		foreach ($ordered_taxes as $order => $taxes) {
565
+			foreach ($taxes as $tax) {
566
+				if ($tax instanceof EE_Price) {
567 567
 					$tax_line_item = EE_Line_Item::new_instance(
568 568
 						array(
569 569
 							'LIN_name'       => $tax->name(),
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 						'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
582 582
 						$tax_line_item
583 583
 					);
584
-					$taxes_line_item->add_child_line_item( $tax_line_item );
584
+					$taxes_line_item->add_child_line_item($tax_line_item);
585 585
 				}
586 586
 			}
587 587
 		}
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
597 597
 	 * @return float
598 598
 	 */
599
-	public static function ensure_taxes_applied( $total_line_item ){
600
-		$taxes_subtotal = self::get_taxes_subtotal( $total_line_item );
601
-		if( ! $taxes_subtotal->children()){
602
-			self::apply_taxes( $total_line_item );
599
+	public static function ensure_taxes_applied($total_line_item) {
600
+		$taxes_subtotal = self::get_taxes_subtotal($total_line_item);
601
+		if ( ! $taxes_subtotal->children()) {
602
+			self::apply_taxes($total_line_item);
603 603
 		}
604 604
 		return $taxes_subtotal->total();
605 605
 	}
@@ -612,16 +612,16 @@  discard block
 block discarded – undo
612 612
 	 * @param EE_Line_Item $parent_line_item
613 613
 	 * @return bool
614 614
 	 */
615
-	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
615
+	public static function delete_all_child_items(EE_Line_Item $parent_line_item) {
616 616
 		$deleted = 0;
617
-		foreach ( $parent_line_item->children() as $child_line_item ) {
618
-			if ( $child_line_item instanceof EE_Line_Item ) {
619
-				$deleted += EEH_Line_Item::delete_all_child_items( $child_line_item );
620
-				if ( $child_line_item->ID() ) {
617
+		foreach ($parent_line_item->children() as $child_line_item) {
618
+			if ($child_line_item instanceof EE_Line_Item) {
619
+				$deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
620
+				if ($child_line_item->ID()) {
621 621
 					$child_line_item->delete();
622
-					unset( $child_line_item );
622
+					unset($child_line_item);
623 623
 				} else {
624
-					$parent_line_item->delete_child_line_item( $child_line_item->code() );
624
+					$parent_line_item->delete_child_line_item($child_line_item->code());
625 625
 				}
626 626
 				$deleted++;
627 627
 			}
@@ -643,25 +643,25 @@  discard block
 block discarded – undo
643 643
 	 * @param array|bool|string $line_item_codes
644 644
 	 * @return int number of items successfully removed
645 645
 	 */
646
-	public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) {
646
+	public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) {
647 647
 
648
-		if( $total_line_item->type() != EEM_Line_Item::type_total ){
649
-			EE_Error::doing_it_wrong('EEH_Line_Item::delete_items', __( 'This static method should only be called with a TOTAL line item, otherwise we won\'t recalculate the totals correctly', 'event_espresso' ), '4.6.18' );
648
+		if ($total_line_item->type() != EEM_Line_Item::type_total) {
649
+			EE_Error::doing_it_wrong('EEH_Line_Item::delete_items', __('This static method should only be called with a TOTAL line item, otherwise we won\'t recalculate the totals correctly', 'event_espresso'), '4.6.18');
650 650
 		}
651
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
651
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
652 652
 
653 653
 		// check if only a single line_item_id was passed
654
-		if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) {
654
+		if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) {
655 655
 			// place single line_item_id in an array to appear as multiple line_item_ids
656
-			$line_item_codes = array ( $line_item_codes );
656
+			$line_item_codes = array($line_item_codes);
657 657
 		}
658 658
 		$removals = 0;
659 659
 		// cycle thru line_item_ids
660
-		foreach ( $line_item_codes as $line_item_id ) {
660
+		foreach ($line_item_codes as $line_item_id) {
661 661
 			$removals += $total_line_item->delete_child_line_item($line_item_id);
662 662
 		}
663 663
 
664
-		if ( $removals > 0 ) {
664
+		if ($removals > 0) {
665 665
 			$total_line_item->recalculate_taxes_and_tax_total();
666 666
 			return $removals;
667 667
 		} else {
@@ -684,32 +684,32 @@  discard block
 block discarded – undo
684 684
 	 *                                           $amount will be added onto it; otherwise will simply set the taxes to match $amount
685 685
 	 * @return EE_Line_Item the new tax line item created
686 686
 	 */
687
-	public static function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false ){
688
-            $tax_subtotal = self::get_taxes_subtotal( $total_line_item );
687
+	public static function set_total_tax_to(EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false) {
688
+            $tax_subtotal = self::get_taxes_subtotal($total_line_item);
689 689
             $taxable_total = $total_line_item->taxable_total();
690 690
 
691
-            if( $add_to_existing_line_item ) {
692
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
693
-                EEM_Line_Item::instance()->delete( array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) ) );
691
+            if ($add_to_existing_line_item) {
692
+                $new_tax = $tax_subtotal->get_child_line_item($code);
693
+                EEM_Line_Item::instance()->delete(array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID())));
694 694
             } else {
695 695
                 $new_tax = null;
696 696
                 $tax_subtotal->delete_children_line_items();
697 697
             }
698
-            if( $new_tax ) {
699
-                $new_tax->set_total( $new_tax->total() + $amount );
700
-                $new_tax->set_percent( $taxable_total ? ( $new_tax->total() ) / $taxable_total * 100 : 0 );
698
+            if ($new_tax) {
699
+                $new_tax->set_total($new_tax->total() + $amount);
700
+                $new_tax->set_percent($taxable_total ? ($new_tax->total()) / $taxable_total * 100 : 0);
701 701
             } else {
702 702
                 //no existing tax item. Create it
703
-				$new_tax = EE_Line_Item::new_instance( array(
703
+				$new_tax = EE_Line_Item::new_instance(array(
704 704
 					'TXN_ID'      => $total_line_item->TXN_ID(),
705
-					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
705
+					'LIN_name'    => $name ? $name : __('Tax', 'event_espresso'),
706 706
 					'LIN_desc'    => $description ? $description : '',
707
-					'LIN_percent' => $taxable_total ? ( $amount / $taxable_total * 100 ) : 0,
707
+					'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
708 708
 					'LIN_total'   => $amount,
709 709
 					'LIN_parent'  => $tax_subtotal->ID(),
710 710
 					'LIN_type'    => EEM_Line_Item::type_tax,
711 711
 					'LIN_code'    => $code
712
-				) );
712
+				));
713 713
 			}
714 714
 
715 715
             $new_tax = apply_filters(
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 				$total_line_item
719 719
             );
720 720
             $new_tax->save();
721
-            $tax_subtotal->set_total( $new_tax->total() );
721
+            $tax_subtotal->set_total($new_tax->total());
722 722
             $tax_subtotal->save();
723 723
             $total_line_item->recalculate_total_including_taxes();
724 724
             return $new_tax;
@@ -734,17 +734,17 @@  discard block
 block discarded – undo
734 734
 	 *  it will be whitelisted (ie, except from becoming taxable)
735 735
 	 * @param boolean $taxable
736 736
 	 */
737
-	public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null ) {
738
-		if( $code_substring_for_whitelist !== null ) {
739
-			$whitelisted = strpos( $line_item->code(), $code_substring_for_whitelist ) !== false ? true : false;
737
+	public static function set_line_items_taxable(EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null) {
738
+		if ($code_substring_for_whitelist !== null) {
739
+			$whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false;
740 740
 		} else {
741 741
 			$whitelisted = false;
742 742
 		}
743
-		if( $line_item->is_line_item() && ! $whitelisted ) {
744
-			$line_item->set_is_taxable( $taxable );
743
+		if ($line_item->is_line_item() && ! $whitelisted) {
744
+			$line_item->set_is_taxable($taxable);
745 745
 		}
746
-		foreach( $line_item->children() as $child_line_item ) {
747
-			EEH_Line_Item::set_line_items_taxable( $child_line_item, $taxable, $code_substring_for_whitelist );
746
+		foreach ($line_item->children() as $child_line_item) {
747
+			EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist);
748 748
 		}
749 749
 	}
750 750
 
@@ -757,8 +757,8 @@  discard block
 block discarded – undo
757 757
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
758 758
 	 * @return EE_Line_Item[]
759 759
 	 */
760
-	public static function get_event_subtotals( EE_Line_Item $parent_line_item ) {
761
-		return self::get_subtotals_of_object_type( $parent_line_item, 'Event' );
760
+	public static function get_event_subtotals(EE_Line_Item $parent_line_item) {
761
+		return self::get_subtotals_of_object_type($parent_line_item, 'Event');
762 762
 	}
763 763
 
764 764
 
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
 	 * @param string $obj_type
772 772
 	 * @return EE_Line_Item[]
773 773
 	 */
774
-	public static function get_subtotals_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
775
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_sub_total, $obj_type );
774
+	public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
775
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_sub_total, $obj_type);
776 776
 	}
777 777
 
778 778
 
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
785 785
 	 * @return EE_Line_Item[]
786 786
 	 */
787
-	public static function get_ticket_line_items( EE_Line_Item $parent_line_item ) {
788
-		return self::get_line_items_of_object_type( $parent_line_item, 'Ticket' );
787
+	public static function get_ticket_line_items(EE_Line_Item $parent_line_item) {
788
+		return self::get_line_items_of_object_type($parent_line_item, 'Ticket');
789 789
 	}
790 790
 
791 791
 
@@ -798,8 +798,8 @@  discard block
 block discarded – undo
798 798
 	 * @param string $obj_type
799 799
 	 * @return EE_Line_Item[]
800 800
 	 */
801
-	public static function get_line_items_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
802
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_line_item, $obj_type );
801
+	public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
802
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_line_item, $obj_type);
803 803
 	}
804 804
 
805 805
 
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
811 811
 	 * @return EE_Line_Item[]
812 812
 	 */
813
-	public static function get_tax_descendants( EE_Line_Item $parent_line_item ) {
814
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_tax );
813
+	public static function get_tax_descendants(EE_Line_Item $parent_line_item) {
814
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_tax);
815 815
 	}
816 816
 
817 817
 
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
823 823
 	 * @return EE_Line_Item[]
824 824
 	 */
825
-	public static function get_line_item_descendants( EE_Line_Item $parent_line_item ) {
826
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_line_item );
825
+	public static function get_line_item_descendants(EE_Line_Item $parent_line_item) {
826
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_line_item);
827 827
 	}
828 828
 
829 829
 
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 	 * @param string $line_item_type one of the EEM_Line_Item constants
837 837
 	 * @return EE_Line_Item[]
838 838
 	 */
839
-	public static function get_descendants_of_type( EE_Line_Item $parent_line_item, $line_item_type ) {
840
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, $line_item_type, NULL );
839
+	public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type) {
840
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, $line_item_type, NULL);
841 841
 	}
842 842
 
843 843
 
@@ -850,15 +850,15 @@  discard block
 block discarded – undo
850 850
 	 * @param string | NULL $obj_type object model class name (minus prefix) or NULL to ignore object type when searching
851 851
 	 * @return EE_Line_Item[]
852 852
 	 */
853
-	protected static function _get_descendants_by_type_and_object_type( EE_Line_Item $parent_line_item, $line_item_type, $obj_type = NULL ) {
853
+	protected static function _get_descendants_by_type_and_object_type(EE_Line_Item $parent_line_item, $line_item_type, $obj_type = NULL) {
854 854
 		$objects = array();
855
-		foreach ( $parent_line_item->children() as $child_line_item ) {
856
-			if ( $child_line_item instanceof EE_Line_Item ) {
857
-				if ( $child_line_item->type() == $line_item_type && ( $child_line_item->OBJ_type() == $obj_type || $obj_type === NULL )) {
855
+		foreach ($parent_line_item->children() as $child_line_item) {
856
+			if ($child_line_item instanceof EE_Line_Item) {
857
+				if ($child_line_item->type() == $line_item_type && ($child_line_item->OBJ_type() == $obj_type || $obj_type === NULL)) {
858 858
 					$objects[] = $child_line_item;
859 859
 				} else {
860 860
 					//go-through-all-its children looking for more matches
861
-					$objects = array_merge( $objects, self::_get_descendants_by_type_and_object_type( $child_line_item, $line_item_type, $obj_type ));
861
+					$objects = array_merge($objects, self::_get_descendants_by_type_and_object_type($child_line_item, $line_item_type, $obj_type));
862 862
 				}
863 863
 			}
864 864
 		}
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 	 * @param array $OBJ_IDs array of OBJ_IDs
877 877
 	 * @return EE_Line_Item[]
878 878
 	 */
879
-	public static function get_line_items_by_object_type_and_IDs( EE_Line_Item $parent_line_item, $OBJ_type = '', $OBJ_IDs = array() ) {
880
-		return self::_get_descendants_by_object_type_and_object_ID( $parent_line_item, $OBJ_type, $OBJ_IDs );
879
+	public static function get_line_items_by_object_type_and_IDs(EE_Line_Item $parent_line_item, $OBJ_type = '', $OBJ_IDs = array()) {
880
+		return self::_get_descendants_by_object_type_and_object_ID($parent_line_item, $OBJ_type, $OBJ_IDs);
881 881
 	}
882 882
 
883 883
 
@@ -890,15 +890,15 @@  discard block
 block discarded – undo
890 890
 	 * @param array $OBJ_IDs array of OBJ_IDs
891 891
 	 * @return EE_Line_Item[]
892 892
 	 */
893
-	protected static function _get_descendants_by_object_type_and_object_ID( EE_Line_Item $parent_line_item, $OBJ_type, $OBJ_IDs ) {
893
+	protected static function _get_descendants_by_object_type_and_object_ID(EE_Line_Item $parent_line_item, $OBJ_type, $OBJ_IDs) {
894 894
 		$objects = array();
895
-		foreach ( $parent_line_item->children() as $child_line_item ) {
896
-			if ( $child_line_item instanceof EE_Line_Item ) {
897
-				if ( is_array( $OBJ_IDs ) && $child_line_item->OBJ_type() == $OBJ_type && in_array( $child_line_item->OBJ_ID(), $OBJ_IDs )) {
895
+		foreach ($parent_line_item->children() as $child_line_item) {
896
+			if ($child_line_item instanceof EE_Line_Item) {
897
+				if (is_array($OBJ_IDs) && $child_line_item->OBJ_type() == $OBJ_type && in_array($child_line_item->OBJ_ID(), $OBJ_IDs)) {
898 898
 					$objects[] = $child_line_item;
899 899
 				} else {
900 900
 					//go-through-all-its children looking for more matches
901
-					$objects = array_merge( $objects, self::_get_descendants_by_object_type_and_object_ID( $child_line_item, $OBJ_type, $OBJ_IDs ));
901
+					$objects = array_merge($objects, self::_get_descendants_by_object_type_and_object_ID($child_line_item, $OBJ_type, $OBJ_IDs));
902 902
 				}
903 903
 			}
904 904
 		}
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 	 * @param string $type like one of the EEM_Line_Item::type_*
917 917
 	 * @return EE_Line_Item
918 918
 	 */
919
-	public static function get_nearest_descendant_of_type( EE_Line_Item $parent_line_item, $type ) {
920
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_type' , $type );
919
+	public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type) {
920
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
921 921
 	}
922 922
 
923 923
 
@@ -930,8 +930,8 @@  discard block
 block discarded – undo
930 930
 	 * @param string $code any value used for LIN_code
931 931
 	 * @return EE_Line_Item
932 932
 	 */
933
-	public static function get_nearest_descendant_having_code( EE_Line_Item $parent_line_item, $code ) {
934
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_code' , $code );
933
+	public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code) {
934
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
935 935
 	}
936 936
 
937 937
 
@@ -944,15 +944,15 @@  discard block
 block discarded – undo
944 944
 	 * @param string $value any value stored in $search_field
945 945
 	 * @return EE_Line_Item
946 946
 	 */
947
-	protected static function _get_nearest_descendant( EE_Line_Item $parent_line_item, $search_field, $value ) {
948
-		foreach( $parent_line_item->children() as $child ){
949
-			if ( $child->get( $search_field ) == $value ){
947
+	protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value) {
948
+		foreach ($parent_line_item->children() as $child) {
949
+			if ($child->get($search_field) == $value) {
950 950
 				return $child;
951 951
 			}
952 952
 		}
953
-		foreach( $parent_line_item->children() as $child ){
954
-			$descendant_found = self::_get_nearest_descendant( $child, $search_field, $value );
955
-			if ( $descendant_found ){
953
+		foreach ($parent_line_item->children() as $child) {
954
+			$descendant_found = self::_get_nearest_descendant($child, $search_field, $value);
955
+			if ($descendant_found) {
956 956
 				return $descendant_found;
957 957
 			}
958 958
 		}
@@ -968,22 +968,22 @@  discard block
 block discarded – undo
968 968
 	 * @param int $indentation
969 969
 	 * @return void
970 970
 	 */
971
-	public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){
971
+	public static function visualize(EE_Line_Item $line_item, $indentation = 0) {
972 972
 		echo "\n<br />";
973
-		for( $i = 0; $i < $indentation; $i++ ){
973
+		for ($i = 0; $i < $indentation; $i++) {
974 974
 			echo " - ";
975 975
 		}
976
-		if( $line_item->is_percent() ) {
977
-			$breakdown = $line_item->percent() . '%';
976
+		if ($line_item->is_percent()) {
977
+			$breakdown = $line_item->percent().'%';
978 978
 		} else {
979
-			$breakdown = '$' . $line_item->unit_price() . "x" . $line_item->quantity();
979
+			$breakdown = '$'.$line_item->unit_price()."x".$line_item->quantity();
980 980
 		}
981
-		echo $line_item->name() . "( " . $line_item->ID() . " ) : " . $line_item->type() . " $" . $line_item->total() . "(" . $breakdown . ")";
982
-		if( $line_item->is_taxable() ){
981
+		echo $line_item->name()."( ".$line_item->ID()." ) : ".$line_item->type()." $".$line_item->total()."(".$breakdown.")";
982
+		if ($line_item->is_taxable()) {
983 983
 			echo "  * taxable";
984 984
 		}
985
-		if( $line_item->children() ){
986
-			foreach($line_item->children() as $child){
985
+		if ($line_item->children()) {
986
+			foreach ($line_item->children() as $child) {
987 987
 				self::visualize($child, $indentation + 1);
988 988
 			}
989 989
 		}
@@ -1024,88 +1024,88 @@  discard block
 block discarded – undo
1024 1024
 	 *                                          is theirs, which can be done with
1025 1025
 	 *                                          `EEM_Line_Item::instance()->get_line_item_for_registration( $registration );`
1026 1026
 	 */
1027
-	public static function calculate_reg_final_prices_per_line_item( EE_Line_Item $line_item, $billable_ticket_quantities = array() ) {
1027
+	public static function calculate_reg_final_prices_per_line_item(EE_Line_Item $line_item, $billable_ticket_quantities = array()) {
1028 1028
 		//init running grand total if not already
1029
-		if ( ! isset( $running_totals[ 'total' ] ) ) {
1030
-			$running_totals[ 'total' ] = 0;
1029
+		if ( ! isset($running_totals['total'])) {
1030
+			$running_totals['total'] = 0;
1031 1031
 		}
1032
-		if( ! isset( $running_totals[ 'taxable' ] ) ) {
1033
-			$running_totals[ 'taxable' ] = array( 'total' => 0 );
1032
+		if ( ! isset($running_totals['taxable'])) {
1033
+			$running_totals['taxable'] = array('total' => 0);
1034 1034
 		}
1035
-		foreach ( $line_item->children() as $child_line_item ) {
1036
-			switch ( $child_line_item->type() ) {
1035
+		foreach ($line_item->children() as $child_line_item) {
1036
+			switch ($child_line_item->type()) {
1037 1037
 
1038 1038
 				case EEM_Line_Item::type_sub_total :
1039
-					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $child_line_item, $billable_ticket_quantities );
1039
+					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item($child_line_item, $billable_ticket_quantities);
1040 1040
 					//combine arrays but preserve numeric keys
1041
-					$running_totals = array_replace_recursive( $running_totals_from_subtotal, $running_totals );
1042
-					$running_totals[ 'total' ] += $running_totals_from_subtotal[ 'total' ];
1043
-					$running_totals[ 'taxable'][ 'total' ] += $running_totals_from_subtotal[ 'taxable' ][ 'total' ];
1041
+					$running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1042
+					$running_totals['total'] += $running_totals_from_subtotal['total'];
1043
+					$running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1044 1044
 					break;
1045 1045
 
1046 1046
 				case EEM_Line_Item::type_tax_sub_total :
1047 1047
 
1048 1048
 					//find how much the taxes percentage is
1049
-					if ( $child_line_item->percent() != 0 ) {
1049
+					if ($child_line_item->percent() != 0) {
1050 1050
 						$tax_percent_decimal = $child_line_item->percent() / 100;
1051 1051
 					} else {
1052 1052
 						$tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1053 1053
 					}
1054 1054
 					//and apply to all the taxable totals, and add to the pretax totals
1055
-					foreach ( $running_totals as $line_item_id => $this_running_total ) {
1055
+					foreach ($running_totals as $line_item_id => $this_running_total) {
1056 1056
 						//"total" and "taxable" array key is an exception
1057
-						if ( $line_item_id === 'taxable' ) {
1057
+						if ($line_item_id === 'taxable') {
1058 1058
 							continue;
1059 1059
 						}
1060
-						$taxable_total = $running_totals[ 'taxable' ][ $line_item_id ];
1061
-						$running_totals[ $line_item_id ] += ( $taxable_total * $tax_percent_decimal );
1060
+						$taxable_total = $running_totals['taxable'][$line_item_id];
1061
+						$running_totals[$line_item_id] += ($taxable_total * $tax_percent_decimal);
1062 1062
 					}
1063 1063
 					break;
1064 1064
 
1065 1065
 				case EEM_Line_Item::type_line_item :
1066 1066
 
1067 1067
 					// ticket line items or ????
1068
-					if ( $child_line_item->OBJ_type() === 'Ticket' ) {
1068
+					if ($child_line_item->OBJ_type() === 'Ticket') {
1069 1069
 						// kk it's a ticket
1070
-						if ( isset( $running_totals[ $child_line_item->ID() ] ) ) {
1070
+						if (isset($running_totals[$child_line_item->ID()])) {
1071 1071
 							//huh? that shouldn't happen.
1072
-							$running_totals[ 'total' ] += $child_line_item->total();
1072
+							$running_totals['total'] += $child_line_item->total();
1073 1073
 						} else {
1074 1074
 							//its not in our running totals yet. great.
1075
-							if ( $child_line_item->is_taxable() ) {
1075
+							if ($child_line_item->is_taxable()) {
1076 1076
 								$taxable_amount = $child_line_item->unit_price();
1077 1077
 							} else {
1078 1078
 								$taxable_amount = 0;
1079 1079
 							}
1080 1080
 							// are we only calculating totals for some tickets?
1081
-							if ( isset( $billable_ticket_quantities[ $child_line_item->OBJ_ID() ] ) ) {
1082
-								$quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1083
-								$running_totals[ $child_line_item->ID() ] = $quantity ? $child_line_item->unit_price() : 0;
1084
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $quantity ? $taxable_amount : 0;
1081
+							if (isset($billable_ticket_quantities[$child_line_item->OBJ_ID()])) {
1082
+								$quantity = $billable_ticket_quantities[$child_line_item->OBJ_ID()];
1083
+								$running_totals[$child_line_item->ID()] = $quantity ? $child_line_item->unit_price() : 0;
1084
+								$running_totals['taxable'][$child_line_item->ID()] = $quantity ? $taxable_amount : 0;
1085 1085
 							} else {
1086 1086
 								$quantity = $child_line_item->quantity();
1087
-								$running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1088
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $taxable_amount;
1087
+								$running_totals[$child_line_item->ID()] = $child_line_item->unit_price();
1088
+								$running_totals['taxable'][$child_line_item->ID()] = $taxable_amount;
1089 1089
 							}
1090
-							$running_totals[ 'taxable' ][ 'total' ] += $taxable_amount * $quantity;
1091
-							$running_totals[ 'total' ] += $child_line_item->unit_price() * $quantity;
1090
+							$running_totals['taxable']['total'] += $taxable_amount * $quantity;
1091
+							$running_totals['total'] += $child_line_item->unit_price() * $quantity;
1092 1092
 						}
1093 1093
 					} else {
1094 1094
 						// it's some other type of item added to the cart
1095 1095
 						// it should affect the running totals
1096 1096
 						// basically we want to convert it into a PERCENT modifier. Because
1097 1097
 						// more clearly affect all registration's final price equally
1098
-						$line_items_percent_of_running_total = $running_totals[ 'total' ] > 0 ? ( $child_line_item->total() / $running_totals[ 'total' ] ) + 1 : 1;
1099
-						foreach ( $running_totals as $line_item_id => $this_running_total ) {
1098
+						$line_items_percent_of_running_total = $running_totals['total'] > 0 ? ($child_line_item->total() / $running_totals['total']) + 1 : 1;
1099
+						foreach ($running_totals as $line_item_id => $this_running_total) {
1100 1100
 							//the "taxable" array key is an exception
1101
-							if ( $line_item_id === 'taxable' ) {
1101
+							if ($line_item_id === 'taxable') {
1102 1102
 								continue;
1103 1103
 							}
1104 1104
 							// update the running totals
1105 1105
 							// yes this actually even works for the running grand total!
1106
-							$running_totals[ $line_item_id ] = $line_items_percent_of_running_total * $this_running_total;
1107
-							if ( $child_line_item->is_taxable() ) {
1108
-								$running_totals[ 'taxable' ][ $line_item_id ] = $line_items_percent_of_running_total * $running_totals[ 'taxable' ][ $line_item_id ];
1106
+							$running_totals[$line_item_id] = $line_items_percent_of_running_total * $this_running_total;
1107
+							if ($child_line_item->is_taxable()) {
1108
+								$running_totals['taxable'][$line_item_id] = $line_items_percent_of_running_total * $running_totals['taxable'][$line_item_id];
1109 1109
 							}
1110 1110
 						}
1111 1111
 					}
@@ -1124,15 +1124,15 @@  discard block
 block discarded – undo
1124 1124
 	 * @param EE_Registration[] $registrations
1125 1125
 	 * @return \EE_Line_Item
1126 1126
 	 */
1127
-	public static function billable_line_item_tree( EE_Line_Item $line_item, $registrations ) {
1128
-		$copy_li = EEH_Line_Item::billable_line_item( $line_item, $registrations );
1129
-		foreach ( $line_item->children() as $child_li ) {
1130
-			$copy_li->add_child_line_item( EEH_Line_Item::billable_line_item_tree( $child_li, $registrations ) );
1127
+	public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations) {
1128
+		$copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1129
+		foreach ($line_item->children() as $child_li) {
1130
+			$copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations));
1131 1131
 		}
1132 1132
 		//if this is the grand total line item, make sure the totals all add up
1133 1133
 		//(we could have duplicated this logic AS we copied the line items, but
1134 1134
 		//it seems DRYer this way)
1135
-		if ( $copy_li->type() === EEM_Line_Item::type_total ) {
1135
+		if ($copy_li->type() === EEM_Line_Item::type_total) {
1136 1136
 			$copy_li->recalculate_total_including_taxes();
1137 1137
 		}
1138 1138
 		return $copy_li;
@@ -1147,26 +1147,26 @@  discard block
 block discarded – undo
1147 1147
 	 * @return EE_Line_Item
1148 1148
 	 * @param EE_Registration[] $registrations
1149 1149
 	 */
1150
-	public static function billable_line_item( EE_Line_Item $line_item, $registrations ) {
1150
+	public static function billable_line_item(EE_Line_Item $line_item, $registrations) {
1151 1151
 		$new_li_fields = $line_item->model_field_array();
1152
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1152
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1153 1153
 			$line_item->OBJ_type() === 'Ticket'
1154 1154
 		) {
1155 1155
 			$count = 0;
1156
-			foreach ( $registrations as $registration ) {
1157
-				if ( $line_item->OBJ_ID() === $registration->ticket_ID() &&
1158
-					in_array( $registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment() )
1156
+			foreach ($registrations as $registration) {
1157
+				if ($line_item->OBJ_ID() === $registration->ticket_ID() &&
1158
+					in_array($registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment())
1159 1159
 				) {
1160 1160
 					$count++;
1161 1161
 				}
1162 1162
 			}
1163
-			$new_li_fields[ 'LIN_quantity' ] = $count;
1163
+			$new_li_fields['LIN_quantity'] = $count;
1164 1164
 		}
1165 1165
 		//don't set the total. We'll leave that up to the code that calculates it
1166
-		unset( $new_li_fields[ 'LIN_ID' ] );
1167
-		unset( $new_li_fields[ 'LIN_parent' ] );
1168
-		unset( $new_li_fields[ 'LIN_total' ] );
1169
-		return EE_Line_Item::new_instance( $new_li_fields );
1166
+		unset($new_li_fields['LIN_ID']);
1167
+		unset($new_li_fields['LIN_parent']);
1168
+		unset($new_li_fields['LIN_total']);
1169
+		return EE_Line_Item::new_instance($new_li_fields);
1170 1170
 	}
1171 1171
 
1172 1172
 
@@ -1178,19 +1178,19 @@  discard block
 block discarded – undo
1178 1178
 	 * @param EE_Line_Item $line_item |null
1179 1179
 	 * @return \EE_Line_Item|null
1180 1180
 	 */
1181
-	public static function non_empty_line_items( EE_Line_Item $line_item ) {
1182
-		$copied_li = EEH_Line_Item::non_empty_line_item( $line_item );
1183
-		if ( $copied_li === null ) {
1181
+	public static function non_empty_line_items(EE_Line_Item $line_item) {
1182
+		$copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1183
+		if ($copied_li === null) {
1184 1184
 			return null;
1185 1185
 		}
1186 1186
 		//if this is an event subtotal, we want to only include it if it
1187 1187
 		//has a non-zero total and at least one ticket line item child
1188 1188
 		$ticket_children = 0;
1189
-		foreach ( $line_item->children() as $child_li ) {
1190
-			$child_li_copy = EEH_Line_Item::non_empty_line_items( $child_li );
1191
-			if ( $child_li_copy !== null ) {
1192
-				$copied_li->add_child_line_item( $child_li_copy );
1193
-				if ( $child_li_copy->type() === EEM_Line_Item::type_line_item &&
1189
+		foreach ($line_item->children() as $child_li) {
1190
+			$child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1191
+			if ($child_li_copy !== null) {
1192
+				$copied_li->add_child_line_item($child_li_copy);
1193
+				if ($child_li_copy->type() === EEM_Line_Item::type_line_item &&
1194 1194
 					$child_li_copy->OBJ_type() === 'Ticket'
1195 1195
 				) {
1196 1196
 					$ticket_children++;
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		}
1200 1200
 		//if this is an event subtotal with NO ticket children
1201 1201
 		//we basically want to ignore it
1202
-		if ( $line_item->type() === EEM_Line_Item::type_sub_total &&
1202
+		if ($line_item->type() === EEM_Line_Item::type_sub_total &&
1203 1203
 			$line_item->OBJ_type() === 'Event' &&
1204 1204
 			$ticket_children === 0 &&
1205 1205
 			$line_item->total() === 0
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 	 * @param EE_Line_Item      $line_item
1218 1218
 	 * @return EE_Line_Item
1219 1219
 	 */
1220
-	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1221
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1220
+	public static function non_empty_line_item(EE_Line_Item $line_item) {
1221
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1222 1222
 			$line_item->OBJ_type() === 'Ticket' &&
1223 1223
 			$line_item->quantity() == 0
1224 1224
 		) {
@@ -1226,9 +1226,9 @@  discard block
 block discarded – undo
1226 1226
 		}
1227 1227
 		$new_li_fields = $line_item->model_field_array();
1228 1228
 		//don't set the total. We'll leave that up to the code that calculates it
1229
-		unset( $new_li_fields[ 'LIN_ID' ] );
1230
-		unset( $new_li_fields[ 'LIN_parent' ] );
1231
-		return EE_Line_Item::new_instance( $new_li_fields );
1229
+		unset($new_li_fields['LIN_ID']);
1230
+		unset($new_li_fields['LIN_parent']);
1231
+		return EE_Line_Item::new_instance($new_li_fields);
1232 1232
 	}
1233 1233
 
1234 1234
 
@@ -1242,9 +1242,9 @@  discard block
 block discarded – undo
1242 1242
 	 * @param EE_Line_Item $total_line_item
1243 1243
 	 *	@return \EE_Line_Item
1244 1244
 	 */
1245
-	public static function get_items_subtotal( EE_Line_Item $total_line_item ){
1246
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1247
-		return self::get_pre_tax_subtotal( $total_line_item );
1245
+	public static function get_items_subtotal(EE_Line_Item $total_line_item) {
1246
+		EE_Error::doing_it_wrong('EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1247
+		return self::get_pre_tax_subtotal($total_line_item);
1248 1248
 	}
1249 1249
 
1250 1250
 
@@ -1254,9 +1254,9 @@  discard block
 block discarded – undo
1254 1254
 	 * @param EE_Transaction $transaction
1255 1255
 	 *	@return \EE_Line_Item
1256 1256
 	 */
1257
-	public static function create_default_total_line_item( $transaction = NULL) {
1258
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0' );
1259
-		return self::create_total_line_item( $transaction );
1257
+	public static function create_default_total_line_item($transaction = NULL) {
1258
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0');
1259
+		return self::create_total_line_item($transaction);
1260 1260
 	}
1261 1261
 
1262 1262
 
@@ -1267,9 +1267,9 @@  discard block
 block discarded – undo
1267 1267
 	 * @param EE_Transaction $transaction
1268 1268
 	 *	@return \EE_Line_Item
1269 1269
 	 */
1270
-	public static function create_default_tickets_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1271
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1272
-		return self::create_pre_tax_subtotal( $total_line_item, $transaction );
1270
+	public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1271
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1272
+		return self::create_pre_tax_subtotal($total_line_item, $transaction);
1273 1273
 	}
1274 1274
 
1275 1275
 
@@ -1280,9 +1280,9 @@  discard block
 block discarded – undo
1280 1280
 	 * @param EE_Transaction $transaction
1281 1281
 	 *	@return \EE_Line_Item
1282 1282
 	 */
1283
-	public static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1284
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0' );
1285
-		return self::create_taxes_subtotal( $total_line_item, $transaction );
1283
+	public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1284
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0');
1285
+		return self::create_taxes_subtotal($total_line_item, $transaction);
1286 1286
 	}
1287 1287
 
1288 1288
 
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
 	 * @param EE_Transaction $transaction
1294 1294
 	 *	@return \EE_Line_Item
1295 1295
 	 */
1296
-	public static function create_default_event_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1297
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0' );
1298
-		return self::create_event_subtotal( $total_line_item, $transaction );
1296
+	public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1297
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0');
1298
+		return self::create_event_subtotal($total_line_item, $transaction);
1299 1299
 	}
1300 1300
 
1301 1301
 
Please login to merge, or discard this patch.