Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
17:38 queued 10s
created
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *    process_registration_from_admin
281 281
 	 *
282 282
 	 * @access    public
283
-	 * @return    int
283
+	 * @return    EE_Transaction
284 284
 	 */
285 285
 	public static function process_registration_from_admin() {
286 286
 		EED_Single_Page_Checkout::load_reg_steps();
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 * _get_transaction_and_cart_for_previous_visit
609 609
 	 *
610 610
 	 * @access private
611
-	 * 	@return mixed EE_Transaction|NULL
611
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
612 612
 	 */
613 613
 	private function _get_transaction_and_cart_for_previous_visit() {
614 614
 		/** @var $TXN_model EEM_Transaction */
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	 * 	generates a new EE_Transaction object and adds it to the $_transaction property.
678 678
 	 *
679 679
 	 * 	@access private
680
-	 * 	@return mixed EE_Transaction|NULL
680
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
681 681
 	 */
682 682
 	private function _initialize_transaction() {
683 683
 		try {
Please login to merge, or discard this patch.
Spacing   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Single_Page_Checkout
39 39
 	 */
40 40
 	public static function instance() {
41
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
42
-		return parent::get_instance( __CLASS__ );
41
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
42
+		return parent::get_instance(__CLASS__);
43 43
 	}
44 44
 
45 45
 
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks_admin() {
86 86
 		EED_Single_Page_Checkout::set_definitions();
87
-		if ( defined( 'DOING_AJAX' )) {
87
+		if (defined('DOING_AJAX')) {
88 88
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
89 89
 			ob_start();
90 90
 			EED_Single_Page_Checkout::load_request_handler();
91 91
 			EED_Single_Page_Checkout::load_reg_steps();
92 92
 		} else {
93 93
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
94
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
94
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
95 95
 		}
96 96
 		// set ajax hooks
97
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
98
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
99
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
100
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
101
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
102
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
97
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
98
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
99
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
100
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
101
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
102
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
103 103
 	}
104 104
 
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * 	process ajax request
109 109
 	 * @param string $ajax_action
110 110
 	 */
111
-	public static function process_ajax_request( $ajax_action ) {
112
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
111
+	public static function process_ajax_request($ajax_action) {
112
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
113 113
 		EED_Single_Page_Checkout::instance()->_initialize();
114 114
 	}
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * 	ajax display registration step
120 120
 	 */
121 121
 	public static function display_reg_step() {
122
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
122
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
123 123
 	}
124 124
 
125 125
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * 	ajax process registration step
129 129
 	 */
130 130
 	public static function process_reg_step() {
131
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
131
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
132 132
 	}
133 133
 
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	ajax process registration step
138 138
 	 */
139 139
 	public static function update_reg_step() {
140
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
140
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
141 141
 	}
142 142
 
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return void
150 150
 	 */
151 151
 	public static function update_checkout() {
152
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
152
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
153 153
 	}
154 154
 
155 155
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public static function load_request_handler() {
164 164
 		// load core Request_Handler class
165
-		if ( ! isset( EE_Registry::instance()->REQ )) {
166
-			EE_Registry::instance()->load_core( 'Request_Handler' );
165
+		if ( ! isset(EE_Registry::instance()->REQ)) {
166
+			EE_Registry::instance()->load_core('Request_Handler');
167 167
 		}
168 168
 	}
169 169
 
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 	 *  @return 	void
177 177
 	 */
178 178
 	public static function set_definitions() {
179
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
180
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
181
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
182
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
183
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
184
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
185
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
186
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
179
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
180
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
181
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
182
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
183
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
184
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
185
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
186
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
187 187
 	}
188 188
 
189 189
 
@@ -198,31 +198,31 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public static function load_reg_steps() {
200 200
 		static $reg_steps_loaded = FALSE;
201
-		if ( $reg_steps_loaded ) {
201
+		if ($reg_steps_loaded) {
202 202
 			return;
203 203
 		}
204 204
 		// load EE_SPCO_Reg_Step base class
205 205
 //		EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class'  );
206 206
 		// filter list of reg_steps
207
-		$reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() );
207
+		$reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps());
208 208
 		// sort by key (order)
209
-		ksort( $reg_steps_to_load );
209
+		ksort($reg_steps_to_load);
210 210
 		// loop through folders
211
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
211
+		foreach ($reg_steps_to_load as $order => $reg_step) {
212 212
 			// we need a
213
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
213
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
214 214
 				// copy over to the reg_steps_array
215
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
215
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
216 216
 				// register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now )
217
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
217
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
218 218
 				// add AJAX or other hooks
219
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
219
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
220 220
 					// setup autoloaders if necessary
221
-					if ( ! class_exists( $reg_step['class_name'] )) {
222
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
221
+					if ( ! class_exists($reg_step['class_name'])) {
222
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
223 223
 					}
224
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
225
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
224
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
225
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
226 226
 					}
227 227
 				}
228 228
 			}
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public static function get_reg_steps() {
243 243
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
244
-		if ( empty( $reg_steps )) {
244
+		if (empty($reg_steps)) {
245 245
 			$reg_steps = array(
246 246
 				10 => array(
247
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
247
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
248 248
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
249 249
 					'slug' => 'attendee_information',
250 250
 					'has_hooks' => FALSE
251 251
 				),
252 252
 				20 => array(
253
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
253
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
254 254
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
255 255
 					'slug' => 'registration_confirmation',
256 256
 					'has_hooks' => FALSE
257 257
 				),
258 258
 				30 => array(
259
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
259
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
260 260
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
261 261
 					'slug' => 'payment_options',
262 262
 					'has_hooks' => TRUE
263 263
 				),
264 264
 				999 => array(
265
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
265
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
266 266
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
267 267
 					'slug' => 'finalize_registration',
268 268
 					'has_hooks' => FALSE
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public static function registration_checkout_for_admin() {
284 284
 		EED_Single_Page_Checkout::load_reg_steps();
285
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
286
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
287
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
285
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
286
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
287
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
288 288
 		EED_Single_Page_Checkout::instance()->_initialize();
289 289
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
290 290
 		return EE_Registry::instance()->REQ->get_output();
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public static function process_registration_from_admin() {
302 302
 		EED_Single_Page_Checkout::load_reg_steps();
303
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
304
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
305
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
303
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
304
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
305
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
306 306
 		EED_Single_Page_Checkout::instance()->_initialize();
307
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
308
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
309
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
310
-				if ( $final_reg_step->process_reg_step() ) {
307
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
308
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
309
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
310
+				if ($final_reg_step->process_reg_step()) {
311 311
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
312 312
 				}
313 313
 			}
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 * @param WP_Query $WP_Query
325 325
 	 * @return    void
326 326
 	 */
327
-	public function run( $WP_Query ) {
328
-		if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) {
327
+	public function run($WP_Query) {
328
+		if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) {
329 329
 			$this->_initialize();
330 330
 		}
331 331
 	}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 * @param WP_Query $WP_Query
341 341
 	 * @return    void
342 342
 	 */
343
-	public static function init( $WP_Query ) {
344
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
343
+	public static function init($WP_Query) {
344
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
345 345
 	}
346 346
 
347 347
 
@@ -355,32 +355,32 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	private function _initialize() {
357 357
 		// ensure SPCO doesn't run twice
358
-		if ( EED_Single_Page_Checkout::$_initialized ) {
358
+		if (EED_Single_Page_Checkout::$_initialized) {
359 359
 			return;
360 360
 		}
361 361
 		// setup the EE_Checkout object
362 362
 		$this->checkout = $this->_initialize_checkout();
363 363
 		// filter checkout
364
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
364
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
365 365
 		// get the $_GET
366 366
 		$this->_get_request_vars();
367 367
 		// filter continue_reg
368
-		$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
368
+		$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
369 369
 		// load the reg steps array
370
-		if ( ! $this->_load_and_instantiate_reg_steps() ) {
370
+		if ( ! $this->_load_and_instantiate_reg_steps()) {
371 371
 			EED_Single_Page_Checkout::$_initialized = true;
372 372
 			return;
373 373
 		}
374 374
 		// set the current step
375
-		$this->checkout->set_current_step( $this->checkout->step );
375
+		$this->checkout->set_current_step($this->checkout->step);
376 376
 		// and the next step
377 377
 		$this->checkout->set_next_step();
378 378
 		// was there already a valid transaction in the checkout from the session ?
379
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
379
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
380 380
 			// get transaction from db or session
381 381
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction();
382
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
383
-				EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
382
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
383
+				EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
384 384
 				// add some style and make it dance
385 385
 				$this->checkout->transaction = EE_Transaction::new_instance();
386 386
 				$this->add_styles_and_scripts();
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 				return;
389 389
 			}
390 390
 			// and the registrations for the transaction
391
-			$this->_get_registrations( $this->checkout->transaction );
391
+			$this->_get_registrations($this->checkout->transaction);
392 392
 		}
393 393
 		// verify that everything has been setup correctly
394
-		if ( ! $this->_final_verifications() ) {
394
+		if ( ! $this->_final_verifications()) {
395 395
 			EED_Single_Page_Checkout::$_initialized = true;
396 396
 			return;
397 397
 		}
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 		// set no cache headers and constants
417 417
 		EE_System::do_not_cache();
418 418
 		// add anchor
419
-		add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
419
+		add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
420 420
 		// remove transaction lock
421
-		add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
421
+		add_action('shutdown', array($this, 'unlock_transaction'), 1);
422 422
 	}
423 423
 
424 424
 
@@ -435,20 +435,20 @@  discard block
 block discarded – undo
435 435
 		// look in session for existing checkout
436 436
 		$checkout = EE_Registry::instance()->SSN->checkout();
437 437
 		// verify
438
-		if ( ! $checkout instanceof EE_Checkout ) {
438
+		if ( ! $checkout instanceof EE_Checkout) {
439 439
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
440
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
440
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
441 441
 			// verify again
442
-			if ( ! $checkout instanceof EE_Checkout ) {
443
-				throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
442
+			if ( ! $checkout instanceof EE_Checkout) {
443
+				throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
444 444
 			}
445 445
 		} else {
446
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
447
-				wp_safe_redirect( $checkout->redirect_url );
446
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
447
+				wp_safe_redirect($checkout->redirect_url);
448 448
 				exit();
449 449
 			}
450 450
 		}
451
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
451
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
452 452
 		// reset anything that needs a clean slate for each request
453 453
 		$checkout->reset_for_current_request();
454 454
 		return $checkout;
@@ -466,22 +466,22 @@  discard block
 block discarded – undo
466 466
 		// load classes
467 467
 		EED_Single_Page_Checkout::load_request_handler();
468 468
 		//make sure this request is marked as belonging to EE
469
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
469
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
470 470
 		// which step is being requested ?
471
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
471
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
472 472
 		// which step is being edited ?
473
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
473
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
474 474
 		// and what we're doing on the current step
475
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
475
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
476 476
 		// returning to edit ?
477
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
477
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
478 478
 		// or some other kind of revisit ?
479
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
479
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
480 480
 		// and whether or not to generate a reg form for this request
481
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
481
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
482 482
 		// and whether or not to process a reg form submission for this request
483
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
484
-		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; 		// TRUE 	FALSE
483
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
484
+		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE 	FALSE
485 485
 		//$this->_display_request_vars();
486 486
 	}
487 487
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 * @return    void
495 495
 	 */
496 496
 	protected function _display_request_vars() {
497
-		if ( ! WP_DEBUG ) {
497
+		if ( ! WP_DEBUG) {
498 498
 			return;
499 499
 		}
500
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
501
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
502
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
503
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
504
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
505
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
506
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
507
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
500
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
501
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
502
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
503
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
504
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
505
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
506
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
507
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
508 508
 	}
509 509
 
510 510
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * @return    array
519 519
 	 */
520 520
 	private function _get_first_step() {
521
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
522
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
521
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
522
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
523 523
 	}
524 524
 
525 525
 
@@ -535,37 +535,37 @@  discard block
 block discarded – undo
535 535
 	private function _load_and_instantiate_reg_steps() {
536 536
 		// have reg_steps already been instantiated ?
537 537
 		if (
538
-			empty( $this->checkout->reg_steps ) ||
539
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
538
+			empty($this->checkout->reg_steps) ||
539
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
540 540
 		) {
541 541
 			// if not, then loop through raw reg steps array
542
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
543
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
542
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
543
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
544 544
 					return false;
545 545
 				}
546 546
 			}
547 547
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
548 548
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
549 549
 			// skip the registration_confirmation page ?
550
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
550
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
551 551
 				// just remove it from the reg steps array
552
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
553
-			} else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( 	$this->checkout->reg_steps['registration_confirmation'] )) {
552
+				$this->checkout->remove_reg_step('registration_confirmation', false);
553
+			} else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) {
554 554
 				// set the order to something big like 100
555
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
555
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
556 556
 			}
557 557
 			// filter the array for good luck
558
-			$this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps );
558
+			$this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps);
559 559
 			// finally re-sort based on the reg step class order properties
560 560
 			$this->checkout->sort_reg_steps();
561 561
 		} else {
562
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
562
+			foreach ($this->checkout->reg_steps as $reg_step) {
563 563
 				// set all current step stati to FALSE
564
-				$reg_step->set_is_current_step( FALSE );
564
+				$reg_step->set_is_current_step(FALSE);
565 565
 			}
566 566
 		}
567
-		if ( empty( $this->checkout->reg_steps )) {
568
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
567
+		if (empty($this->checkout->reg_steps)) {
568
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
569 569
 			return false;
570 570
 		}
571 571
 			// make reg step details available to JS
@@ -583,34 +583,34 @@  discard block
 block discarded – undo
583 583
 	 * @param int   $order
584 584
 	 * @return bool
585 585
 	 */
586
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
586
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
587 587
 
588 588
 		// we need a file_path, class_name, and slug to add a reg step
589
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
589
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
590 590
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
591
-			if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) {
591
+			if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') {
592 592
 				return true;
593 593
 			}
594 594
 			// instantiate step class using file path and class name
595
-			$reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE  );
595
+			$reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE);
596 596
 			// did we gets the goods ?
597
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
597
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
598 598
 				// set reg step order based on config
599
-				$reg_step_obj->set_order( $order );
599
+				$reg_step_obj->set_order($order);
600 600
 				// add instantiated reg step object to the master reg steps array
601
-				$this->checkout->add_reg_step( $reg_step_obj );
601
+				$this->checkout->add_reg_step($reg_step_obj);
602 602
 			} else {
603
-				EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
603
+				EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
604 604
 				return false;
605 605
 			}
606 606
 		} else {
607
-			if ( WP_DEBUG ) {
607
+			if (WP_DEBUG) {
608 608
 				EE_Error::add_error(
609 609
 					sprintf(
610
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
611
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
612
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
613
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
610
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
611
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
612
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
613
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
614 614
 						'<ul>',
615 615
 						'<li>',
616 616
 						'</li>',
@@ -634,16 +634,16 @@  discard block
 block discarded – undo
634 634
 	 */
635 635
 	private function _get_transaction_and_cart_for_previous_visit() {
636 636
 		/** @var $TXN_model EEM_Transaction */
637
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
637
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
638 638
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
639
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
639
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
640 640
 		// verify transaction
641
-		if ( $transaction instanceof EE_Transaction ) {
641
+		if ($transaction instanceof EE_Transaction) {
642 642
 			// and get the cart that was used for that transaction
643
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
643
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
644 644
 			return $transaction;
645 645
 		} else {
646
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
646
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
647 647
 			return NULL;
648 648
 		}
649 649
 	}
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 	 * @param EE_Transaction $transaction
658 658
 	 * @return EE_Cart
659 659
 	 */
660
-	private function _get_cart_for_transaction( $transaction ) {
661
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL;
660
+	private function _get_cart_for_transaction($transaction) {
661
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL;
662 662
 		// verify cart
663
-		if ( ! $cart instanceof EE_Cart ) {
664
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
663
+		if ( ! $cart instanceof EE_Cart) {
664
+			$cart = EE_Registry::instance()->load_core('Cart');
665 665
 		}
666 666
 		return $cart;
667 667
 	}
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 	 * @param EE_Transaction $transaction
677 677
 	 * 	@return EE_Cart
678 678
 	 */
679
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
680
-		return EE_Cart::get_cart_from_txn( $transaction );
679
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
680
+		return EE_Cart::get_cart_from_txn($transaction);
681 681
 	}
682 682
 
683 683
 
@@ -692,17 +692,17 @@  discard block
 block discarded – undo
692 692
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
693 693
 		//  if there's no transaction, then this is the FIRST visit to SPCO
694 694
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
695
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
695
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
696 696
 		// and then create a new transaction
697 697
 		$transaction = $this->_initialize_transaction();
698 698
 		// verify transaction
699
-		if ( $transaction instanceof EE_Transaction ) {
699
+		if ($transaction instanceof EE_Transaction) {
700 700
 			// save it so that we have an ID for other objects to use
701 701
 			$transaction->save();
702 702
 			// and save TXN data to the cart
703
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
703
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
704 704
 		} else {
705
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
706 706
 		}
707 707
 		return $transaction;
708 708
 	}
@@ -722,15 +722,15 @@  discard block
 block discarded – undo
722 722
 			// grab the cart grand total
723 723
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
724 724
 			// create new TXN
725
-			return EE_Transaction::new_instance( array(
725
+			return EE_Transaction::new_instance(array(
726 726
 				'TXN_timestamp' 	=> time(),
727 727
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
728 728
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
729 729
 				'TXN_paid' 				=> 0,
730 730
 				'STS_ID' 					=> EEM_Transaction::failed_status_code,
731 731
 			));
732
-		} catch( Exception $e ) {
733
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
732
+		} catch (Exception $e) {
733
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
734 734
 		}
735 735
 		return NULL;
736 736
 	}
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param EE_Transaction $transaction
745 745
 	 * @return EE_Cart
746 746
 	 */
747
-	private function _get_registrations( EE_Transaction $transaction ) {
747
+	private function _get_registrations(EE_Transaction $transaction) {
748 748
 		// first step: grab the registrants  { : o
749
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
749
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
750 750
 		// verify registrations have been set
751
-		if ( empty( $registrations )) {
751
+		if (empty($registrations)) {
752 752
 			// if no cached registrations, then check the db
753
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
753
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
754 754
 			// still nothing ? well as long as this isn't a revisit
755
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
755
+			if (empty($registrations) && ! $this->checkout->revisit) {
756 756
 				// generate new registrations from scratch
757
-				$registrations = $this->_initialize_registrations( $transaction );
757
+				$registrations = $this->_initialize_registrations($transaction);
758 758
 			}
759 759
 		}
760 760
 		// sort by their original registration order
761
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
761
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
762 762
 		// then loop thru the array
763
-		foreach ( $registrations as $registration ) {
763
+		foreach ($registrations as $registration) {
764 764
 			// verify each registration
765
-			if ( $registration instanceof EE_Registration ) {
765
+			if ($registration instanceof EE_Registration) {
766 766
 				// we display all attendee info for the primary registrant
767
-				if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) {
767
+				if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
768 768
 					$this->checkout->primary_revisit = TRUE;
769 769
 					break;
770
-				} else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) {
770
+				} else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) {
771 771
 					// but hide info if it doesn't belong to you
772
-					$transaction->clear_cache( 'Registration', $registration->ID() );
772
+					$transaction->clear_cache('Registration', $registration->ID());
773 773
 				}
774
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
774
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
775 775
 			}
776 776
 		}
777 777
 	}
@@ -785,17 +785,17 @@  discard block
 block discarded – undo
785 785
 	 * @param EE_Transaction $transaction
786 786
 	 * @return    array
787 787
 	 */
788
-	private function _initialize_registrations( EE_Transaction $transaction ) {
788
+	private function _initialize_registrations(EE_Transaction $transaction) {
789 789
 		$att_nmbr = 0;
790 790
 		$registrations = array();
791
-		if ( $transaction instanceof EE_Transaction ) {
791
+		if ($transaction instanceof EE_Transaction) {
792 792
 			/** @type EE_Registration_Processor $registration_processor */
793
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
793
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
794 794
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
795 795
 			// now let's add the cart items to the $transaction
796
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
796
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
797 797
 				//do the following for each ticket of this type they selected
798
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
798
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
799 799
 					$att_nmbr++;
800 800
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
801 801
 						$line_item,
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
 						$att_nmbr,
804 804
 						$this->checkout->total_ticket_count
805 805
 					);
806
-					if ( $registration instanceof EE_Registration ) {
807
-						$registrations[ $registration->ID() ] = $registration;
806
+					if ($registration instanceof EE_Registration) {
807
+						$registrations[$registration->ID()] = $registration;
808 808
 					}
809 809
 				}
810 810
 			}
811
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
811
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
812 812
 		}
813 813
 		return $registrations;
814 814
 	}
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
 	 * @param EE_Registration $reg_B
824 824
 	 * @return array()
825 825
 	 */
826
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
826
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
827 827
 		// this shouldn't ever happen within the same TXN, but oh well
828
-		if ( $reg_A->count() == $reg_B->count() ) {
828
+		if ($reg_A->count() == $reg_B->count()) {
829 829
 			return 0;
830 830
 		}
831
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
831
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
832 832
 	}
833 833
 
834 834
 
@@ -843,35 +843,35 @@  discard block
 block discarded – undo
843 843
 	 */
844 844
 	private function _final_verifications() {
845 845
 		// filter checkout
846
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
846
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
847 847
 		//verify that current step is still set correctly
848
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
849
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
849
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 			return false;
851 851
 		}
852 852
 		// if returning to SPCO, then verify that primary registrant is set
853
-		if ( ! empty( $this->checkout->reg_url_link )) {
853
+		if ( ! empty($this->checkout->reg_url_link)) {
854 854
 			$valid_registrant = $this->checkout->transaction->primary_registration();
855
-			if ( ! $valid_registrant instanceof EE_Registration ) {
856
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
855
+			if ( ! $valid_registrant instanceof EE_Registration) {
856
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
857 857
 				return false;
858 858
 			}
859 859
 			$valid_registrant = null;
860
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
861
-				if ( $registration instanceof EE_Registration ) {
862
-					if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) {
860
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
861
+				if ($registration instanceof EE_Registration) {
862
+					if ($registration->reg_url_link() == $this->checkout->reg_url_link) {
863 863
 						$valid_registrant = $registration;
864 864
 					}
865 865
 				}
866 866
 			}
867
-			if ( ! $valid_registrant instanceof EE_Registration ) {
868
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
867
+			if ( ! $valid_registrant instanceof EE_Registration) {
868
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
869 869
 				return false;
870 870
 			}
871 871
 		}
872 872
 		// now that things have been kinda sufficiently verified,
873 873
 		// let's add the checkout to the session so that's available other systems
874
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
874
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
875 875
 		return true;
876 876
 	}
877 877
 
@@ -887,28 +887,28 @@  discard block
 block discarded – undo
887 887
 	 * @access    private
888 888
 	 * @param bool $reinitializing
889 889
 	 */
890
-	private function _initialize_reg_steps( $reinitializing = false ) {
891
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
890
+	private function _initialize_reg_steps($reinitializing = false) {
891
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
892 892
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
893
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
894
-			if ( ! $reg_step->initialize_reg_step() ) {
893
+		foreach ($this->checkout->reg_steps as $reg_step) {
894
+			if ( ! $reg_step->initialize_reg_step()) {
895 895
 				// if not initialized then maybe this step is being removed...
896
-				if ( $reg_step->is_current_step() && ! $reinitializing ) {
896
+				if ($reg_step->is_current_step() && ! $reinitializing) {
897 897
 					// if it was the current step, then we need to start over here
898
-					$this->_initialize_reg_steps( true );
898
+					$this->_initialize_reg_steps(true);
899 899
 					return;
900 900
 				}
901 901
 				continue;
902 902
 			}
903 903
 			// i18n
904 904
 			$reg_step->translate_js_strings();
905
-			if ( $reg_step->is_current_step() ) {
905
+			if ($reg_step->is_current_step()) {
906 906
 				// the text that appears on the reg step form submit button
907 907
 				$reg_step->set_submit_button_text();
908 908
 			}
909 909
 		}
910 910
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
911
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
911
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
912 912
 	}
913 913
 
914 914
 
@@ -921,39 +921,39 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	private function _check_form_submission() {
923 923
 		//does this request require the reg form to be generated ?
924
-		if ( $this->checkout->generate_reg_form ) {
924
+		if ($this->checkout->generate_reg_form) {
925 925
 			// ever heard that song by Blue Rodeo ?
926 926
 			try {
927 927
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
928 928
 				// if not displaying a form, then check for form submission
929
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
929
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
930 930
 					// clear out any old data in case this step is being run again
931
-					$this->checkout->current_step->set_valid_data( array() );
931
+					$this->checkout->current_step->set_valid_data(array());
932 932
 					// capture submitted form data
933 933
 					$this->checkout->current_step->reg_form->receive_form_submission(
934
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
934
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
935 935
 					);
936 936
 					// validate submitted form data
937
-					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) {
937
+					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) {
938 938
 						// thou shall not pass !!!
939 939
 						$this->checkout->continue_reg = FALSE;
940 940
 						// any form validation errors?
941
-						if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) {
941
+						if ($this->checkout->current_step->reg_form->submission_error_message() != '') {
942 942
 							$submission_error_messages = array();
943 943
 							// bad, bad, bad registrant
944
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
945
-								if ( $validation_error instanceof EE_Validation_Error ) {
946
-									$submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() );
944
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
945
+								if ($validation_error instanceof EE_Validation_Error) {
946
+									$submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage());
947 947
 								}
948 948
 							}
949
-							EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
949
+							EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
950 950
 						}
951 951
 						// well not really... what will happen is we'll just get redirected back to redo the current step
952 952
 						$this->go_to_next_step();
953 953
 						return;
954 954
 					}
955 955
 				}
956
-			} catch( EE_Error $e ) {
956
+			} catch (EE_Error $e) {
957 957
 				$e->get_error();
958 958
 			}
959 959
 		}
@@ -969,38 +969,38 @@  discard block
 block discarded – undo
969 969
 	 */
970 970
 	private function _process_form_action() {
971 971
 		// what cha wanna do?
972
-		switch( $this->checkout->action ) {
972
+		switch ($this->checkout->action) {
973 973
 			// AJAX next step reg form
974 974
 			case 'display_spco_reg_step' :
975 975
 				$this->checkout->redirect = FALSE;
976
-				if ( EE_Registry::instance()->REQ->ajax ) {
977
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
976
+				if (EE_Registry::instance()->REQ->ajax) {
977
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
978 978
 				}
979 979
 				break;
980 980
 
981 981
 			default :
982 982
 				// meh... do one of those other steps first
983
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
983
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
984 984
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
985
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
985
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
986 986
 					// call action on current step
987
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
987
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
988 988
 						// good registrant, you get to proceed
989
-						if ( $this->checkout->current_step->success_message() != '' ) {
990
-							if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) {
991
-								EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() );
989
+						if ($this->checkout->current_step->success_message() != '') {
990
+							if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) {
991
+								EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions());
992 992
 							}
993 993
 						}
994 994
 						// pack it up, pack it in...
995 995
 						$this->_setup_redirect();
996 996
 					}
997 997
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
998
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
998
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
999 999
 
1000 1000
 				} else {
1001 1001
 					EE_Error::add_error(
1002 1002
 						sprintf(
1003
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1003
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1004 1004
 							$this->checkout->action,
1005 1005
 							$this->checkout->current_step->name()
1006 1006
 						),
@@ -1026,10 +1026,10 @@  discard block
 block discarded – undo
1026 1026
 	public function add_styles_and_scripts() {
1027 1027
 		// i18n
1028 1028
 		$this->translate_js_strings();
1029
-		if ( $this->checkout->admin_request ) {
1030
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1029
+		if ($this->checkout->admin_request) {
1030
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1031 1031
 		} else {
1032
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1032
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1033 1033
 		}
1034 1034
 	}
1035 1035
 
@@ -1045,42 +1045,42 @@  discard block
 block discarded – undo
1045 1045
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1046 1046
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1047 1047
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1048
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1049
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1050
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1048
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1049
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1050
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1051 1051
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1052 1052
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1053
-		EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' );
1054
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1053
+		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>');
1054
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1055 1055
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1056 1056
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1057 1057
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1058
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1059
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1060
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1061
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1062
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1063
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1064
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1065
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1066
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1067
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1068
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1069
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1070
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1071
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1058
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1059
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1060
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1061
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1062
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1063
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1064
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1065
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1066
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1067
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1068
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1069
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1070
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1071
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1072 1072
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1073
-			__( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
1073
+			__('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
1074 1074
 			'<h4 class="important-notice">',
1075 1075
 			'</h4>',
1076 1076
 			'<br />',
1077 1077
 			'<p>',
1078
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1078
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1079 1079
 			'">',
1080 1080
 			'</a>',
1081 1081
 			'</p>'
1082 1082
 		);
1083
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1083
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1084 1084
 	}
1085 1085
 
1086 1086
 
@@ -1093,25 +1093,25 @@  discard block
 block discarded – undo
1093 1093
 	 */
1094 1094
 	public function enqueue_styles_and_scripts() {
1095 1095
 		// load css
1096
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1097
-		wp_enqueue_style( 'single_page_checkout' );
1096
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1097
+		wp_enqueue_style('single_page_checkout');
1098 1098
 		// load JS
1099
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1100
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1101
-		wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE );
1102
-		wp_enqueue_script( 'single_page_checkout' );
1099
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1100
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1101
+		wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE);
1102
+		wp_enqueue_script('single_page_checkout');
1103 1103
 
1104 1104
 		/**
1105 1105
 		 * global action hook for enqueueing styles and scripts with
1106 1106
 		 * spco calls.
1107 1107
 		 */
1108
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1108
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1109 1109
 
1110 1110
 		/**
1111 1111
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1112 1112
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1113 1113
 		 */
1114
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1114
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1115 1115
 
1116 1116
 		// add css and JS for current step
1117 1117
 		$this->checkout->current_step->enqueue_styles_and_scripts();
@@ -1127,20 +1127,20 @@  discard block
 block discarded – undo
1127 1127
 	 */
1128 1128
 	private function _display_spco_reg_form() {
1129 1129
 		// if registering via the admin, just display the reg form for the current step
1130
-		if ( $this->checkout->admin_request ) {
1131
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1130
+		if ($this->checkout->admin_request) {
1131
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1132 1132
 		} else {
1133 1133
 			// add powered by EE msg
1134
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1134
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1135 1135
 
1136
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1136
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1137 1137
 			$cookies_not_set_msg = '';
1138
-			if ( $empty_cart ) {
1139
-				if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1138
+			if ($empty_cart) {
1139
+				if ( ! isset($_COOKIE['ee_cookie_test'])) {
1140 1140
 					$cookies_not_set_msg = apply_filters(
1141 1141
 						'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1142 1142
 						sprintf(
1143
-							__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1143
+							__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1144 1144
 							'<div class="ee-attention">',
1145 1145
 							'</div>',
1146 1146
 							'<h6 class="important-notice">',
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 					'layout_strategy' =>
1162 1162
 						new EE_Template_Layout(
1163 1163
 							array(
1164
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1164
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1165 1165
 								'template_args' => array(
1166 1166
 									'empty_cart' 		=> $empty_cart,
1167 1167
 									'revisit' 				=> $this->checkout->revisit,
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
 									'empty_msg' 		=> apply_filters(
1171 1171
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1172 1172
 										sprintf(
1173
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1174
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1173
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1174
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1175 1175
 											'">',
1176 1176
 											'</a>'
1177 1177
 										)
@@ -1179,14 +1179,14 @@  discard block
 block discarded – undo
1179 1179
 									'cookies_not_set_msg' 		=> $cookies_not_set_msg,
1180 1180
 									'registration_time_limit' 	=> $this->checkout->get_registration_time_limit(),
1181 1181
 									'session_expiration' 			=>
1182
-										gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) )
1182
+										gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS))
1183 1183
 							)
1184 1184
 						)
1185 1185
 					)
1186 1186
 				)
1187 1187
 			);
1188 1188
 			// load template and add to output sent that gets filtered into the_content()
1189
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1189
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1190 1190
 		}
1191 1191
 	}
1192 1192
 
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 	 * @internal  param string $label
1201 1201
 	 * @return        string
1202 1202
 	 */
1203
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1204
-		if ( $next_step == 'finalize_registration' ) {
1203
+	public function add_extra_finalize_registration_inputs($next_step) {
1204
+		if ($next_step == 'finalize_registration') {
1205 1205
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1206 1206
 		}
1207 1207
 	}
@@ -1215,18 +1215,18 @@  discard block
 block discarded – undo
1215 1215
 	 *  @return 	string
1216 1216
 	 */
1217 1217
 	public static function display_registration_footer() {
1218
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1219
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1220
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' );
1221
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1218
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1219
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1220
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/');
1221
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1222 1222
 			echo apply_filters(
1223 1223
 				'FHEE__EE_Front_Controller__display_registration_footer',
1224 1224
 				sprintf(
1225
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1226
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1225
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1226
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1227 1227
 					'" target="_blank">',
1228 1228
 					'</a>',
1229
-					'<a href="' . $url . '" title="',
1229
+					'<a href="'.$url.'" title="',
1230 1230
 					'" target="_blank">',
1231 1231
 					'</a></div>'
1232 1232
 				)
@@ -1257,12 +1257,12 @@  discard block
 block discarded – undo
1257 1257
 	 * @return 	array
1258 1258
 	 */
1259 1259
 	private function _setup_redirect() {
1260
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1260
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1261 1261
 			$this->checkout->redirect = TRUE;
1262
-			if ( empty( $this->checkout->redirect_url )) {
1262
+			if (empty($this->checkout->redirect_url)) {
1263 1263
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1264 1264
 			}
1265
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1265
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1266 1266
 		}
1267 1267
 	}
1268 1268
 
@@ -1275,12 +1275,12 @@  discard block
 block discarded – undo
1275 1275
 	 * @return void
1276 1276
 	 */
1277 1277
 	public function go_to_next_step() {
1278
-		if ( EE_Registry::instance()->REQ->ajax ) {
1278
+		if (EE_Registry::instance()->REQ->ajax) {
1279 1279
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1280
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1280
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1281 1281
 		}
1282 1282
 		// just return for these conditions
1283
-		if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) {
1283
+		if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') {
1284 1284
 			return;
1285 1285
 		}
1286 1286
 		// AJAX response
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	 */
1302 1302
 	protected function _handle_json_response() {
1303 1303
 		// if this is an ajax request
1304
-		if ( EE_Registry::instance()->REQ->ajax ) {
1304
+		if (EE_Registry::instance()->REQ->ajax) {
1305 1305
 			// DEBUG LOG
1306 1306
 			//$this->checkout->log(
1307 1307
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1311,10 +1311,10 @@  discard block
 block discarded – undo
1311 1311
 			//		'continue_reg'               => $this->checkout->continue_reg,
1312 1312
 			//	)
1313 1313
 			//);
1314
-			$this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() );
1315
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1314
+			$this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit());
1315
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1316 1316
 			// just send the ajax (
1317
-			$json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response );
1317
+			$json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response);
1318 1318
 			$this->unlock_transaction();
1319 1319
 			echo $json_response;
1320 1320
 			exit();
@@ -1331,9 +1331,9 @@  discard block
 block discarded – undo
1331 1331
 	 */
1332 1332
 	protected function _handle_html_redirects() {
1333 1333
 		// going somewhere ?
1334
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1334
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1335 1335
 			// store notices in a transient
1336
-			EE_Error::get_notices( false, true, true );
1336
+			EE_Error::get_notices(false, true, true);
1337 1337
 			$this->unlock_transaction();
1338 1338
 			// DEBUG LOG
1339 1339
 			//$this->checkout->log(
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 			//		'headers_list'    => headers_list(),
1345 1345
 			//	)
1346 1346
 			//);
1347
-			wp_safe_redirect( $this->checkout->redirect_url );
1347
+			wp_safe_redirect($this->checkout->redirect_url);
1348 1348
 			exit();
1349 1349
 		}
1350 1350
 	}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 // (all other times it gets resurrected from a wordpress option)
15 15
 $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*');
16 16
 $class_to_filepath = array();
17
-foreach($stages as $filepath){
17
+foreach ($stages as $filepath) {
18 18
 	$matches = array();
19
-	preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches);
19
+	preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20 20
 	$class_to_filepath[$matches[1]] = $filepath;
21 21
 }
22 22
 //give addons a chance to autoload their stages too
23
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath);
23
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath);
24 24
 EEH_Autoloader::register_autoloader($class_to_filepath);
25 25
 
26 26
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  * @since                4.7.0
37 37
  *
38 38
  */
39
-class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{
39
+class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base {
40 40
 
41 41
 	/**
42 42
 	 * return EE_DMS_Core_4_7_0
@@ -58,18 +58,18 @@  discard block
 block discarded – undo
58 58
 	 * @return bool
59 59
 	 */
60 60
 	public function can_migrate_from_version($version_array) {
61
-		EE_Registry::instance()->load_helper( 'Activation' );
61
+		EE_Registry::instance()->load_helper('Activation');
62 62
 		$version_string = $version_array['Core'];
63 63
 		if (
64
-			( $version_string <= '4.7.0' && $version_string >= '4.6.0' )
64
+			($version_string <= '4.7.0' && $version_string >= '4.6.0')
65 65
 			||
66
-			( $version_string >= '4.7.0' &&
67
-					! EEH_Activation::table_exists( 'esp_registration_payment' ) &&
68
-					EEH_Activation::table_exists( 'esp_registration' ) ) ) {
66
+			($version_string >= '4.7.0' &&
67
+					! EEH_Activation::table_exists('esp_registration_payment') &&
68
+					EEH_Activation::table_exists('esp_registration')) ) {
69 69
 			return true;
70
-		} elseif ( ! $version_string ) {
70
+		} elseif ( ! $version_string) {
71 71
 			//no version string provided... this must be pre 4.3
72
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
72
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
73 73
 		} else {
74 74
 			return false;
75 75
 		}
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function schema_changes_before_migration() {
93 93
 		//relies on 4.1's EEH_Activation::create_table
94
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
95
-		$table_name='esp_answer';
96
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
94
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
95
+		$table_name = 'esp_answer';
96
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
97 97
 					REG_ID INT UNSIGNED NOT NULL,
98 98
 					QST_ID INT UNSIGNED NOT NULL,
99 99
 					ANS_value TEXT NOT NULL,
100 100
 					PRIMARY KEY  (ANS_ID),
101 101
 					KEY REG_ID (REG_ID),
102 102
 					KEY QST_ID (QST_ID)";
103
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
103
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
104 104
 
105 105
 		$table_name = 'esp_attendee_meta';
106 106
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
141 141
 					  CNT_active TINYINT(1) DEFAULT '0',
142 142
 					  PRIMARY KEY  (CNT_ISO)";
143
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
143
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
144 144
 
145 145
 		$table_name = 'esp_currency';
146 146
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
151 151
 				CUR_active TINYINT(1) DEFAULT '0',
152 152
 				PRIMARY KEY  (CUR_code)";
153
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
153
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
154 154
 
155 155
 
156 156
 		$table_name = 'esp_currency_payment_method';
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 						KEY EVT_ID (EVT_ID),
181 181
 						KEY DTT_is_primary (DTT_is_primary)";
182 182
 
183
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
183
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
184 184
 
185 185
 		$table_name = 'esp_event_meta';
186 186
 		$sql = "
@@ -199,44 +199,44 @@  discard block
 block discarded – undo
199 199
 			EVT_donations TINYINT(1) NULL,
200 200
 			PRIMARY KEY  (EVTM_ID),
201 201
 			KEY EVT_ID (EVT_ID)";
202
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
202
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
203 203
 
204 204
 
205 205
 
206
-		$table_name='esp_event_question_group';
207
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
206
+		$table_name = 'esp_event_question_group';
207
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
208 208
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
209 209
 					QSG_ID INT UNSIGNED NOT NULL,
210 210
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
211 211
 					PRIMARY KEY  (EQG_ID),
212 212
 					KEY EVT_ID (EVT_ID),
213 213
 					KEY QSG_ID (QSG_ID)";
214
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
214
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
215 215
 
216 216
 
217 217
 
218
-		$table_name='esp_event_venue';
219
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
218
+		$table_name = 'esp_event_venue';
219
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
220 220
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
221 221
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
222 222
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
223 223
 				PRIMARY KEY  (EVV_ID)";
224
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
224
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
225 225
 
226 226
 
227 227
 
228
-		$table_name='esp_extra_meta';
229
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
228
+		$table_name = 'esp_extra_meta';
229
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
230 230
 				OBJ_ID INT(11) DEFAULT NULL,
231 231
 				EXM_type VARCHAR(45) DEFAULT NULL,
232 232
 				EXM_key VARCHAR(45) DEFAULT NULL,
233 233
 				EXM_value TEXT,
234 234
 				PRIMARY KEY  (EXM_ID),
235 235
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
236
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
236
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
237 237
 
238
-		$table_name='esp_line_item';
239
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
238
+		$table_name = 'esp_line_item';
239
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
240 240
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
241 241
 				TXN_ID INT(11) DEFAULT NULL,
242 242
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				PRIMARY KEY  (LIN_ID),
255 255
 				KEY LIN_code (LIN_code(191)),
256 256
 				KEY TXN_ID (TXN_ID)";
257
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
257
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
258 258
 
259 259
 		$table_name = 'esp_log';
260 260
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
295 295
 					PRIMARY KEY  (GRP_ID),
296 296
 					KEY MTP_user_id (MTP_user_id)";
297
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
297
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
298 298
 
299 299
 		$table_name = 'esp_event_message_template';
300 300
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 					PRIMARY KEY  (EMT_ID),
304 304
 					KEY EVT_ID (EVT_ID),
305 305
 					KEY GRP_ID (GRP_ID)";
306
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
306
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
307 307
 
308 308
 
309 309
 		$table_name = 'esp_payment';
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 					  PRIMARY KEY  (TTM_ID)";
377 377
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
378 378
 
379
-		$table_name='esp_question';
380
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
379
+		$table_name = 'esp_question';
380
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
381 381
 					QST_display_text TEXT NOT NULL,
382 382
 					QST_admin_label VARCHAR(255) NOT NULL,
383 383
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -390,22 +390,22 @@  discard block
 block discarded – undo
390 390
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
391 391
 					PRIMARY KEY  (QST_ID),
392 392
 					KEY QST_order (QST_order)';
393
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
393
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
394 394
 
395
-		$table_name='esp_question_group_question';
396
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
395
+		$table_name = 'esp_question_group_question';
396
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
397 397
 					QSG_ID INT UNSIGNED NOT NULL,
398 398
 					QST_ID INT UNSIGNED NOT NULL,
399 399
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
400 400
 					PRIMARY KEY  (QGQ_ID),
401 401
 					KEY QST_ID (QST_ID),
402 402
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
403
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
403
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
404 404
 
405 405
 
406 406
 
407
-		$table_name='esp_question_option';
408
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
407
+		$table_name = 'esp_question_option';
408
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
409 409
 					QSO_value VARCHAR(255) NOT NULL,
410 410
 					QSO_desc TEXT NOT NULL,
411 411
 					QST_ID INT UNSIGNED NOT NULL,
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 					PRIMARY KEY  (QSO_ID),
415 415
 					KEY QST_ID (QST_ID),
416 416
 					KEY QSO_order (QSO_order)";
417
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
417
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
418 418
 
419 419
 
420 420
 
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 
461 461
 
462 462
 
463
-		$table_name='esp_checkin';
464
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
463
+		$table_name = 'esp_checkin';
464
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
465 465
 					REG_ID INT(10) UNSIGNED NOT NULL,
466 466
 					DTT_ID INT(10) UNSIGNED NOT NULL,
467 467
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
557 557
 					  PRIMARY KEY  (PRC_ID),
558 558
 					  KEY PRT_ID (PRT_ID)";
559
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
559
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
560 560
 
561 561
 		$table_name = "esp_price_type";
562 562
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -594,10 +594,10 @@  discard block
 block discarded – undo
594 594
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
595 595
 					  PRIMARY KEY  (TKT_ID),
596 596
 					  KEY TKT_start_date (TKT_start_date)";
597
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
597
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
598 598
 
599 599
 		$table_name = 'esp_question_group';
600
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
600
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
601 601
 					QSG_name VARCHAR(255) NOT NULL,
602 602
 					QSG_identifier VARCHAR(100) NOT NULL,
603 603
 					QSG_desc TEXT NULL,
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 					PRIMARY KEY  (QSG_ID),
611 611
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC),
612 612
 					KEY QSG_order (QSG_order)';
613
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
613
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
614 614
 
615 615
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
616 616
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 		return true;
643 643
 	}
644 644
 
645
-	public function migration_page_hooks(){
645
+	public function migration_page_hooks() {
646 646
 
647 647
 	}
648 648
 
Please login to merge, or discard this patch.
core/db_models/EEM_Event.model.php 2 patches
Spacing   +161 added lines, -161 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
-require_once( EE_MODELS . 'EEM_CPT_Base.model.php');
2
+require_once(EE_MODELS.'EEM_CPT_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * EEM_Event Model
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author				Michael Nelson, Brent Christensen
12 12
  *
13 13
  */
14
-class EEM_Event  extends EEM_CPT_Base{
14
+class EEM_Event  extends EEM_CPT_Base {
15 15
 
16 16
 	/**
17 17
 	 * constant used by status(), indicating that no more tickets can be purchased for any of the datetimes for the event
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 	 * @param string $timezone
52 52
 	 * @return EEM_Event
53 53
 	 */
54
-	public static function instance( $timezone = NULL ){
54
+	public static function instance($timezone = NULL) {
55 55
 
56 56
 		// check if instance of EEM_Event already exists
57
-		if ( ! self::$_instance instanceof EEM_Event ) {
57
+		if ( ! self::$_instance instanceof EEM_Event) {
58 58
 			// instantiate Espresso_model
59
-			self::$_instance = new self( $timezone );
59
+			self::$_instance = new self($timezone);
60 60
 		}
61 61
 		//we might have a timezone set, let set_timezone decide what to do with it
62
-		self::$_instance->set_timezone( $timezone );
62
+		self::$_instance->set_timezone($timezone);
63 63
 		// EEM_Event object
64 64
 		return self::$_instance;
65 65
 	}
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 	 * @param string $timezone
71 71
 	 * @return EEM_Event
72 72
 	 */
73
-	protected function __construct($timezone = null){
73
+	protected function __construct($timezone = null) {
74 74
 
75
-		EE_Registry::instance()->load_model( 'Registration' );
75
+		EE_Registry::instance()->load_model('Registration');
76 76
 
77
-		$this->singular_item = __('Event','event_espresso');
78
-		$this->plural_item = __('Events','event_espresso');
77
+		$this->singular_item = __('Event', 'event_espresso');
78
+		$this->plural_item = __('Events', 'event_espresso');
79 79
 
80 80
 		// to remove Cancelled events from the frontend, copy the following filter to your functions.php file
81 81
 		// add_filter( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', '__return_false' );
@@ -89,57 +89,57 @@  discard block
 block discarded – undo
89 89
 			array(
90 90
 				EEM_Event::cancelled => array(
91 91
 					'label' => __('Cancelled', 'event_espresso'),
92
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE )
92
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE)
93 93
 				),
94 94
 				EEM_Event::postponed => array(
95 95
 					'label' => __('Postponed', 'event_espresso'),
96
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE )
96
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE)
97 97
 				),
98 98
 				EEM_Event::sold_out => array(
99 99
 					'label' => __('Sold Out', 'event_espresso'),
100
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE )
100
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE)
101 101
 				)
102 102
 			)
103 103
 		);
104 104
 
105
-		self::$_default_reg_status = empty( self::$_default_reg_status ) ? EEM_Registration::status_id_pending_payment : self::$_default_reg_status;
105
+		self::$_default_reg_status = empty(self::$_default_reg_status) ? EEM_Registration::status_id_pending_payment : self::$_default_reg_status;
106 106
 
107 107
 		$this->_tables = array(
108
-			'Event_CPT'=>new EE_Primary_Table( 'posts','ID' ),
109
-			'Event_Meta'=> new EE_Secondary_Table( 'esp_event_meta', 'EVTM_ID', 'EVT_ID' )
108
+			'Event_CPT'=>new EE_Primary_Table('posts', 'ID'),
109
+			'Event_Meta'=> new EE_Secondary_Table('esp_event_meta', 'EVTM_ID', 'EVT_ID')
110 110
 		);
111 111
 
112 112
 		$this->_fields = array(
113 113
 			'Event_CPT'=>array(
114
-				'EVT_ID'=>new EE_Primary_Key_Int_Field( 'ID', __( 'Post ID for Event','event_espresso' )),
115
-				'EVT_name'=>new EE_Plain_Text_Field( 'post_title', __( 'Event Name','event_espresso' ), FALSE, '' ),
116
-				'EVT_desc'=>new EE_Post_Content_Field( 'post_content', __( 'Event Description', 'event_espresso' ), FALSE, '' ),
117
-				'EVT_slug'=>new EE_Slug_Field( 'post_name', __( 'Event Slug', 'event_espresso' ), FALSE, '' ),
118
-				'EVT_created'=>new EE_Datetime_Field( 'post_date', __( 'Date/Time Event Created', 'event_espresso' ), FALSE, time()),
119
-				'EVT_short_desc'=>new EE_Simple_HTML_Field( 'post_excerpt', __( 'Event Short Description', 'event_espresso' ), FALSE,'' ),
120
-				'EVT_modified'=>new EE_Datetime_Field( 'post_modified', __( 'Date/Time Event Modified', 'event_espresso' ), FALSE, time()),
121
-				'EVT_wp_user'=>new EE_WP_User_Field( 'post_author', __( 'Event Creator ID', 'event_espresso'), FALSE),
122
-				'parent'=>new EE_Integer_Field( 'post_parent', __( 'Event Parent ID', 'event_espresso' ), FALSE, 0 ),
123
-				'EVT_order'=>new EE_Integer_Field( 'menu_order', __( 'Event Menu Order', 'event_espresso' ), FALSE, 1 ),
124
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'),// EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
125
-				'status' => new EE_WP_Post_Status_Field( 'post_status', __( 'Event Status', 'event_espresso' ), FALSE, 'draft', $this->_custom_stati )
114
+				'EVT_ID'=>new EE_Primary_Key_Int_Field('ID', __('Post ID for Event', 'event_espresso')),
115
+				'EVT_name'=>new EE_Plain_Text_Field('post_title', __('Event Name', 'event_espresso'), FALSE, ''),
116
+				'EVT_desc'=>new EE_Post_Content_Field('post_content', __('Event Description', 'event_espresso'), FALSE, ''),
117
+				'EVT_slug'=>new EE_Slug_Field('post_name', __('Event Slug', 'event_espresso'), FALSE, ''),
118
+				'EVT_created'=>new EE_Datetime_Field('post_date', __('Date/Time Event Created', 'event_espresso'), FALSE, time()),
119
+				'EVT_short_desc'=>new EE_Simple_HTML_Field('post_excerpt', __('Event Short Description', 'event_espresso'), FALSE, ''),
120
+				'EVT_modified'=>new EE_Datetime_Field('post_modified', __('Date/Time Event Modified', 'event_espresso'), FALSE, time()),
121
+				'EVT_wp_user'=>new EE_WP_User_Field('post_author', __('Event Creator ID', 'event_espresso'), FALSE),
122
+				'parent'=>new EE_Integer_Field('post_parent', __('Event Parent ID', 'event_espresso'), FALSE, 0),
123
+				'EVT_order'=>new EE_Integer_Field('menu_order', __('Event Menu Order', 'event_espresso'), FALSE, 1),
124
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'), // EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
125
+				'status' => new EE_WP_Post_Status_Field('post_status', __('Event Status', 'event_espresso'), FALSE, 'draft', $this->_custom_stati)
126 126
 			),
127 127
 			'Event_Meta'=>array(
128
-				'EVTM_ID'=> new EE_DB_Only_Float_Field( 'EVTM_ID', __( 'Event Meta Row ID','event_espresso' ), FALSE ),
129
-				'EVT_ID_fk'=>new EE_DB_Only_Int_Field( 'EVT_ID', __( 'Foreign key to Event ID from Event Meta table', 'event_espresso' ), FALSE ),
130
-				'EVT_display_desc'=>new EE_Boolean_Field( 'EVT_display_desc', __( 'Display Description Flag', 'event_espresso' ), FALSE, 1 ),
131
-				'EVT_display_ticket_selector'=>new EE_Boolean_Field( 'EVT_display_ticket_selector', __( 'Display Ticket Selector Flag', 'event_espresso' ), FALSE, 1 ),
132
-				'EVT_visible_on'=>new EE_Datetime_Field( 'EVT_visible_on', __( 'Event Visible Date', 'event_espresso' ), TRUE, time()),
133
-				'EVT_additional_limit'=>new EE_Integer_Field( 'EVT_additional_limit', __( 'Limit of Additional Registrations on Same Transaction', 'event_espresso' ), TRUE, 10 ),
128
+				'EVTM_ID'=> new EE_DB_Only_Float_Field('EVTM_ID', __('Event Meta Row ID', 'event_espresso'), FALSE),
129
+				'EVT_ID_fk'=>new EE_DB_Only_Int_Field('EVT_ID', __('Foreign key to Event ID from Event Meta table', 'event_espresso'), FALSE),
130
+				'EVT_display_desc'=>new EE_Boolean_Field('EVT_display_desc', __('Display Description Flag', 'event_espresso'), FALSE, 1),
131
+				'EVT_display_ticket_selector'=>new EE_Boolean_Field('EVT_display_ticket_selector', __('Display Ticket Selector Flag', 'event_espresso'), FALSE, 1),
132
+				'EVT_visible_on'=>new EE_Datetime_Field('EVT_visible_on', __('Event Visible Date', 'event_espresso'), TRUE, time()),
133
+				'EVT_additional_limit'=>new EE_Integer_Field('EVT_additional_limit', __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), TRUE, 10),
134 134
 				'EVT_default_registration_status'=>new EE_Enum_Text_Field(
135
-					'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array()
135
+					'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array()
136 136
 				),
137
-				'EVT_member_only'=>new EE_Boolean_Field( 'EVT_member_only', __( 'Member-Only Event Flag', 'event_espresso' ), FALSE, FALSE ),
138
-				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __( 'Event Phone Number', 'event_espresso' ), FALSE ),
139
-				'EVT_allow_overflow'=>new EE_Boolean_Field(  'EVT_allow_overflow', __( 'Allow Overflow on Event', 'event_espresso' ), FALSE, FALSE ),
140
-				'EVT_timezone_string'=>new EE_Plain_Text_Field( 'EVT_timezone_string', __( 'Timezone (name) for Event times', 'event_espresso' ), FALSE ),
141
-				'EVT_external_URL'=>new EE_Plain_Text_Field( 'EVT_external_URL', __( 'URL of Event Page if hosted elsewhere', 'event_espresso' ), TRUE ),
142
-				'EVT_donations'=>new EE_Boolean_Field( 'EVT_donations', __( 'Accept Donations?', 'event_espresso' ), FALSE, FALSE )
137
+				'EVT_member_only'=>new EE_Boolean_Field('EVT_member_only', __('Member-Only Event Flag', 'event_espresso'), FALSE, FALSE),
138
+				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __('Event Phone Number', 'event_espresso'), FALSE),
139
+				'EVT_allow_overflow'=>new EE_Boolean_Field('EVT_allow_overflow', __('Allow Overflow on Event', 'event_espresso'), FALSE, FALSE),
140
+				'EVT_timezone_string'=>new EE_Plain_Text_Field('EVT_timezone_string', __('Timezone (name) for Event times', 'event_espresso'), FALSE),
141
+				'EVT_external_URL'=>new EE_Plain_Text_Field('EVT_external_URL', __('URL of Event Page if hosted elsewhere', 'event_espresso'), TRUE),
142
+				'EVT_donations'=>new EE_Boolean_Field('EVT_donations', __('Accept Donations?', 'event_espresso'), FALSE, FALSE)
143 143
 
144 144
 			));
145 145
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 
157 157
 		$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_events', 'EVTM_ID');
158 158
 		//this model is generally available for reading
159
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
160
-		parent::__construct( $timezone );
159
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
160
+		parent::__construct($timezone);
161 161
 	}
162 162
 
163 163
 
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
 	/**
166 166
 	 * @param string $default_reg_status
167 167
 	 */
168
-	public static function set_default_reg_status( $default_reg_status ) {
168
+	public static function set_default_reg_status($default_reg_status) {
169 169
 		self::$_default_reg_status = $default_reg_status;
170 170
 		//if EEM_Event has already been instantiated, then we need to reset the `EVT_default_reg_status` field to use the new default.
171
-		if ( self::$_instance instanceof EEM_Event ) {
171
+		if (self::$_instance instanceof EEM_Event) {
172 172
 			self::$_instance->_fields['Event_Meta']['EVT_default_registration_status'] = new EE_Enum_Text_Field(
173
-				'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), false, $default_reg_status, EEM_Registration::reg_status_array()
173
+				'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), false, $default_reg_status, EEM_Registration::reg_status_array()
174 174
 			);
175
-			self::$_instance->_fields['Event_Meta']['EVT_default_registration_status']->_construct_finalize( 'Event_Meta', 'EVT_default_registration_status', 'EEM_Event' );
175
+			self::$_instance->_fields['Event_Meta']['EVT_default_registration_status']->_construct_finalize('Event_Meta', 'EVT_default_registration_status', 'EEM_Event');
176 176
 		}
177 177
 	}
178 178
 
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 	*		@return 		array
186 186
 	*/
187 187
 	public function get_all_question_groups() {
188
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
189
-			array( 'QSG_deleted' => FALSE ),
190
-			'order_by' => array( 'QSG_order' => 'ASC' )
188
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
189
+			array('QSG_deleted' => FALSE),
190
+			'order_by' => array('QSG_order' => 'ASC')
191 191
 		));
192 192
 	}
193 193
 
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 	* 		@param		int $EVT_ID
204 204
 	*		@return 		array
205 205
 	*/
206
-	public function get_all_event_question_groups( $EVT_ID = 0 ) {
207
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
208
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
206
+	public function get_all_event_question_groups($EVT_ID = 0) {
207
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
208
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
209 209
 			return FALSE;
210 210
 		}
211
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
212
-			array( 'EVT_ID' => $EVT_ID )
211
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
212
+			array('EVT_ID' => $EVT_ID)
213 213
 		));
214 214
 	}
215 215
 
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
 	* 		@param		boolean	$for_primary_attendee
226 226
 	*		@return 		array
227 227
 	*/
228
-	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
229
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
230
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
228
+	public function get_event_question_groups($EVT_ID = 0, $for_primary_attendee = TRUE) {
229
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
230
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
231 231
 			return FALSE;
232 232
 		}
233
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
234
-			array( 'EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee )
233
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
234
+			array('EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee)
235 235
 		));
236 236
 	}
237 237
 
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 	* 		@param		EE_Registration 	$registration
249 249
 	*		@return 		array
250 250
 	*/
251
-	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
251
+	public function get_question_groups_for_event($EVT_ID = 0, EE_Registration $registration) {
252 252
 
253
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
254
-			EE_Error::add_error( __( 'An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
253
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
254
+			EE_Error::add_error(__('An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
255 255
 			return FALSE;
256 256
 		}
257 257
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 			'QSG_deleted' => FALSE
262 262
 		);
263 263
 
264
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
264
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
265 265
 			$where_params,
266 266
 			'order_by' => array('QSG_order' => 'ASC')
267 267
 		));
@@ -281,16 +281,16 @@  discard block
 block discarded – undo
281 281
 	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
282 282
 	*		@return 		array
283 283
 	*/
284
-	public function get_questions_in_groups( $QSG_IDs = '' ) {
284
+	public function get_questions_in_groups($QSG_IDs = '') {
285 285
 
286
-		if ( empty( $QSG_IDs )) {
287
-			EE_Error::add_error( __( 'An error occurred. No Question Group IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
286
+		if (empty($QSG_IDs)) {
287
+			EE_Error::add_error(__('An error occurred. No Question Group IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
288 288
 			return FALSE;
289 289
 		}
290 290
 
291
-		return EE_Registry::instance()->load_model( 'Question' )->get_all( array(
291
+		return EE_Registry::instance()->load_model('Question')->get_all(array(
292 292
 			array(
293
-				'Question_Group.QSG_ID' => array( 'IN', $QSG_IDs ),
293
+				'Question_Group.QSG_ID' => array('IN', $QSG_IDs),
294 294
 				'QST_deleted' => FALSE,
295 295
 				'QST_admin_only' => is_admin()
296 296
 			),
@@ -312,16 +312,16 @@  discard block
 block discarded – undo
312 312
 	* 		@param		string		$QST_IDs  csv list of $QST IDs
313 313
 	*		@return 		array
314 314
 	*/
315
-	public function get_options_for_question( $QST_IDs ) {
315
+	public function get_options_for_question($QST_IDs) {
316 316
 
317
-		if ( empty( $QST_IDs )) {
318
-			EE_Error::add_error( __( 'An error occurred. No Question IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
317
+		if (empty($QST_IDs)) {
318
+			EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
319 319
 			return FALSE;
320 320
 		}
321 321
 
322
-		return EE_Registry::instance()->load_model( 'Question_Option' )->get_all( array(
322
+		return EE_Registry::instance()->load_model('Question_Option')->get_all(array(
323 323
 			array(
324
-				'Question.QST_ID' => array( 'IN', $QST_IDs ),
324
+				'Question.QST_ID' => array('IN', $QST_IDs),
325 325
 				'QSO_deleted' => FALSE
326 326
 			),
327 327
 			'order_by' => 'QSO_ID'
@@ -340,45 +340,45 @@  discard block
 block discarded – undo
340 340
 	 * @throws EE_Error
341 341
 	 * @return 	array
342 342
 	 */
343
-	public function assemble_array_of_groups_questions_and_options( EE_Registration $registration, $EVT_ID = 0 ) {
343
+	public function assemble_array_of_groups_questions_and_options(EE_Registration $registration, $EVT_ID = 0) {
344 344
 
345
-		if ( empty( $EVT_ID ) ) {
346
-			throw new EE_Error( __( 'An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso' ) );
345
+		if (empty($EVT_ID)) {
346
+			throw new EE_Error(__('An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso'));
347 347
 		}
348 348
 
349 349
 		$questions = array();
350 350
 
351 351
 		// get all question groups for event
352
-		$qgs = $this->get_question_groups_for_event( $EVT_ID, $registration );
353
-		if ( !empty( $qgs ) ) {
354
-			foreach ( $qgs as $qg ) {
352
+		$qgs = $this->get_question_groups_for_event($EVT_ID, $registration);
353
+		if ( ! empty($qgs)) {
354
+			foreach ($qgs as $qg) {
355 355
 			 	$qsts = $qg->questions();
356
-			 	$questions[ $qg->ID() ] = $qg->model_field_array();
357
-			 	$questions[ $qg->ID() ]['QSG_questions'] = array();
358
-			 	foreach ( $qsts as $qst ) {
359
-			 		if ( $qst->is_system_question() )
356
+			 	$questions[$qg->ID()] = $qg->model_field_array();
357
+			 	$questions[$qg->ID()]['QSG_questions'] = array();
358
+			 	foreach ($qsts as $qst) {
359
+			 		if ($qst->is_system_question())
360 360
 			 			continue;
361
-			 		$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) );
361
+			 		$answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID())));
362 362
 			 		$answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object();
363 363
 			 		$qst_name = $qstn_id = $qst->ID();
364 364
 			 		$ans_id = $answer->ID();
365
-			 		$qst_name = !empty( $ans_id ) ?  '[' . $qst_name . '][' . $ans_id . ']' : '[' . $qst_name . ']';
365
+			 		$qst_name = ! empty($ans_id) ? '['.$qst_name.']['.$ans_id.']' : '['.$qst_name.']';
366 366
 			 		$input_name = '';
367
-			 		$input_id = sanitize_key( $qst->display_text() );
367
+			 		$input_id = sanitize_key($qst->display_text());
368 368
 			 		$input_class = '';
369 369
 			 		$questions[$qg->ID()]['QSG_questions'][$qst->ID()] = $qst->model_field_array();
370
-		 			$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_name'] = 'qstn' . $input_name . $qst_name;
371
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_id'] = $input_id . '-' . $qstn_id;
372
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_class'] = $input_class;
373
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'] = array();
374
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['qst_obj'] = $qst;
375
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['ans_obj'] = $answer;
376
-
377
-					if ( $qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN' ) {
378
-						$QSOs = $qst->options(TRUE,$answer->value());
379
-						if ( is_array( $QSOs ) ) {
380
-							foreach ( $QSOs as $QSO_ID => $QSO ) {
381
-								$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'][ $QSO_ID ] = $QSO->model_field_array();
370
+		 			$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_name'] = 'qstn'.$input_name.$qst_name;
371
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_id'] = $input_id.'-'.$qstn_id;
372
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_class'] = $input_class;
373
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'] = array();
374
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['qst_obj'] = $qst;
375
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['ans_obj'] = $answer;
376
+
377
+					if ($qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN') {
378
+						$QSOs = $qst->options(TRUE, $answer->value());
379
+						if (is_array($QSOs)) {
380
+							foreach ($QSOs as $QSO_ID => $QSO) {
381
+								$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'][$QSO_ID] = $QSO->model_field_array();
382 382
 							}
383 383
 						}
384 384
 					}
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 	* 		@param		$QST
403 403
 	*		@return 		string		string
404 404
 	*/
405
-	private function _generate_question_input_name( $QST ) {
405
+	private function _generate_question_input_name($QST) {
406 406
 
407
-		if ( $QST->QST_system ) {
407
+		if ($QST->QST_system) {
408 408
 			$qst_name = $QST->QST_system;
409 409
 /*			switch( $QST->QST_system ) {
410 410
 
@@ -471,36 +471,36 @@  discard block
 block discarded – undo
471 471
 	 * @param bool    $count whether to return the count or not (default FALSE)
472 472
 	 * @return array 	EE_Event objects
473 473
 	 */
474
-	public function get_active_events( $query_params, $count = FALSE ) {
475
-		if ( array_key_exists( 0, $query_params ) ) {
474
+	public function get_active_events($query_params, $count = FALSE) {
475
+		if (array_key_exists(0, $query_params)) {
476 476
 			$where_params = $query_params[0];
477
-			unset( $query_params[0] );
477
+			unset($query_params[0]);
478 478
 		} else {
479 479
 			$where_params = array();
480 480
 		}
481 481
 
482 482
 		//if we have count make sure we don't include group by
483
-		if ( $count && isset( $query_params['group_by'] ) ) {
484
-			unset( $query_params['group_by'] );
483
+		if ($count && isset($query_params['group_by'])) {
484
+			unset($query_params['group_by']);
485 485
 		}
486 486
 
487 487
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
488 488
 		$where_params['status'] = 'publish';
489 489
 		//if already have where params for DTT_EVT_start or DTT_EVT_end then append these conditions
490
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
491
-			$where_params['Datetime.DTT_EVT_start******'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
490
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
491
+			$where_params['Datetime.DTT_EVT_start******'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
492 492
 		} else {
493
-			$where_params['Datetime.DTT_EVT_start'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
493
+			$where_params['Datetime.DTT_EVT_start'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
494 494
 		}
495 495
 
496
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
497
-			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
496
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
497
+			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
498 498
 		} else {
499
-			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
499
+			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
500 500
 		}
501 501
 		$query_params[0] = $where_params;
502 502
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
503
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
503
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
504 504
 	}
505 505
 
506 506
 
@@ -515,30 +515,30 @@  discard block
 block discarded – undo
515 515
 	 * @param bool    $count whether to return the count or not (default FALSE)
516 516
 	 * @return array               EE_Event objects
517 517
 	 */
518
-	public function get_upcoming_events( $query_params, $count = FALSE ) {
519
-		if ( array_key_exists( 0, $query_params ) ) {
518
+	public function get_upcoming_events($query_params, $count = FALSE) {
519
+		if (array_key_exists(0, $query_params)) {
520 520
 			$where_params = $query_params[0];
521
-			unset( $query_params[0] );
521
+			unset($query_params[0]);
522 522
 		} else {
523 523
 			$where_params = array();
524 524
 		}
525 525
 
526 526
 		//if we have count make sure we don't include group by
527
-		if ( $count && isset( $query_params['group_by'] ) ) {
528
-			unset( $query_params['group_by'] );
527
+		if ($count && isset($query_params['group_by'])) {
528
+			unset($query_params['group_by']);
529 529
 		}
530 530
 
531 531
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
532 532
 		$where_params['status'] = 'publish';
533 533
 		//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
534
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
535
-			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
534
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
535
+			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
536 536
 		} else {
537
-			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
537
+			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
538 538
 		}
539 539
 		$query_params[0] = $where_params;
540 540
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
541
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
541
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
542 542
 	}
543 543
 
544 544
 
@@ -550,56 +550,56 @@  discard block
 block discarded – undo
550 550
 	 * @param bool    $count whether to return the count or not (default FALSE)
551 551
 	 * @return array 	EE_Event objects
552 552
 	 */
553
-	public function get_expired_events( $query_params, $count = FALSE ) {
553
+	public function get_expired_events($query_params, $count = FALSE) {
554 554
 
555
-		$where_params = isset( $query_params[0] ) ? $query_params[0] : array();
555
+		$where_params = isset($query_params[0]) ? $query_params[0] : array();
556 556
 
557 557
 		//if we have count make sure we don't include group by
558
-		if ( $count && isset( $query_params['group_by'] ) ) {
559
-			unset( $query_params['group_by'] );
558
+		if ($count && isset($query_params['group_by'])) {
559
+			unset($query_params['group_by']);
560 560
 		}
561 561
 
562 562
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
563
-		if ( isset( $where_params['status'] ) ) {
564
-			unset( $where_params['status'] );
563
+		if (isset($where_params['status'])) {
564
+			unset($where_params['status']);
565 565
 		}
566 566
 		$exclude_query = $query_params;
567
-		if ( isset( $exclude_query[0] ) ) {
568
-			unset( $exclude_query[0] );
567
+		if (isset($exclude_query[0])) {
568
+			unset($exclude_query[0]);
569 569
 		}
570
-		$exclude_query[0] = array( 'Datetime.DTT_EVT_end' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) );
570
+		$exclude_query[0] = array('Datetime.DTT_EVT_end' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')));
571 571
 		//first get all events that have datetimes where its not expired.
572
-		$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Event_CPT.ID' );
573
-		$event_ids = array_keys( $event_ids );
572
+		$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Event_CPT.ID');
573
+		$event_ids = array_keys($event_ids);
574 574
 
575 575
 		//if we have any additional query_params, let's add them to the 'AND' condition
576 576
 		$and_condition = array(
577
-			'Datetime.DTT_EVT_end' => array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ),
578
-			'EVT_ID' =>  array( 'NOT IN', $event_ids )
577
+			'Datetime.DTT_EVT_end' => array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')),
578
+			'EVT_ID' =>  array('NOT IN', $event_ids)
579 579
 			);
580 580
 
581
-		if ( isset( $where_params['OR'] ) ) {
581
+		if (isset($where_params['OR'])) {
582 582
 			$and_condition['OR'] = $where_params['OR'];
583
-			unset( $where_params['OR'] );
583
+			unset($where_params['OR']);
584 584
 		}
585 585
 
586
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
586
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
587 587
 			$and_condition['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end'];
588
-			unset( $where_params['Datetime.DTT_EVT_end'] );
588
+			unset($where_params['Datetime.DTT_EVT_end']);
589 589
 		}
590 590
 
591
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
591
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
592 592
 			$and_condition['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start'];
593
-			unset( $where_params['Datetime.DTT_EVT_start'] );
593
+			unset($where_params['Datetime.DTT_EVT_start']);
594 594
 		}
595 595
 
596 596
 		//merge remaining $where params with the and conditions.
597
-		$and_condtion = array_merge( $and_condition, $where_params );
597
+		$and_condtion = array_merge($and_condition, $where_params);
598 598
 
599 599
 		$where_params['AND'] = $and_condition;
600 600
 		$query_params[0] = $where_params;
601 601
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
602
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
602
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
603 603
 	}
604 604
 
605 605
 
@@ -610,40 +610,40 @@  discard block
 block discarded – undo
610 610
 	 * @param  boolean $count        whether to return the count or not (default FALSE)
611 611
 	 * @return EE_Event[]            array of EE_Event objects
612 612
 	 */
613
-	public function get_inactive_events( $query_params, $count = FALSE ) {
614
-		$where_params = isset( $query_params[0] ) ? $query_params[0] : array();
613
+	public function get_inactive_events($query_params, $count = FALSE) {
614
+		$where_params = isset($query_params[0]) ? $query_params[0] : array();
615 615
 
616 616
 		//let's add in specific query_params for inactive events.
617
-		if ( isset( $where_params['status'] ) ) {
618
-			unset( $where_params['status'] );
617
+		if (isset($where_params['status'])) {
618
+			unset($where_params['status']);
619 619
 		}
620 620
 
621 621
 		//if we have count make sure we don't include group by
622
-		if ( $count && isset( $query_params['group_by'] ) ) {
623
-			unset( $query_params['group_by'] );
622
+		if ($count && isset($query_params['group_by'])) {
623
+			unset($query_params['group_by']);
624 624
 		}
625 625
 
626 626
 		//if we have any additional query_params, let's add them to the 'AND' condition
627
-		$where_params['AND']['status'] = array( '!=', 'publish' );
627
+		$where_params['AND']['status'] = array('!=', 'publish');
628 628
 
629
-		if ( isset( $where_params['OR'] ) ) {
629
+		if (isset($where_params['OR'])) {
630 630
 			$where_params['AND']['OR'] = $where_params['OR'];
631
-			unset( $where_params['OR'] );
631
+			unset($where_params['OR']);
632 632
 		}
633 633
 
634
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
634
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
635 635
 			$where_params['AND']['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end'];
636
-			unset( $where_params['Datetime.DTT_EVT_end'] );
636
+			unset($where_params['Datetime.DTT_EVT_end']);
637 637
 		}
638 638
 
639
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
639
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
640 640
 			$where_params['AND']['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start'];
641
-			unset( $where_params['Datetime.DTT_EVT_start'] );
641
+			unset($where_params['Datetime.DTT_EVT_start']);
642 642
 		}
643 643
 
644 644
 		$query_params[0] = $where_params;
645 645
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
646
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
646
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
647 647
 	}
648 648
 
649 649
 
@@ -651,13 +651,13 @@  discard block
 block discarded – undo
651 651
 	 * This is just injecting into the parent add_relationship_to so we do special handling on price relationships because we don't want to override any existing global default prices but instead insert NEW prices that get attached to the event.
652 652
 	 * See parent for param descriptions
653 653
 	 */
654
-	public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query = array()){
654
+	public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) {
655 655
 
656
-		if ( $relationName == 'Price' ) {
656
+		if ($relationName == 'Price') {
657 657
 			//let's get the PRC object for the given ID to make sure that we aren't dealing with a default
658 658
 			$prc_chk = $this->get_related_model_obj($relationName)->ensure_is_obj($other_model_id_or_obj);
659 659
 			//if EVT_ID = 0, then this is a default
660
-			if ( $prc_chk->get('EVT_ID') == 0 ) {
660
+			if ($prc_chk->get('EVT_ID') == 0) {
661 661
 				//let's set the prc_id as 0 so we force an insert on the add_relation_to carried out by relation
662 662
 				$prc_chk->set('PRC_ID', 0);
663 663
 			}
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 		}
668 668
 
669 669
 		//otherwise carry on as normal
670
-		return parent::add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query);
670
+		return parent::add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query);
671 671
 	}
672 672
 
673 673
 
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 
180 180
 
181 181
 	/**
182
-	*		get_question_groups
183
-	*
184
-	* 		@access		public
185
-	*		@return 		array
186
-	*/
182
+	 *		get_question_groups
183
+	 *
184
+	 * 		@access		public
185
+	 *		@return 		array
186
+	 */
187 187
 	public function get_all_question_groups() {
188 188
 		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
189 189
 			array( 'QSG_deleted' => FALSE ),
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 	/**
200
-	*		get_question_groups
201
-	*
202
-	* 		@access		public
203
-	* 		@param		int $EVT_ID
204
-	*		@return 		array
205
-	*/
200
+	 *		get_question_groups
201
+	 *
202
+	 * 		@access		public
203
+	 * 		@param		int $EVT_ID
204
+	 *		@return 		array
205
+	 */
206 206
 	public function get_all_event_question_groups( $EVT_ID = 0 ) {
207 207
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
208 208
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 
219 219
 
220 220
 	/**
221
-	*		get_question_groups
222
-	*
223
-	* 		@access		public
224
-	* 		@param		int $EVT_ID
225
-	* 		@param		boolean	$for_primary_attendee
226
-	*		@return 		array
227
-	*/
221
+	 *		get_question_groups
222
+	 *
223
+	 * 		@access		public
224
+	 * 		@param		int $EVT_ID
225
+	 * 		@param		boolean	$for_primary_attendee
226
+	 *		@return 		array
227
+	 */
228 228
 	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
229 229
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
230 230
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 	/**
244
-	*		get_question_groups
245
-	*
246
-	* 		@access		public
247
-	* 		@param		int $EVT_ID
248
-	* 		@param		EE_Registration 	$registration
249
-	*		@return 		array
250
-	*/
244
+	 *		get_question_groups
245
+	 *
246
+	 * 		@access		public
247
+	 * 		@param		int $EVT_ID
248
+	 * 		@param		EE_Registration 	$registration
249
+	 *		@return 		array
250
+	 */
251 251
 	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
252 252
 
253 253
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 
276 276
 
277 277
 	/**
278
-	*		get_question_target_db_column
279
-	*
280
-	* 		@access		public
281
-	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
282
-	*		@return 		array
283
-	*/
278
+	 *		get_question_target_db_column
279
+	 *
280
+	 * 		@access		public
281
+	 * 		@param		string		$QSG_IDs  csv list of $QSG IDs
282
+	 *		@return 		array
283
+	 */
284 284
 	public function get_questions_in_groups( $QSG_IDs = '' ) {
285 285
 
286 286
 		if ( empty( $QSG_IDs )) {
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 
307 307
 
308 308
 	/**
309
-	*		get_options_for_question
310
-	*
311
-	* 		@access		public
312
-	* 		@param		string		$QST_IDs  csv list of $QST IDs
313
-	*		@return 		array
314
-	*/
309
+	 *		get_options_for_question
310
+	 *
311
+	 * 		@access		public
312
+	 * 		@param		string		$QST_IDs  csv list of $QST IDs
313
+	 *		@return 		array
314
+	 */
315 315
 	public function get_options_for_question( $QST_IDs ) {
316 316
 
317 317
 		if ( empty( $QST_IDs )) {
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
 	/**
399
-	*		_get_question_target_db_column
400
-	*
401
-	* 		@access		private
402
-	* 		@param		$QST
403
-	*		@return 		string		string
404
-	*/
399
+	 *		_get_question_target_db_column
400
+	 *
401
+	 * 		@access		private
402
+	 * 		@param		$QST
403
+	 *		@return 		string		string
404
+	 */
405 405
 	private function _generate_question_input_name( $QST ) {
406 406
 
407 407
 		if ( $QST->QST_system ) {
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page.core.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 	 * _create_payment_from_request_data
1177 1177
 	 *
1178 1178
 	 * @param array $valid_data
1179
-	 * @return EE_Payment
1179
+	 * @return EE_Attendee
1180 1180
 	 */
1181 1181
 	protected function _create_payment_from_request_data( $valid_data ) {
1182 1182
 		$PAY_ID = $valid_data[ 'PAY_ID' ];
@@ -1348,7 +1348,7 @@  discard block
 block discarded – undo
1348 1348
 	 * @param  EE_Transaction $transaction
1349 1349
 	 * @param \EE_Payment $payment
1350 1350
 	 * @param array $REG_IDs
1351
-	 * @return bool
1351
+	 * @return boolean|null
1352 1352
 	 */
1353 1353
 	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1354 1354
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
@@ -1537,6 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 	 *
1538 1538
 	 * @access protected
1539 1539
 	 * @param \EE_Payment | null $payment
1540
+	 * @param EE_Attendee $payment
1540 1541
 	 */
1541 1542
 	protected function _maybe_send_notifications( $payment = null ) {
1542 1543
 		switch ( $payment instanceof EE_Payment ) {
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author				Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
11
- * @ link					{@link http://www.eventespresso.com}
12
- * @ since		 		4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * EE_Admin_Transactions class
17
- *
18
- * @package			Event Espresso
19
- * @subpackage	includes/core/admin/transactions/Transactions_Admin_Page.core.php
20
- * @author				Brent Christensen
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author				Seth Shoultes
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
11
+	 * @ link					{@link http://www.eventespresso.com}
12
+	 * @ since		 		4.0
13
+	 *
14
+	 * ------------------------------------------------------------------------
15
+	 *
16
+	 * EE_Admin_Transactions class
17
+	 *
18
+	 * @package			Event Espresso
19
+	 * @subpackage	includes/core/admin/transactions/Transactions_Admin_Page.core.php
20
+	 * @author				Brent Christensen
21
+	 *
22
+	 * ------------------------------------------------------------------------
23
+	 */
24 24
 class Transactions_Admin_Page extends EE_Admin_Page {
25 25
 
26 26
 	/**
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
 	/**
108 108
 	 * 		grab url requests and route them
109
-	*		@access private
110
-	*		@return void
111
-	*/
109
+	 *		@access private
110
+	 *		@return void
111
+	 */
112 112
 	public function _set_page_routes() {
113 113
 
114 114
 		$this->_set_transaction_status_array();
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 	/**
248 248
 	 * _set_transaction_status_array
249 249
 	 * sets list of transaction statuses
250
-	*
250
+	 *
251 251
 	 * @access private
252
-	*	@return void
253
-	*/
252
+	 *	@return void
253
+	 */
254 254
 	private function _set_transaction_status_array() {
255 255
 		self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE);
256 256
 	}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 
273 273
 	/**
274 274
 	 * 	get list of payment statuses
275
-	*
275
+	 *
276 276
 	 * @access private
277
-	*	@return void
278
-	*/
277
+	 *	@return void
278
+	 */
279 279
 	private function _get_payment_status_array() {
280 280
 		self::$_pay_status = EEM_Payment::instance()->status_array(TRUE);
281 281
 		$this->_template_args['payment_status'] = self::$_pay_status;
@@ -383,18 +383,18 @@  discard block
 block discarded – undo
383 383
 		if ( is_object( $this->_transaction) )
384 384
 			return; //get out we've already set the object
385 385
 
386
-	    $TXN = EEM_Transaction::instance();
386
+		$TXN = EEM_Transaction::instance();
387 387
 
388
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
388
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
389 389
 
390
-	    //get transaction object
391
-	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
392
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
390
+		//get transaction object
391
+		$this->_transaction = $TXN->get_one_by_ID($TXN_ID);
392
+		$this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
393 393
 
394 394
 	 	if ( empty( $this->_transaction ) ) {
395
-	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
395
+			$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
396 396
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
397
-	    }
397
+		}
398 398
 	}
399 399
 
400 400
 
@@ -496,12 +496,12 @@  discard block
 block discarded – undo
496 496
 
497 497
 
498 498
 	/**
499
-	* 	_transaction_details
499
+	 * 	_transaction_details
500 500
 	 * generates HTML for the View Transaction Details Admin page
501
-	*
501
+	 *
502 502
 	 * @access protected
503
-	*	@return void
504
-	*/
503
+	 *	@return void
504
+	 */
505 505
 	protected function _transaction_details() {
506 506
 		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
507 507
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
@@ -624,10 +624,10 @@  discard block
 block discarded – undo
624 624
 	/**
625 625
 	 * txn_details_meta_box
626 626
 	 * generates HTML for the Transaction main meta box
627
-	*
627
+	 *
628 628
 	 * @access public
629
-	*	@return void
630
-	*/
629
+	 *	@return void
630
+	 */
631 631
 	public function txn_details_meta_box() {
632 632
 
633 633
 		$this->_set_transaction_object();
@@ -968,10 +968,10 @@  discard block
 block discarded – undo
968 968
 	/**
969 969
 	 * txn_billing_info_side_meta_box
970 970
 	 * 	generates HTML for the Edit Transaction side meta box
971
-	*
971
+	 *
972 972
 	 * @access public
973
-	*	@return void
974
-	*/
973
+	 *	@return void
974
+	 */
975 975
 	public function txn_billing_info_side_meta_box() {
976 976
 
977 977
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
@@ -989,10 +989,10 @@  discard block
 block discarded – undo
989 989
 	/**
990 990
 	 * apply_payments_or_refunds
991 991
 	 * 	registers a payment or refund made towards a transaction
992
-	*
992
+	 *
993 993
 	 * @access public
994
-	*	@return void
995
-	*/
994
+	 *	@return void
995
+	 */
996 996
 	public function apply_payments_or_refunds() {
997 997
 		$json_response_data = array( 'return_data' => FALSE );
998 998
 		$valid_data = $this->_validate_payment_request_data();
@@ -1140,9 +1140,9 @@  discard block
 block discarded – undo
1140 1140
 							'default' => '',
1141 1141
 							'required' => false,
1142 1142
 							'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ),
1143
-                                                        'validation_strategies' => array(
1144
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1145
-                                                        )
1143
+														'validation_strategies' => array(
1144
+															new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1145
+														)
1146 1146
 						)
1147 1147
 					),
1148 1148
 					'po_number' => new EE_Text_Input(
@@ -1150,9 +1150,9 @@  discard block
 block discarded – undo
1150 1150
 							'default' => '',
1151 1151
 							'required' => false,
1152 1152
 							'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ),
1153
-                                                        'validation_strategies' => array(
1154
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1155
-                                                        )
1153
+														'validation_strategies' => array(
1154
+															new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1155
+														)
1156 1156
 						)
1157 1157
 					),
1158 1158
 					'accounting' => new EE_Text_Input(
@@ -1160,9 +1160,9 @@  discard block
 block discarded – undo
1160 1160
 							'default' => '',
1161 1161
 							'required' => false,
1162 1162
 							'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ),
1163
-                                                        'validation_strategies' => array(
1164
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1165
-                                                        )
1163
+														'validation_strategies' => array(
1164
+															new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1165
+														)
1166 1166
 						)
1167 1167
 					),
1168 1168
 				)
@@ -1454,10 +1454,10 @@  discard block
 block discarded – undo
1454 1454
 	/**
1455 1455
 	 * delete_payment
1456 1456
 	 * 	delete a payment or refund made towards a transaction
1457
-	*
1457
+	 *
1458 1458
 	 * @access public
1459
-	*	@return void
1460
-	*/
1459
+	 *	@return void
1460
+	 */
1461 1461
 	public function delete_payment() {
1462 1462
 		$json_response_data = array( 'return_data' => FALSE );
1463 1463
 		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
@@ -1572,12 +1572,12 @@  discard block
 block discarded – undo
1572 1572
 	/**
1573 1573
 	 * _send_payment_reminder
1574 1574
 	 * 	generates HTML for the View Transaction Details Admin page
1575
-	*
1575
+	 *
1576 1576
 	 * @access protected
1577
-	*	@return void
1578
-	*/
1577
+	 *	@return void
1578
+	 */
1579 1579
 	protected function _send_payment_reminder() {
1580
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1580
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1581 1581
 		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1582 1582
 		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1583 1583
 		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
@@ -1599,29 +1599,29 @@  discard block
 block discarded – undo
1599 1599
 
1600 1600
 		$TXN = EEM_Transaction::instance();
1601 1601
 
1602
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1603
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1602
+		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1603
+		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1604 1604
 
1605
-	    //make sure our timestamps start and end right at the boundaries for each day
1606
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1607
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1605
+		//make sure our timestamps start and end right at the boundaries for each day
1606
+		$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1607
+		$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1608 1608
 
1609 1609
 
1610
-	    //convert to timestamps
1611
-	    $start_date = strtotime( $start_date );
1612
-	    $end_date = strtotime( $end_date );
1610
+		//convert to timestamps
1611
+		$start_date = strtotime( $start_date );
1612
+		$end_date = strtotime( $end_date );
1613 1613
 
1614
-	    //makes sure start date is the lowest value and vice versa
1615
-	    $start_date = min( $start_date, $end_date );
1616
-	    $end_date = max( $start_date, $end_date );
1614
+		//makes sure start date is the lowest value and vice versa
1615
+		$start_date = min( $start_date, $end_date );
1616
+		$end_date = max( $start_date, $end_date );
1617 1617
 
1618
-	    //convert to correct format for query
1618
+		//convert to correct format for query
1619 1619
 	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1620 1620
 	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1621 1621
 
1622 1622
 
1623 1623
 
1624
-	    //set orderby
1624
+		//set orderby
1625 1625
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1626 1626
 
1627 1627
 		switch ( $this->_req_data['orderby'] ) {
Please login to merge, or discard this patch.
Spacing   +400 added lines, -400 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Transactions_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61 61
 	}
62 62
 
63 63
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	protected function _ajax_hooks() {
83
-		add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds'));
84
-		add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds'));
85
-		add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment'));
83
+		add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds'));
84
+		add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds'));
85
+		add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment'));
86 86
 	}
87 87
 
88 88
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			'buttons' => array(
98 98
 				'add' => __('Add New Transaction', 'event_espresso'),
99 99
 				'edit' => __('Edit Transaction', 'event_espresso'),
100
-				'delete' => __('Delete Transaction','event_espresso')
100
+				'delete' => __('Delete Transaction', 'event_espresso')
101 101
 				)
102 102
 			);
103 103
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$this->_set_transaction_status_array();
115 115
 
116
-		$txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0;
116
+		$txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0;
117 117
 
118 118
 		$this->_page_routes = array(
119 119
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 						'filename' => 'transactions_overview_views_filters_search'
186 186
 					),
187 187
 				),
188
-				'help_tour' => array( 'Transactions_Overview_Help_Tour' ),
188
+				'help_tour' => array('Transactions_Overview_Help_Tour'),
189 189
 				/**
190 190
 				 * commented out because currently we are not displaying tips for transaction list table status but this
191 191
 				 * may change in a later iteration so want to keep the code for then.
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				'nav' => array(
198 198
 					'label' => __('View Transaction', 'event_espresso'),
199 199
 					'order' => 5,
200
-					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
200
+					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
201 201
 					'persistent' => FALSE
202 202
 					),
203 203
 				'help_tabs' => array(
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 						'filename' => 'transactions_view_transaction_primary_registrant_billing_information'
219 219
 					),
220 220
 				),
221
-				'qtips' => array( 'Transaction_Details_Tips' ),
222
-				'help_tour' => array( 'Transaction_Details_Help_Tour' ),
221
+				'qtips' => array('Transaction_Details_Tips'),
222
+				'help_tour' => array('Transaction_Details_Help_Tour'),
223 223
 				'metaboxes' => array('_transaction_details_metaboxes'),
224 224
 
225 225
 				'require_nonce' => FALSE
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 	protected function _add_screen_options() {}
235 235
 	protected function _add_feature_pointers() {}
236 236
 	public function admin_init() {
237
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
238
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
239
-		EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status;
240
-		EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status;
237
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
238
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
239
+		EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status;
240
+		EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status;
241 241
 	}
242 242
 	public function admin_notices() {}
243 243
 	public function admin_footer_scripts() {}
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
 	 */
305 305
 	public function load_scripts_styles() {
306 306
 		//enqueue style
307
-		wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION );
307
+		wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION);
308 308
 		wp_enqueue_style('espresso_txn');
309 309
 
310 310
 		//scripts
311 311
 		add_filter('FHEE_load_accounting_js', '__return_true');
312 312
 
313 313
 		//scripts
314
-		wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
314
+		wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
315 315
 		wp_enqueue_script('espresso_txn');
316 316
 
317 317
 	}
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 	 *	@return void
352 352
 	 */
353 353
 	protected function _set_list_table_views_default() {
354
-		$this->_views = array (
355
-			'all' => array (
354
+		$this->_views = array(
355
+			'all' => array(
356 356
 				'slug' 		=> 'all',
357 357
 				'label' 		=> __('View All Transactions', 'event_espresso'),
358 358
 				'count' 	=> 0
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
 	 *	@return void
381 381
 	 */
382 382
 	private function _set_transaction_object() {
383
-		if ( is_object( $this->_transaction) )
383
+		if (is_object($this->_transaction))
384 384
 			return; //get out we've already set the object
385 385
 
386 386
 	    $TXN = EEM_Transaction::instance();
387 387
 
388
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
388
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
389 389
 
390 390
 	    //get transaction object
391 391
 	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
392
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
392
+	    $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL;
393 393
 
394
-	 	if ( empty( $this->_transaction ) ) {
395
-	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
396
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
394
+	 	if (empty($this->_transaction)) {
395
+	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso');
396
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
397 397
 	    }
398 398
 	}
399 399
 
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
 	 *	@return array
407 407
 	 */
408 408
 	protected function _transaction_legend_items() {
409
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
409
+		EE_Registry::instance()->load_helper('MSG_Template');
410 410
 
411
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) {
412
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
413
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
411
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) {
412
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
413
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
414 414
 				$items['view_related_messages'] = array(
415 415
 					'class' => $related_for_icon['css_class'],
416 416
 					'desc' => $related_for_icon['label'],
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
 		$items = apply_filters(
422 422
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__items',
423
-			array_merge( $items,
423
+			array_merge($items,
424 424
 				array(
425 425
 					'view_details' => array(
426 426
 						'class' => 'dashicons dashicons-cart',
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 					),
433 433
 					'view_receipt' => array(
434 434
 						'class' => 'dashicons dashicons-media-default',
435
-						'desc' => __('View Transaction Receipt', 'event_espresso' )
435
+						'desc' => __('View Transaction Receipt', 'event_espresso')
436 436
 					),
437 437
 					'view_registration' => array(
438 438
 						'class' => 'dashicons dashicons-clipboard',
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 			)
443 443
 		);
444 444
 
445
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
446
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
445
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
446
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
447 447
 				$items['send_payment_reminder'] = array(
448 448
 					'class' => 'dashicons dashicons-email-alt',
449 449
 					'desc' => __('Send Payment Reminder', 'event_espresso')
@@ -464,29 +464,29 @@  discard block
 block discarded – undo
464 464
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
465 465
 			array(
466 466
 				'overpaid'   => array(
467
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
468
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
467
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
468
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
469 469
 				),
470 470
 				'complete'   => array(
471
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
472
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
471
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
472
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
473 473
 				),
474 474
 				'incomplete' => array(
475
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
476
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
475
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
476
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
477 477
 				),
478 478
 				'abandoned'  => array(
479
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
480
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
479
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
480
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
481 481
 				),
482 482
 				'failed'     => array(
483
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
484
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
483
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
484
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
485 485
 				)
486 486
 			)
487 487
 		);
488 488
 
489
-		return array_merge( $items, $more_items);
489
+		return array_merge($items, $more_items);
490 490
 	}
491 491
 
492 492
 
@@ -499,9 +499,9 @@  discard block
 block discarded – undo
499 499
 	 */
500 500
 	protected function _transactions_overview_list_table() {
501 501
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
502
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
503
-		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : '';
504
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
502
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
503
+		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : '';
504
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
505 505
 		$this->display_admin_list_table_page_with_no_sidebar();
506 506
 	}
507 507
 
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	*	@return void
516 516
 	*/
517 517
 	protected function _transaction_details() {
518
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
519
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
518
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
519
+		EE_Registry::instance()->load_helper('MSG_Template');
520 520
 
521 521
 		$this->_set_transaction_status_array();
522 522
 
@@ -529,75 +529,75 @@  discard block
 block discarded – undo
529 529
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
530 530
 
531 531
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
532
-		$this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' );
532
+		$this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso');
533 533
 
534
-		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a' );
535
-		$this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' );
534
+		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a');
535
+		$this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso');
536 536
 
537
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
538
-		$this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' );
539
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
537
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
538
+		$this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso');
539
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
540 540
 
541 541
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
542 542
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
543 543
 
544
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
545
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
546
-			$this->_template_args['send_payment_reminder_button'] = EEH_MSG_Template::is_mt_active( 'payment_reminder' )
544
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
545
+			EE_Registry::instance()->load_helper('MSG_Template');
546
+			$this->_template_args['send_payment_reminder_button'] = EEH_MSG_Template::is_mt_active('payment_reminder')
547 547
 				 && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
548 548
 				 && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
549
-				 ? EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$this->_transaction->ID(), 'redirect_to' => 'view_transaction' ), TXN_ADMIN_URL ), __(' Send Payment Reminder'), 'button secondary-button right',  'dashicons dashicons-email-alt' )
549
+				 ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$this->_transaction->ID(), 'redirect_to' => 'view_transaction'), TXN_ADMIN_URL), __(' Send Payment Reminder'), 'button secondary-button right', 'dashicons dashicons-email-alt')
550 550
 				 : '';
551 551
 		} else {
552 552
 			$this->_template_args['send_payment_reminder_button'] = '';
553 553
 		}
554 554
 
555 555
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
556
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
557
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
558
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
556
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
557
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
558
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
559 559
 		} else {
560
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
560
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
561 561
 		}
562
-		$this->_template_args['amount_due_class'] =  '';
562
+		$this->_template_args['amount_due_class'] = '';
563 563
 
564
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
564
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
565 565
 			// paid in full
566
-			$this->_template_args['amount_due'] =  FALSE;
567
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
566
+			$this->_template_args['amount_due'] = FALSE;
567
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
568 568
 			// overpaid
569
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
570
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
569
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
570
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
571 571
 			// monies owing
572
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
573
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
572
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
573
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
574 574
 			// no payments made yet
575
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
576
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
575
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
576
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
577 577
 			// free event
578
-			$this->_template_args['amount_due'] =  FALSE;
578
+			$this->_template_args['amount_due'] = FALSE;
579 579
 		}
580 580
 
581 581
 		$payment_method = $this->_transaction->payment_method();
582 582
 
583
-		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
583
+		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
584 584
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
585 585
 		// link back to overview
586
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : TXN_ADMIN_URL;
586
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : TXN_ADMIN_URL;
587 587
 
588 588
 
589 589
 		//next and previous links
590
-		$next_txn = $this->_transaction->next(null, array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), 'TXN_ID' );
591
-		$this->_template_args['next_transaction'] = $next_txn ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), TXN_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
592
-		$previous_txn = $this->_transaction->previous( null, array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), 'TXN_ID' );
593
-		$this->_template_args['previous_transaction'] = $previous_txn ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), TXN_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
590
+		$next_txn = $this->_transaction->next(null, array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), 'TXN_ID');
591
+		$this->_template_args['next_transaction'] = $next_txn ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), TXN_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
592
+		$previous_txn = $this->_transaction->previous(null, array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), 'TXN_ID');
593
+		$this->_template_args['previous_transaction'] = $previous_txn ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), TXN_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
594 594
 
595 595
 
596 596
 		// grab messages at the last second
597 597
 		$this->_template_args['notices'] = EE_Error::get_notices();
598 598
 		// path to template
599
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
600
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
599
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
600
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
601 601
 
602 602
 		// the details template wrapper
603 603
 		$this->display_admin_page_with_sidebar();
@@ -616,18 +616,18 @@  discard block
 block discarded – undo
616 616
 
617 617
 		$this->_set_transaction_object();
618 618
 
619
-		add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
619
+		add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
620 620
 		add_meta_box(
621 621
 			'edit-txn-attendees-mbox',
622
-			__( 'Attendees Registered in this Transaction', 'event_espresso' ),
623
-			array( $this, 'txn_attendees_meta_box' ),
622
+			__('Attendees Registered in this Transaction', 'event_espresso'),
623
+			array($this, 'txn_attendees_meta_box'),
624 624
 			$this->_wp_page_slug,
625 625
 			'normal',
626 626
 			'high',
627
-			array( 'TXN_ID' => $this->_transaction->ID() )
627
+			array('TXN_ID' => $this->_transaction->ID())
628 628
 		);
629
-		add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
630
-		add_meta_box( 'edit-txn-billing-info-mbox', __( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
629
+		add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
630
+		add_meta_box('edit-txn-billing-info-mbox', __('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
631 631
 
632 632
 	}
633 633
 
@@ -648,15 +648,15 @@  discard block
 block discarded – undo
648 648
 
649 649
 		//get line table
650 650
 		EEH_Autoloader::register_line_item_display_autoloaders();
651
-		$Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' );
652
-		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() );
651
+		$Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy');
652
+		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item());
653 653
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
654 654
 
655 655
 		// process taxes
656
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
657
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
656
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
657
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
658 658
 
659
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
659
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
660 660
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
661 661
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
662 662
 
@@ -664,63 +664,63 @@  discard block
 block discarded – undo
664 664
 
665 665
 		// process payment details
666 666
 		$payments = $this->_transaction->get_many_related('Payment');
667
-		if( ! empty(  $payments ) ) {
668
-			$this->_template_args[ 'payments' ] = $payments;
669
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
667
+		if ( ! empty($payments)) {
668
+			$this->_template_args['payments'] = $payments;
669
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
670 670
 		} else {
671
-			$this->_template_args[ 'payments' ] = false;
672
-			$this->_template_args[ 'existing_reg_payments' ] = array();
671
+			$this->_template_args['payments'] = false;
672
+			$this->_template_args['existing_reg_payments'] = array();
673 673
 		}
674 674
 
675
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
676
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
675
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
676
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
677 677
 
678
-		if ( isset( $txn_details['invoice_number'] )) {
678
+		if (isset($txn_details['invoice_number'])) {
679 679
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
680
-			$this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' );
680
+			$this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso');
681 681
 		}
682 682
 
683 683
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
684
-		$this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
684
+		$this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
685 685
 
686
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
687
-		$this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' );
686
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
687
+		$this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso');
688 688
 
689
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
690
-		$this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
689
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
690
+		$this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
691 691
 
692 692
 		$reg_steps = '<ul>';
693
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
694
-			if ( $reg_step_status === true ) {
695
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
696
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
697
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
698
-							__( '%1$s : Initiated %2$s', 'event_espresso' ),
699
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
700
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
701
-						) . '</li>';
693
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
694
+			if ($reg_step_status === true) {
695
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
696
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
697
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
698
+							__('%1$s : Initiated %2$s', 'event_espresso'),
699
+							ucwords(str_replace('_', ' ', $reg_step)),
700
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
701
+						).'</li>';
702 702
 				} else {
703
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
703
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
704 704
 			}
705 705
 		}
706 706
 		$reg_steps .= '</ul>';
707 707
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
708
-		$this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' );
708
+		$this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso');
709 709
 
710 710
 
711 711
 		$this->_get_registrations_to_apply_payment_to();
712
-		$this->_get_payment_methods( $payments );
712
+		$this->_get_payment_methods($payments);
713 713
 		$this->_get_payment_status_array();
714 714
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
715 715
 
716
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
717
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
718
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
716
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
717
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
718
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
719 719
 
720 720
 		// 'espresso_delete_payment_nonce'
721 721
 
722
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
723
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
722
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
723
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
724 724
 
725 725
 	}
726 726
 
@@ -735,27 +735,27 @@  discard block
 block discarded – undo
735 735
 	 * @param EE_Payment[] $payments
736 736
 	 * @return array
737 737
 	 */
738
-	protected function _get_registration_payment_IDs( $payments = array() ) {
738
+	protected function _get_registration_payment_IDs($payments = array()) {
739 739
 		$existing_reg_payments = array();
740 740
 		// get all reg payments for these payments
741
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
741
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
742 742
 			array(
743 743
 				'PAY_ID' => array(
744 744
 					'IN',
745
-					array_keys( $payments )
745
+					array_keys($payments)
746 746
 				)
747 747
 			)
748
-		) );
749
-		if ( ! empty( $reg_payments ) ) {
750
-			foreach ( $payments as $payment ) {
751
-				if ( ! $payment instanceof EE_Payment ) {
748
+		));
749
+		if ( ! empty($reg_payments)) {
750
+			foreach ($payments as $payment) {
751
+				if ( ! $payment instanceof EE_Payment) {
752 752
 					continue;
753
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
754
-					$existing_reg_payments[ $payment->ID() ] = array();
753
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
754
+					$existing_reg_payments[$payment->ID()] = array();
755 755
 				}
756
-				foreach ( $reg_payments as $reg_payment ) {
757
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
758
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
756
+				foreach ($reg_payments as $reg_payment) {
757
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
758
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
759 759
 					}
760 760
 				}
761 761
 			}
@@ -792,39 +792,39 @@  discard block
 block discarded – undo
792 792
 		$registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">';
793 793
 		$registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">';
794 794
 		$registrations_to_apply_payment_to .= '<thead><tr>';
795
-		$registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>';
796
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>';
797
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>';
798
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>';
799
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>';
800
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>';
801
-		$registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>';
795
+		$registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>';
796
+		$registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>';
797
+		$registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>';
798
+		$registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>';
799
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>';
800
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>';
801
+		$registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>';
802 802
 		$registrations_to_apply_payment_to .= '</tr></thead><tbody>';
803 803
 		// get registrations for TXN
804
-		$registrations = $this->_transaction->registrations( $query_params );
805
-		foreach ( $registrations as $registration ) {
806
-			if ( $registration instanceof EE_Registration ) {
804
+		$registrations = $this->_transaction->registrations($query_params);
805
+		foreach ($registrations as $registration) {
806
+			if ($registration instanceof EE_Registration) {
807 807
 				$owing = $registration->final_price() - $registration->paid();
808
-				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : '';
809
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : '';
810
-				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">';
808
+				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : '';
809
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : '';
810
+				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">';
811 811
 				// add html for checkbox input and label
812
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>';
813
-				$registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>';
814
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>';
815
-				$registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>';
816
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>';
817
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>';
812
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>';
813
+				$registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>';
814
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>';
815
+				$registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>';
816
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>';
817
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>';
818 818
 				$registrations_to_apply_payment_to .= '<td class="jst-cntr">';
819 819
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
820
-				$registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>';
820
+				$registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>';
821 821
 				$registrations_to_apply_payment_to .= '</td>';
822 822
 				$registrations_to_apply_payment_to .= '</tr>';
823 823
 			}
824 824
 		}
825 825
 		$registrations_to_apply_payment_to .= '</tbody></table></div>';
826
-		$registrations_to_apply_payment_to .= '<p class="clear description">' . __( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>';
827
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
826
+		$registrations_to_apply_payment_to .= '<p class="clear description">'.__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>';
827
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
828 828
 	}
829 829
 
830 830
 
@@ -841,9 +841,9 @@  discard block
 block discarded – undo
841 841
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
842 842
 		//let's add a "don't change" option.
843 843
 		$status_array['NAN'] = __('Leave the Same', 'event_espresso');
844
-		$status_array = array_merge( $status_array, $statuses );
845
-		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' );
846
-		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' );
844
+		$status_array = array_merge($status_array, $statuses);
845
+		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status');
846
+		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status');
847 847
 
848 848
 	}
849 849
 
@@ -858,21 +858,21 @@  discard block
 block discarded – undo
858 858
 	 * @param EE_Payment[] to show on this page
859 859
 	 *	@return void
860 860
 	 */
861
-	private function _get_payment_methods( $payments = array() ) {
861
+	private function _get_payment_methods($payments = array()) {
862 862
 		$payment_methods_of_payments = array();
863
-		foreach( $payments as $payment ){
864
-			if( $payment instanceof EE_Payment ){
865
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
863
+		foreach ($payments as $payment) {
864
+			if ($payment instanceof EE_Payment) {
865
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
866 866
 			}
867 867
 		}
868
-		if( $payment_methods_of_payments ){
869
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
870
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
871
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
872
-		}else{
873
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
868
+		if ($payment_methods_of_payments) {
869
+			$query_args = array(array('OR*payment_method_for_payment' => array(
870
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
871
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
872
+		} else {
873
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
874 874
 		}
875
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
875
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
876 876
 	}
877 877
 
878 878
 
@@ -886,46 +886,46 @@  discard block
 block discarded – undo
886 886
 	 * @param array $metabox
887 887
 	 * @return void
888 888
 	 */
889
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
889
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
890 890
 
891
-		extract( $metabox['args'] );
891
+		extract($metabox['args']);
892 892
 		$this->_template_args['post'] = $post;
893 893
 		$this->_template_args['event_attendees'] = array();
894 894
 		// process items in cart
895
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
896
-		if ( ! empty( $line_items )) {
897
-			foreach ( $line_items as $item ) {
898
-				if ( $item instanceof EE_Line_Item ) {
899
-					switch( $item->OBJ_type() ) {
895
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
896
+		if ( ! empty($line_items)) {
897
+			foreach ($line_items as $item) {
898
+				if ($item instanceof EE_Line_Item) {
899
+					switch ($item->OBJ_type()) {
900 900
 
901 901
 						case 'Event' :
902 902
 							break;
903 903
 
904 904
 						case 'Ticket' :
905 905
 							$ticket = $item->ticket();
906
-							if ( empty( $ticket )) {
906
+							if (empty($ticket)) {
907 907
 								continue; //right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
908 908
 							}
909
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ));
909
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
910 910
 							$event = $ticket->get_first_related('Registration')->get_first_related('Event');
911
-							$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
911
+							$event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : '';
912 912
 
913
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
914
-							foreach( $registrations as $registration ) {
915
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 						= $registration->get('REG_count');
916
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
917
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 				= $ticket_price;
913
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
914
+							foreach ($registrations as $registration) {
915
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
916
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
917
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
918 918
 								// attendee info
919 919
 								$attendee = $registration->get_first_related('Attendee');
920
-								if ( $attendee instanceof EE_Attendee ) {
920
+								if ($attendee instanceof EE_Attendee) {
921 921
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= $attendee->ID();
922 922
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
923
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
924
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		=  implode(',<br>', $attendee->full_address_as_array() );
923
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
924
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= implode(',<br>', $attendee->full_address_as_array());
925 925
 								} else {
926 926
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= '';
927 927
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
928
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '';
928
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
929 929
 									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= '';
930 930
 								}
931 931
 							}
@@ -935,12 +935,12 @@  discard block
 block discarded – undo
935 935
 				}
936 936
 			}
937 937
 
938
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
939
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
938
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
939
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
940 940
 
941 941
 		} else {
942 942
 			echo sprintf(
943
-				__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
943
+				__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
944 944
 				'<p class="important-notice">',
945 945
 				'</p>'
946 946
 			);
@@ -959,20 +959,20 @@  discard block
 block discarded – undo
959 959
 	 */
960 960
 	public function txn_registrant_side_meta_box() {
961 961
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
962
-		if ( ! $primary_att instanceof EE_Attendee ) {
962
+		if ( ! $primary_att instanceof EE_Attendee) {
963 963
 			$this->_template_args['no_attendee_message'] = __('There is no attached contact for this transaction.  The transaction either failed due to an error or was abandoned.', 'event_espresso');
964 964
 			$primary_att = EEM_Attendee::instance()->create_default_object();
965 965
 		}
966
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
966
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
967 967
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
968 968
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
969
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
969
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
970 970
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
971
-		$this->_template_args['edit_attendee_url'] 	= EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID()  ), REG_ADMIN_URL );
971
+		$this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL);
972 972
 		// get formatted address for registrant
973
-		EE_Registry::instance()->load_helper( 'Formatter' );
974
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
975
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
973
+		EE_Registry::instance()->load_helper('Formatter');
974
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
975
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
976 976
 	}
977 977
 
978 978
 
@@ -988,12 +988,12 @@  discard block
 block discarded – undo
988 988
 
989 989
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
990 990
 		$this->_template_args['billing_form_url'] = add_query_arg(
991
-			array( 'action' => 'edit_transaction', 'process' => 'billing'  ),
991
+			array('action' => 'edit_transaction', 'process' => 'billing'),
992 992
 			TXN_ADMIN_URL
993 993
 		);
994 994
 
995
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
996
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
995
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
996
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
997 997
 	}
998 998
 
999 999
 
@@ -1006,43 +1006,43 @@  discard block
 block discarded – undo
1006 1006
 	*	@return void
1007 1007
 	*/
1008 1008
 	public function apply_payments_or_refunds() {
1009
-		$json_response_data = array( 'return_data' => FALSE );
1009
+		$json_response_data = array('return_data' => FALSE);
1010 1010
 		$valid_data = $this->_validate_payment_request_data();
1011
-		if ( ! empty( $valid_data ) ) {
1012
-			$PAY_ID = $valid_data[ 'PAY_ID' ];
1011
+		if ( ! empty($valid_data)) {
1012
+			$PAY_ID = $valid_data['PAY_ID'];
1013 1013
 			//save  the new payment
1014
-			$payment = $this->_create_payment_from_request_data( $valid_data );
1014
+			$payment = $this->_create_payment_from_request_data($valid_data);
1015 1015
 			// get the TXN for this payment
1016 1016
 			$transaction = $payment->transaction();
1017 1017
 			// verify transaction
1018
-			if ( $transaction instanceof EE_Transaction ) {
1018
+			if ($transaction instanceof EE_Transaction) {
1019 1019
 				// calculate_total_payments_and_update_status
1020
-				$this->_process_transaction_payments( $transaction );
1021
-				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment );
1022
-				$this->_remove_existing_registration_payments( $payment, $PAY_ID );
1020
+				$this->_process_transaction_payments($transaction);
1021
+				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment);
1022
+				$this->_remove_existing_registration_payments($payment, $PAY_ID);
1023 1023
 				// apply payment to registrations (if applicable)
1024
-				if ( ! empty( $REG_IDs ) ) {
1025
-					$this->_update_registration_payments( $transaction, $payment, $REG_IDs );
1024
+				if ( ! empty($REG_IDs)) {
1025
+					$this->_update_registration_payments($transaction, $payment, $REG_IDs);
1026 1026
 					$this->_maybe_send_notifications();
1027 1027
 					// now process status changes for the same registrations
1028
-					$this->_process_registration_status_change( $transaction, $REG_IDs );
1028
+					$this->_process_registration_status_change($transaction, $REG_IDs);
1029 1029
 				}
1030
-				$this->_maybe_send_notifications( $payment );
1030
+				$this->_maybe_send_notifications($payment);
1031 1031
 				//prepare to render page
1032
-				$json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs );
1033
-				do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment );
1032
+				$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs);
1033
+				do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment);
1034 1034
 			} else {
1035 1035
 				EE_Error::add_error(
1036
-					__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ),
1036
+					__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'),
1037 1037
 					__FILE__, __FUNCTION__, __LINE__
1038 1038
 				);
1039 1039
 			}
1040 1040
 		} else {
1041
-			EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1041
+			EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1042 1042
 		}
1043 1043
 
1044
-		$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
1045
-		echo json_encode( array_merge( $json_response_data, $notices ));
1044
+		$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
1045
+		echo json_encode(array_merge($json_response_data, $notices));
1046 1046
 		die();
1047 1047
 	}
1048 1048
 
@@ -1054,30 +1054,30 @@  discard block
 block discarded – undo
1054 1054
 	 * @return array
1055 1055
 	 */
1056 1056
 	protected function _validate_payment_request_data() {
1057
-		if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) {
1057
+		if ( ! isset($this->_req_data['txn_admin_payment'])) {
1058 1058
 			return false;
1059 1059
 		}
1060 1060
 		$payment_form = $this->_generate_payment_form_section();
1061 1061
 		try {
1062
-			if ( $payment_form->was_submitted() ) {
1062
+			if ($payment_form->was_submitted()) {
1063 1063
 				$payment_form->receive_form_submission();
1064
-				if ( ! $payment_form->is_valid() ) {
1064
+				if ( ! $payment_form->is_valid()) {
1065 1065
 					$submission_error_messages = array();
1066
-					foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) {
1067
-						if ( $validation_error instanceof EE_Validation_Error ) {
1066
+					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) {
1067
+						if ($validation_error instanceof EE_Validation_Error) {
1068 1068
 							$submission_error_messages[] = sprintf(
1069
-								_x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ),
1069
+								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'),
1070 1070
 								$validation_error->get_form_section()->html_label_text(),
1071 1071
 								$validation_error->getMessage()
1072 1072
 							);
1073 1073
 						}
1074 1074
 					}
1075
-					EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1075
+					EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1076 1076
 					return array();
1077 1077
 				}
1078 1078
 			}
1079
-		} catch ( EE_Error $e ) {
1080
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1079
+		} catch (EE_Error $e) {
1080
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1081 1081
 			return array();
1082 1082
 		}
1083 1083
 		return $payment_form->valid_data();
@@ -1099,63 +1099,63 @@  discard block
 block discarded – undo
1099 1099
 						array(
1100 1100
 							'default' => 0,
1101 1101
 							'required' => false,
1102
-							'html_label_text' => __( 'Payment ID', 'event_espresso' ),
1103
-							'validation_strategies' => array( new EE_Int_Normalization() )
1102
+							'html_label_text' => __('Payment ID', 'event_espresso'),
1103
+							'validation_strategies' => array(new EE_Int_Normalization())
1104 1104
 						)
1105 1105
 					),
1106 1106
 					'TXN_ID' => new EE_Text_Input(
1107 1107
 						array(
1108 1108
 							'default' => 0,
1109 1109
 							'required' => true,
1110
-							'html_label_text' => __( 'Transaction ID', 'event_espresso' ),
1111
-							'validation_strategies' => array( new EE_Int_Normalization() )
1110
+							'html_label_text' => __('Transaction ID', 'event_espresso'),
1111
+							'validation_strategies' => array(new EE_Int_Normalization())
1112 1112
 						)
1113 1113
 					),
1114 1114
 					'type' => new EE_Text_Input(
1115 1115
 						array(
1116 1116
 							'default' => 1,
1117 1117
 							'required' => true,
1118
-							'html_label_text' => __( 'Payment or Refund', 'event_espresso' ),
1119
-							'validation_strategies' => array( new EE_Int_Normalization() )
1118
+							'html_label_text' => __('Payment or Refund', 'event_espresso'),
1119
+							'validation_strategies' => array(new EE_Int_Normalization())
1120 1120
 						)
1121 1121
 					),
1122 1122
 					'amount' => new EE_Text_Input(
1123 1123
 						array(
1124 1124
 							'default' => 0,
1125 1125
 							'required' => true,
1126
-							'html_label_text' => __( 'Payment amount', 'event_espresso' ),
1127
-							'validation_strategies' => array( new EE_Float_Normalization() )
1126
+							'html_label_text' => __('Payment amount', 'event_espresso'),
1127
+							'validation_strategies' => array(new EE_Float_Normalization())
1128 1128
 						)
1129 1129
 					),
1130 1130
 					'status' => new EE_Text_Input(
1131 1131
 						array(
1132 1132
 							'default' => EEM_Payment::status_id_approved,
1133 1133
 							'required' => true,
1134
-							'html_label_text' => __( 'Payment status', 'event_espresso' ),
1134
+							'html_label_text' => __('Payment status', 'event_espresso'),
1135 1135
 						)
1136 1136
 					),
1137 1137
 					'PMD_ID' => new EE_Text_Input(
1138 1138
 						array(
1139 1139
 							'default' => 2,
1140 1140
 							'required' => true,
1141
-							'html_label_text' => __( 'Payment Method', 'event_espresso' ),
1142
-							'validation_strategies' => array( new EE_Int_Normalization() )
1141
+							'html_label_text' => __('Payment Method', 'event_espresso'),
1142
+							'validation_strategies' => array(new EE_Int_Normalization())
1143 1143
 						)
1144 1144
 					),
1145 1145
 					'date' => new EE_Text_Input(
1146 1146
 						array(
1147 1147
 							'default' => time(),
1148 1148
 							'required' => true,
1149
-							'html_label_text' => __( 'Payment date', 'event_espresso' ),
1149
+							'html_label_text' => __('Payment date', 'event_espresso'),
1150 1150
 						)
1151 1151
 					),
1152 1152
 					'txn_id_chq_nmbr' => new EE_Text_Input(
1153 1153
 						array(
1154 1154
 							'default' => '',
1155 1155
 							'required' => false,
1156
-							'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ),
1156
+							'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'),
1157 1157
                                                         'validation_strategies' => array(
1158
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1158
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1159 1159
                                                         )
1160 1160
 						)
1161 1161
 					),
@@ -1163,9 +1163,9 @@  discard block
 block discarded – undo
1163 1163
 						array(
1164 1164
 							'default' => '',
1165 1165
 							'required' => false,
1166
-							'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ),
1166
+							'html_label_text' => __('Purchase Order Number', 'event_espresso'),
1167 1167
                                                         'validation_strategies' => array(
1168
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1168
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1169 1169
                                                         )
1170 1170
 						)
1171 1171
 					),
@@ -1173,9 +1173,9 @@  discard block
 block discarded – undo
1173 1173
 						array(
1174 1174
 							'default' => '',
1175 1175
 							'required' => false,
1176
-							'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ),
1176
+							'html_label_text' => __('Extra Field for Accounting', 'event_espresso'),
1177 1177
                                                         'validation_strategies' => array(
1178
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1178
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1179 1179
                                                         )
1180 1180
 						)
1181 1181
 					),
@@ -1192,34 +1192,34 @@  discard block
 block discarded – undo
1192 1192
 	 * @param array $valid_data
1193 1193
 	 * @return EE_Payment
1194 1194
 	 */
1195
-	protected function _create_payment_from_request_data( $valid_data ) {
1196
-		$PAY_ID = $valid_data[ 'PAY_ID' ];
1195
+	protected function _create_payment_from_request_data($valid_data) {
1196
+		$PAY_ID = $valid_data['PAY_ID'];
1197 1197
 		// get payment amount
1198
-		$amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0;
1198
+		$amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0;
1199 1199
 		// payments have a type value of 1 and refunds have a type value of -1
1200 1200
 		// so multiplying amount by type will give a positive value for payments, and negative values for refunds
1201
-		$amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount;
1201
+		$amount = $valid_data['type'] < 0 ? $amount * -1 : $amount;
1202 1202
 		$payment = EE_Payment::new_instance(
1203 1203
 			array(
1204
-				'TXN_ID' 								=> $valid_data[ 'TXN_ID' ],
1205
-				'STS_ID' 								=> $valid_data[ 'status' ],
1206
-				'PAY_timestamp' 				=> $valid_data[ 'date' ],
1204
+				'TXN_ID' 								=> $valid_data['TXN_ID'],
1205
+				'STS_ID' 								=> $valid_data['status'],
1206
+				'PAY_timestamp' 				=> $valid_data['date'],
1207 1207
 				'PAY_source'           			=> EEM_Payment_Method::scope_admin,
1208
-				'PMD_ID'               				=> $valid_data[ 'PMD_ID' ],
1208
+				'PMD_ID'               				=> $valid_data['PMD_ID'],
1209 1209
 				'PAY_amount'           			=> $amount,
1210
-				'PAY_txn_id_chq_nmbr'  	=> $valid_data[ 'txn_id_chq_nmbr' ],
1211
-				'PAY_po_number'        		=> $valid_data[ 'po_number' ],
1212
-				'PAY_extra_accntng'    		=> $valid_data[ 'accounting' ],
1210
+				'PAY_txn_id_chq_nmbr'  	=> $valid_data['txn_id_chq_nmbr'],
1211
+				'PAY_po_number'        		=> $valid_data['po_number'],
1212
+				'PAY_extra_accntng'    		=> $valid_data['accounting'],
1213 1213
 				'PAY_details'          				=> $valid_data,
1214 1214
 				'PAY_ID'               				=> $PAY_ID
1215 1215
 			),
1216 1216
 			'',
1217
-			array( 'Y-m-d', 'H:i a' )
1217
+			array('Y-m-d', 'H:i a')
1218 1218
 		);
1219
-		if ( ! $payment->save() ) {
1219
+		if ( ! $payment->save()) {
1220 1220
 			EE_Error::add_error(
1221 1221
 				sprintf(
1222
-					__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ),
1222
+					__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'),
1223 1223
 					$payment->ID()
1224 1224
 				),
1225 1225
 				__FILE__, __FUNCTION__, __LINE__
@@ -1236,15 +1236,15 @@  discard block
 block discarded – undo
1236 1236
 	 * @param \EE_Transaction $transaction
1237 1237
 	 * @return array
1238 1238
 	 */
1239
-	protected function _process_transaction_payments( EE_Transaction $transaction ) {
1239
+	protected function _process_transaction_payments(EE_Transaction $transaction) {
1240 1240
 		/** @type EE_Transaction_Payments $transaction_payments */
1241
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1241
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1242 1242
 		//update the transaction with this payment
1243
-		if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) {
1244
-			EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1243
+		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1244
+			EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1245 1245
 		} else {
1246 1246
 			EE_Error::add_error(
1247
-				__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' )
1247
+				__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso')
1248 1248
 				, __FILE__, __FUNCTION__, __LINE__
1249 1249
 			);
1250 1250
 		}
@@ -1260,19 +1260,19 @@  discard block
 block discarded – undo
1260 1260
 	 * @param \EE_Payment $payment
1261 1261
 	 * @return array
1262 1262
 	 */
1263
-	protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) {
1263
+	protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) {
1264 1264
 		$REG_IDs = array();
1265 1265
 		// grab array of IDs for specific registrations to apply changes to
1266
-		if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1267
-			$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1266
+		if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1267
+			$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1268 1268
 		}
1269 1269
 		//nothing specified ? then get all reg IDs
1270
-		if ( empty( $REG_IDs ) ) {
1270
+		if (empty($REG_IDs)) {
1271 1271
 			$registrations = $payment->transaction()->registrations();
1272
-			$REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment );
1272
+			$REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment);
1273 1273
 		}
1274 1274
 		// ensure that REG_IDs are integers and NOT strings
1275
-		return array_map( 'intval', $REG_IDs );
1275
+		return array_map('intval', $REG_IDs);
1276 1276
 	}
1277 1277
 
1278 1278
 
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
 	/**
1290 1290
 	 * @param array $existing_reg_payment_REG_IDs
1291 1291
 	 */
1292
-	public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) {
1292
+	public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) {
1293 1293
 		$this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs;
1294 1294
 	}
1295 1295
 
@@ -1304,13 +1304,13 @@  discard block
 block discarded – undo
1304 1304
 	 * @param \EE_Payment $payment
1305 1305
 	 * @return array
1306 1306
 	 */
1307
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1308
-		if ( $this->existing_reg_payment_REG_IDs() === null ) {
1307
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1308
+		if ($this->existing_reg_payment_REG_IDs() === null) {
1309 1309
 			// let's get any existing reg payment records for this payment
1310
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1310
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1311 1311
 			// but we only want the REG IDs, so grab the array keys
1312
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1313
-			$this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs );
1312
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1313
+			$this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs);
1314 1314
 		}
1315 1315
 		return $this->existing_reg_payment_REG_IDs();
1316 1316
 	}
@@ -1329,23 +1329,23 @@  discard block
 block discarded – undo
1329 1329
 	 * @param int         $PAY_ID
1330 1330
 	 * @return bool;
1331 1331
 	 */
1332
-	protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) {
1332
+	protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) {
1333 1333
 		// newly created payments will have nothing recorded for $PAY_ID
1334
-		if ( $PAY_ID == 0 ) {
1334
+		if ($PAY_ID == 0) {
1335 1335
 			return false;
1336 1336
 		}
1337
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1338
-		if ( empty( $existing_reg_payment_REG_IDs )) {
1337
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1338
+		if (empty($existing_reg_payment_REG_IDs)) {
1339 1339
 			return false;
1340 1340
 		}
1341 1341
 		/** @type EE_Transaction_Payments $transaction_payments */
1342
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1342
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1343 1343
 		return $transaction_payments->delete_registration_payments_and_update_registrations(
1344 1344
 			$payment,
1345 1345
 			array(
1346 1346
 				array(
1347 1347
 					'PAY_ID' => $payment->ID(),
1348
-					'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ),
1348
+					'REG_ID' => array('IN', $existing_reg_payment_REG_IDs),
1349 1349
 				)
1350 1350
 			)
1351 1351
 		);
@@ -1364,25 +1364,25 @@  discard block
 block discarded – undo
1364 1364
 	 * @param array $REG_IDs
1365 1365
 	 * @return bool
1366 1366
 	 */
1367
-	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1367
+	protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) {
1368 1368
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1369 1369
 		// so let's do that using our set of REG_IDs from the form
1370 1370
 		$registration_query_where_params = array(
1371
-			'REG_ID' => array( 'IN', $REG_IDs )
1371
+			'REG_ID' => array('IN', $REG_IDs)
1372 1372
 		);
1373 1373
 		// but add in some conditions regarding payment,
1374 1374
 		// so that we don't apply payments to registrations that are free or have already been paid for
1375 1375
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1376
-		if ( ! $payment->is_a_refund() ) {
1377
-			$registration_query_where_params[ 'REG_final_price' ]  = array( '!=', 0 );
1378
-			$registration_query_where_params[ 'REG_final_price*' ]  = array( '!=', 'REG_paid', true );
1376
+		if ( ! $payment->is_a_refund()) {
1377
+			$registration_query_where_params['REG_final_price'] = array('!=', 0);
1378
+			$registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true);
1379 1379
 		}
1380 1380
 		//EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ );
1381
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1382
-		if ( ! empty( $registrations ) ) {
1381
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1382
+		if ( ! empty($registrations)) {
1383 1383
 			/** @type EE_Payment_Processor $payment_processor */
1384
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1385
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1384
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1385
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1386 1386
 		}
1387 1387
 	}
1388 1388
 
@@ -1398,22 +1398,22 @@  discard block
 block discarded – undo
1398 1398
 	 * @param array $REG_IDs
1399 1399
 	 * @return bool
1400 1400
 	 */
1401
-	protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) {
1401
+	protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) {
1402 1402
 		// first if there is no change in status then we get out.
1403 1403
 		if (
1404
-			! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] )
1404
+			! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status'])
1405 1405
 			|| $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN'
1406 1406
 		) {
1407 1407
 			//no error message, no change requested, just nothing to do man.
1408 1408
 			return FALSE;
1409 1409
 		}
1410 1410
 		/** @type EE_Transaction_Processor $transaction_processor */
1411
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1411
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1412 1412
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1413 1413
 		return $transaction_processor->manually_update_registration_statuses(
1414 1414
 			$transaction,
1415
-			sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ),
1416
-			array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) )
1415
+			sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']),
1416
+			array(array('REG_ID' => array('IN', $REG_IDs)))
1417 1417
 		);
1418 1418
 	}
1419 1419
 
@@ -1428,16 +1428,16 @@  discard block
 block discarded – undo
1428 1428
 	 * @param bool | null        $delete_txn_reg_status_change
1429 1429
 	 * @return array
1430 1430
 	 */
1431
-	protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) {
1431
+	protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) {
1432 1432
 		// was the payment deleted ?
1433
-		if ( is_bool( $delete_txn_reg_status_change )) {
1433
+		if (is_bool($delete_txn_reg_status_change)) {
1434 1434
 			return array(
1435 1435
 				'PAY_ID' 				=> $payment->ID(),
1436 1436
 				'amount' 			=> $payment->amount(),
1437 1437
 				'total_paid' 			=> $payment->transaction()->paid(),
1438 1438
 				'txn_status' 			=> $payment->transaction()->status_ID(),
1439 1439
 				'pay_status' 		=> $payment->STS_ID(),
1440
-				'registrations' 	=> $this->_registration_payment_data_array( $REG_IDs ),
1440
+				'registrations' 	=> $this->_registration_payment_data_array($REG_IDs),
1441 1441
 				'delete_txn_reg_status_change' => $delete_txn_reg_status_change,
1442 1442
 			);
1443 1443
 		} else {
@@ -1449,16 +1449,16 @@  discard block
 block discarded – undo
1449 1449
 				'pay_status' 	=> $payment->STS_ID(),
1450 1450
 				'PAY_ID'           => $payment->ID(),
1451 1451
 				'STS_ID' 			=> $payment->STS_ID(),
1452
-				'status' 			=> self::$_pay_status[ $payment->STS_ID() ],
1453
-				'date' 				=> $payment->timestamp( 'Y-m-d', 'h:i a' ),
1454
-				'method' 		=> strtoupper( $payment->source() ),
1452
+				'status' 			=> self::$_pay_status[$payment->STS_ID()],
1453
+				'date' 				=> $payment->timestamp('Y-m-d', 'h:i a'),
1454
+				'method' 		=> strtoupper($payment->source()),
1455 1455
 				'PM_ID' 			=> $payment->payment_method() ? $payment->payment_method()->ID() : 1,
1456
-				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ),
1456
+				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'),
1457 1457
 				'gateway_response' 	=> $payment->gateway_response(),
1458 1458
 				'txn_id_chq_nmbr'  	=> $payment->txn_id_chq_nmbr(),
1459 1459
 				'po_number'        		=> $payment->po_number(),
1460 1460
 				'extra_accntng'    		=> $payment->extra_accntng(),
1461
-				'registrations'    			=> $this->_registration_payment_data_array( $REG_IDs ),
1461
+				'registrations'    			=> $this->_registration_payment_data_array($REG_IDs),
1462 1462
 			);
1463 1463
 		}
1464 1464
 	}
@@ -1473,42 +1473,42 @@  discard block
 block discarded – undo
1473 1473
 	*	@return void
1474 1474
 	*/
1475 1475
 	public function delete_payment() {
1476
-		$json_response_data = array( 'return_data' => FALSE );
1477
-		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
1478
-		if ( $PAY_ID ) {
1479
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1480
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1481
-			if ( $payment instanceof EE_Payment ) {
1482
-				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1476
+		$json_response_data = array('return_data' => FALSE);
1477
+		$PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0;
1478
+		if ($PAY_ID) {
1479
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1480
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1481
+			if ($payment instanceof EE_Payment) {
1482
+				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1483 1483
 				/** @type EE_Transaction_Payments $transaction_payments */
1484
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1485
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1486
-					EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) );
1487
-					$json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change );
1488
-					if ( $delete_txn_reg_status_change ) {
1484
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1485
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1486
+					EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso'));
1487
+					$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change);
1488
+					if ($delete_txn_reg_status_change) {
1489 1489
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1490 1490
 						//MAKE sure we also add the delete_txn_req_status_change to the
1491 1491
 						//$_REQUEST global because that's how messages will be looking for it.
1492 1492
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1493 1493
 						$this->_maybe_send_notifications();
1494
-						$this->_process_registration_status_change( $payment->transaction(), $REG_IDs );
1494
+						$this->_process_registration_status_change($payment->transaction(), $REG_IDs);
1495 1495
 						//$this->_maybe_send_notifications( $payment );
1496 1496
 					}
1497 1497
 				}
1498 1498
 			} else {
1499 1499
 				EE_Error::add_error(
1500
-					__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ),
1500
+					__('Valid Payment data could not be retrieved from the database.', 'event_espresso'),
1501 1501
 					__FILE__, __FUNCTION__, __LINE__
1502 1502
 				);
1503 1503
 			}
1504 1504
 		} else {
1505 1505
 			EE_Error::add_error(
1506
-				__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ),
1506
+				__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'),
1507 1507
 				__FILE__, __FUNCTION__, __LINE__
1508 1508
 			);
1509 1509
 		}
1510
-		$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
1511
-		echo json_encode( array_merge( $json_response_data, $notices ));
1510
+		$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
1511
+		echo json_encode(array_merge($json_response_data, $notices));
1512 1512
 		die();
1513 1513
 	}
1514 1514
 
@@ -1522,17 +1522,17 @@  discard block
 block discarded – undo
1522 1522
 	 * @param array $REG_IDs
1523 1523
 	 * @return array
1524 1524
 	 */
1525
-	protected function _registration_payment_data_array( $REG_IDs ) {
1525
+	protected function _registration_payment_data_array($REG_IDs) {
1526 1526
 		$registration_payment_data = array();
1527 1527
 		//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
1528
-		if ( ! empty( $REG_IDs ) ) {
1529
-			EE_Registry::instance()->load_helper( 'Template' );
1530
-			$registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) );
1531
-			foreach ( $registrations as $registration ) {
1532
-				if ( $registration instanceof EE_Registration ) {
1533
-					$registration_payment_data[ $registration->ID() ] = array(
1528
+		if ( ! empty($REG_IDs)) {
1529
+			EE_Registry::instance()->load_helper('Template');
1530
+			$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
1531
+			foreach ($registrations as $registration) {
1532
+				if ($registration instanceof EE_Registration) {
1533
+					$registration_payment_data[$registration->ID()] = array(
1534 1534
 						'paid' => $registration->pretty_paid(),
1535
-						'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ),
1535
+						'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()),
1536 1536
 					);
1537 1537
 				}
1538 1538
 			}
@@ -1552,30 +1552,30 @@  discard block
 block discarded – undo
1552 1552
 	 * @access protected
1553 1553
 	 * @param \EE_Payment | null $payment
1554 1554
 	 */
1555
-	protected function _maybe_send_notifications( $payment = null ) {
1556
-		switch ( $payment instanceof EE_Payment ) {
1555
+	protected function _maybe_send_notifications($payment = null) {
1556
+		switch ($payment instanceof EE_Payment) {
1557 1557
 			// payment notifications
1558 1558
 			case true :
1559 1559
 				if (
1560 1560
 					isset(
1561
-						$this->_req_data[ 'txn_payments' ],
1562
-						$this->_req_data[ 'txn_payments' ][ 'send_notifications' ]
1561
+						$this->_req_data['txn_payments'],
1562
+						$this->_req_data['txn_payments']['send_notifications']
1563 1563
 					) &&
1564
-					filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1564
+					filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1565 1565
 				) {
1566
-					$this->_process_payment_notification( $payment );
1566
+					$this->_process_payment_notification($payment);
1567 1567
 				}
1568 1568
 				break;
1569 1569
 			// registration notifications
1570 1570
 			case false :
1571 1571
 				if (
1572 1572
 					isset(
1573
-						$this->_req_data[ 'txn_reg_status_change' ],
1574
-						$this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ]
1573
+						$this->_req_data['txn_reg_status_change'],
1574
+						$this->_req_data['txn_reg_status_change']['send_notifications']
1575 1575
 					) &&
1576
-					filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1576
+					filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1577 1577
 				) {
1578
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
1578
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
1579 1579
 				}
1580 1580
 				break;
1581 1581
 		}
@@ -1591,11 +1591,11 @@  discard block
 block discarded – undo
1591 1591
 	*	@return void
1592 1592
 	*/
1593 1593
 	protected function _send_payment_reminder() {
1594
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1595
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1596
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1597
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1598
-		$this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE );
1594
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1595
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1596
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1597
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1598
+		$this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE);
1599 1599
 	}
1600 1600
 
1601 1601
 
@@ -1609,36 +1609,36 @@  discard block
 block discarded – undo
1609 1609
 	 * @param string   $view
1610 1610
 	 * @return mixed int = count || array of transaction objects
1611 1611
 	 */
1612
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1612
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1613 1613
 
1614 1614
 		$TXN = EEM_Transaction::instance();
1615 1615
 
1616
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1617
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1616
+	    $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
1617
+	    $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
1618 1618
 
1619 1619
 	    //make sure our timestamps start and end right at the boundaries for each day
1620
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1621
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1620
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1621
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1622 1622
 
1623 1623
 
1624 1624
 	    //convert to timestamps
1625
-	    $start_date = strtotime( $start_date );
1626
-	    $end_date = strtotime( $end_date );
1625
+	    $start_date = strtotime($start_date);
1626
+	    $end_date = strtotime($end_date);
1627 1627
 
1628 1628
 	    //makes sure start date is the lowest value and vice versa
1629
-	    $start_date = min( $start_date, $end_date );
1630
-	    $end_date = max( $start_date, $end_date );
1629
+	    $start_date = min($start_date, $end_date);
1630
+	    $end_date = max($start_date, $end_date);
1631 1631
 
1632 1632
 	    //convert to correct format for query
1633
-	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1634
-	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1633
+	$start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
1634
+	$end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
1635 1635
 
1636 1636
 
1637 1637
 
1638 1638
 	    //set orderby
1639 1639
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1640 1640
 
1641
-		switch ( $this->_req_data['orderby'] ) {
1641
+		switch ($this->_req_data['orderby']) {
1642 1642
 			case 'TXN_ID':
1643 1643
 				$orderby = 'TXN_ID';
1644 1644
 				break;
@@ -1652,66 +1652,66 @@  discard block
 block discarded – undo
1652 1652
 				$orderby = 'TXN_timestamp';
1653 1653
 		}
1654 1654
 
1655
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1656
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1657
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1658
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1655
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1656
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1657
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1658
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1659 1659
 
1660
-		$offset = ($current_page-1)*$per_page;
1661
-		$limit = array( $offset, $per_page );
1660
+		$offset = ($current_page - 1) * $per_page;
1661
+		$limit = array($offset, $per_page);
1662 1662
 
1663 1663
 		$_where = array(
1664
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1664
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1665 1665
 			'Registration.REG_count' => 1
1666 1666
 		);
1667 1667
 
1668
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1668
+		if (isset($this->_req_data['EVT_ID'])) {
1669 1669
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1670 1670
 		}
1671 1671
 
1672
-		if ( isset( $this->_req_data['s'] ) ) {
1673
-			$search_string = '%' . $this->_req_data['s'] . '%';
1672
+		if (isset($this->_req_data['s'])) {
1673
+			$search_string = '%'.$this->_req_data['s'].'%';
1674 1674
 			$_where['OR'] = array(
1675
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1676
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1677
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1678
-				'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ),
1679
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1680
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1681
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1682
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1683
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1684
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1685
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1686
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1687
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1688
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1689
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1690
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1691
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1692
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1693
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1694
-				'TXN_session_data' => array( 'LIKE', $search_string ),
1695
-				'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string )
1675
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1676
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1677
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1678
+				'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string),
1679
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1680
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1681
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1682
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1683
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1684
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1685
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1686
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1687
+				'Registration.REG_code' => array('LIKE', $search_string),
1688
+				'Registration.REG_count' => array('LIKE', $search_string),
1689
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1690
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1691
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1692
+				'Payment.PAY_source' => array('LIKE', $search_string),
1693
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1694
+				'TXN_session_data' => array('LIKE', $search_string),
1695
+				'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string)
1696 1696
 				);
1697 1697
 		}
1698 1698
 
1699 1699
 		//failed transactions
1700
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1701
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1700
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE;
1701
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE;
1702 1702
 
1703
-		if ( $failed ) {
1704
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1705
-		} else if ( $abandoned ) {
1703
+		if ($failed) {
1704
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1705
+		} else if ($abandoned) {
1706 1706
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1707 1707
 		} else {
1708
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1709
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1708
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1709
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1710 1710
 		}
1711 1711
 
1712
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1712
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1713 1713
 
1714
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1714
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1715 1715
 
1716 1716
 
1717 1717
 		return $transactions;
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Doc Comments   +18 added lines, -1 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
182 182
 	 * @param  EE_Event $evtobj The Event object we're attaching data to
183 183
 	 * @param  array    $data   The request data from the form
184
-	 * @return bool             success or fail
184
+	 * @return boolean|null             success or fail
185 185
 	 */
186 186
 	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
@@ -879,6 +879,9 @@  discard block
 block discarded – undo
879 879
 
880 880
 
881 881
 
882
+	/**
883
+	 * @param integer $dttrow
884
+	 */
882 885
 	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
883 886
 
884 887
 		$dtt_display_template_args = array(
@@ -902,6 +905,7 @@  discard block
 block discarded – undo
902 905
 	 *                               				object.
903 906
 	 * @param bool   $default  		         Whether a default row is being generated or not.
904 907
 	 * @param EE_Datetime[] $all_dtts             This is the array of all datetimes used in the editor.
908
+	 * @param EE_Datetime|null $dtt
905 909
 	 *
906 910
 	 * @return string Generated edit row.
907 911
 	 */
@@ -936,6 +940,10 @@  discard block
 block discarded – undo
936 940
 	}
937 941
 
938 942
 
943
+	/**
944
+	 * @param EE_Datetime|null $dtt
945
+	 * @param boolean $default
946
+	 */
939 947
 	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
940 948
 
941 949
 		$template_args = array(
@@ -1142,6 +1150,9 @@  discard block
 block discarded – undo
1142 1150
 
1143 1151
 
1144 1152
 
1153
+	/**
1154
+	 * @param integer $tktrow
1155
+	 */
1145 1156
 	protected function _get_tax_rows( $tktrow, $ticket ) {
1146 1157
 		$tax_rows = '';
1147 1158
 		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
@@ -1175,6 +1186,9 @@  discard block
 block discarded – undo
1175 1186
 
1176 1187
 
1177 1188
 
1189
+	/**
1190
+	 * @param boolean $default
1191
+	 */
1178 1192
 	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1179 1193
 		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1180 1194
 		$template_args = array(
@@ -1281,6 +1295,9 @@  discard block
 block discarded – undo
1281 1295
 
1282 1296
 
1283 1297
 
1298
+	/**
1299
+	 * @param boolean $default
1300
+	 */
1284 1301
 	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1285 1302
 		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1286 1303
 		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 
167 168
 	public function caf_updates( $update_callbacks ) {
168 169
 		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
170
+			if ( $callback[1] == '_default_tickets_update' ) {
171
+							unset( $update_callbacks[$key] );
172
+			}
171 173
 		}
172 174
 
173 175
 		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
@@ -273,8 +275,9 @@  discard block
 block discarded – undo
273 275
 			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
274 276
 			foreach ( $dtts_to_delete as $id ) {
275 277
 				$id = absint( $id );
276
-				if ( empty( $id ) )
277
-					continue;
278
+				if ( empty( $id ) ) {
279
+									continue;
280
+				}
278 281
 
279 282
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
280 283
 
@@ -512,8 +515,9 @@  discard block
 block discarded – undo
512 515
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
513 516
 
514 517
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
515
-			if ( $tkt_to_remove->get('TKT_is_default') )
516
-				continue;
518
+			if ( $tkt_to_remove->get('TKT_is_default') ) {
519
+							continue;
520
+			}
517 521
 
518 522
 			// if this tkt has any registrations attached so then we just ARCHIVE
519 523
 			// because we don't actually permanently delete these tickets.
@@ -688,13 +692,16 @@  discard block
 block discarded – undo
688 692
 		}
689 693
 
690 694
 		//possibly need to save tkt
691
-		if ( ! $ticket->ID() )
692
-			$ticket->save();
695
+		if ( ! $ticket->ID() ) {
696
+					$ticket->save();
697
+		}
693 698
 
694 699
 		foreach ( $prices as $row => $prc ) {
695 700
 			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
696
-			if ( empty($prt_id) )
697
-				continue; //prices MUST have a price type id.
701
+			if ( empty($prt_id) ) {
702
+							continue;
703
+			}
704
+			//prices MUST have a price type id.
698 705
 			$PRC_values = array(
699 706
 				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
700 707
 				'PRT_ID' => $prt_id,
@@ -838,8 +845,9 @@  discard block
 block discarded – undo
838 845
 				$datetime_tickets[$dttid][] = $tktrow;
839 846
 
840 847
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
841
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
842
-					$ticket_datetimes[$tktid][] = $dttrow;
848
+				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) {
849
+									$ticket_datetimes[$tktid][] = $dttrow;
850
+				}
843 851
 			}
844 852
 		}
845 853
 
Please login to merge, or discard this patch.
Spacing   +376 added lines, -376 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
61
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
61
+		EE_Registry::instance()->load_helper('DTT_Helper');
62 62
 
63 63
 		//if we were going to add our own metaboxes we'd use the below.
64 64
 		$this->_metaboxes = array(
65 65
 			0 => array(
66
-				'page_route' => array('edit','create_new'),
66
+				'page_route' => array('edit', 'create_new'),
67 67
 				'func' => 'pricing_metabox',
68 68
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
69 69
 				'priority' => 'high',
70 70
 				'context' => 'normal'
71 71
 				),
72 72
 
73
-			);/**/
73
+			); /**/
74 74
 
75 75
 		$this->_remove_metaboxes = array(
76 76
 			0 => array(
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 		 *
90 90
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
91 91
 		 */
92
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
93 93
 				'date' => 'Y-m-d',
94 94
 				'time' => 'h:i a'
95 95
 			));
96 96
 
97 97
 		//validate
98
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
99
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
98
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
99
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
100 100
 
101 101
 		//validate format strings
102
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
103
-		if ( is_array( $format_validation ) ) {
104
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
105
-			foreach ( $format_validation as $error ) {
106
-				$msg .= '<li>' . $error . '</li>';
102
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
103
+		if (is_array($format_validation)) {
104
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
105
+			foreach ($format_validation as $error) {
106
+				$msg .= '<li>'.$error.'</li>';
107 107
 			}
108
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
109
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
108
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
109
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
110 110
 			$this->_date_format_strings = array(
111 111
 				'date' => 'Y-m-d',
112 112
 				'time' => 'h:i a'
@@ -117,60 +117,60 @@  discard block
 block discarded – undo
117 117
 		$this->_scripts_styles = array(
118 118
 			'registers' => array(
119 119
 				'ee-tickets-datetimes-css' => array(
120
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
120
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
121 121
 					'type' => 'css'
122 122
 					),
123 123
 				'ee-dtt-ticket-metabox' => array(
124
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
124
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
125 125
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
126 126
 					)
127 127
 				),
128 128
 			'deregisters' => array(
129
-				'event-editor-css' => array('type' => 'css' ),
129
+				'event-editor-css' => array('type' => 'css'),
130 130
 				'event-datetime-metabox' => array('type' => 'js')
131 131
 				),
132 132
 			'enqueues' => array(
133
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
134
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
133
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
134
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
135 135
 				),
136 136
 			'localize' => array(
137 137
 				'ee-dtt-ticket-metabox' => array(
138 138
 					'DTT_TRASH_BLOCK' => array(
139 139
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
140 140
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
141
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
141
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
142 142
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143 143
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
144
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
144
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
145 145
 						),
146 146
 					'DTT_ERROR_MSG' => array(
147 147
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
148
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
148
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
149 149
 						),
150 150
 					'DTT_OVERSELL_WARNING' => array(
151 151
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
152 152
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
153 153
 						),
154
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
155
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
154
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
155
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
156 156
 					)
157 157
 				)
158 158
 			);
159 159
 
160 160
 
161
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
162
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
161
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
162
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
163 163
 	}
164 164
 
165 165
 
166 166
 
167
-	public function caf_updates( $update_callbacks ) {
168
-		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
167
+	public function caf_updates($update_callbacks) {
168
+		foreach ($update_callbacks as $key => $callback) {
169
+			if ($callback[1] == '_default_tickets_update')
170
+				unset($update_callbacks[$key]);
171 171
 		}
172 172
 
173
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
173
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
174 174
 		return $update_callbacks;
175 175
 	}
176 176
 
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param  array    $data   The request data from the form
184 184
 	 * @return bool             success or fail
185 185
 	 */
186
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
186
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
188
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
188
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
189 189
 		//next tackle the tickets (and prices?)
190
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
190
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
191 191
 	}
192 192
 
193 193
 
@@ -198,41 +198,41 @@  discard block
 block discarded – undo
198 198
 	 * @param  array    	$data    the request data from the form
199 199
 	 * @return EE_Datetime[]
200 200
 	 */
201
-	protected function _update_dtts( $evt_obj, $data ) {
202
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
201
+	protected function _update_dtts($evt_obj, $data) {
202
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
203 203
 		$saved_dtt_ids = array();
204 204
 		$saved_dtt_objs = array();
205 205
 
206
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
206
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
207 207
 			//trim all values to ensure any excess whitespace is removed.
208 208
 			$dtt = array_map(
209
-				function( $datetime_data ) {
210
-					return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data );
209
+				function($datetime_data) {
210
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
211 211
 				},
212 212
 				$dtt
213 213
 			);
214
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
214
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
215 215
 			$datetime_values = array(
216
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
217
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
218
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
216
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
217
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
218
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
219 219
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
220 220
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
221
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
222
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
221
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
222
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
223 223
 			);
224 224
 
225 225
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
226 226
 
227
-			if ( !empty( $dtt['DTT_ID'] ) ) {
228
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
227
+			if ( ! empty($dtt['DTT_ID'])) {
228
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
229 229
 
230 230
 				//set date and time format according to what is set in this class.
231
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
232
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
231
+				$DTM->set_date_format($this->_date_format_strings['date']);
232
+				$DTM->set_time_format($this->_date_format_strings['time']);
233 233
 
234
-				foreach ( $datetime_values as $field => $value ) {
235
-					$DTM->set( $field, $value );
234
+				foreach ($datetime_values as $field => $value) {
235
+					$DTM->set($field, $value);
236 236
 				}
237 237
 
238 238
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -240,24 +240,24 @@  discard block
 block discarded – undo
240 240
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
241 241
 
242 242
 			} else {
243
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
243
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
244 244
 
245 245
 				//reset date and times to match the format
246
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
247
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
248
-				foreach( $datetime_values as $field => $value ) {
249
-					$DTM->set( $field, $value );
246
+				$DTM->set_date_format($this->_date_format_strings['date']);
247
+				$DTM->set_time_format($this->_date_format_strings['time']);
248
+				foreach ($datetime_values as $field => $value) {
249
+					$DTM->set($field, $value);
250 250
 				}
251 251
 			}
252 252
 
253 253
 
254 254
 			$DTM->save();
255
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
255
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
256 256
 			$evt_obj->save();
257 257
 
258 258
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
259
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
260
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
259
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
260
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
261 261
 				EE_Registry::instance()->load_helper('DTT_Helper');
262 262
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
263 263
 				$DTM->save();
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 		}
274 274
 
275 275
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
276
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
276
+		$old_datetimes = explode(',', $data['datetime_IDs']);
277 277
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
278 278
 
279
-		if ( is_array( $old_datetimes ) ) {
280
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
281
-			foreach ( $dtts_to_delete as $id ) {
282
-				$id = absint( $id );
283
-				if ( empty( $id ) )
279
+		if (is_array($old_datetimes)) {
280
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
281
+			foreach ($dtts_to_delete as $id) {
282
+				$id = absint($id);
283
+				if (empty($id))
284 284
 					continue;
285 285
 
286 286
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
287 287
 
288 288
 				//remove tkt relationships.
289 289
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
290
-				foreach ( $related_tickets as $tkt ) {
290
+				foreach ($related_tickets as $tkt) {
291 291
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
292 292
 				}
293 293
 
294
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
294
+				$evt_obj->_remove_relation_to($id, 'Datetime');
295 295
 				$dtt_to_remove->refresh_cache_of_related_objects();
296 296
 
297 297
 			}
@@ -312,86 +312,86 @@  discard block
 block discarded – undo
312 312
 	 * @param  array            $data       incoming request data
313 313
 	 * @return EE_Ticket[]
314 314
 	 */
315
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
315
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
316 316
 
317 317
 		$new_tkt = null;
318 318
 		$new_default = null;
319 319
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
320 320
 		$data = stripslashes_deep($data);
321
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
321
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
322 322
 		$saved_tickets = $dtts_on_existing = array();
323
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
323
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
324 324
 
325 325
 		//load money helper
326
-		EE_Registry::instance()->load_helper( 'Money' );
326
+		EE_Registry::instance()->load_helper('Money');
327 327
 
328
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
328
+		foreach ($data['edit_tickets'] as $row => $tkt) {
329 329
 
330 330
 			$update_prices = $create_new_TKT = FALSE;
331 331
 
332 332
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
333 333
 
334
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
335
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
334
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
335
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
336 336
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
337 337
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
338 338
 
339 339
 			// trim inputs to ensure any excess whitespace is removed.
340 340
 			$tkt = array_map(
341
-				function( $ticket_data ) {
342
-					return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data );
341
+				function($ticket_data) {
342
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
343 343
 				},
344 344
 				$tkt
345 345
 			);
346 346
 
347 347
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
348 348
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
349
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
349
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
350 350
 
351 351
 			//note incoming base price needs converted from localized value.
352
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
352
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
353 353
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
354 354
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
355
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
355
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
356 356
 
357 357
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
358 358
 
359 359
 			$now = null;
360
-			if ( empty( $tkt['TKT_start_date'] ) ) {
360
+			if (empty($tkt['TKT_start_date'])) {
361 361
 				//lets' use now in the set timezone.
362
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
363
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
362
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
363
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
364 364
 			}
365 365
 
366
-			if ( empty( $tkt['TKT_end_date'] ) ) {
366
+			if (empty($tkt['TKT_end_date'])) {
367 367
 				/**
368 368
 				 * set the TKT_end_date to the first datetime attached to the ticket.
369 369
 				 */
370
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
371
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
370
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
371
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
372 372
 			}
373 373
 
374 374
 			$TKT_values = array(
375
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
376
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
377
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
378
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
375
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
376
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
377
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
378
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
379 379
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
380 380
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
381
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
382
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
383
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
384
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
381
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
382
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
383
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
384
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
385 385
 				'TKT_row' 			=> $row,
386
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
387
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
388
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
386
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
387
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
388
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
389 389
 				'TKT_price' 		=> $ticket_price
390 390
 			);
391 391
 
392 392
 
393 393
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
394
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
394
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
395 395
 				$TKT_values['TKT_ID'] = 0;
396 396
 				$TKT_values['TKT_is_default'] = 0;
397 397
 				$update_prices = TRUE;
@@ -403,21 +403,21 @@  discard block
 block discarded – undo
403 403
 			// but DID have it's items modified.
404 404
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
405 405
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
406
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
407
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
408
-				if ( $TKT instanceof EE_Ticket ) {
406
+			if (absint($TKT_values['TKT_ID'])) {
407
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
408
+				if ($TKT instanceof EE_Ticket) {
409 409
 
410
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
410
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
411 411
 					// are there any registrations using this ticket ?
412 412
 					$tickets_sold = $TKT->count_related(
413 413
 						'Registration',
414
-						array( array(
415
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
416
-						) )
414
+						array(array(
415
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
416
+						))
417 417
 					);
418 418
 					//set ticket formats
419
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
420
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
419
+					$TKT->set_date_format($this->_date_format_strings['date']);
420
+					$TKT->set_time_format($this->_date_format_strings['time']);
421 421
 
422 422
 					// let's just check the total price for the existing ticket
423 423
 					// and determine if it matches the new total price.
@@ -427,17 +427,17 @@  discard block
 block discarded – undo
427 427
 							? TRUE : FALSE;
428 428
 
429 429
 					//set new values
430
-					foreach ( $TKT_values as $field => $value ) {
431
-						if ( $field === 'TKT_qty' ) {
432
-							$TKT->set_qty( $value );
430
+					foreach ($TKT_values as $field => $value) {
431
+						if ($field === 'TKT_qty') {
432
+							$TKT->set_qty($value);
433 433
 						} else {
434
-							$TKT->set( $field, $value );
434
+							$TKT->set($field, $value);
435 435
 						}
436 436
 					}
437 437
 
438 438
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
439
-					if ( $create_new_TKT ) {
440
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
439
+					if ($create_new_TKT) {
440
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
441 441
 					}
442 442
 				}
443 443
 
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
 				$TKT = EE_Ticket::new_instance(
447 447
 					$TKT_values,
448 448
 					$timezone,
449
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
449
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
450 450
 				);
451
-				if ( $TKT instanceof EE_Ticket ) {
451
+				if ($TKT instanceof EE_Ticket) {
452 452
 					// make sure ticket has an ID of setting relations won't work
453 453
 					$TKT->save();
454
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
454
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
455 455
 					$update_prices = TRUE;
456 456
 				}
457 457
 			}
@@ -459,38 +459,38 @@  discard block
 block discarded – undo
459 459
 			//$TKT->save();
460 460
 
461 461
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
462
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
463
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
462
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
463
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
464 464
 				EE_Registry::instance()->load_helper('DTT_Helper');
465 465
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
466 466
 			}
467 467
 
468 468
 			//let's make sure the base price is handled
469
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
469
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
470 470
 
471 471
 			//add/update price_modifiers
472
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
472
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
473 473
 
474 474
 			//need to make sue that the TKT_price is accurate after saving the prices.
475 475
 			$TKT->ensure_TKT_Price_correct();
476 476
 
477 477
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
478
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
479
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
478
+			if ( ! defined('DOING_AUTOSAVE')) {
479
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
480 480
 					$update_prices = TRUE;
481 481
 					$new_default = clone $TKT;
482
-					$new_default->set( 'TKT_ID', 0 );
483
-					$new_default->set( 'TKT_is_default', 1 );
484
-					$new_default->set( 'TKT_row', 1 );
485
-					$new_default->set( 'TKT_price', $ticket_price );
482
+					$new_default->set('TKT_ID', 0);
483
+					$new_default->set('TKT_is_default', 1);
484
+					$new_default->set('TKT_row', 1);
485
+					$new_default->set('TKT_price', $ticket_price);
486 486
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
487 487
 					$new_default->_remove_relations('Datetime');
488 488
 					//todo we need to add the current attached prices as new prices to the new default ticket.
489
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
489
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
490 490
 					//don't forget the base price!
491
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
491
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
492 492
 					$new_default->save();
493
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
493
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
494 494
 				}
495 495
 			}
496 496
 
@@ -501,19 +501,19 @@  discard block
 block discarded – undo
501 501
 			//let's assign any tickets that have been setup to the saved_tickets tracker
502 502
 			//save existing TKT
503 503
 			$TKT->save();
504
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
504
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
505 505
 				//save new TKT
506 506
 				$new_tkt->save();
507 507
 				//add new ticket to array
508
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
508
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
509 509
 
510
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
510
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
511 511
 
512 512
 			} else {
513 513
 				//add tkt to saved tkts
514
-				$saved_tickets[ $TKT->ID() ] = $TKT;
514
+				$saved_tickets[$TKT->ID()] = $TKT;
515 515
 
516
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
516
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
517 517
 			}
518 518
 
519 519
 		}
@@ -523,22 +523,22 @@  discard block
 block discarded – undo
523 523
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
524 524
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
525 525
 		// No sense in keeping all the related data in the db!
526
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
527
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
526
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
527
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
528 528
 
529
-		foreach ( $tickets_removed as $id ) {
530
-			$id = absint( $id );
529
+		foreach ($tickets_removed as $id) {
530
+			$id = absint($id);
531 531
 
532 532
 			//get the ticket for this id
533 533
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
534 534
 
535 535
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
536
-			if ( $tkt_to_remove->get('TKT_is_default') )
536
+			if ($tkt_to_remove->get('TKT_is_default'))
537 537
 				continue;
538 538
 
539 539
 			// if this tkt has any registrations attached so then we just ARCHIVE
540 540
 			// because we don't actually permanently delete these tickets.
541
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
541
+			if ($tkt_to_remove->count_related('Registration') > 0) {
542 542
 				$tkt_to_remove->delete();
543 543
 				continue;
544 544
 			}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
548 548
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
549 549
 
550
-			foreach( $dtts as $dtt ) {
550
+			foreach ($dtts as $dtt) {
551 551
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
552 552
 			}
553 553
 
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
556 556
 			$tkt_to_remove->delete_related_permanently('Price');
557 557
 
558
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
558
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
559 559
 
560 560
 			// finally let's delete this ticket
561 561
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -587,39 +587,39 @@  discard block
 block discarded – undo
587 587
 		// and removing the ticket from datetimes it got removed from.
588 588
 
589 589
 		// first let's add datetimes
590
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
591
-			foreach ( $added_datetimes as $row_id ) {
592
-				$row_id = (int)$row_id;
593
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
594
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
590
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
591
+			foreach ($added_datetimes as $row_id) {
592
+				$row_id = (int) $row_id;
593
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
594
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
595 595
 					// Is this an existing ticket (has an ID) and does it have any sold?
596 596
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
597
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
598
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
599
-						$saved_datetimes[ $row_id ]->save();
597
+					if ($ticket->ID() && $ticket->sold() > 0) {
598
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
599
+						$saved_datetimes[$row_id]->save();
600 600
 					}
601 601
 				}
602 602
 			}
603 603
 		}
604 604
 		// then remove datetimes
605
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
606
-			foreach ( $removed_datetimes as $row_id ) {
607
-				$row_id = (int)$row_id;
605
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
606
+			foreach ($removed_datetimes as $row_id) {
607
+				$row_id = (int) $row_id;
608 608
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
609 609
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
610
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
611
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
610
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
611
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
612 612
 					// Is this an existing ticket (has an ID) and does it have any sold?
613 613
 					// If so, then we need to remove it's sold from the DTT_sold.
614
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
615
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
616
-						$saved_datetimes[ $row_id ]->save();
614
+					if ($ticket->ID() && $ticket->sold() > 0) {
615
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
616
+						$saved_datetimes[$row_id]->save();
617 617
 					}
618 618
 				}
619 619
 			}
620 620
 		}
621 621
 		// cap ticket qty by datetime reg limits
622
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
622
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
623 623
 		return $ticket;
624 624
 	}
625 625
 
@@ -640,39 +640,39 @@  discard block
 block discarded – undo
640 640
 		EE_Ticket $ticket,
641 641
 		$price_rows = array(),
642 642
 		$ticket_price = 0,
643
-		$base_price = 0 ,
643
+		$base_price = 0,
644 644
 		$base_price_id = 0
645 645
 	) {
646 646
 
647 647
 		// create new ticket that's a copy of the existing
648 648
 		// except a new id of course (and not archived)
649 649
 		// AND has the new TKT_price associated with it.
650
-		$new_ticket = clone( $ticket );
651
-		$new_ticket->set( 'TKT_ID', 0 );
652
-		$new_ticket->set( 'TKT_deleted', 0 );
653
-		$new_ticket->set( 'TKT_price', $ticket_price );
654
-		$new_ticket->set( 'TKT_sold', 0 );
650
+		$new_ticket = clone($ticket);
651
+		$new_ticket->set('TKT_ID', 0);
652
+		$new_ticket->set('TKT_deleted', 0);
653
+		$new_ticket->set('TKT_price', $ticket_price);
654
+		$new_ticket->set('TKT_sold', 0);
655 655
 		// let's get a new ID for this ticket
656 656
 		$new_ticket->save();
657 657
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
658
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
658
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
659 659
 		$new_ticket = $this->_update_ticket_datetimes(
660 660
 			$new_ticket,
661 661
 			$datetimes_on_existing,
662
-			array_keys( $datetimes_on_existing )
662
+			array_keys($datetimes_on_existing)
663 663
 		);
664 664
 
665 665
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
666 666
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
667 667
 		// available.
668
-		if ( $ticket->sold() > 0 ) {
668
+		if ($ticket->sold() > 0) {
669 669
 			$new_qty = $ticket->qty() - $ticket->sold();
670
-			$new_ticket->set_qty( $new_qty );
670
+			$new_ticket->set_qty($new_qty);
671 671
 		}
672 672
 		//now we update the prices just for this ticket
673
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
673
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
674 674
 		//and we update the base price
675
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
675
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
676 676
 		return $new_ticket;
677 677
 	}
678 678
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
693 693
 	 * @return EE_Ticket
694 694
 	 */
695
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
695
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
696 696
 
697 697
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
698 698
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 		$updated_prices = array();
701 701
 
702 702
 		// if $base_price ! FALSE then updating a base price.
703
-		if ( $base_price !== FALSE ) {
703
+		if ($base_price !== FALSE) {
704 704
 			$prices[1] = array(
705 705
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
706 706
 				'PRT_ID' => 1,
@@ -711,47 +711,47 @@  discard block
 block discarded – undo
711 711
 		}
712 712
 
713 713
 		//possibly need to save tkt
714
-		if ( ! $ticket->ID() )
714
+		if ( ! $ticket->ID())
715 715
 			$ticket->save();
716 716
 
717
-		foreach ( $prices as $row => $prc ) {
718
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
719
-			if ( empty($prt_id) )
717
+		foreach ($prices as $row => $prc) {
718
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
719
+			if (empty($prt_id))
720 720
 				continue; //prices MUST have a price type id.
721 721
 			$PRC_values = array(
722
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
722
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
723 723
 				'PRT_ID' => $prt_id,
724
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
725
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
726
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
724
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
725
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
726
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
727 727
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
728 728
 				'PRC_order' => $row
729 729
 				);
730
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
730
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
731 731
 				$PRC_values['PRC_ID'] = 0;
732
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
732
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
733 733
 			} else {
734
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
734
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
735 735
 				//update this price with new values
736
-				foreach ( $PRC_values as $field => $newprc ) {
737
-					$PRC->set( $field, $newprc );
736
+				foreach ($PRC_values as $field => $newprc) {
737
+					$PRC->set($field, $newprc);
738 738
 				}
739 739
 			}
740 740
 			$PRC->save();
741 741
 			$prcid = $PRC->ID();
742 742
 			$updated_prices[$prcid] = $PRC;
743
-			$ticket->_add_relation_to( $PRC, 'Price' );
743
+			$ticket->_add_relation_to($PRC, 'Price');
744 744
 		}
745 745
 
746 746
 		//now let's remove any prices that got removed from the ticket
747
-		if ( !empty ( $current_prices_on_ticket ) ) {
747
+		if ( ! empty ($current_prices_on_ticket)) {
748 748
 			$current = array_keys($current_prices_on_ticket);
749 749
 			$updated = array_keys($updated_prices);
750 750
 			$prices_to_remove = array_diff($current, $updated);
751
-			if ( !empty( $prices_to_remove ) ) {
752
-				foreach ( $prices_to_remove as $prc_id ) {
751
+			if ( ! empty($prices_to_remove)) {
752
+				foreach ($prices_to_remove as $prc_id) {
753 753
 					$p = $current_prices_on_ticket[$prc_id];
754
-					$ticket->_remove_relation_to( $p, 'Price' );
754
+					$ticket->_remove_relation_to($p, 'Price');
755 755
 
756 756
 					//delete permanently the price
757 757
 					$p->delete_permanently();
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
 
766 766
 
767
-	public function autosave_handling( $event_admin_obj ) {
767
+	public function autosave_handling($event_admin_obj) {
768 768
 		return $event_admin_obj; //doing nothing for the moment.
769 769
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
770 770
 
@@ -798,12 +798,12 @@  discard block
 block discarded – undo
798 798
 
799 799
 		//default main template args
800 800
 		$main_template_args = array(
801
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
801
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
802 802
 			'existing_datetime_ids' => '',
803 803
 			'total_dtt_rows' => 1,
804
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
804
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
805 805
 			'datetime_rows' => '',
806
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
806
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
807 807
 			'ticket_rows' => '',
808 808
 			'existing_ticket_ids' => '',
809 809
 			'total_ticket_rows' => 1,
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 
814 814
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
815 815
 
816
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
816
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
817 817
 
818 818
 		/**
819 819
 		 * 1. Start with retrieving Datetimes
@@ -821,25 +821,25 @@  discard block
 block discarded – undo
821 821
 		 * 3. For each ticket get related prices
822 822
 		 */
823 823
 
824
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
825
-		$times = $DTM->get_all_event_dates( $evtID );
824
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
825
+		$times = $DTM->get_all_event_dates($evtID);
826 826
 
827 827
 
828 828
 
829 829
 		$main_template_args['total_dtt_rows'] = count($times);
830
-		foreach ( $times as $time ) {
830
+		foreach ($times as $time) {
831 831
 			$dttid = $time->get('DTT_ID');
832 832
 			$dttrow = $time->get('DTT_order');
833 833
 			$existing_datetime_ids[] = $dttid;
834 834
 
835 835
 			//tickets attached
836
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
836
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
837 837
 
838 838
 			//if there are no related tickets this is likely a new event OR autodraft
839 839
 			// event so we need to generate the default tickets because dtts
840 840
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
841 841
 			// datetime on the event.
842
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
842
+			if (empty ($related_tickets) && count($times) < 2) {
843 843
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
844 844
 			}
845 845
 
@@ -848,11 +848,11 @@  discard block
 block discarded – undo
848 848
 
849 849
 			//loop through and setup the ticket rows and make sure the order is set.
850 850
 			$order = 0;
851
-			foreach ( $related_tickets as $ticket ) {
851
+			foreach ($related_tickets as $ticket) {
852 852
 				$tktid = $ticket->get('TKT_ID');
853 853
 				$tktrow = $ticket->get('TKT_row');
854 854
 				//we only want unique tickets in our final display!!
855
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
855
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
856 856
 					$existing_ticket_ids[] = $tktid;
857 857
 					$all_tickets[] = $ticket;
858 858
 				}
@@ -861,56 +861,56 @@  discard block
 block discarded – undo
861 861
 				$datetime_tickets[$dttid][] = $tktrow;
862 862
 
863 863
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
864
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
864
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
865 865
 					$ticket_datetimes[$tktid][] = $dttrow;
866 866
 			}
867 867
 		}
868 868
 
869
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
870
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
871
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
869
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
870
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
871
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
872 872
 
873 873
 		//sort $all_tickets by order
874
-		usort( $all_tickets, function( $a, $b ) {
874
+		usort($all_tickets, function($a, $b) {
875 875
 			$a_order = (int) $a->get('TKT_order');
876 876
 			$b_order = (int) $b->get('TKT_order');
877
-			if ( $a_order == $b_order ) {
877
+			if ($a_order == $b_order) {
878 878
 				return 0;
879 879
 			}
880
-			return ( $a_order < $b_order ) ? -1 : 1;
880
+			return ($a_order < $b_order) ? -1 : 1;
881 881
 		});
882 882
 
883 883
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
884 884
 		$dttrow = 1;
885
-		foreach ( $times as $time ) {
886
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
885
+		foreach ($times as $time) {
886
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
887 887
 			$dttrow++;
888 888
 		}
889 889
 
890 890
 		//then loop through all tickets for the ticket rows.
891 891
 		$tktrow = 1;
892
-		foreach ( $all_tickets as $ticket ) {
893
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
892
+		foreach ($all_tickets as $ticket) {
893
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
894 894
 			$tktrow++;
895 895
 		}
896 896
 
897 897
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
898
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
899
-		EEH_Template::display_template( $template, $main_template_args );
898
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
899
+		EEH_Template::display_template($template, $main_template_args);
900 900
 		return;
901 901
 	}
902 902
 
903 903
 
904 904
 
905
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
905
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
906 906
 
907 907
 		$dtt_display_template_args = array(
908
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
909
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
908
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
909
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
910 910
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
911 911
 			);
912
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
913
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
912
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
913
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
914 914
 	}
915 915
 
916 916
 
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 	 *
929 929
 	 * @return string Generated edit row.
930 930
 	 */
931
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
931
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
932 932
 
933 933
 		// if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true.
934 934
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -936,30 +936,30 @@  discard block
 block discarded – undo
936 936
 		$template_args = array(
937 937
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
938 938
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
939
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
939
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
940 940
 			'DTT_ID' => $default ? '' : $dtt->ID(),
941 941
 			'DTT_name' => $default ? '' : $dtt->name(),
942 942
 			'DTT_description' => $default ? '' : $dtt->description(),
943
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
944
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
945
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
943
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
944
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
945
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
946 946
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
947 947
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
948
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
949
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
948
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
949
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
950 950
 			);
951 951
 
952
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
952
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
953 953
 
954 954
 		//allow filtering of template args at this point.
955
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
955
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
956 956
 
957
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
958
-		return EEH_Template::display_template( $template, $template_args, TRUE );
957
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
958
+		return EEH_Template::display_template($template, $template_args, TRUE);
959 959
 	}
960 960
 
961 961
 
962
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
962
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
963 963
 
964 964
 		$template_args = array(
965 965
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -967,47 +967,47 @@  discard block
 block discarded – undo
967 967
 			'DTT_description' => $default ? '' : $dtt->description(),
968 968
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
969 969
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
970
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
970
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
971 971
 			'DTT_ID' => $default ? '' : $dtt->ID()
972 972
 			);
973 973
 
974 974
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
975
-		if ( !$default ) {
975
+		if ( ! $default) {
976 976
 			$tktrow = 1;
977
-			foreach ( $all_tickets as $ticket ) {
978
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
977
+			foreach ($all_tickets as $ticket) {
978
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
979 979
 				$tktrow++;
980 980
 			}
981 981
 		}
982 982
 
983 983
 		//filter template args at this point
984
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
984
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
985 985
 
986
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
987
-		return EEH_Template::display_template( $template, $template_args, TRUE );
986
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
987
+		return EEH_Template::display_template($template, $template_args, TRUE);
988 988
 	}
989 989
 
990 990
 
991 991
 
992
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
993
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
994
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
992
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
993
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
994
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
995 995
 
996
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
996
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
997 997
 		$template_args = array(
998 998
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
999
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
999
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1000 1000
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1001 1001
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1002
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
1003
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1002
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1003
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1004 1004
 			);
1005 1005
 
1006 1006
 		//filter template args
1007
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
1007
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1008 1008
 
1009
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1010
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1009
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1010
+		return EEH_Template::display_template($template, $template_args, TRUE);
1011 1011
 	}
1012 1012
 
1013 1013
 
@@ -1029,32 +1029,32 @@  discard block
 block discarded – undo
1029 1029
 	 *
1030 1030
 	 * @return [type] [description]
1031 1031
 	 */
1032
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1032
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1033 1033
 
1034 1034
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1035
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1035
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1036 1036
 
1037 1037
 
1038
-		$prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1038
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1039 1039
 
1040 1040
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1041
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1041
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1042 1042
 
1043
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1043
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1044 1044
 
1045 1045
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1046
-		$base_price = $default ? NULL :  $ticket->base_price();
1046
+		$base_price = $default ? NULL : $ticket->base_price();
1047 1047
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1048 1048
 
1049 1049
 		//breaking out complicated condition for ticket_status
1050
-		if ( $default ) {
1051
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1050
+		if ($default) {
1051
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1052 1052
 		} else {
1053
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1053
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1054 1054
 		}
1055 1055
 
1056 1056
 		//breaking out complicated condition for TKT_taxable
1057
-		if ( $default ) {
1057
+		if ($default) {
1058 1058
 			$TKT_taxable = '';
1059 1059
 		} else {
1060 1060
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1069,19 +1069,19 @@  discard block
 block discarded – undo
1069 1069
 			'edit_tkt_expanded' => '',
1070 1070
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1071 1071
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1072
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1073
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1074
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1072
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1073
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1074
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1075 1075
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1076 1076
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1077 1077
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1078
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1079
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1080
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1081
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1082
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1078
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1079
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1080
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1081
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1082
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1083 1083
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1084
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1084
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1085 1085
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1086 1086
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1087 1087
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1090,99 +1090,99 @@  discard block
 block discarded – undo
1090 1090
 			'ticket_price_rows' => '',
1091 1091
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1092 1092
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1093
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1094
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1093
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1094
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1095 1095
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1096 1096
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1097 1097
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1098 1098
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1099
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1099
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1100 1100
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1101 1101
 			'TKT_taxable' => $TKT_taxable,
1102 1102
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1103 1103
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1104
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1104
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1105 1105
 			'TKT_subtotal_amount' => $ticket_subtotal,
1106
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1107
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1106
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1107
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1108 1108
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1109 1109
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1110 1110
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1111 1111
 			);
1112 1112
 
1113
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1113
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1114 1114
 
1115 1115
 		//handle rows that should NOT be empty
1116
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1116
+		if (empty($template_args['TKT_start_date'])) {
1117 1117
 			//if empty then the start date will be now.
1118
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1119
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1118
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1119
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1120 1120
 		}
1121 1121
 
1122
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1122
+		if (empty($template_args['TKT_end_date'])) {
1123 1123
 
1124 1124
 			//get the earliest datetime (if present);
1125
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1125
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1126 1126
 
1127
-			if ( !empty( $earliest_dtt ) ) {
1128
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1127
+			if ( ! empty($earliest_dtt)) {
1128
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1129 1129
 			} else {
1130 1130
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1131
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1131
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1132 1132
 			}
1133
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1133
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1134 1134
 		}
1135 1135
 
1136 1136
 		//generate ticket_datetime items
1137
-		if ( ! $default ) {
1137
+		if ( ! $default) {
1138 1138
 			$dttrow = 1;
1139
-			foreach ( $all_dtts as $dtt ) {
1140
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1139
+			foreach ($all_dtts as $dtt) {
1140
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1141 1141
 				$dttrow++;
1142 1142
 			}
1143 1143
 		}
1144 1144
 
1145 1145
 		$prcrow = 1;
1146
-		foreach ( $prices as $price ) {
1147
-			if ( $price->is_base_price() ) {
1146
+		foreach ($prices as $price) {
1147
+			if ($price->is_base_price()) {
1148 1148
 				$prcrow++;
1149 1149
 				continue;
1150 1150
 			}
1151
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1152
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1153
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1151
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1152
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1153
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1154 1154
 			$prcrow++;
1155 1155
 		}
1156 1156
 
1157 1157
 		//filter $template_args
1158
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1158
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1159 1159
 
1160
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1161
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1160
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1161
+		return EEH_Template::display_template($template, $template_args, TRUE);
1162 1162
 	}
1163 1163
 
1164 1164
 
1165 1165
 
1166 1166
 
1167 1167
 
1168
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1168
+	protected function _get_tax_rows($tktrow, $ticket) {
1169 1169
 		$tax_rows = '';
1170
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1170
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1171 1171
 		$template_args = array();
1172
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1173
-		foreach ( $taxes as $tax ) {
1174
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1172
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1173
+		foreach ($taxes as $tax) {
1174
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1175 1175
 			$template_args = array(
1176
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1176
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1177 1177
 				'tax_id' => $tax->ID(),
1178 1178
 				'tkt_row' => $tktrow,
1179 1179
 				'tax_label' => $tax->get('PRC_name'),
1180 1180
 				'tax_added' => $tax_added,
1181
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1181
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1182 1182
 				'tax_amount' => $tax->get('PRC_amount')
1183 1183
 				);
1184
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1185
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1184
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1185
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1186 1186
 		}
1187 1187
 
1188 1188
 
@@ -1190,81 +1190,81 @@  discard block
 block discarded – undo
1190 1190
 	}
1191 1191
 
1192 1192
 
1193
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1194
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1193
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1194
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1195 1195
 		return $subtotal * $tax->get('PRC_amount') / 100;
1196 1196
 	}
1197 1197
 
1198 1198
 
1199 1199
 
1200 1200
 
1201
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1202
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1201
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1202
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1203 1203
 		$template_args = array(
1204 1204
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1205 1205
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1206 1206
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1207
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1207
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1208 1208
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1209 1209
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1210 1210
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1211 1211
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1212 1212
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1213
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1214
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1215
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1216
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1217
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1213
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1214
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1215
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1216
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1217
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1218 1218
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1219 1219
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1220
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1221
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1220
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1221
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1222 1222
 			);
1223 1223
 
1224
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1224
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1225 1225
 
1226
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1227
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1226
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1227
+		return EEH_Template::display_template($template, $template_args, TRUE);
1228 1228
 	}
1229 1229
 
1230 1230
 
1231
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1232
-		if ( $price->is_base_price() ) {
1233
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1231
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1232
+		if ($price->is_base_price()) {
1233
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1234 1234
 		} else {
1235
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1235
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1236 1236
 		}
1237 1237
 
1238 1238
 	}
1239 1239
 
1240 1240
 
1241
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1241
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1242 1242
 		$template_args = array(
1243 1243
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1244
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1245
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1244
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1245
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1246 1246
 				'PRT_name' => __('Price', 'event_espresso'),
1247 1247
 				'price_selected_operator' => '+',
1248 1248
 				'price_selected_is_percent' => 0
1249 1249
 			);
1250
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1250
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1251 1251
 
1252
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1252
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1253 1253
 
1254
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1254
+		return EEH_Template::display_template($template, $template_args, TRUE);
1255 1255
 	}
1256 1256
 
1257 1257
 
1258 1258
 
1259
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1260
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1261
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1262
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1263
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1264
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1259
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1260
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1261
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1262
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1263
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1264
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1265 1265
 		$price_option_spans = '';
1266 1266
 		//setup pricetypes for selector
1267
-		foreach ( $price_types as $price_type ) {
1267
+		foreach ($price_types as $price_type) {
1268 1268
 			$all_price_types[] = array(
1269 1269
 				'id' => $price_type->ID(),
1270 1270
 				'text' => $price_type->get('PRT_name'),
@@ -1276,50 +1276,50 @@  discard block
 block discarded – undo
1276 1276
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1277 1277
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1278 1278
 				);
1279
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1279
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1280 1280
 		}
1281 1281
 
1282
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1282
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1283 1283
 		$main_name = $select_name;
1284
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1284
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1285 1285
 
1286 1286
 		$template_args = array(
1287 1287
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1288
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1289
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1288
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1289
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1290 1290
 			'main_name' => $main_name,
1291 1291
 			'selected_price_type_id' => $selected_price_type_id,
1292 1292
 			'price_option_spans' => $price_option_spans,
1293
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1294
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1293
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1294
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1295 1295
 			'disabled' => $disabled
1296 1296
 			);
1297 1297
 
1298
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1298
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1299 1299
 
1300
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1300
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1301 1301
 
1302
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1302
+		return EEH_Template::display_template($template, $template_args, TRUE);
1303 1303
 	}
1304 1304
 
1305 1305
 
1306 1306
 
1307
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1308
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1309
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1310
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1307
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1308
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1309
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1310
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1311 1311
 		$template_args = array(
1312
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1312
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1313 1313
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1314
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1315
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1316
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1314
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1315
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1316
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1317 1317
 			'tkt_status_class' => '',
1318 1318
 			);
1319 1319
 
1320
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1321
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1322
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1320
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1321
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1322
+		return EEH_Template::display_template($template, $template_args, TRUE);
1323 1323
 	}
1324 1324
 
1325 1325
 
@@ -1327,53 +1327,53 @@  discard block
 block discarded – undo
1327 1327
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1328 1328
 		$template_args = array(
1329 1329
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1330
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1331
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1330
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1331
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1332 1332
 			'default_price_rows' => '',
1333 1333
 			'default_base_price_amount' => 0,
1334 1334
 			'default_base_price_name' => '',
1335 1335
 			'default_base_price_description' => '',
1336
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1337
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1336
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1337
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1338 1338
 			'existing_available_datetime_tickets_list' => '',
1339 1339
 			'existing_available_ticket_datetimes_list' => '',
1340
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1341
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1340
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1341
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1342 1342
 			);
1343 1343
 
1344 1344
 		$tktrow = 1;
1345
-		foreach ( $all_tickets as $ticket ) {
1346
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1345
+		foreach ($all_tickets as $ticket) {
1346
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1347 1347
 			$tktrow++;
1348 1348
 		}
1349 1349
 
1350 1350
 
1351 1351
 		$dttrow = 1;
1352
-		foreach ( $all_dtts as $dtt ) {
1353
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1352
+		foreach ($all_dtts as $dtt) {
1353
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1354 1354
 			$dttrow++;
1355 1355
 		}
1356 1356
 
1357 1357
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1358 1358
 		$prcrow = 1;
1359
-		foreach ( $default_prices as $price ) {
1360
-			if ( $price->is_base_price() ) {
1359
+		foreach ($default_prices as $price) {
1360
+			if ($price->is_base_price()) {
1361 1361
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1362 1362
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1363 1363
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1364 1364
 				$prcrow++;
1365 1365
 				continue;
1366 1366
 			}
1367
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1368
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1369
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1367
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1368
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1369
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1370 1370
 			$prcrow++;
1371 1371
 		}
1372 1372
 
1373
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1373
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1374 1374
 
1375
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1376
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1375
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1376
+		return EEH_Template::display_template($template, $template_args, TRUE);
1377 1377
 	}
1378 1378
 
1379 1379
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Mijireh/EEG_Mijireh.gateway.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@
 block discarded – undo
173 173
 	 *
174 174
 	 * @param array $update_info unused. We just use the $transaction
175 175
 	 * @param EEI_Transaction $transaction
176
-	 * @return \EEI_Payment|null
176
+	 * @return EEI_Payment
177 177
 	 */
178 178
 	public function handle_payment_update($update_info, $transaction) {
179 179
 
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @author				Mike Nelson
9 9
  *
10 10
  */
11
-class EEG_Mijireh extends EE_Offsite_Gateway{
11
+class EEG_Mijireh extends EE_Offsite_Gateway {
12 12
 
13 13
 	protected $_access_key;
14 14
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 		$primary_attendee = $primary_registrant->attendee();
38 38
 		$items = array();
39 39
 		//if we're are charging for the full amount, show the normal line items
40
-		if( $this->_can_easily_itemize_transaction_for( $payment )){
40
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
41 41
 			$total_line_item = $transaction->total_line_item();
42 42
 			$tax_total = $total_line_item->get_total_tax();
43
-			foreach($total_line_item->get_items() as $line_item){
43
+			foreach ($total_line_item->get_items() as $line_item) {
44 44
 				$items[] = array(
45 45
 					'name'=>$line_item->name(),
46 46
 					'price'=>$this->format_currency($line_item->unit_price()),
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 					'quantity'=>$line_item->quantity()
49 49
 				);
50 50
 			}
51
-		}else{//its a partial payment
51
+		} else {//its a partial payment
52 52
 			$tax_total = 0;
53 53
 			//partial payment, so just add 1 item
54 54
 			$items[] = array(
55
-				'name'=>  sprintf(__("Partial payment for registration %s", 'event_espresso'),$primary_registrant->reg_code()),
55
+				'name'=>  sprintf(__("Partial payment for registration %s", 'event_espresso'), $primary_registrant->reg_code()),
56 56
 				'price'=> $this->format_currency($payment->amount()),
57 57
 				'sku'=>$primary_registrant->reg_code(),
58 58
 				'quantity'=>1
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
 		$order = array(
62 62
 			'total'=>$this->format_currency($payment->amount()),
63 63
 			'return_url'=>$return_url,
64
-			'items'=>$this->_prepare_for_mijireh( $items ),
64
+			'items'=>$this->_prepare_for_mijireh($items),
65 65
 			'email'=>$primary_attendee->email(),
66 66
 			'first_name'=>$primary_attendee->fname(),
67 67
 			'last_name'=>$primary_attendee->lname(),
68 68
 			'tax'=>$this->format_currency($tax_total),
69 69
 			'partner_id'=>'ee');
70 70
 		//setup address?
71
-		if(		$primary_attendee->address()  &&
72
-				$primary_attendee->city()  &&
73
-				$primary_attendee->state_ID()  &&
74
-				$primary_attendee->country_ID()  &&
75
-				$primary_attendee->zip()  ){
71
+		if ($primary_attendee->address() &&
72
+				$primary_attendee->city() &&
73
+				$primary_attendee->state_ID() &&
74
+				$primary_attendee->country_ID() &&
75
+				$primary_attendee->zip()) {
76 76
 			$shipping_address = array(
77 77
 				'first_name'=>$primary_attendee->fname(),
78 78
 				'last_name'=>$primary_attendee->lname(),
@@ -82,61 +82,61 @@  discard block
 block discarded – undo
82 82
 				'zip_code' => $primary_attendee->zip(),
83 83
 				'country' => $primary_attendee->country_ID()
84 84
 			);
85
-			if( $primary_attendee->address2() ){
86
-				$shipping_address[ 'apt_suite' ] = $primary_attendee->address2();
85
+			if ($primary_attendee->address2()) {
86
+				$shipping_address['apt_suite'] = $primary_attendee->address2();
87 87
 			}
88
-			if( $primary_attendee->phone() ){
89
-				$shipping_address[ 'phone' ] = $primary_attendee->phone();
88
+			if ($primary_attendee->phone()) {
89
+				$shipping_address['phone'] = $primary_attendee->phone();
90 90
 			}
91
-			$order[ 'shipping_address' ] = $shipping_address;
91
+			$order['shipping_address'] = $shipping_address;
92 92
 		}
93
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)) );
93
+		do_action('AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)));
94 94
 				$args = array(
95 95
 		'headers' => array(
96
-			'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ),
96
+			'Authorization' => 'Basic '.base64_encode($this->_access_key.':'),
97 97
 			'Accept'=>'application/json'
98 98
 			),
99 99
 		'body'=>  json_encode($order)
100 100
 		);
101
-		$response = wp_remote_post( $this->_mijireh_api_orders_url, $args );
101
+		$response = wp_remote_post($this->_mijireh_api_orders_url, $args);
102 102
                 $problems_string = false;
103
-		$this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment);
104
-		if( ! $response instanceof WP_Error ){
103
+		$this->log(array('get checkout url request_args' => $args, 'response' => $response), $payment);
104
+		if ( ! $response instanceof WP_Error) {
105 105
 			$response_body = json_decode($response['body']);
106
-			if($response_body && isset($response_body->checkout_url)){
106
+			if ($response_body && isset($response_body->checkout_url)) {
107 107
                             $payment->set_redirect_url($response_body->checkout_url);
108 108
                             $payment->set_txn_id_chq_nmbr($response_body->order_number);
109 109
                             $payment->set_details($response['body']);
110 110
 			} else {
111
-                           if( is_array( $response_body ) || is_object( $response_body)){
112
-                                    $response_body_as_array = (array)$response_body;
113
-                                    foreach($response_body_as_array as $problem_parameter => $problems){
114
-                                            $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
111
+                           if (is_array($response_body) || is_object($response_body)) {
112
+                                    $response_body_as_array = (array) $response_body;
113
+                                    foreach ($response_body_as_array as $problem_parameter => $problems) {
114
+                                            $problems_string .= sprintf(__('\nProblems with %s: %s', 'event_espresso'), $problem_parameter, implode(", ", $problems));
115 115
                                     }
116
-                            }else{
116
+                            } else {
117 117
                                     $problems_string = $response['body'];
118 118
                             }
119
-                            if( ! $problems_string ) {
119
+                            if ( ! $problems_string) {
120 120
                                 //no message to show? wack
121
-                                if( isset( $response[ 'headers' ][ 'status' ] ) ){
122
-                                        $problems_string = $response[ 'headers' ][ 'status' ];
123
-                                }else{
124
-                                        $problems_string = __( 'No response from Mijireh', 'event_espresso' );
121
+                                if (isset($response['headers']['status'])) {
122
+                                        $problems_string = $response['headers']['status'];
123
+                                } else {
124
+                                        $problems_string = __('No response from Mijireh', 'event_espresso');
125 125
                                 }
126 126
                             }
127 127
                         }
128
-		}else{
129
-                    $problems_string = implode( ",", $response->get_error_messages() );
128
+		} else {
129
+                    $problems_string = implode(",", $response->get_error_messages());
130 130
 		}
131 131
                 
132
-                if( $problems_string ) {
133
-                    $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
134
-                    $payment->set_details( $response );
135
-                    $payment->set_redirect_url( null );
132
+                if ($problems_string) {
133
+                    $payment->set_gateway_response(sprintf(__('Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string));
134
+                    $payment->set_details($response);
135
+                    $payment->set_redirect_url(null);
136 136
                     //even though the payment's status is failed at this point anyways,
137 137
                     //let's be explicit about it. The fact that the redirect url is null
138 138
                     //should be enough to client code that they can't redirect the user
139
-                    $payment->set_status( $this->_pay_model->failed_status() );
139
+                    $payment->set_status($this->_pay_model->failed_status());
140 140
                 }
141 141
 		return $payment;
142 142
 	}
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 	 * @param mixed $data
150 150
 	 * @return mixed same type as $data
151 151
 	 */
152
-	private function _prepare_for_mijireh( $data ){
153
-		if( is_array( $data ) ){
152
+	private function _prepare_for_mijireh($data) {
153
+		if (is_array($data)) {
154 154
 			$prepared_data = array();
155
-			foreach($data as $key => $datum ){
156
-				$prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum );
155
+			foreach ($data as $key => $datum) {
156
+				$prepared_data[$key] = $this->_prepare_for_mijireh($datum);
157 157
 			}
158 158
 			return $prepared_data;
159
-		}elseif(is_string( $data ) ){
160
-			return str_replace( '%', 'percent', $data );
161
-		}else{
159
+		}elseif (is_string($data)) {
160
+			return str_replace('%', 'percent', $data);
161
+		} else {
162 162
 			return $data;
163 163
 		}
164 164
 	}
@@ -179,30 +179,30 @@  discard block
 block discarded – undo
179 179
 
180 180
 		$payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL;
181 181
 
182
-		if ( ! $payment instanceof EEI_Payment ){
183
-			throw new EE_Error( sprintf( __( "Could not find Mijireh payment for transaction %s", 'event_espresso' ), $transaction->ID() ) );
182
+		if ( ! $payment instanceof EEI_Payment) {
183
+			throw new EE_Error(sprintf(__("Could not find Mijireh payment for transaction %s", 'event_espresso'), $transaction->ID()));
184 184
 		}
185 185
 
186 186
 		$request_args = array(
187 187
 			'headers' => array(
188
-				'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ),
188
+				'Authorization' => 'Basic '.base64_encode($this->_access_key.':'),
189 189
 				'Accept'=>'application/json'
190 190
 			)
191 191
 		);
192 192
 
193 193
 		$response = wp_remote_get(
194
-			$this->_mijireh_api_orders_url . '/' . $payment->txn_id_chq_nmbr(),
194
+			$this->_mijireh_api_orders_url.'/'.$payment->txn_id_chq_nmbr(),
195 195
 			$request_args
196 196
 		);
197 197
 
198 198
 		$this->log(
199
-			array( 'get payment status request_args' => $request_args, 'response' => $response ),
199
+			array('get payment status request_args' => $request_args, 'response' => $response),
200 200
 			$payment
201 201
 		);
202 202
 		// validate response
203
-		$response_body = isset( $response[ 'body' ] ) ? json_decode( $response[ 'body' ] ) : '';
204
-		if( $response && $response_body ){
205
-			switch( $response_body->status ){
203
+		$response_body = isset($response['body']) ? json_decode($response['body']) : '';
204
+		if ($response && $response_body) {
205
+			switch ($response_body->status) {
206 206
 				case 'paid':
207 207
 					$payment->set_status($this->_pay_model->approved_status());
208 208
 					break;
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 			}
215 215
 
216 216
 		} else {
217
-			$payment->set_gateway_response( __( 'Response from Mijireh could not be understood.', 'event_espresso' ) );
218
-			$payment->set_details( $response );
219
-			$payment->set_status( $this->_pay_model->failed_status() );
217
+			$payment->set_gateway_response(__('Response from Mijireh could not be understood.', 'event_espresso'));
218
+			$payment->set_details($response);
219
+			$payment->set_status($this->_pay_model->failed_status());
220 220
 		}
221 221
 		// the following is ONLY for testing the Mijireh IPN and should NEVER be uncommented for real usage
222 222
 //		$payment->set_status( $this->_pay_model->pending_status() );
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 					'quantity'=>$line_item->quantity()
49 49
 				);
50 50
 			}
51
-		}else{//its a partial payment
51
+		} else{//its a partial payment
52 52
 			$tax_total = 0;
53 53
 			//partial payment, so just add 1 item
54 54
 			$items[] = array(
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
                                     foreach($response_body_as_array as $problem_parameter => $problems){
114 114
                                             $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
115 115
                                     }
116
-                            }else{
116
+                            } else{
117 117
                                     $problems_string = $response['body'];
118 118
                             }
119 119
                             if( ! $problems_string ) {
120 120
                                 //no message to show? wack
121 121
                                 if( isset( $response[ 'headers' ][ 'status' ] ) ){
122 122
                                         $problems_string = $response[ 'headers' ][ 'status' ];
123
-                                }else{
123
+                                } else{
124 124
                                         $problems_string = __( 'No response from Mijireh', 'event_espresso' );
125 125
                                 }
126 126
                             }
127 127
                         }
128
-		}else{
128
+		} else{
129 129
                     $problems_string = implode( ",", $response->get_error_messages() );
130 130
 		}
131 131
                 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 				$prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum );
157 157
 			}
158 158
 			return $prepared_data;
159
-		}elseif(is_string( $data ) ){
159
+		} elseif(is_string( $data ) ){
160 160
 			return str_replace( '%', 'percent', $data );
161
-		}else{
161
+		} else{
162 162
 			return $data;
163 163
 		}
164 164
 	}
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- *
4
- * EEG_Mijireh
5
- *
6
- * @package			Event Espresso
7
- * @subpackage
8
- * @author				Mike Nelson
9
- *
10
- */
3
+	 *
4
+	 * EEG_Mijireh
5
+	 *
6
+	 * @package			Event Espresso
7
+	 * @subpackage
8
+	 * @author				Mike Nelson
9
+	 *
10
+	 */
11 11
 class EEG_Mijireh extends EE_Offsite_Gateway{
12 12
 
13 13
 	protected $_access_key;
@@ -99,45 +99,45 @@  discard block
 block discarded – undo
99 99
 		'body'=>  json_encode($order)
100 100
 		);
101 101
 		$response = wp_remote_post( $this->_mijireh_api_orders_url, $args );
102
-                $problems_string = false;
102
+				$problems_string = false;
103 103
 		$this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment);
104 104
 		if( ! $response instanceof WP_Error ){
105 105
 			$response_body = json_decode($response['body']);
106 106
 			if($response_body && isset($response_body->checkout_url)){
107
-                            $payment->set_redirect_url($response_body->checkout_url);
108
-                            $payment->set_txn_id_chq_nmbr($response_body->order_number);
109
-                            $payment->set_details($response['body']);
107
+							$payment->set_redirect_url($response_body->checkout_url);
108
+							$payment->set_txn_id_chq_nmbr($response_body->order_number);
109
+							$payment->set_details($response['body']);
110 110
 			} else {
111
-                           if( is_array( $response_body ) || is_object( $response_body)){
112
-                                    $response_body_as_array = (array)$response_body;
113
-                                    foreach($response_body_as_array as $problem_parameter => $problems){
114
-                                            $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
115
-                                    }
116
-                            }else{
117
-                                    $problems_string = $response['body'];
118
-                            }
119
-                            if( ! $problems_string ) {
120
-                                //no message to show? wack
121
-                                if( isset( $response[ 'headers' ][ 'status' ] ) ){
122
-                                        $problems_string = $response[ 'headers' ][ 'status' ];
123
-                                }else{
124
-                                        $problems_string = __( 'No response from Mijireh', 'event_espresso' );
125
-                                }
126
-                            }
127
-                        }
111
+						   if( is_array( $response_body ) || is_object( $response_body)){
112
+									$response_body_as_array = (array)$response_body;
113
+									foreach($response_body_as_array as $problem_parameter => $problems){
114
+											$problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
115
+									}
116
+							}else{
117
+									$problems_string = $response['body'];
118
+							}
119
+							if( ! $problems_string ) {
120
+								//no message to show? wack
121
+								if( isset( $response[ 'headers' ][ 'status' ] ) ){
122
+										$problems_string = $response[ 'headers' ][ 'status' ];
123
+								}else{
124
+										$problems_string = __( 'No response from Mijireh', 'event_espresso' );
125
+								}
126
+							}
127
+						}
128 128
 		}else{
129
-                    $problems_string = implode( ",", $response->get_error_messages() );
129
+					$problems_string = implode( ",", $response->get_error_messages() );
130 130
 		}
131 131
                 
132
-                if( $problems_string ) {
133
-                    $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
134
-                    $payment->set_details( $response );
135
-                    $payment->set_redirect_url( null );
136
-                    //even though the payment's status is failed at this point anyways,
137
-                    //let's be explicit about it. The fact that the redirect url is null
138
-                    //should be enough to client code that they can't redirect the user
139
-                    $payment->set_status( $this->_pay_model->failed_status() );
140
-                }
132
+				if( $problems_string ) {
133
+					$payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
134
+					$payment->set_details( $response );
135
+					$payment->set_redirect_url( null );
136
+					//even though the payment's status is failed at this point anyways,
137
+					//let's be explicit about it. The fact that the redirect url is null
138
+					//should be enough to client code that they can't redirect the user
139
+					$payment->set_status( $this->_pay_model->failed_status() );
140
+				}
141 141
 		return $payment;
142 142
 	}
143 143
 
Please login to merge, or discard this patch.
core/db_classes/EE_Payment_Method.class.php 1 patch
Doc Comments   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 	/**
114 114
 	 * Gets button_url
115
-	 * @return string
115
+	 * @return boolean
116 116
 	 */
117 117
 	function button_url() {
118 118
 		return $this->get('PMD_button_url');
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
 	/**
154 154
 	 * Gets description
155
-	 * @return string
155
+	 * @return boolean
156 156
 	 */
157 157
 	function description() {
158 158
 		return $this->get('PMD_desc');
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 	/**
174 174
 	 * Gets name
175
-	 * @return string
175
+	 * @return boolean
176 176
 	 */
177 177
 	function name() {
178 178
 		return $this->get('PMD_name');
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 	/**
214 214
 	 * Gets order
215
-	 * @return int
215
+	 * @return boolean
216 216
 	 */
217 217
 	function order() {
218 218
 		return $this->get('PMD_order');
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
 	/**
234 234
 	 * Gets slug
235
-	 * @return string
235
+	 * @return boolean
236 236
 	 */
237 237
 	function slug() {
238 238
 		return $this->get('PMD_slug');
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
 	/**
254 254
 	 * Gets type
255
-	 * @return string
255
+	 * @return boolean
256 256
 	 */
257 257
 	function type() {
258 258
 		return $this->get('PMD_type');
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
 	/**
274 274
 	 * Gets wp_user
275
-	 * @return int
275
+	 * @return boolean
276 276
 	 */
277 277
 	function wp_user() {
278 278
 		return $this->get('PMD_wp_user');
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
 	/**
309 309
 	 * Gets admin_name
310
-	 * @return string
310
+	 * @return boolean
311 311
 	 */
312 312
 	function admin_name() {
313 313
 		return $this->get('PMD_admin_name');
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
 	/**
329 329
 	 * Gets admin_desc
330
-	 * @return string
330
+	 * @return boolean
331 331
 	 */
332 332
 	function admin_desc() {
333 333
 		return $this->get('PMD_admin_desc');
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
 	/**
349 349
 	 * Gets scope
350
-	 * @return array
350
+	 * @return boolean
351 351
 	 */
352 352
 	function scope() {
353 353
 		return $this->get('PMD_scope');
Please login to merge, or discard this patch.
core/db_classes/EE_Post_Meta.class.php 2 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	/**
51 51
 	 * Gets meta_id
52
-	 * @return int
52
+	 * @return boolean
53 53
 	 */
54 54
 	function meta_id() {
55 55
 		return $this->get( 'meta_id' );
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * Sets meta_id
62 62
 	 * @param int $meta_id
63
-	 * @return boolean
63
+	 * @return boolean|null
64 64
 	 */
65 65
 	function set_meta_id( $meta_id) {
66 66
 		return $this->set( 'meta_id', $meta_id);
67 67
 	}
68 68
 	/**
69 69
 	 * Gets post_id
70
-	 * @return int
70
+	 * @return boolean
71 71
 	 */
72 72
 	function post_id() {
73 73
 		return $this->get( 'post_id' );
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 	/**
79 79
 	 * Sets post_id
80 80
 	 * @param int $post_id
81
-	 * @return boolean
81
+	 * @return boolean|null
82 82
 	 */
83 83
 	function set_post_id( $post_id) {
84 84
 		return $this->set( 'post_id', $post_id);
85 85
 	}
86 86
 	/**
87 87
 	 * Gets meta_key
88
-	 * @return string
88
+	 * @return boolean
89 89
 	 */
90 90
 	function meta_key() {
91 91
 		return $this->get( 'meta_key' );
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * Sets meta_key
98 98
 	 * @param string $meta_key
99
-	 * @return boolean
99
+	 * @return boolean|null
100 100
 	 */
101 101
 	function set_meta_key( $meta_key) {
102 102
 		return $this->set( 'meta_key', $meta_key);
103 103
 	}
104 104
 	/**
105 105
 	 * Gets meta_value
106
-	 * @return mixed
106
+	 * @return boolean
107 107
 	 */
108 108
 	function meta_value() {
109 109
 		return $this->get( 'meta_value' );
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * Sets meta_value
116 116
 	 * @param mixed $meta_value
117
-	 * @return boolean
117
+	 * @return boolean|null
118 118
 	 */
119 119
 	function set_meta_value( $meta_value) {
120 120
 		return $this->set( 'meta_value', $meta_value);
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 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
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @param array $props_n_values
31 31
 	 * @return EE_Post_Meta|mixed
32 32
 	 */
33
-	public static function new_instance( $props_n_values = array() ) {
34
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
35
-		return $has_object ? $has_object : new self( $props_n_values );
33
+	public static function new_instance($props_n_values = array()) {
34
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
35
+		return $has_object ? $has_object : new self($props_n_values);
36 36
 	}
37 37
 
38 38
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @param array $props_n_values
42 42
 	 * @return EE_Post_Meta
43 43
 	 */
44
-	public static function new_instance_from_db( $props_n_values = array() ) {
45
-		return new self( $props_n_values, TRUE );
44
+	public static function new_instance_from_db($props_n_values = array()) {
45
+		return new self($props_n_values, TRUE);
46 46
 	}
47 47
 
48 48
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @return int
53 53
 	 */
54 54
 	function meta_id() {
55
-		return $this->get( 'meta_id' );
55
+		return $this->get('meta_id');
56 56
 	}
57 57
 
58 58
 
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param int $meta_id
63 63
 	 * @return boolean
64 64
 	 */
65
-	function set_meta_id( $meta_id) {
66
-		return $this->set( 'meta_id', $meta_id);
65
+	function set_meta_id($meta_id) {
66
+		return $this->set('meta_id', $meta_id);
67 67
 	}
68 68
 	/**
69 69
 	 * Gets post_id
70 70
 	 * @return int
71 71
 	 */
72 72
 	function post_id() {
73
-		return $this->get( 'post_id' );
73
+		return $this->get('post_id');
74 74
 	}
75 75
 
76 76
 
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	 * @param int $post_id
81 81
 	 * @return boolean
82 82
 	 */
83
-	function set_post_id( $post_id) {
84
-		return $this->set( 'post_id', $post_id);
83
+	function set_post_id($post_id) {
84
+		return $this->set('post_id', $post_id);
85 85
 	}
86 86
 	/**
87 87
 	 * Gets meta_key
88 88
 	 * @return string
89 89
 	 */
90 90
 	function meta_key() {
91
-		return $this->get( 'meta_key' );
91
+		return $this->get('meta_key');
92 92
 	}
93 93
 
94 94
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 	 * @param string $meta_key
99 99
 	 * @return boolean
100 100
 	 */
101
-	function set_meta_key( $meta_key) {
102
-		return $this->set( 'meta_key', $meta_key);
101
+	function set_meta_key($meta_key) {
102
+		return $this->set('meta_key', $meta_key);
103 103
 	}
104 104
 	/**
105 105
 	 * Gets meta_value
106 106
 	 * @return mixed
107 107
 	 */
108 108
 	function meta_value() {
109
-		return $this->get( 'meta_value' );
109
+		return $this->get('meta_value');
110 110
 	}
111 111
 
112 112
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 * @param mixed $meta_value
117 117
 	 * @return boolean
118 118
 	 */
119
-	function set_meta_value( $meta_value) {
120
-		return $this->set( 'meta_value', $meta_value);
119
+	function set_meta_value($meta_value) {
120
+		return $this->set('meta_value', $meta_value);
121 121
 	}
122 122
 
123 123
 
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Option.class.php 2 patches
Doc Comments   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @param array $props_n_values  incoming values from the database
57 57
 	 * @param string $timezone  incoming timezone as set by the model.  If not set the timezone for
58 58
 	 *                          		the website will be used.
59
-	 * @return EE_Attendee
59
+	 * @return EE_Question_Option
60 60
 	 */
61 61
 	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
62 62
 		return new self( $props_n_values, TRUE, $timezone );
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	/**
68 68
 	 * Sets the option's key value
69 69
 	 * @param string $value
70
-	 * @return bool success
70
+	 * @return boolean|null success
71 71
 	 */
72 72
 	public function set_value( $value ) {
73 73
 		$this->set( 'QSO_value', $value );
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	/**
79 79
 	 * Sets the option's Display Text
80 80
 	 * @param string $text
81
-	 * @return bool success
81
+	 * @return boolean|null success
82 82
 	 */
83 83
 	public function set_desc( $text ) {
84 84
 		$this->set( 'QSO_desc', $text );
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @access public
93 93
 	 * @param integer $order
94
-	 * @return bool      $success
94
+	 * @return boolean|null      $success
95 95
 	 */
96 96
 	public function set_order( $order ) {
97 97
 		$this->set( 'QSO_order', $order );
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	/**
103 103
 	 * Sets the ID of the related question
104 104
 	 * @param int $question_ID
105
-	 * @return bool success
105
+	 * @return boolean|null success
106 106
 	 */
107 107
 	public function set_question_ID( $question_ID ) {
108 108
 		$this->set( 'QST_ID', $question_ID );
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	/**
114 114
 	 * Sets the option's opt_group
115 115
 	 * @param string $text
116
-	 * @return bool success
116
+	 * @return string success
117 117
 	 */
118 118
 	public function set_opt_group( $text ) {
119 119
 		return $this->_QSO_opt_group = $text;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 	/**
125 125
 	 * Gets the option's key value
126
-	 * @return string
126
+	 * @return boolean
127 127
 	 */
128 128
 	public function value() {
129 129
 		return $this->get( 'QSO_value' );
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 	/**
135 135
 	 * Gets the option's display text
136
-	 * @return string
136
+	 * @return boolean
137 137
 	 */
138 138
 	public function desc() {
139 139
 		return $this->get( 'QSO_desc' );
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * Returns the order or the Question Option
156 156
 	 *
157 157
 	 * @access public
158
-	 * @return integer
158
+	 * @return boolean
159 159
 	 */
160 160
 	public function order() {
161 161
 		return $this->get( 'QSO_option' );
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
 	/**
167 167
 	 * Gets the related question's ID
168
-	 * @return int
168
+	 * @return boolean
169 169
 	 */
170 170
 	public function question_ID() {
171 171
 		return $this->get( 'QST_ID' );
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	
209 209
 	/**
210 210
 	 * Gets the QSO_system value
211
-	 * @return string|null
211
+	 * @return boolean
212 212
 	 */
213 213
 	public function system() {
214 214
 		return $this->get('QSO_system');
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	/**
218 218
 	 * Sets QSO_system
219 219
 	 * @param string $QSO_system
220
-	 * @return bool
220
+	 * @return boolean|null
221 221
 	 */
222 222
 	public function set_system( $QSO_system ) {
223 223
 		return $this->set( 'QSO_system', $QSO_system );
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 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
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 *                             		    date_format and the second value is the time format
46 46
 	 * @return EE_Attendee
47 47
 	 */
48
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
49
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
50
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
48
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
49
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
50
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
51 51
 	}
52 52
 
53 53
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 *                          		the website will be used.
59 59
 	 * @return EE_Attendee
60 60
 	 */
61
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
62
-		return new self( $props_n_values, TRUE, $timezone );
61
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
62
+		return new self($props_n_values, TRUE, $timezone);
63 63
 	}
64 64
 
65 65
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 * @param string $value
70 70
 	 * @return bool success
71 71
 	 */
72
-	public function set_value( $value ) {
73
-		$this->set( 'QSO_value', $value );
72
+	public function set_value($value) {
73
+		$this->set('QSO_value', $value);
74 74
 	}
75 75
 
76 76
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @param string $text
81 81
 	 * @return bool success
82 82
 	 */
83
-	public function set_desc( $text ) {
84
-		$this->set( 'QSO_desc', $text );
83
+	public function set_desc($text) {
84
+		$this->set('QSO_desc', $text);
85 85
 	}
86 86
 
87 87
 
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 * @param integer $order
94 94
 	 * @return bool      $success
95 95
 	 */
96
-	public function set_order( $order ) {
97
-		$this->set( 'QSO_order', $order );
96
+	public function set_order($order) {
97
+		$this->set('QSO_order', $order);
98 98
 	}
99 99
 
100 100
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param int $question_ID
105 105
 	 * @return bool success
106 106
 	 */
107
-	public function set_question_ID( $question_ID ) {
108
-		$this->set( 'QST_ID', $question_ID );
107
+	public function set_question_ID($question_ID) {
108
+		$this->set('QST_ID', $question_ID);
109 109
 	}
110 110
 
111 111
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @param string $text
116 116
 	 * @return bool success
117 117
 	 */
118
-	public function set_opt_group( $text ) {
118
+	public function set_opt_group($text) {
119 119
 		return $this->_QSO_opt_group = $text;
120 120
 	}
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return string
127 127
 	 */
128 128
 	public function value() {
129
-		return $this->get( 'QSO_value' );
129
+		return $this->get('QSO_value');
130 130
 	}
131 131
 
132 132
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @return string
137 137
 	 */
138 138
 	public function desc() {
139
-		return $this->get( 'QSO_desc' );
139
+		return $this->get('QSO_desc');
140 140
 	}
141 141
 
142 142
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return boolean
147 147
 	 */
148 148
 	public function deleted() {
149
-		return $this->get( 'QSO_deleted' );
149
+		return $this->get('QSO_deleted');
150 150
 	}
151 151
 
152 152
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @return integer
159 159
 	 */
160 160
 	public function order() {
161
-		return $this->get( 'QSO_option' );
161
+		return $this->get('QSO_option');
162 162
 	}
163 163
 
164 164
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return int
169 169
 	 */
170 170
 	public function question_ID() {
171
-		return $this->get( 'QST_ID' );
171
+		return $this->get('QST_ID');
172 172
 	}
173 173
 
174 174
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @return EE_Question
179 179
 	 */
180 180
 	public function question() {
181
-		return $this->get_first_related( 'Question' );
181
+		return $this->get_first_related('Question');
182 182
 	}
183 183
 
184 184
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 	 * @param array $options {
198 198
 	 *	@type int $QST_ID the QST_ID attribute of this question option, otherwise it will be for the same question as the original
199 199
 	 */
200
-	public function duplicate( $options = array() ) {
200
+	public function duplicate($options = array()) {
201 201
 		$new_question_option = clone $this;
202
-		$new_question_option->set( 'QSO_ID', null );
203
-		if( array_key_exists( 'QST_ID', $options ) ) {//use array_key_exists instead of isset because NULL might be a valid value
204
-			$new_question_option->set_question_ID( $options[ 'QST_ID' ] );
202
+		$new_question_option->set('QSO_ID', null);
203
+		if (array_key_exists('QST_ID', $options)) {//use array_key_exists instead of isset because NULL might be a valid value
204
+			$new_question_option->set_question_ID($options['QST_ID']);
205 205
 		}
206 206
 		$new_question_option->save();
207 207
 	}
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	 * @param string $QSO_system
220 220
 	 * @return bool
221 221
 	 */
222
-	public function set_system( $QSO_system ) {
223
-		return $this->set( 'QSO_system', $QSO_system );
222
+	public function set_system($QSO_system) {
223
+		return $this->set('QSO_system', $QSO_system);
224 224
 	}
225 225
 }
226 226
 
Please login to merge, or discard this patch.