Completed
Branch BUG-9492-refactor-activation-l... (cb6da3)
by
unknown
26:42 queued 14:49
created
core/EE_Front_Controller.core.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * EE_Front_Controller
4 4
  *
@@ -75,37 +75,37 @@  discard block
 block discarded – undo
75 75
 		$this->Request_Handler = $Request_Handler;
76 76
 		$this->Module_Request_Router = $Module_Request_Router;
77 77
 		// make sure template tags are loaded immediately so that themes don't break
78
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 );
78
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
79 79
 		// determine how to integrate WP_Query with the EE models
80
-		add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' ));
80
+		add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
81 81
 		// load other resources and begin to actually run shortcodes and modules
82
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 );
82
+		add_action('wp_loaded', array($this, 'wp_loaded'), 5);
83 83
 		// analyse the incoming WP request
84
-		add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 );
84
+		add_action('parse_request', array($this, 'get_request'), 1, 1);
85 85
 		// process any content shortcodes
86
-		add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 );
86
+		add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
87 87
 		// process request with module factory
88
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 );
88
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
89 89
 		// before headers sent
90
-		add_action( 'wp', array( $this, 'wp' ), 5 );
90
+		add_action('wp', array($this, 'wp'), 5);
91 91
 		// load css and js
92
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 );
92
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1);
93 93
 		// header
94
-		add_action('wp_head', array( $this, 'header_meta_tag' ), 5 );
95
-		add_filter( 'template_include', array( $this, 'template_include' ), 1 );
94
+		add_action('wp_head', array($this, 'header_meta_tag'), 5);
95
+		add_filter('template_include', array($this, 'template_include'), 1);
96 96
 		// display errors
97
-		add_action('loop_start', array( $this, 'display_errors' ), 2 );
97
+		add_action('loop_start', array($this, 'display_errors'), 2);
98 98
 		// the content
99 99
 		// add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
100 100
 		//exclude our private cpt comments
101
-		add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 );
101
+		add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
102 102
 		//make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
103
-		add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 );
103
+		add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
104 104
 		// action hook EE
105
-		do_action( 'AHEE__EE_Front_Controller__construct__done',$this );
105
+		do_action('AHEE__EE_Front_Controller__construct__done', $this);
106 106
 		// for checking that browser cookies are enabled
107
-		if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) {
108
-			setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' );
107
+		if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) {
108
+			setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/');
109 109
 			// add the following to your site's filters to turn off the test cookie:
110 110
 			// add_filter( 'FHEE__EE_Front_Controller____construct__set_test_cookie', '__return_false' );
111 111
 		}
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * 	@return void
144 144
 	 */
145 145
 	public function load_espresso_template_tags() {
146
-		if ( is_readable( EE_PUBLIC . 'template_tags.php' )) {
147
-			require_once( EE_PUBLIC . 'template_tags.php' );
146
+		if (is_readable(EE_PUBLIC.'template_tags.php')) {
147
+			require_once(EE_PUBLIC.'template_tags.php');
148 148
 		}
149 149
 	}
150 150
 
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
 	 * @param  array $clauses array of comment clauses setup by WP_Comment_Query
160 160
 	 * @return array array of comment clauses with modifications.
161 161
 	 */
162
-	public function filter_wp_comments( $clauses ) {
162
+	public function filter_wp_comments($clauses) {
163 163
 		global $wpdb;
164
-		if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) {
164
+		if (strpos($clauses['join'], $wpdb->posts) !== FALSE) {
165 165
 			$cpts = EE_Register_CPTs::get_private_CPTs();
166
-			foreach ( $cpts as $cpt => $details ) {
167
-				$clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt );
166
+			foreach ($cpts as $cpt => $details) {
167
+				$clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
168 168
 			}
169 169
 		}
170 170
 		return $clauses;
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 *  @return 	void
182 182
 	 */
183 183
 	public function employ_CPT_Strategy() {
184
-		if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){
185
-			$this->Registry->load_core( 'CPT_Strategy' );
184
+		if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
185
+			$this->Registry->load_core('CPT_Strategy');
186 186
 		}
187 187
 	}
188 188
 
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 * @param  string $url    incoming url
195 195
 	 * @return string         final assembled url
196 196
 	 */
197
-	public function maybe_force_admin_ajax_ssl( $url ) {
198
-		if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) {
199
-			$url = str_replace( 'http://', 'https://', $url );
197
+	public function maybe_force_admin_ajax_ssl($url) {
198
+		if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
199
+			$url = str_replace('http://', 'https://', $url);
200 200
 		}
201 201
 		return $url;
202 202
 	}
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 	 * @param WP $WP
234 234
 	 * @return void
235 235
 	 */
236
-	public function get_request( WP $WP ) {
237
-		do_action( 'AHEE__EE_Front_Controller__get_request__start' );
238
-		$this->Request_Handler->parse_request( $WP );
239
-		do_action( 'AHEE__EE_Front_Controller__get_request__complete' );
236
+	public function get_request(WP $WP) {
237
+		do_action('AHEE__EE_Front_Controller__get_request__start');
238
+		$this->Request_Handler->parse_request($WP);
239
+		do_action('AHEE__EE_Front_Controller__get_request__complete');
240 240
 	}
241 241
 
242 242
 
@@ -248,21 +248,21 @@  discard block
 block discarded – undo
248 248
 	 * @param WP $WP
249 249
 	 * @return    void
250 250
 	 */
251
-	public function _initialize_shortcodes( WP $WP ) {
252
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this );
253
-		$this->Request_Handler->set_request_vars( $WP );
251
+	public function _initialize_shortcodes(WP $WP) {
252
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
253
+		$this->Request_Handler->set_request_vars($WP);
254 254
 		// grab post_name from request
255
-		$current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get( 'post_name' ));
256
-		$show_on_front = get_option( 'show_on_front' );
255
+		$current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get('post_name'));
256
+		$show_on_front = get_option('show_on_front');
257 257
 		// if it's not set, then check if frontpage is blog
258
-		if ( empty( $current_post ) ) {
258
+		if (empty($current_post)) {
259 259
 			// yup.. this is the posts page, prepare to load all shortcode modules
260 260
 			$current_post = 'posts';
261 261
 			// unless..
262
-			if ( $show_on_front === 'page' ) {
262
+			if ($show_on_front === 'page') {
263 263
 				// some other page is set as the homepage
264
-				$page_on_front = get_option( 'page_on_front' );
265
-				if ( $page_on_front ) {
264
+				$page_on_front = get_option('page_on_front');
265
+				if ($page_on_front) {
266 266
 					// k now we need to find the post_name for this page
267 267
 					global $wpdb;
268 268
 					$page_on_front = $wpdb->get_var(
@@ -279,22 +279,22 @@  discard block
 block discarded – undo
279 279
 		// where are posts being displayed ?
280 280
 		$page_for_posts = EE_Config::get_page_for_posts();
281 281
 		// in case $current_post is hierarchical like: /parent-page/current-page
282
-		$current_post = basename( $current_post );
282
+		$current_post = basename($current_post);
283 283
 		// are we on a category page?
284
-		$term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars );
284
+		$term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars);
285 285
 		// make sure shortcodes are set
286
-		if ( isset( $this->Registry->CFG->core->post_shortcodes )) {
287
-			if ( ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) ) {
288
-				$this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] = array();
286
+		if (isset($this->Registry->CFG->core->post_shortcodes)) {
287
+			if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) {
288
+				$this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array();
289 289
 			}
290 290
 			// cycle thru all posts with shortcodes set
291
-			foreach ( $this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) {
291
+			foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) {
292 292
 				// filter shortcodes so
293
-				$post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes );
293
+				$post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes);
294 294
 				// now cycle thru shortcodes
295
-				foreach ( $post_shortcodes as $shortcode_class => $post_id ) {
295
+				foreach ($post_shortcodes as $shortcode_class => $post_id) {
296 296
 					// are we on this page, or on the blog page, or an EE CPT category page ?
297
-					if ( $current_post === $post_name || $term_exists ) {
297
+					if ($current_post === $post_name || $term_exists) {
298 298
 						// maybe init the shortcode
299 299
 						$this->initialize_shortcode_if_active_on_page(
300 300
 							$shortcode_class,
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
 					// but the shortcode is not being tracked for this page
310 310
 					} else if (
311 311
 						$post_name !== $page_for_posts
312
-						&& isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] )
313
-						&& ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )
312
+						&& isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])
313
+						&& ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])
314 314
 					) {
315 315
 						// then remove the "fallback" shortcode processor
316
-						remove_shortcode( $shortcode_class );
316
+						remove_shortcode($shortcode_class);
317 317
 					}
318 318
 				}
319 319
 			}
320 320
 		}
321
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this );
321
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
322 322
 	}
323 323
 
324 324
 
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 		$WP
341 341
 	) {
342 342
 		// verify shortcode is in list of registered shortcodes
343
-		if ( ! isset( $this->Registry->shortcodes->{$shortcode_class} ) ) {
344
-			if ( $current_post !== $page_for_posts && current_user_can( 'edit_post', $post_id ) ) {
343
+		if ( ! isset($this->Registry->shortcodes->{$shortcode_class} )) {
344
+			if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) {
345 345
 				EE_Error::add_error(
346 346
 					sprintf(
347 347
 						__(
@@ -354,24 +354,24 @@  discard block
 block discarded – undo
354 354
 					__FUNCTION__,
355 355
 					__LINE__
356 356
 				);
357
-				add_filter( 'FHEE_run_EE_the_content', '__return_true' );
357
+				add_filter('FHEE_run_EE_the_content', '__return_true');
358 358
 			}
359
-			add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' ) );
359
+			add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor'));
360 360
 			return;
361 361
 		}
362 362
 		// is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ?
363 363
 		if (
364 364
 			$term_exists
365 365
 			|| $current_post === $page_for_posts
366
-			|| isset( $this->Registry->CFG->core->post_shortcodes[ $current_post ] )
366
+			|| isset($this->Registry->CFG->core->post_shortcodes[$current_post])
367 367
 		) {
368 368
 			// let's pause to reflect on this...
369
-			$sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class );
369
+			$sc_reflector = new ReflectionClass('EES_'.$shortcode_class);
370 370
 			// ensure that class is actually a shortcode
371 371
 			if (
372
-				defined( 'WP_DEBUG' )
372
+				defined('WP_DEBUG')
373 373
 				&& WP_DEBUG === true
374
-				&& ! $sc_reflector->isSubclassOf( 'EES_Shortcode' )
374
+				&& ! $sc_reflector->isSubclassOf('EES_Shortcode')
375 375
 			) {
376 376
 				EE_Error::add_error(
377 377
 					sprintf(
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
 					__FUNCTION__,
386 386
 					__LINE__
387 387
 				);
388
-				add_filter( 'FHEE_run_EE_the_content', '__return_true' );
388
+				add_filter('FHEE_run_EE_the_content', '__return_true');
389 389
 				return;
390 390
 			}
391 391
 			// and pass the request object to the run method
392 392
 			$this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
393 393
 			// fire the shortcode class's run method, so that it can activate resources
394
-			$this->Registry->shortcodes->{$shortcode_class}->run( $WP );
394
+			$this->Registry->shortcodes->{$shortcode_class}->run($WP);
395 395
 		}
396 396
 	}
397 397
 
@@ -404,19 +404,19 @@  discard block
 block discarded – undo
404 404
 	 * @param   WP_Query    $WP_Query
405 405
 	 * @return    void
406 406
 	 */
407
-	public function pre_get_posts( $WP_Query ) {
407
+	public function pre_get_posts($WP_Query) {
408 408
 		// only load Module_Request_Router if this is the main query
409 409
 		if (
410 410
 			$this->Module_Request_Router instanceof EE_Module_Request_Router
411 411
 			&& $WP_Query->is_main_query()
412 412
 		) {
413 413
 			// cycle thru module routes
414
-			while ( $route = $this->Module_Request_Router->get_route( $WP_Query )) {
414
+			while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
415 415
 				// determine module and method for route
416
-				$module = $this->Module_Request_Router->resolve_route( $route[0], $route[1] );
417
-				if( $module instanceof EED_Module ) {
416
+				$module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
417
+				if ($module instanceof EED_Module) {
418 418
 					// get registered view for route
419
-					$this->_template_path = $this->Module_Request_Router->get_view( $route );
419
+					$this->_template_path = $this->Module_Request_Router->get_view($route);
420 420
 					// grab module name
421 421
 					$module_name = $module->module_name();
422 422
 					// map the module to the module objects
@@ -458,29 +458,29 @@  discard block
 block discarded – undo
458 458
 	public function wp_enqueue_scripts() {
459 459
 
460 460
 		// css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
461
-		if ( apply_filters( 'FHEE_load_css', TRUE ) ) {
461
+		if (apply_filters('FHEE_load_css', TRUE)) {
462 462
 
463 463
 			$this->Registry->CFG->template_settings->enable_default_style = TRUE;
464 464
 			//Load the ThemeRoller styles if enabled
465
-			if ( isset( $this->Registry->CFG->template_settings->enable_default_style ) && $this->Registry->CFG->template_settings->enable_default_style ) {
465
+			if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) {
466 466
 
467 467
 				//Load custom style sheet if available
468
-				if ( isset( $this->Registry->CFG->template_settings->custom_style_sheet )) {
469
-					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION );
468
+				if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) {
469
+					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION);
470 470
 					wp_enqueue_style('espresso_custom_css');
471 471
 				}
472 472
 
473
-				if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) {
474
-					wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
473
+				if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) {
474
+					wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
475 475
 				} else {
476
-					wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
476
+					wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
477 477
 				}
478 478
 				wp_enqueue_style('espresso_default');
479 479
 
480
-				if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) {
481
-					wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
480
+				if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) {
481
+					wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
482 482
 				} else {
483
-					wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
483
+					wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
484 484
 				}
485 485
 
486 486
 			}
@@ -488,38 +488,38 @@  discard block
 block discarded – undo
488 488
 		}
489 489
 
490 490
 		// js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
491
-		if ( apply_filters( 'FHEE_load_js', TRUE ) ) {
491
+		if (apply_filters('FHEE_load_js', TRUE)) {
492 492
 
493
-			wp_enqueue_script( 'jquery' );
493
+			wp_enqueue_script('jquery');
494 494
 			//let's make sure that all required scripts have been setup
495
-			if ( function_exists( 'wp_script_is' ) && ! wp_script_is( 'jquery' )) {
495
+			if (function_exists('wp_script_is') && ! wp_script_is('jquery')) {
496 496
 				$msg = sprintf(
497
-					__( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ),
497
+					__('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'),
498 498
 					'<em><br />',
499 499
 					'</em>'
500 500
 				);
501
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
501
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
502 502
 			}
503 503
 			// load core js
504
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
505
-			wp_enqueue_script( 'espresso_core' );
506
-			wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
504
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
505
+			wp_enqueue_script('espresso_core');
506
+			wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
507 507
 
508 508
 		}
509 509
 
510 510
 		//qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
511
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
511
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
512 512
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
513 513
 		}
514 514
 
515 515
 
516 516
 		//accounting.js library
517 517
 		// @link http://josscrowcroft.github.io/accounting.js/
518
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
519
-			$acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
520
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
521
-			wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE );
522
-			wp_enqueue_script( 'ee-accounting' );
518
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
519
+			$acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js';
520
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
521
+			wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE);
522
+			wp_enqueue_script('ee-accounting');
523 523
 
524 524
 			$currency_config = array(
525 525
 				'currency' => array(
@@ -542,21 +542,21 @@  discard block
 block discarded – undo
542 542
 			wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
543 543
 		}
544 544
 
545
-		if ( ! function_exists( 'wp_head' )) {
545
+		if ( ! function_exists('wp_head')) {
546 546
 			$msg = sprintf(
547
-				__( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
547
+				__('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
548 548
 				'<em><br />',
549 549
 				'</em>'
550 550
 			);
551
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
551
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
552 552
 		}
553
-		if ( ! function_exists( 'wp_footer' )) {
553
+		if ( ! function_exists('wp_footer')) {
554 554
 			$msg = sprintf(
555
-				__( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
555
+				__('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
556 556
 				'<em><br />',
557 557
 				'</em>'
558 558
 			);
559
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
559
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
560 560
 		}
561 561
 
562 562
 	}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 	 *  @return 	void
571 571
 	 */
572 572
 	public function header_meta_tag() {
573
-		print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />"));
573
+		print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />"));
574 574
 	}
575 575
 
576 576
 
@@ -611,10 +611,10 @@  discard block
 block discarded – undo
611 611
 	 */
612 612
 	public function display_errors() {
613 613
 		static $shown_already = FALSE;
614
-		do_action( 'AHEE__EE_Front_Controller__display_errors__begin' );
614
+		do_action('AHEE__EE_Front_Controller__display_errors__begin');
615 615
 		if (
616 616
 			! $shown_already
617
-			&& apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE )
617
+			&& apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE)
618 618
 			&& is_main_query()
619 619
 			&& ! is_feed()
620 620
 			&& in_the_loop()
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
 		) {
623 623
 			echo EE_Error::get_notices();
624 624
 			$shown_already = TRUE;
625
-			EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' );
625
+			EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php');
626 626
 		}
627
-		do_action( 'AHEE__EE_Front_Controller__display_errors__end' );
627
+		do_action('AHEE__EE_Front_Controller__display_errors__end');
628 628
 	}
629 629
 
630 630
 
@@ -639,12 +639,12 @@  discard block
 block discarded – undo
639 639
 	 * @param   string $template_include_path
640 640
 	 * @return    string
641 641
 	 */
642
-	public function template_include( $template_include_path = NULL ) {
643
-		if ( $this->Request_Handler->is_espresso_page() ) {
644
-			$this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path );
645
-			$template_path = EEH_Template::locate_template( $this->_template_path, array(), false );
646
-			$this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path;
647
-			$this->_template = basename( $this->_template_path );
642
+	public function template_include($template_include_path = NULL) {
643
+		if ($this->Request_Handler->is_espresso_page()) {
644
+			$this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
645
+			$template_path = EEH_Template::locate_template($this->_template_path, array(), false);
646
+			$this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
647
+			$this->_template = basename($this->_template_path);
648 648
 			return $this->_template_path;
649 649
 		}
650 650
 		return $template_include_path;
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * @param bool $with_path
660 660
 	 * @return    string
661 661
 	 */
662
-	public function get_selected_template( $with_path = FALSE ) {
662
+	public function get_selected_template($with_path = FALSE) {
663 663
 		return $with_path ? $this->_template_path : $this->_template;
664 664
 	}
665 665
 
Please login to merge, or discard this patch.
core/EE_Activation_Manager.core.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 	 * @return \EE_Activation_Manager
94 94
 	 * @throws \EE_Error
95 95
 	 */
96
-	public static function instance( \EE_Maintenance_Mode $maintenanceMode = null ) {
96
+	public static function instance(\EE_Maintenance_Mode $maintenanceMode = null) {
97 97
 		// check if class object is instantiated
98
-		if ( ! self::$_instance instanceof EE_Activation_Manager ) {
99
-			if ( ! $maintenanceMode instanceof \EE_Maintenance_Mode ) {
98
+		if ( ! self::$_instance instanceof EE_Activation_Manager) {
99
+			if ( ! $maintenanceMode instanceof \EE_Maintenance_Mode) {
100 100
 				throw new \EE_Error(
101 101
 					__(
102 102
 						'A valid instance of the EE_Maintenance_Mode class is required to instantiate EE_Activation_Manager.',
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 					)
105 105
 				);
106 106
 			}
107
-			self::$_instance = new self( $maintenanceMode );
107
+			self::$_instance = new self($maintenanceMode);
108 108
 		}
109 109
 		return self::$_instance;
110 110
 	}
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @param \EE_Maintenance_Mode $maintenanceMode
118 118
 	 */
119
-	private function __construct( \EE_Maintenance_Mode $maintenanceMode  ) {
119
+	private function __construct(\EE_Maintenance_Mode $maintenanceMode) {
120 120
 		$this->maintenanceMode = $maintenanceMode;
121 121
 		// detect whether install or upgrade
122 122
 		add_action(
123 123
 			'AHEE__EE_Bootstrap__detect_activations_or_upgrades',
124
-			array( $this, 'detect_activations_or_upgrades' ),
124
+			array($this, 'detect_activations_or_upgrades'),
125 125
 			10
126 126
 		);
127 127
 	}
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 	 * @param EspressoCore $espressoCore
133 133
 	 * @throws \EE_Error
134 134
 	 */
135
-	public function setEspressoCore( $espressoCore ) {
135
+	public function setEspressoCore($espressoCore) {
136 136
 		$this->espressoCore = $espressoCore;
137
-		if ( ! $this->espressoCore->registry() instanceof \EE_Registry ) {
137
+		if ( ! $this->espressoCore->registry() instanceof \EE_Registry) {
138 138
 			throw new \EE_Error(
139 139
 				__(
140 140
 					'A valid instance of the EE_Registry class is required for EE_Activation_Manager to function properly.',
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 				)
143 143
 			);
144 144
 		}
145
-		if ( ! $this->espressoCore->registry()->request() instanceof \EE_Request ) {
145
+		if ( ! $this->espressoCore->registry()->request() instanceof \EE_Request) {
146 146
 			throw new \EE_Error(
147 147
 				__(
148 148
 					'A valid instance of the EE_Request class is required for EE_Activation_Manager to function properly.',
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 	 * @throws \EE_Error
168 168
 	 */
169 169
 	public function detect_activations_or_upgrades() {
170
-		do_action( 'AHEE__EE_Activation_Manager__detect_activations_or_upgrades__begin', $this );
170
+		do_action('AHEE__EE_Activation_Manager__detect_activations_or_upgrades__begin', $this);
171 171
 		// check if db has been updated, or if its a brand-new installation
172
-		$this->espressoCore->registry()->request()->set_activation_type( $this->detect_activation_type() );
172
+		$this->espressoCore->registry()->request()->set_activation_type($this->detect_activation_type());
173 173
 		$this->process_activation_type();
174
-		foreach ( $this->espressoCore->registry()->addons as $addon ) {
174
+		foreach ($this->espressoCore->registry()->addons as $addon) {
175 175
 			//detect the request type for that addon
176 176
 			$addon->detect_activation_or_upgrade();
177 177
 		}
178
-		do_action( 'AHEE__EE_Activation_Manager__detect_activations_or_upgrades__end', $this );
178
+		do_action('AHEE__EE_Activation_Manager__detect_activations_or_upgrades__end', $this);
179 179
 	}
180 180
 
181 181
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function detect_activation_type() {
190 190
 		$activation_type = $this->espressoCore->registry()->request()->activation_type();
191
-		if ( is_int( $activation_type ) ) {
191
+		if (is_int($activation_type)) {
192 192
 			return $activation_type;
193 193
 		}
194 194
 		$activation_type = EE_Activation_Manager::detect_activation_type_given_activation_history(
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 			EE_Activation_Manager::activation_indicator_option_name,
197 197
 			EVENT_ESPRESSO_VERSION
198 198
 		);
199
-		$this->espressoCore->registry()->request()->set_activation_type( $activation_type );
199
+		$this->espressoCore->registry()->request()->set_activation_type($activation_type);
200 200
 		return $activation_type;
201 201
 	}
202 202
 
@@ -221,35 +221,35 @@  discard block
 block discarded – undo
221 221
 			$activation_history_for_addon,
222 222
 			$version_to_upgrade_to
223 223
 		);
224
-		if ( $activation_history_for_addon ) {
224
+		if ($activation_history_for_addon) {
225 225
 			//it exists, so this isn't a completely new install
226 226
 			//check if this version already in that list of previously installed versions
227
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] ) ) {
227
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
228 228
 				//it a version we haven't seen before
229
-				if ( $version_is_higher === 1 ) {
229
+				if ($version_is_higher === 1) {
230 230
 					$activation_type = EE_Activation_Manager::activation_type_upgrade;
231 231
 				} else {
232 232
 					$activation_type = EE_Activation_Manager::activation_type_downgrade;
233 233
 				}
234
-				delete_option( $activation_indicator_option_name );
234
+				delete_option($activation_indicator_option_name);
235 235
 			} else {
236 236
 				// its not an update. maybe a reactivation?
237
-				if ( get_option( $activation_indicator_option_name, false ) ) {
238
-					if ( $version_is_higher === -1 ) {
237
+				if (get_option($activation_indicator_option_name, false)) {
238
+					if ($version_is_higher === -1) {
239 239
 						$activation_type = EE_Activation_Manager::activation_type_downgrade;
240
-					} elseif ( $version_is_higher === 0 ) {
240
+					} elseif ($version_is_higher === 0) {
241 241
 						//we've seen this version before, but it's an activation. must be a reactivation
242 242
 						$activation_type = EE_Activation_Manager::activation_type_reactivation;
243 243
 					} else {
244 244
 						//$version_is_higher === 1
245 245
 						$activation_type = EE_Activation_Manager::activation_type_upgrade;
246 246
 					}
247
-					delete_option( $activation_indicator_option_name );
247
+					delete_option($activation_indicator_option_name);
248 248
 				} else {
249 249
 					//we've seen this version before and the activation indicate doesn't show it was just activated
250
-					if ( $version_is_higher === -1 ) {
250
+					if ($version_is_higher === -1) {
251 251
 						$activation_type = EE_Activation_Manager::activation_type_downgrade;
252
-					} elseif ( $version_is_higher === 0 ) {
252
+					} elseif ($version_is_higher === 0) {
253 253
 						//we've seen this version before and it's not an activation. its normal request
254 254
 						$activation_type = EE_Activation_Manager::activation_type_none;
255 255
 					} else {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		} else {
262 262
 			//brand new install
263 263
 			$activation_type = EE_Activation_Manager::activation_type_new;
264
-			delete_option( $activation_indicator_option_name );
264
+			delete_option($activation_indicator_option_name);
265 265
 		}
266 266
 		return $activation_type;
267 267
 	}
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 	 *                                             0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
281 281
 	 *                                             1 if $version_to_upgrade_to is HIGHER (upgrade) ;
282 282
 	 */
283
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ) {
283
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
284 284
 		//find the most recently-activated version
285 285
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
286 286
 		$most_recently_active_version = '0.0.0.dev.000';
287
-		if ( is_array( $activation_history_for_addon ) ) {
288
-			foreach ( $activation_history_for_addon as $version => $times_activated ) {
287
+		if (is_array($activation_history_for_addon)) {
288
+			foreach ($activation_history_for_addon as $version => $times_activated) {
289 289
 				//check there is a record of when this version was activated. Otherwise,
290 290
 				//mark it as unknown
291
-				if ( ! $times_activated ) {
292
-					$times_activated = array( 'unknown-date' );
291
+				if ( ! $times_activated) {
292
+					$times_activated = array('unknown-date');
293 293
 				}
294
-				if ( is_string( $times_activated ) ) {
295
-					$times_activated = array( $times_activated );
294
+				if (is_string($times_activated)) {
295
+					$times_activated = array($times_activated);
296 296
 				}
297
-				foreach ( $times_activated as $an_activation ) {
297
+				foreach ($times_activated as $an_activation) {
298 298
 					if (
299 299
 						$an_activation !== 'unknown-date'
300 300
 					    && $an_activation > $most_recently_active_version_activation
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 				}
308 308
 			}
309 309
 		}
310
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
310
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
311 311
 	}
312 312
 
313 313
 
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	public function get_db_version_history() {
323 323
 		$db_version_history = $this->espressoCore->db_version_history();
324
-		if ( empty( $db_version_history ) ) {
325
-			$db_version_history = $this->fix_espresso_db_upgrade_option( $db_version_history );
326
-			$this->espressoCore->set_db_version_history( $db_version_history );
324
+		if (empty($db_version_history)) {
325
+			$db_version_history = $this->fix_espresso_db_upgrade_option($db_version_history);
326
+			$this->espressoCore->set_db_version_history($db_version_history);
327 327
 		}
328 328
 		return $db_version_history;
329 329
 	}
@@ -339,42 +339,42 @@  discard block
 block discarded – undo
339 339
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
340 340
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
341 341
 	 */
342
-	private function fix_espresso_db_upgrade_option( $db_version_history = null ) {
343
-		if ( empty( $db_version_history ) ) {
344
-			$db_version_history = get_option( EE_Activation_Manager::db_version_option_name );
342
+	private function fix_espresso_db_upgrade_option($db_version_history = null) {
343
+		if (empty($db_version_history)) {
344
+			$db_version_history = get_option(EE_Activation_Manager::db_version_option_name);
345 345
 		}
346
-		do_action( 'AHEE__EE_Activation_Manager__fix_espresso_db_upgrade_option__begin', $db_version_history );
346
+		do_action('AHEE__EE_Activation_Manager__fix_espresso_db_upgrade_option__begin', $db_version_history);
347 347
 		// check that option is an array
348
-		if ( ! is_array( $db_version_history ) ) {
348
+		if ( ! is_array($db_version_history)) {
349 349
 			// if option is FALSE, then it never existed
350
-			if ( $db_version_history === false ) {
350
+			if ($db_version_history === false) {
351 351
 				// make $espresso_db_update an array and save option with autoload OFF
352 352
 				$db_version_history = array();
353
-				add_option( EE_Activation_Manager::db_version_option_name, $db_version_history, '', 'no' );
353
+				add_option(EE_Activation_Manager::db_version_option_name, $db_version_history, '', 'no');
354 354
 			} else {
355 355
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
356
-				$db_version_history = array( $db_version_history => array() );
357
-				update_option( EE_Activation_Manager::db_version_option_name, $db_version_history );
356
+				$db_version_history = array($db_version_history => array());
357
+				update_option(EE_Activation_Manager::db_version_option_name, $db_version_history);
358 358
 			}
359 359
 		} else {
360 360
 			$corrected_db_update = array();
361 361
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
362
-			foreach ( $db_version_history as $should_be_version_string => $should_be_array ) {
363
-				if ( is_int( $should_be_version_string ) && ! is_array( $should_be_array ) ) {
362
+			foreach ($db_version_history as $should_be_version_string => $should_be_array) {
363
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
364 364
 					//the key is an int, and the value IS NOT an array
365 365
 					//so it must be numerically-indexed, where values are versions installed...
366 366
 					//fix it!
367 367
 					$version_string = $should_be_array;
368
-					$corrected_db_update[ $version_string ] = array( 'unknown-date' );
368
+					$corrected_db_update[$version_string] = array('unknown-date');
369 369
 				} else {
370 370
 					//ok it checks out
371
-					$corrected_db_update[ $should_be_version_string ] = $should_be_array;
371
+					$corrected_db_update[$should_be_version_string] = $should_be_array;
372 372
 				}
373 373
 			}
374 374
 			$db_version_history = $corrected_db_update;
375
-			update_option( EE_Activation_Manager::db_version_option_name, $db_version_history );
375
+			update_option(EE_Activation_Manager::db_version_option_name, $db_version_history);
376 376
 		}
377
-		do_action( 'AHEE__EE_Activation_Manager__fix_espresso_db_upgrade_option__complete', $db_version_history );
377
+		do_action('AHEE__EE_Activation_Manager__fix_espresso_db_upgrade_option__complete', $db_version_history);
378 378
 		return $db_version_history;
379 379
 	}
380 380
 
@@ -389,18 +389,18 @@  discard block
 block discarded – undo
389 389
 	 * @access public
390 390
 	 */
391 391
 	public function process_activation_type() {
392
-		do_action( 'AHEE__EE_Activation_Manager__process_activation_type__begin' );
392
+		do_action('AHEE__EE_Activation_Manager__process_activation_type__begin');
393 393
 		if (
394 394
 			$this->espressoCore->registry()->request()->activation_type() !== EE_Activation_Manager::activation_type_none
395 395
 		) {
396 396
 			// NOT a normal request so do NOT proceed with regular application execution
397
-			add_filter( 'FHEE__EE_System__brew_espresso', '__return_false' );
397
+			add_filter('FHEE__EE_System__brew_espresso', '__return_false');
398 398
 			// perform any necessary activations upgrades and migrations instead
399
-			add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
399
+			add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
400 400
 			// update the db version history
401
-			$this->_handle_core_version_change( $this->espressoCore->db_version_history() );
401
+			$this->_handle_core_version_change($this->espressoCore->db_version_history());
402 402
 		}
403
-		do_action( 'AHEE__EE_Activation_Manager__process_activation_type__complete' );
403
+		do_action('AHEE__EE_Activation_Manager__process_activation_type__complete');
404 404
 	}
405 405
 
406 406
 
@@ -413,21 +413,21 @@  discard block
 block discarded – undo
413 413
 	 * @throws \EE_Error
414 414
 	 */
415 415
 	public function perform_activations_upgrades_and_migrations() {
416
-		switch ( $this->espressoCore->registry()->request()->activation_type() ) {
416
+		switch ($this->espressoCore->registry()->request()->activation_type()) {
417 417
 			case EE_Activation_Manager::activation_type_new:
418
-				do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__new_activation' );
418
+				do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__new_activation');
419 419
 
420 420
 				break;
421 421
 			case EE_Activation_Manager::activation_type_reactivation:
422
-				do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__reactivation' );
422
+				do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__reactivation');
423 423
 				break;
424 424
 			case EE_Activation_Manager::activation_type_upgrade:
425
-				do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__upgrade' );
425
+				do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__upgrade');
426 426
 				//migrations may be required now that we've upgraded
427 427
 				$this->maintenanceMode->set_maintenance_mode_if_db_old();
428 428
 				break;
429 429
 			case EE_Activation_Manager::activation_type_downgrade:
430
-				do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__downgrade' );
430
+				do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__downgrade');
431 431
 				//its possible migrations are no longer required
432 432
 				$this->maintenanceMode->set_maintenance_mode_if_db_old();
433 433
 				break;
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 				break;
437 437
 		}		//first check if we had previously attempted to setup EE's directories but failed
438 438
 		// load activation helper if need be
439
-		$this->espressoCore->registry()->load_helper( 'Activation' );
440
-		if ( EEH_Activation::upload_directories_incomplete() ) {
439
+		$this->espressoCore->registry()->load_helper('Activation');
440
+		if (EEH_Activation::upload_directories_incomplete()) {
441 441
 			EEH_Activation::create_upload_directories();
442 442
 		}
443
-		do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations', $this );
443
+		do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations', $this);
444 444
 	}
445 445
 
446 446
 
@@ -451,12 +451,12 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @param array $db_version_history
453 453
 	 */
454
-	protected function _handle_core_version_change( $db_version_history ) {
455
-		$this->update_list_of_installed_versions( $db_version_history );
454
+	protected function _handle_core_version_change($db_version_history) {
455
+		$this->update_list_of_installed_versions($db_version_history);
456 456
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
457 457
 		add_action(
458 458
 			'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations',
459
-			array( $this, 'initialize_db_if_no_migrations_required' )
459
+			array($this, 'initialize_db_if_no_migrations_required')
460 460
 		);
461 461
 	}
462 462
 
@@ -469,18 +469,18 @@  discard block
 block discarded – undo
469 469
 	 * @param    string $current_version_to_add version to be added to the version history
470 470
 	 * @return    boolean success as to whether or not this option was changed
471 471
 	 */
472
-	protected function update_list_of_installed_versions( $db_version_history = null, $current_version_to_add = null ) {
472
+	protected function update_list_of_installed_versions($db_version_history = null, $current_version_to_add = null) {
473 473
 		// check db version history is set
474
-		$db_version_history = ! empty( $db_version_history )
474
+		$db_version_history = ! empty($db_version_history)
475 475
 			? $db_version_history
476 476
 			: $this->get_db_version_history();
477 477
 		// check current version is set
478
-		$current_version_to_add = ! empty( $current_version_to_add )
478
+		$current_version_to_add = ! empty($current_version_to_add)
479 479
 			? $current_version_to_add
480 480
 			: EVENT_ESPRESSO_VERSION;
481 481
 		// add this version and save
482
-		$db_version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s', time() );
483
-		return update_option( EE_Activation_Manager::db_version_option_name, $db_version_history );
482
+		$db_version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
483
+		return update_option(EE_Activation_Manager::db_version_option_name, $db_version_history);
484 484
 	}
485 485
 
486 486
 
@@ -505,19 +505,19 @@  discard block
 block discarded – undo
505 505
 	) {
506 506
 		$this->detect_activation_type();
507 507
 		//only initialize system if we're not in maintenance mode.
508
-		if ( $this->maintenanceMode->level() !== \EE_Maintenance_Mode::level_2_complete_maintenance ) {
509
-			update_option( 'ee_flush_rewrite_rules', true );
510
-			if ( $verify_db_schema ) {
508
+		if ($this->maintenanceMode->level() !== \EE_Maintenance_Mode::level_2_complete_maintenance) {
509
+			update_option('ee_flush_rewrite_rules', true);
510
+			if ($verify_db_schema) {
511 511
 				\EEH_Activation::initialize_db_and_folders();
512 512
 			}
513 513
 			\EEH_Activation::initialize_db_content();
514 514
 			\EEH_Activation::system_initialization();
515
-			if ( $initialize_addons_too ) {
515
+			if ($initialize_addons_too) {
516 516
 				$this->initialize_addons();
517 517
 			}
518 518
 		} else {
519 519
 			$this->espressoCore->registry()->load_core('Data_Migration_Manager');
520
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
520
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
521 521
 		}
522 522
 		$activation_type = $this->espressoCore->registry()->request()->activation_type();
523 523
 		if (
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 			|| $activation_type === EE_Activation_Manager::activation_type_upgrade
526 526
 			//|| $activation_type == EE_Activation_Manager::activation_type_reactivation
527 527
 		) {
528
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
528
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
529 529
 		}
530 530
 	}
531 531
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	public function initialize_addons() {
540 540
 		//foreach registered addon, make sure its db is up-to-date too
541
-		foreach ( $this->espressoCore->registry()->addons as $addon ) {
541
+		foreach ($this->espressoCore->registry()->addons as $addon) {
542 542
 			$addon->initialize_db_if_no_migrations_required();
543 543
 		}
544 544
 	}
@@ -551,20 +551,20 @@  discard block
 block discarded – undo
551 551
 	 * @return void
552 552
 	 */
553 553
 	public function redirect_to_about_ee() {
554
-		$notices = \EE_Error::get_notices( false );
554
+		$notices = \EE_Error::get_notices(false);
555 555
 		//if current user is an admin and it's not an ajax request
556
-		if ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
557
-		     && ! isset( $notices['errors'] )
558
-		     && $this->espressoCore->registry()->CAP->current_user_can( 'manage_options', 'espresso_about_default' )
556
+		if ( ! (defined('DOING_AJAX') && DOING_AJAX)
557
+		     && ! isset($notices['errors'])
558
+		     && $this->espressoCore->registry()->CAP->current_user_can('manage_options', 'espresso_about_default')
559 559
 		) {
560
-			$query_params = array( 'page' => 'espresso_about' );
561
-			if ( $this->detect_activation_type() === EE_Activation_Manager::activation_type_new ) {
560
+			$query_params = array('page' => 'espresso_about');
561
+			if ($this->detect_activation_type() === EE_Activation_Manager::activation_type_new) {
562 562
 				$query_params['new_activation'] = true;
563
-			} else if ( $this->detect_activation_type() === EE_Activation_Manager::activation_type_reactivation ) {
563
+			} else if ($this->detect_activation_type() === EE_Activation_Manager::activation_type_reactivation) {
564 564
 				$query_params['reactivation'] = true;
565 565
 			}
566
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
567
-			wp_safe_redirect( $url );
566
+			$url = add_query_arg($query_params, admin_url('admin.php'));
567
+			wp_safe_redirect($url);
568 568
 			exit();
569 569
 		}
570 570
 	}
Please login to merge, or discard this patch.
modules/core_rest_api/EED_Core_Rest_Api.module.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\core\libraries\rest_api\Calculated_Model_Fields;
3 3
 
4
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public static function instance() {
39 39
 		self::$_field_calculator = new Calculated_Model_Fields();
40
-		return parent::get_instance( __CLASS__ );
40
+		return parent::get_instance(__CLASS__);
41 41
 	}
42 42
 
43 43
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 * @throws \EE_Error
75 75
 	 */
76 76
 	public static function set_hooks_both() {
77
-		add_action( 'AHEE__EE_System__after_brew_espresso', array( 'EED_Core_Rest_Api', 'maybe_load_basic_auth' ), 10 );
78
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 );
79
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 );
80
-		add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 );
81
-		add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) );
77
+		add_action('AHEE__EE_System__after_brew_espresso', array('EED_Core_Rest_Api', 'maybe_load_basic_auth'), 10);
78
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10);
79
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5);
80
+		add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2);
81
+		add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index'));
82 82
 		EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();
83 83
 	}
84 84
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @throws \EE_Error
106 106
 	 */
107
-	public static function set_hooks_for_changes(){
107
+	public static function set_hooks_for_changes() {
108 108
 		self::_set_hooks_for_changes();
109 109
 	}
110 110
 
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 	 * @throws \EE_Error
118 118
 	 */
119 119
 	protected static function _set_hooks_for_changes() {
120
-		$folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false );
121
-		foreach( $folder_contents as $classname_in_namespace => $filepath ) {
120
+		$folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false);
121
+		foreach ($folder_contents as $classname_in_namespace => $filepath) {
122 122
 			//ignore the base parent class
123
-			if( $classname_in_namespace === 'Changes_In_Base' ) {
123
+			if ($classname_in_namespace === 'Changes_In_Base') {
124 124
 				continue;
125 125
 			}
126
-			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
127
-			if ( class_exists( $full_classname )) {
126
+			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace;
127
+			if (class_exists($full_classname)) {
128 128
 				$instance_of_class = new $full_classname;
129
-				if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) {
129
+				if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) {
130 130
 					$instance_of_class->set_hooks();
131 131
 				}
132 132
 			}
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public static function maybe_load_basic_auth() {
146 146
 		if (
147
-			! ( isset( $_GET['activate'] ) && $_GET['activate'] === 'true' )
148
-			&& ! function_exists( 'json_basic_auth_handler' )
149
-			&& ! function_exists( 'json_basic_auth_error' )
147
+			! (isset($_GET['activate']) && $_GET['activate'] === 'true')
148
+			&& ! function_exists('json_basic_auth_handler')
149
+			&& ! function_exists('json_basic_auth_error')
150 150
 			&& ! (
151
-				isset( $_GET['action'] )
152
-				&& in_array( $_GET['action'], array( 'activate', 'activate-selected' ) )
151
+				isset($_GET['action'])
152
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
153 153
 			)
154 154
 		) {
155 155
 			try {
156
-				include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
157
-			} catch ( Exception $e ) {
158
-				EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
156
+				include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
157
+			} catch (Exception $e) {
158
+				EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
159 159
 			}
160 160
 		}
161 161
 	}
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
 	 * @throws \EE_Error
170 170
 	 */
171 171
 	public static function register_routes() {
172
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
173
-			foreach( $relative_urls as $endpoint => $routes ) {
174
-				foreach( $routes as $route ) {
172
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
173
+			foreach ($relative_urls as $endpoint => $routes) {
174
+				foreach ($routes as $route) {
175 175
 					register_rest_route(
176 176
 						$namespace,
177 177
 						$endpoint,
178 178
 						array(
179
-							'callback' => $route[ 'callback' ],
180
-							'methods' => $route[ 'methods' ],
181
-							'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(),
179
+							'callback' => $route['callback'],
180
+							'methods' => $route['methods'],
181
+							'args' => isset($route['args']) ? $route['args'] : array(),
182 182
 						)
183 183
 					);
184 184
 				}
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 	 * @throws \EE_Error
195 195
 	 */
196 196
 	public static function invalidate_cached_route_data_on_version_change() {
197
-		if( EE_Registry::instance()->request()->activation_type() !== EE_Activation_Manager::activation_type_none ) {
197
+		if (EE_Registry::instance()->request()->activation_type() !== EE_Activation_Manager::activation_type_none) {
198 198
 			EED_Core_Rest_Api::invalidate_cached_route_data();
199 199
 		}
200
-		foreach( EE_Registry::instance()->addons as $addon ){
201
-			if(
200
+		foreach (EE_Registry::instance()->addons as $addon) {
201
+			if (
202 202
 				$addon instanceof EE_Addon
203 203
 				&& $addon->detect_req_type() !== EE_Activation_Manager::activation_type_none
204 204
 			) {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	public static function invalidate_cached_route_data() {
214 214
 		//delete the saved EE REST API routes
215
-		delete_option( EED_Core_Rest_Api::saved_routes_option_names );
215
+		delete_option(EED_Core_Rest_Api::saved_routes_option_names);
216 216
 	}
217 217
 
218 218
 	/**
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	public static function get_ee_route_data() {
229 229
 		$ee_routes = array();
230
-		foreach( self::versions_served() as $version => $hidden_endpoints ) {
231
-			$ee_routes[  self::ee_api_namespace . $version ] = self::_get_ee_route_data_for_version( $version, $hidden_endpoints );
230
+		foreach (self::versions_served() as $version => $hidden_endpoints) {
231
+			$ee_routes[self::ee_api_namespace.$version] = self::_get_ee_route_data_for_version($version, $hidden_endpoints);
232 232
 		}
233 233
 		return $ee_routes;
234 234
 	}
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 	 * @param boolean $hidden_endpoints
241 241
 	 * @return array
242 242
 	 */
243
-	protected static function _get_ee_route_data_for_version( $version, $hidden_endpoints = false ) {
244
-		$ee_routes = get_option( self::saved_routes_option_names . $version , null );
245
-		if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){
246
-			$ee_routes = self::_save_ee_route_data_for_version( $version, $hidden_endpoints );
243
+	protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) {
244
+		$ee_routes = get_option(self::saved_routes_option_names.$version, null);
245
+		if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) {
246
+			$ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints);
247 247
 		}
248 248
 		return $ee_routes;
249 249
 	}
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
 	 * @param string $version
254 254
 	 * @param boolean $hidden_endpoints
255 255
 	 */
256
-	protected static function _save_ee_route_data_for_version( $version, $hidden_endpoints = false ) {
256
+	protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false) {
257 257
 		$instance = self::instance();
258 258
 		$routes = apply_filters(
259 259
 			'EED_Core_Rest_Api__save_ee_route_data_for_version__routes',
260 260
 			array_replace_recursive(
261
-				$instance->_get_config_route_data_for_version( $version, $hidden_endpoints ),
262
-				$instance->_get_meta_route_data_for_version( $version, $hidden_endpoints ),
263
-				$instance->_get_model_route_data_for_version( $version, $hidden_endpoints ),
264
-				$instance->_get_rpc_route_data_for_version( $version, $hidden_endpoints )
261
+				$instance->_get_config_route_data_for_version($version, $hidden_endpoints),
262
+				$instance->_get_meta_route_data_for_version($version, $hidden_endpoints),
263
+				$instance->_get_model_route_data_for_version($version, $hidden_endpoints),
264
+				$instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)
265 265
 			)
266 266
 		);
267
-		update_option( self::saved_routes_option_names . $version, $routes, true );
267
+		update_option(self::saved_routes_option_names.$version, $routes, true);
268 268
 		return $routes;
269 269
 	}
270 270
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 * @throws \EE_Error
277 277
 	 */
278 278
 	public static function save_ee_routes() {
279
-		if( EE_Maintenance_Mode::instance()->models_can_query() ){
279
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
280 280
 			$instance = self::instance();
281 281
 			$routes = apply_filters(
282 282
 				'EED_Core_Rest_Api__save_ee_routes__routes',
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 					$instance->_register_rpc_routes()
288 288
 				)
289 289
 			);
290
-			update_option( self::saved_routes_option_names, $routes, true );
290
+			update_option(self::saved_routes_option_names, $routes, true);
291 291
 		}
292 292
 	}
293 293
 
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	protected function _register_model_routes() {
302 302
 		$model_routes = array( );
303
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
304
-			$model_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint );
303
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
304
+			$model_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
305 305
 		}
306 306
 		return $model_routes;
307 307
 	}
@@ -312,30 +312,30 @@  discard block
 block discarded – undo
312 312
 	 * @param boolean $hidden_endpoint
313 313
 	 * @return array
314 314
 	 */
315
-	protected function _get_model_route_data_for_version( $version, $hidden_endpoint = false ) {
316
-		$model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info( $version );
315
+	protected function _get_model_route_data_for_version($version, $hidden_endpoint = false) {
316
+		$model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info($version);
317 317
 		$models_to_register = apply_filters(
318 318
 			'FHEE__EED_Core_REST_API___register_model_routes',
319 319
 			$model_version_info->models_for_requested_version()
320 320
 		);
321 321
 		//let's not bother having endpoints for extra metas
322
-		unset( $models_to_register['Extra_Meta'], $models_to_register['Extra_Join'] );
322
+		unset($models_to_register['Extra_Meta'], $models_to_register['Extra_Join']);
323 323
 		$model_routes = array();
324
-		foreach ( $models_to_register as $model_name => $model_classname ) {
325
-			$model = \EE_Registry::instance()->load_model( $model_name );
324
+		foreach ($models_to_register as $model_name => $model_classname) {
325
+			$model = \EE_Registry::instance()->load_model($model_name);
326 326
 			//yes we could just register one route for ALL models, but then they wouldn't show up in the index
327
-			$plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name );
328
-			$singular_model_route = $plural_model_route . '/(?P<id>\d+)' ;
329
-			$model_routes[ $plural_model_route ] = array(
327
+			$plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);
328
+			$singular_model_route = $plural_model_route.'/(?P<id>\d+)';
329
+			$model_routes[$plural_model_route] = array(
330 330
 					array(
331 331
 						'callback' => array(
332 332
 							'EventEspresso\core\libraries\rest_api\controllers\model\Read',
333 333
 							'handle_request_get_all' ),
334 334
 						'methods' => WP_REST_Server::READABLE,
335 335
 						'hidden_endpoint' => $hidden_endpoint,
336
-						'args' => $this->_get_read_query_params( $model, $version ),
336
+						'args' => $this->_get_read_query_params($model, $version),
337 337
 						'_links' => array(
338
-							'self' => rest_url( EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route ),
338
+							'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace.$version.$singular_model_route),
339 339
 						)
340 340
 					),
341 341
 //						array(
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 //							'hidden_endpoint' => $hidden_endpoint
347 347
 //						)
348 348
 				);
349
-			$model_routes[ $singular_model_route ] = array(
349
+			$model_routes[$singular_model_route] = array(
350 350
 					array(
351 351
 						'callback' => array(
352 352
 							'EventEspresso\core\libraries\rest_api\controllers\model\Read',
353 353
 							'handle_request_get_one' ),
354 354
 						'methods' => WP_REST_Server::READABLE,
355 355
 						'hidden_endpoint' => $hidden_endpoint,
356
-						'args' => $this->_get_response_selection_query_params( $model, $version)
356
+						'args' => $this->_get_response_selection_query_params($model, $version)
357 357
 					),
358 358
 //						array(
359 359
 //							'callback' => array(
@@ -364,19 +364,19 @@  discard block
 block discarded – undo
364 364
 //							),
365 365
 			);
366 366
 			//@todo: also handle  DELETE for a single item
367
-			foreach ( $model->relation_settings() as $relation_name => $relation_obj ) {
367
+			foreach ($model->relation_settings() as $relation_name => $relation_obj) {
368 368
 				$related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name(
369 369
 					$relation_name,
370 370
 					$relation_obj
371 371
 				);
372
-				$model_routes[ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array(
372
+				$model_routes[$singular_model_route.'/'.$related_model_name_endpoint_part] = array(
373 373
 						array(
374 374
 							'callback' => array(
375 375
 								'EventEspresso\core\libraries\rest_api\controllers\model\Read',
376 376
 								'handle_request_get_related' ),
377 377
 							'methods' => WP_REST_Server::READABLE,
378 378
 							'hidden_endpoint' => $hidden_endpoint,
379
-							'args' => $this->_get_read_query_params( $relation_obj->get_other_model(), $version ),
379
+							'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version),
380 380
 						),
381 381
 //							array(
382 382
 //								'callback' => array(
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	protected function _register_rpc_routes() {
401 401
 		$routes = array();
402
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
403
-			$routes[ self::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( $version, $hidden_endpoint );
402
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
403
+			$routes[self::ee_api_namespace.$version] = $this->_get_rpc_route_data_for_version($version, $hidden_endpoint);
404 404
 		}
405 405
 		return $routes;
406 406
 	}
@@ -411,10 +411,10 @@  discard block
 block discarded – undo
411 411
 	 * @param boolean $hidden_endpoint
412 412
 	 * @return array
413 413
 	 */
414
-	protected function _get_rpc_route_data_for_version( $version, $hidden_endpoint = false ) {
414
+	protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false) {
415 415
 		$this_versions_routes = array();
416 416
 			//checkin endpoint
417
-			$this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array(
417
+			$this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array(
418 418
 				array(
419 419
 					'callback' => array(
420 420
 						'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 						'force' => array(
426 426
 							'required' => false,
427 427
 							'default' => false,
428
-							'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' )
428
+							'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso')
429 429
 						)
430 430
 					)
431 431
 				)
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 * @param string $version
445 445
 	 * @return array
446 446
 	 */
447
-	protected function _get_response_selection_query_params( \EEM_Base $model, $version ) {
447
+	protected function _get_response_selection_query_params(\EEM_Base $model, $version) {
448 448
 		return apply_filters(
449 449
 			'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
450 450
 			array(
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 				'calculate' => array(
456 456
 					'required' => false,
457 457
 					'default' => '',
458
-					'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model( $model )
458
+					'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model($model)
459 459
 				)
460 460
 			),
461 461
 			$model,
@@ -473,13 +473,13 @@  discard block
 block discarded – undo
473 473
 	 * @return array    describing the args acceptable when querying this model
474 474
 	 * @throws \EE_Error
475 475
 	 */
476
-	protected function _get_read_query_params( \EEM_Base $model, $version ) {
476
+	protected function _get_read_query_params(\EEM_Base $model, $version) {
477 477
 		$default_orderby = array();
478
-		foreach( $model->get_combined_primary_key_fields() as $key_field ) {
479
-			$default_orderby[ $key_field->get_name() ] = 'ASC';
478
+		foreach ($model->get_combined_primary_key_fields() as $key_field) {
479
+			$default_orderby[$key_field->get_name()] = 'ASC';
480 480
 		}
481 481
 		return array_merge(
482
-			$this->_get_response_selection_query_params( $model, $version ),
482
+			$this->_get_response_selection_query_params($model, $version),
483 483
 			array(
484 484
 				'where' => array(
485 485
 					'required' => false,
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 	 */
517 517
 	protected function _register_config_routes() {
518 518
 		$config_routes = array();
519
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
520
-			$config_routes[ self::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version,	$hidden_endpoint );
519
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
520
+			$config_routes[self::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
521 521
 		}
522 522
 		return $config_routes;
523 523
 	}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	 * @param boolean $hidden_endpoint
529 529
 	 * @return array
530 530
 	 */
531
-	protected function _get_config_route_data_for_version( $version, $hidden_endpoint ) {
531
+	protected function _get_config_route_data_for_version($version, $hidden_endpoint) {
532 532
 		return array(
533 533
 			'config' => array(
534 534
 				array(
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
 	 */
550 550
 	protected function _register_meta_routes() {
551 551
 		$meta_routes = array();
552
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
553
-			$meta_routes[ self::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( $version, $hidden_endpoint );
552
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
553
+			$meta_routes[self::ee_api_namespace.$version] = $this->_get_meta_route_data_for_version($version, $hidden_endpoint);
554 554
 		}
555 555
 		return $meta_routes;
556 556
 	}
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	 * @param boolean $hidden_endpoint
562 562
 	 * @return array
563 563
 	 */
564
-	protected function _get_meta_route_data_for_version( $version, $hidden_endpoint = false ) {
564
+	protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false) {
565 565
 		return array( 
566 566
 			'resources'  => array(
567 567
 				array(
@@ -584,13 +584,13 @@  discard block
 block discarded – undo
584 584
 	 * @return array
585 585
 	 * @throws \EE_Error
586 586
 	 */
587
-	public static function hide_old_endpoints( $route_data ) {
588
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
589
-			foreach( $relative_urls as $endpoint => $routes ) {
590
-				foreach( $routes as $route ) {
591
-					if( $route[ 'hidden_endpoint' ] ) {
592
-						$full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' );
593
-						unset( $route_data[ $full_route ] );
587
+	public static function hide_old_endpoints($route_data) {
588
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
589
+			foreach ($relative_urls as $endpoint => $routes) {
590
+				foreach ($routes as $route) {
591
+					if ($route['hidden_endpoint']) {
592
+						$full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/');
593
+						unset($route_data[$full_route]);
594 594
 					}
595 595
 				}
596 596
 			}
@@ -629,8 +629,8 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	public static function latest_rest_api_version() {
631 631
 		$versions_served = \EED_Core_Rest_Api::versions_served();
632
-		$versions_served_keys = array_keys( $versions_served );
633
-		return end( $versions_served_keys );
632
+		$versions_served_keys = array_keys($versions_served);
633
+		return end($versions_served_keys);
634 634
 	}
635 635
 
636 636
 	/**
@@ -644,32 +644,32 @@  discard block
 block discarded – undo
644 644
 	public static function versions_served() {
645 645
 		$versions_served = array();
646 646
 		$possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
647
-		$lowest_compatible_version = end( $possibly_served_versions);
648
-		reset( $possibly_served_versions );
649
-		$versions_served_historically = array_keys( $possibly_served_versions );
650
-		$latest_version = end( $versions_served_historically );
651
-		reset( $versions_served_historically );
647
+		$lowest_compatible_version = end($possibly_served_versions);
648
+		reset($possibly_served_versions);
649
+		$versions_served_historically = array_keys($possibly_served_versions);
650
+		$latest_version = end($versions_served_historically);
651
+		reset($versions_served_historically);
652 652
 		//for each version of core we have ever served:
653
-		foreach ( $versions_served_historically as $key_versioned_endpoint ) {
653
+		foreach ($versions_served_historically as $key_versioned_endpoint) {
654 654
 			//if it's not above the current core version, and it's compatible with the current version of core
655
-			if( $key_versioned_endpoint === $latest_version ) {
655
+			if ($key_versioned_endpoint === $latest_version) {
656 656
 				//don't hide the latest version in the index
657
-				$versions_served[ $key_versioned_endpoint ] = false;
658
-			} else if(
657
+				$versions_served[$key_versioned_endpoint] = false;
658
+			} else if (
659 659
 				$key_versioned_endpoint >= $lowest_compatible_version
660 660
 				&& $key_versioned_endpoint < EED_Core_Rest_Api::core_version()
661 661
 			) {
662 662
 				//include, but hide, previous versions which are still supported
663
-				$versions_served[ $key_versioned_endpoint ] = true;
664
-			} elseif(
663
+				$versions_served[$key_versioned_endpoint] = true;
664
+			} elseif (
665 665
 				apply_filters(
666 666
 					'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
667 667
 					false,
668 668
 					$possibly_served_versions
669 669
 				)
670
-			){
670
+			) {
671 671
 				//if a version is no longer supported, don't include it in index or list of versions served
672
-				$versions_served[ $key_versioned_endpoint ] = true;
672
+				$versions_served[$key_versioned_endpoint] = true;
673 673
 			}
674 674
 		}
675 675
 		return $versions_served;
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	 * @return string
683 683
 	 */
684 684
 	public static function core_version() {
685
-		return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) );
685
+		return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3)));
686 686
 	}
687 687
 
688 688
 	/**
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 * @param  WP $WP
708 708
 	 * @return    void
709 709
 	 */
710
-	public function run( $WP ) {
710
+	public function run($WP) {
711 711
 
712 712
 	}
713 713
 
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 1 patch
Spacing   +257 added lines, -257 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 * @return EED_Single_Page_Checkout
54 54
 	 */
55 55
 	public static function instance() {
56
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
57
-		return parent::get_instance( __CLASS__ );
56
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
57
+		return parent::get_instance(__CLASS__);
58 58
 	}
59 59
 
60 60
 
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public static function set_hooks_admin() {
101 101
 		EED_Single_Page_Checkout::set_definitions();
102
-		if ( defined( 'DOING_AJAX' )) {
102
+		if (defined('DOING_AJAX')) {
103 103
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
104 104
 			ob_start();
105 105
 			EED_Single_Page_Checkout::load_reg_steps();
106 106
 		} else {
107 107
 			// 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
108
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
108
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
109 109
 		}
110 110
 		// set ajax hooks
111
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
112
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
113
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
114
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
115
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
116
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
111
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
112
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
113
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
114
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
115
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
116
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
117 117
 	}
118 118
 
119 119
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 * @param string $ajax_action
125 125
 	 * @throws EE_Error
126 126
 	 */
127
-	public static function process_ajax_request( $ajax_action ) {
128
-		EE_Registry::instance()->request()->set( 'action', $ajax_action );
127
+	public static function process_ajax_request($ajax_action) {
128
+		EE_Registry::instance()->request()->set('action', $ajax_action);
129 129
 		EED_Single_Page_Checkout::instance()->_initialize();
130 130
 	}
131 131
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @throws EE_Error
138 138
 	 */
139 139
 	public static function display_reg_step() {
140
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
140
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
141 141
 	}
142 142
 
143 143
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @throws EE_Error
149 149
 	 */
150 150
 	public static function process_reg_step() {
151
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
151
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
152 152
 	}
153 153
 
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @throws EE_Error
160 160
 	 */
161 161
 	public static function update_reg_step() {
162
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
162
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
163 163
 	}
164 164
 
165 165
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @throws EE_Error
173 173
 	 */
174 174
 	public static function update_checkout() {
175
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
175
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
176 176
 	}
177 177
 
178 178
 
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 	 * @throws EE_Error
186 186
 	 */
187 187
 	public static function set_definitions() {
188
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
189
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
190
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
191
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
192
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
193
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
194
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
195
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
188
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
189
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
190
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
191
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
192
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
193
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
194
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
195
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
196 196
 	}
197 197
 
198 198
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public static function load_reg_steps() {
209 209
 		static $reg_steps_loaded = FALSE;
210
-		if ( $reg_steps_loaded ) {
210
+		if ($reg_steps_loaded) {
211 211
 			return;
212 212
 		}
213 213
 		// filter list of reg_steps
@@ -216,24 +216,24 @@  discard block
 block discarded – undo
216 216
 			EED_Single_Page_Checkout::get_reg_steps()
217 217
 		);
218 218
 		// sort by key (order)
219
-		ksort( $reg_steps_to_load );
219
+		ksort($reg_steps_to_load);
220 220
 		// loop through folders
221
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
221
+		foreach ($reg_steps_to_load as $order => $reg_step) {
222 222
 			// we need a
223
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
223
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
224 224
 				// copy over to the reg_steps_array
225
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
225
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
226 226
 				// register custom key route for each reg step
227 227
 				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
228
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
228
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
229 229
 				// add AJAX or other hooks
230
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
230
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
231 231
 					// setup autoloaders if necessary
232 232
 					$reg_step_class_name = $reg_step['class_name'];
233
-					if ( ! class_exists( $reg_step_class_name )) {
234
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
233
+					if ( ! class_exists($reg_step_class_name)) {
234
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
235 235
 					}
236
-					if ( is_subclass_of( $reg_step_class_name, 'EE_SPCO_Reg_Step' )) {
236
+					if (is_subclass_of($reg_step_class_name, 'EE_SPCO_Reg_Step')) {
237 237
 						/** @var EE_SPCO_Reg_Step $reg_step_class_name */
238 238
 						$reg_step_class_name::set_hooks();
239 239
 					}
@@ -254,28 +254,28 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public static function get_reg_steps() {
256 256
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
257
-		if ( empty( $reg_steps )) {
257
+		if (empty($reg_steps)) {
258 258
 			$reg_steps = array(
259 259
 				10 => array(
260
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
260
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
261 261
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
262 262
 					'slug' => 'attendee_information',
263 263
 					'has_hooks' => FALSE
264 264
 				),
265 265
 				20 => array(
266
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
266
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
267 267
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
268 268
 					'slug' => 'registration_confirmation',
269 269
 					'has_hooks' => FALSE
270 270
 				),
271 271
 				30 => array(
272
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
272
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
273 273
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
274 274
 					'slug' => 'payment_options',
275 275
 					'has_hooks' => TRUE
276 276
 				),
277 277
 				999 => array(
278
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
278
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
279 279
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
280 280
 					'slug' => 'finalize_registration',
281 281
 					'has_hooks' => FALSE
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public static function registration_checkout_for_admin() {
298 298
 		EED_Single_Page_Checkout::load_reg_steps();
299
-		EE_Registry::instance()->request()->set( 'step', 'attendee_information' );
300
-		EE_Registry::instance()->request()->set( 'action', 'display_spco_reg_step' );
301
-		EE_Registry::instance()->request()->set( 'process_form_submission', false );
299
+		EE_Registry::instance()->request()->set('step', 'attendee_information');
300
+		EE_Registry::instance()->request()->set('action', 'display_spco_reg_step');
301
+		EE_Registry::instance()->request()->set('process_form_submission', false);
302 302
 		EED_Single_Page_Checkout::instance()->_initialize();
303 303
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
304 304
 		return EE_Registry::instance()->REQ->get_output();
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public static function process_registration_from_admin() {
317 317
 		EED_Single_Page_Checkout::load_reg_steps();
318
-		EE_Registry::instance()->request()->set( 'step', 'attendee_information' );
319
-		EE_Registry::instance()->request()->set( 'action', 'process_reg_step' );
320
-		EE_Registry::instance()->request()->set( 'process_form_submission', true );
318
+		EE_Registry::instance()->request()->set('step', 'attendee_information');
319
+		EE_Registry::instance()->request()->set('action', 'process_reg_step');
320
+		EE_Registry::instance()->request()->set('process_form_submission', true);
321 321
 		EED_Single_Page_Checkout::instance()->_initialize();
322
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
323
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
324
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
325
-				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step );
326
-				if ( $final_reg_step->process_reg_step() ) {
322
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
323
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
324
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
325
+				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
326
+				if ($final_reg_step->process_reg_step()) {
327 327
 					$final_reg_step->set_completed();
328 328
 					EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
329 329
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
 	 * @return    void
344 344
 	 * @throws EE_Error
345 345
 	 */
346
-	public function run( $WP_Query ) {
346
+	public function run($WP_Query) {
347 347
 		if (
348 348
 			$WP_Query instanceof WP_Query
349 349
 			&& $WP_Query->is_main_query()
350
-			&& apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )
350
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
351 351
 		) {
352 352
 			$this->_initialize();
353 353
 		}
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 	 * @return    void
364 364
 	 * @throws EE_Error
365 365
 	 */
366
-	public static function init( $WP_Query ) {
367
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
366
+	public static function init($WP_Query) {
367
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
368 368
 	}
369 369
 
370 370
 
@@ -378,34 +378,34 @@  discard block
 block discarded – undo
378 378
 	 */
379 379
 	private function _initialize() {
380 380
 		// ensure SPCO doesn't run twice
381
-		if ( EED_Single_Page_Checkout::$_initialized ) {
381
+		if (EED_Single_Page_Checkout::$_initialized) {
382 382
 			return;
383 383
 		}
384 384
 		try {
385 385
 			// setup the EE_Checkout object
386 386
 			$this->checkout = $this->_initialize_checkout();
387 387
 			// filter checkout
388
-			$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
388
+			$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
389 389
 			// get the $_GET
390 390
 			$this->_get_request_vars();
391 391
 			// filter continue_reg
392
-			$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
392
+			$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
393 393
 			// load the reg steps array
394
-			if ( ! $this->_load_and_instantiate_reg_steps() ) {
394
+			if ( ! $this->_load_and_instantiate_reg_steps()) {
395 395
 				EED_Single_Page_Checkout::$_initialized = true;
396 396
 				return;
397 397
 			}
398 398
 			// set the current step
399
-			$this->checkout->set_current_step( $this->checkout->step );
399
+			$this->checkout->set_current_step($this->checkout->step);
400 400
 			// and the next step
401 401
 			$this->checkout->set_next_step();
402 402
 			// was there already a valid transaction in the checkout from the session ?
403
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
403
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
404 404
 				// get transaction from db or session
405 405
 				$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
406 406
 					? $this->_get_transaction_and_cart_for_previous_visit()
407 407
 					: $this->_get_cart_for_current_session_and_setup_new_transaction();
408
-				if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
408
+				if ( ! $this->checkout->transaction instanceof EE_Transaction) {
409 409
 					// add some style and make it dance
410 410
 					$this->checkout->transaction = EE_Transaction::new_instance();
411 411
 					$this->add_styles_and_scripts();
@@ -413,10 +413,10 @@  discard block
 block discarded – undo
413 413
 					return;
414 414
 				}
415 415
 				// and the registrations for the transaction
416
-				$this->_get_registrations( $this->checkout->transaction );
416
+				$this->_get_registrations($this->checkout->transaction);
417 417
 			}
418 418
 			// verify that everything has been setup correctly
419
-			if ( ! $this->_final_verifications() ) {
419
+			if ( ! $this->_final_verifications()) {
420 420
 				EED_Single_Page_Checkout::$_initialized = true;
421 421
 				return;
422 422
 			}
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 			// set no cache headers and constants
442 442
 			EE_System::do_not_cache();
443 443
 			// add anchor
444
-			add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
445
-		} catch ( Exception $e ) {
446
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
444
+			add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
445
+		} catch (Exception $e) {
446
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
447 447
 		}
448 448
 	}
449 449
 
@@ -461,20 +461,20 @@  discard block
 block discarded – undo
461 461
 		// look in session for existing checkout
462 462
 		$checkout = EE_Registry::instance()->SSN->checkout();
463 463
 		// verify
464
-		if ( ! $checkout instanceof EE_Checkout ) {
464
+		if ( ! $checkout instanceof EE_Checkout) {
465 465
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
466
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
466
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
467 467
 		} else {
468
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
468
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
469 469
 				$this->unlock_transaction();
470
-				wp_safe_redirect( $checkout->redirect_url );
470
+				wp_safe_redirect($checkout->redirect_url);
471 471
 				exit();
472 472
 			}
473 473
 		}
474
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
474
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
475 475
 		// verify again
476
-		if ( ! $checkout instanceof EE_Checkout ) {
477
-			throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
476
+		if ( ! $checkout instanceof EE_Checkout) {
477
+			throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
478 478
 		}
479 479
 		// reset anything that needs a clean slate for each request
480 480
 		$checkout->reset_for_current_request();
@@ -492,24 +492,24 @@  discard block
 block discarded – undo
492 492
 	 */
493 493
 	private function _get_request_vars() {
494 494
 		//make sure this request is marked as belonging to EE
495
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
495
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
496 496
 		// which step is being requested ?
497
-		$this->checkout->step = EE_Registry::instance()->request()->get( 'step', $this->_get_first_step() );
497
+		$this->checkout->step = EE_Registry::instance()->request()->get('step', $this->_get_first_step());
498 498
 		// which step is being edited ?
499
-		$this->checkout->edit_step = EE_Registry::instance()->request()->get( 'edit_step', '' );
499
+		$this->checkout->edit_step = EE_Registry::instance()->request()->get('edit_step', '');
500 500
 		// and what we're doing on the current step
501
-		$this->checkout->action = EE_Registry::instance()->request()->get( 'action', 'display_spco_reg_step' );
501
+		$this->checkout->action = EE_Registry::instance()->request()->get('action', 'display_spco_reg_step');
502 502
 		// returning to edit ?
503
-		$this->checkout->reg_url_link = EE_Registry::instance()->request()->get( 'e_reg_url_link', '' );
503
+		$this->checkout->reg_url_link = EE_Registry::instance()->request()->get('e_reg_url_link', '');
504 504
 		// or some other kind of revisit ?
505
-		$this->checkout->revisit = EE_Registry::instance()->request()->get( 'revisit', FALSE );
505
+		$this->checkout->revisit = EE_Registry::instance()->request()->get('revisit', FALSE);
506 506
 		// and whether or not to generate a reg form for this request
507
-		$this->checkout->generate_reg_form = EE_Registry::instance()->request()->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
507
+		$this->checkout->generate_reg_form = EE_Registry::instance()->request()->get('generate_reg_form', TRUE); // TRUE 	FALSE
508 508
 		// and whether or not to process a reg form submission for this request
509
-		$this->checkout->process_form_submission = EE_Registry::instance()->request()->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
509
+		$this->checkout->process_form_submission = EE_Registry::instance()->request()->get('process_form_submission', FALSE); // TRUE 	FALSE
510 510
 		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step'
511 511
 			? $this->checkout->process_form_submission
512
-			: false; 		// true 	false
512
+			: false; // true 	false
513 513
 		//$this->_display_request_vars();
514 514
 	}
515 515
 
@@ -522,17 +522,17 @@  discard block
 block discarded – undo
522 522
 	 * @return    void
523 523
 	 */
524 524
 	protected function _display_request_vars() {
525
-		if ( ! WP_DEBUG ) {
525
+		if ( ! WP_DEBUG) {
526 526
 			return;
527 527
 		}
528
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
529
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
530
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
531
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
532
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
533
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
534
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
535
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
528
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
529
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
530
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
531
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
532
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
533
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
534
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
535
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
536 536
 	}
537 537
 
538 538
 
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
 	 * @throws EE_Error
547 547
 	 */
548 548
 	private function _get_first_step() {
549
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
550
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
549
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
550
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
551 551
 	}
552 552
 
553 553
 
@@ -563,27 +563,27 @@  discard block
 block discarded – undo
563 563
 	private function _load_and_instantiate_reg_steps() {
564 564
 		// have reg_steps already been instantiated ?
565 565
 		if (
566
-			empty( $this->checkout->reg_steps ) ||
567
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
566
+			empty($this->checkout->reg_steps) ||
567
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
568 568
 		) {
569 569
 			// if not, then loop through raw reg steps array
570
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
571
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
570
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
571
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
572 572
 					return false;
573 573
 				}
574 574
 			}
575 575
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
576 576
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
577 577
 			// skip the registration_confirmation page ?
578
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
578
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
579 579
 				// just remove it from the reg steps array
580
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
580
+				$this->checkout->remove_reg_step('registration_confirmation', false);
581 581
 			} else if (
582
-				isset( $this->checkout->reg_steps['registration_confirmation'] )
582
+				isset($this->checkout->reg_steps['registration_confirmation'])
583 583
 				&& EE_Registry::instance()->CFG->registration->reg_confirmation_last
584 584
 			) {
585 585
 				// set the order to something big like 100
586
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
586
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
587 587
 			}
588 588
 			// filter the array for good luck
589 589
 			$this->checkout->reg_steps = apply_filters(
@@ -593,13 +593,13 @@  discard block
 block discarded – undo
593 593
 			// finally re-sort based on the reg step class order properties
594 594
 			$this->checkout->sort_reg_steps();
595 595
 		} else {
596
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
596
+			foreach ($this->checkout->reg_steps as $reg_step) {
597 597
 				// set all current step stati to FALSE
598
-				$reg_step->set_is_current_step( FALSE );
598
+				$reg_step->set_is_current_step(FALSE);
599 599
 			}
600 600
 		}
601
-		if ( empty( $this->checkout->reg_steps )) {
602
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
601
+		if (empty($this->checkout->reg_steps)) {
602
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
603 603
 			return false;
604 604
 		}
605 605
 			// make reg step details available to JS
@@ -618,10 +618,10 @@  discard block
 block discarded – undo
618 618
 	 * @return bool
619 619
 	 * @throws EE_Error
620 620
 	 */
621
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
621
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
622 622
 
623 623
 		// we need a file_path, class_name, and slug to add a reg step
624
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
624
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
625 625
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
626 626
 			if (
627 627
 				$this->checkout->reg_url_link
@@ -639,26 +639,26 @@  discard block
 block discarded – undo
639 639
 				FALSE
640 640
 			);
641 641
 			// did we gets the goods ?
642
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
642
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
643 643
 				// set reg step order based on config
644
-				$reg_step_obj->set_order( $order );
644
+				$reg_step_obj->set_order($order);
645 645
 				// add instantiated reg step object to the master reg steps array
646
-				$this->checkout->add_reg_step( $reg_step_obj );
646
+				$this->checkout->add_reg_step($reg_step_obj);
647 647
 			} else {
648 648
 				EE_Error::add_error(
649
-					__( 'The current step could not be set.', 'event_espresso' ),
649
+					__('The current step could not be set.', 'event_espresso'),
650 650
 					__FILE__, __FUNCTION__, __LINE__
651 651
 				);
652 652
 				return false;
653 653
 			}
654 654
 		} else {
655
-			if ( WP_DEBUG ) {
655
+			if (WP_DEBUG) {
656 656
 				EE_Error::add_error(
657 657
 					sprintf(
658
-						__( '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' ),
659
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
660
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
661
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
658
+						__('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'),
659
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
660
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
661
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
662 662
 						'<ul>',
663 663
 						'<li>',
664 664
 						'</li>',
@@ -683,16 +683,16 @@  discard block
 block discarded – undo
683 683
 	 */
684 684
 	private function _get_transaction_and_cart_for_previous_visit() {
685 685
 		/** @var $TXN_model EEM_Transaction */
686
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
686
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
687 687
 		// 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
688
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
688
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
689 689
 		// verify transaction
690
-		if ( $transaction instanceof EE_Transaction ) {
690
+		if ($transaction instanceof EE_Transaction) {
691 691
 			// and get the cart that was used for that transaction
692
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
692
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
693 693
 			return $transaction;
694 694
 		} else {
695
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
695
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
696 696
 			return NULL;
697 697
 		}
698 698
 	}
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
 	 * @return EE_Cart
708 708
 	 * @throws EE_Error
709 709
 	 */
710
-	private function _get_cart_for_transaction( $transaction ) {
711
-		return $this->checkout->get_cart_for_transaction( $transaction );
710
+	private function _get_cart_for_transaction($transaction) {
711
+		return $this->checkout->get_cart_for_transaction($transaction);
712 712
 	}
713 713
 
714 714
 
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 	 * @param EE_Transaction $transaction
721 721
 	 * @return EE_Cart
722 722
 	 */
723
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
724
-		return $this->checkout->get_cart_for_transaction( $transaction );
723
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
724
+		return $this->checkout->get_cart_for_transaction($transaction);
725 725
 	}
726 726
 
727 727
 
@@ -737,17 +737,17 @@  discard block
 block discarded – undo
737 737
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
738 738
 		//  if there's no transaction, then this is the FIRST visit to SPCO
739 739
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
740
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
740
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
741 741
 		// and then create a new transaction
742 742
 		$transaction = $this->_initialize_transaction();
743 743
 		// verify transaction
744
-		if ( $transaction instanceof EE_Transaction ) {
744
+		if ($transaction instanceof EE_Transaction) {
745 745
 			// save it so that we have an ID for other objects to use
746 746
 			$transaction->save();
747 747
 			// and save TXN data to the cart
748
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
748
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
749 749
 		} else {
750
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
750
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
751 751
 		}
752 752
 		return $transaction;
753 753
 	}
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
 			// grab the cart grand total
768 768
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
769 769
 			// create new TXN
770
-			return EE_Transaction::new_instance( array(
770
+			return EE_Transaction::new_instance(array(
771 771
 				'TXN_timestamp' 	=> time(),
772 772
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
773 773
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
774 774
 				'TXN_paid' 				=> 0,
775 775
 				'STS_ID' 					=> EEM_Transaction::failed_status_code,
776 776
 			));
777
-		} catch( Exception $e ) {
778
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
777
+		} catch (Exception $e) {
778
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
779 779
 		}
780 780
 		return NULL;
781 781
 	}
@@ -790,25 +790,25 @@  discard block
 block discarded – undo
790 790
 	 * @return EE_Cart
791 791
 	 * @throws EE_Error
792 792
 	 */
793
-	private function _get_registrations( EE_Transaction $transaction ) {
793
+	private function _get_registrations(EE_Transaction $transaction) {
794 794
 		// first step: grab the registrants  { : o
795
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
795
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
796 796
 		// verify registrations have been set
797
-		if ( empty( $registrations )) {
797
+		if (empty($registrations)) {
798 798
 			// if no cached registrations, then check the db
799
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
799
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
800 800
 			// still nothing ? well as long as this isn't a revisit
801
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
801
+			if (empty($registrations) && ! $this->checkout->revisit) {
802 802
 				// generate new registrations from scratch
803
-				$registrations = $this->_initialize_registrations( $transaction );
803
+				$registrations = $this->_initialize_registrations($transaction);
804 804
 			}
805 805
 		}
806 806
 		// sort by their original registration order
807
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
807
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
808 808
 		// then loop thru the array
809
-		foreach ( $registrations as $registration ) {
809
+		foreach ($registrations as $registration) {
810 810
 			// verify each registration
811
-			if ( $registration instanceof EE_Registration ) {
811
+			if ($registration instanceof EE_Registration) {
812 812
 				// we display all attendee info for the primary registrant
813 813
 				if (
814 814
 				     $this->checkout->reg_url_link === $registration->reg_url_link()
@@ -821,9 +821,9 @@  discard block
 block discarded – undo
821 821
 				    && $this->checkout->reg_url_link !== $registration->reg_url_link()
822 822
 				) {
823 823
 					// but hide info if it doesn't belong to you
824
-					$transaction->clear_cache( 'Registration', $registration->ID() );
824
+					$transaction->clear_cache('Registration', $registration->ID());
825 825
 				}
826
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
826
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
827 827
 			}
828 828
 		}
829 829
 	}
@@ -838,17 +838,17 @@  discard block
 block discarded – undo
838 838
 	 * @return array
839 839
 	 * @throws EE_Error
840 840
 	 */
841
-	private function _initialize_registrations( EE_Transaction $transaction ) {
841
+	private function _initialize_registrations(EE_Transaction $transaction) {
842 842
 		$att_nmbr = 0;
843 843
 		$registrations = array();
844
-		if ( $transaction instanceof EE_Transaction ) {
844
+		if ($transaction instanceof EE_Transaction) {
845 845
 			/** @type EE_Registration_Processor $registration_processor */
846
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
846
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
847 847
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
848 848
 			// now let's add the cart items to the $transaction
849
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
849
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
850 850
 				//do the following for each ticket of this type they selected
851
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
851
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
852 852
 					$att_nmbr++;
853 853
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
854 854
 						$line_item,
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
 						$att_nmbr,
857 857
 						$this->checkout->total_ticket_count
858 858
 					);
859
-					if ( $registration instanceof EE_Registration ) {
860
-						$registrations[ $registration->ID() ] = $registration;
859
+					if ($registration instanceof EE_Registration) {
860
+						$registrations[$registration->ID()] = $registration;
861 861
 					}
862 862
 				}
863 863
 			}
864
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
864
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
865 865
 		}
866 866
 		return $registrations;
867 867
 	}
@@ -876,12 +876,12 @@  discard block
 block discarded – undo
876 876
 	 * @param EE_Registration $reg_B
877 877
 	 * @return array()
878 878
 	 */
879
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
879
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
880 880
 		// this shouldn't ever happen within the same TXN, but oh well
881
-		if ( $reg_A->count() === $reg_B->count() ) {
881
+		if ($reg_A->count() === $reg_B->count()) {
882 882
 			return 0;
883 883
 		}
884
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
884
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
885 885
 	}
886 886
 
887 887
 
@@ -896,21 +896,21 @@  discard block
 block discarded – undo
896 896
 	 */
897 897
 	private function _final_verifications() {
898 898
 		// filter checkout
899
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
899
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
900 900
 		//verify that current step is still set correctly
901
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
902
-			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__ );
901
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
902
+			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__);
903 903
 			return false;
904 904
 		}
905 905
 		// if returning to SPCO, then verify that primary registrant is set
906
-		if ( ! empty( $this->checkout->reg_url_link )) {
906
+		if ( ! empty($this->checkout->reg_url_link)) {
907 907
 			$valid_registrant = $this->checkout->transaction->primary_registration();
908
-			if ( ! $valid_registrant instanceof EE_Registration ) {
909
-				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__ );
908
+			if ( ! $valid_registrant instanceof EE_Registration) {
909
+				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__);
910 910
 				return false;
911 911
 			}
912 912
 			$valid_registrant = null;
913
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
913
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
914 914
 				if (
915 915
 					$registration instanceof EE_Registration
916 916
 					&& $registration->reg_url_link() === $this->checkout->reg_url_link
@@ -918,9 +918,9 @@  discard block
 block discarded – undo
918 918
 					$valid_registrant = $registration;
919 919
 				}
920 920
 			}
921
-			if ( ! $valid_registrant instanceof EE_Registration ) {
921
+			if ( ! $valid_registrant instanceof EE_Registration) {
922 922
 				// hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
923
-				if ( EED_Single_Page_Checkout::$_checkout_verified ) {
923
+				if (EED_Single_Page_Checkout::$_checkout_verified) {
924 924
 					// clear the session, mark the checkout as unverified, and try again
925 925
 					EE_Registry::instance()->SSN->clear_session();
926 926
 					EED_Single_Page_Checkout::$_initialized = false;
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 					EE_Error::reset_notices();
930 930
 					return false;
931 931
 				}
932
-				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__ );
932
+				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__);
933 933
 				return false;
934 934
 			}
935 935
 		}
936 936
 		// now that things have been kinda sufficiently verified,
937 937
 		// let's add the checkout to the session so that's available other systems
938
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
938
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
939 939
 		return true;
940 940
 	}
941 941
 
@@ -950,15 +950,15 @@  discard block
 block discarded – undo
950 950
 	 * @param bool $reinitializing
951 951
 	 * @throws \EE_Error
952 952
 	 */
953
-	private function _initialize_reg_steps( $reinitializing = false ) {
954
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
953
+	private function _initialize_reg_steps($reinitializing = false) {
954
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
955 955
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
956
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
957
-			if ( ! $reg_step->initialize_reg_step() ) {
956
+		foreach ($this->checkout->reg_steps as $reg_step) {
957
+			if ( ! $reg_step->initialize_reg_step()) {
958 958
 				// if not initialized then maybe this step is being removed...
959
-				if ( ! $reinitializing && $reg_step->is_current_step() ) {
959
+				if ( ! $reinitializing && $reg_step->is_current_step()) {
960 960
 					// if it was the current step, then we need to start over here
961
-					$this->_initialize_reg_steps( true );
961
+					$this->_initialize_reg_steps(true);
962 962
 					return;
963 963
 				}
964 964
 				continue;
@@ -967,13 +967,13 @@  discard block
 block discarded – undo
967 967
 			$reg_step->enqueue_styles_and_scripts();
968 968
 			// i18n
969 969
 			$reg_step->translate_js_strings();
970
-			if ( $reg_step->is_current_step() ) {
970
+			if ($reg_step->is_current_step()) {
971 971
 				// the text that appears on the reg step form submit button
972 972
 				$reg_step->set_submit_button_text();
973 973
 			}
974 974
 		}
975 975
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
976
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
976
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
977 977
 	}
978 978
 
979 979
 
@@ -986,43 +986,43 @@  discard block
 block discarded – undo
986 986
 	 */
987 987
 	private function _check_form_submission() {
988 988
 		//does this request require the reg form to be generated ?
989
-		if ( $this->checkout->generate_reg_form ) {
989
+		if ($this->checkout->generate_reg_form) {
990 990
 			// ever heard that song by Blue Rodeo ?
991 991
 			try {
992 992
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
993 993
 				// if not displaying a form, then check for form submission
994
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
994
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
995 995
 					// clear out any old data in case this step is being run again
996
-					$this->checkout->current_step->set_valid_data( array() );
996
+					$this->checkout->current_step->set_valid_data(array());
997 997
 					// capture submitted form data
998 998
 					$this->checkout->current_step->reg_form->receive_form_submission(
999
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->request()->params(), $this->checkout )
999
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->request()->params(), $this->checkout)
1000 1000
 					);
1001 1001
 					// validate submitted form data
1002
-					if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid() ) {
1002
+					if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid()) {
1003 1003
 						// thou shall not pass !!!
1004 1004
 						$this->checkout->continue_reg = FALSE;
1005 1005
 						// any form validation errors?
1006
-						if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) {
1006
+						if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1007 1007
 							$submission_error_messages = array();
1008 1008
 							// bad, bad, bad registrant
1009
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
1010
-								if ( $validation_error instanceof EE_Validation_Error ) {
1009
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1010
+								if ($validation_error instanceof EE_Validation_Error) {
1011 1011
 									$submission_error_messages[] = sprintf(
1012
-										__( '%s : %s', 'event_espresso' ),
1012
+										__('%s : %s', 'event_espresso'),
1013 1013
 										$validation_error->get_form_section()->html_label_text(),
1014 1014
 										$validation_error->getMessage()
1015 1015
 									);
1016 1016
 								}
1017 1017
 							}
1018
-							EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1018
+							EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1019 1019
 						}
1020 1020
 						// well not really... what will happen is we'll just get redirected back to redo the current step
1021 1021
 						$this->go_to_next_step();
1022 1022
 						return;
1023 1023
 					}
1024 1024
 				}
1025
-			} catch( EE_Error $e ) {
1025
+			} catch (EE_Error $e) {
1026 1026
 				$e->get_error();
1027 1027
 			}
1028 1028
 		}
@@ -1039,28 +1039,28 @@  discard block
 block discarded – undo
1039 1039
 	 */
1040 1040
 	private function _process_form_action() {
1041 1041
 		// what cha wanna do?
1042
-		if( $this->checkout->action === 'display_spco_reg_step' ) {
1042
+		if ($this->checkout->action === 'display_spco_reg_step') {
1043 1043
 			// AJAX next step reg form
1044 1044
 			$this->checkout->redirect = false;
1045
-			if ( EE_Registry::instance()->request()->ajax ) {
1046
-				$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
1045
+			if (EE_Registry::instance()->request()->ajax) {
1046
+				$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1047 1047
 			}
1048 1048
 		} else {
1049 1049
 			// meh... do one of those other steps first
1050
-			if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
1050
+			if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1051 1051
 				// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1052 1052
 				do_action(
1053 1053
 					"AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}",
1054 1054
 					$this->checkout->current_step
1055 1055
 				);
1056 1056
 				// call action on current step
1057
-				if ( $this->checkout->current_step->{$this->checkout->action}() ) {
1057
+				if ($this->checkout->current_step->{$this->checkout->action}()) {
1058 1058
 					// good registrant, you get to proceed
1059 1059
 					if (
1060 1060
 						$this->checkout->current_step->success_message() !== ''
1061
-						&& apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false )
1061
+						&& apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)
1062 1062
 					) {
1063
-						EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() );
1063
+						EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions());
1064 1064
 					}
1065 1065
 					// pack it up, pack it in...
1066 1066
 					$this->_setup_redirect();
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 			} else {
1075 1075
 				EE_Error::add_error(
1076 1076
 					sprintf(
1077
-						__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1077
+						__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1078 1078
 						$this->checkout->action,
1079 1079
 						$this->checkout->current_step->name()
1080 1080
 					),
@@ -1101,10 +1101,10 @@  discard block
 block discarded – undo
1101 1101
 	public function add_styles_and_scripts() {
1102 1102
 		// i18n
1103 1103
 		$this->translate_js_strings();
1104
-		if ( $this->checkout->admin_request ) {
1105
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1104
+		if ($this->checkout->admin_request) {
1105
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1106 1106
 		} else {
1107
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1107
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1108 1108
 		}
1109 1109
 	}
1110 1110
 
@@ -1121,42 +1121,42 @@  discard block
 block discarded – undo
1121 1121
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1122 1122
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1123 1123
 		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');
1124
-		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' );
1125
-		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' );
1126
-		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' );
1124
+		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');
1125
+		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');
1126
+		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');
1127 1127
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1128 1128
 		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');
1129
-		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/>' );
1130
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1129
+		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/>');
1130
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1131 1131
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1132 1132
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1133 1133
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1134
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1135
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1136
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1137
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1138
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1139
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1140
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1141
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1142
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1143
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1144
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1145
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1146
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1147
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1134
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1135
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1136
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1137
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1138
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1139
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1140
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1141
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1142
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1143
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1144
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1145
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1146
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1147
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1148 1148
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1149
-			__( '%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' ),
1149
+			__('%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'),
1150 1150
 			'<h4 class="important-notice">',
1151 1151
 			'</h4>',
1152 1152
 			'<br />',
1153 1153
 			'<p>',
1154
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1154
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1155 1155
 			'">',
1156 1156
 			'</a>',
1157 1157
 			'</p>'
1158 1158
 		);
1159
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1159
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1160 1160
 	}
1161 1161
 
1162 1162
 
@@ -1169,25 +1169,25 @@  discard block
 block discarded – undo
1169 1169
 	 */
1170 1170
 	public function enqueue_styles_and_scripts() {
1171 1171
 		// load css
1172
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1173
-		wp_enqueue_style( 'single_page_checkout' );
1172
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1173
+		wp_enqueue_style('single_page_checkout');
1174 1174
 		// load JS
1175
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1176
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1177
-		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 );
1178
-		wp_enqueue_script( 'single_page_checkout' );
1175
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1176
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1177
+		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);
1178
+		wp_enqueue_script('single_page_checkout');
1179 1179
 
1180 1180
 		/**
1181 1181
 		 * global action hook for enqueueing styles and scripts with
1182 1182
 		 * spco calls.
1183 1183
 		 */
1184
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1184
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1185 1185
 
1186 1186
 		/**
1187 1187
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1188 1188
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1189 1189
 		 */
1190
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1190
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1191 1191
 
1192 1192
 	}
1193 1193
 
@@ -1202,19 +1202,19 @@  discard block
 block discarded – undo
1202 1202
 	 */
1203 1203
 	private function _display_spco_reg_form() {
1204 1204
 		// if registering via the admin, just display the reg form for the current step
1205
-		if ( $this->checkout->admin_request ) {
1206
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1205
+		if ($this->checkout->admin_request) {
1206
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1207 1207
 		} else {
1208 1208
 			// add powered by EE msg
1209
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1209
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1210 1210
 
1211
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1211
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1212 1212
 			$cookies_not_set_msg = '';
1213
-			if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1213
+			if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1214 1214
 				$cookies_not_set_msg = apply_filters(
1215 1215
 					'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1216 1216
 					sprintf(
1217
-						__( '%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' ),
1217
+						__('%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'),
1218 1218
 						'<div class="ee-attention">',
1219 1219
 						'</div>',
1220 1220
 						'<h6 class="important-notice">',
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 					'html_id' 	=> 'ee-single-page-checkout-dv',
1234 1234
 					'layout_strategy' => new EE_Template_Layout(
1235 1235
 						array(
1236
-							'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1236
+							'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1237 1237
 							'template_args' => array(
1238 1238
 								'empty_cart' => $empty_cart,
1239 1239
 								'revisit' => $this->checkout->revisit,
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
 								'empty_msg' => apply_filters(
1245 1245
 									'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1246 1246
 									sprintf(
1247
-										__( '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' ),
1248
-										'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1247
+										__('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'),
1248
+										'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1249 1249
 										'">',
1250 1250
 										'</a>'
1251 1251
 									)
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 								'registration_time_limit' => $this->checkout->get_registration_time_limit(),
1255 1255
 								'session_expiration'      => gmdate(
1256 1256
 									'M d, Y H:i:s',
1257
-									EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS )
1257
+									EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1258 1258
 								)
1259 1259
 							)
1260 1260
 						)
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 				)
1263 1263
 			);
1264 1264
 			// load template and add to output sent that gets filtered into the_content()
1265
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1265
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1266 1266
 		}
1267 1267
 	}
1268 1268
 
@@ -1276,8 +1276,8 @@  discard block
 block discarded – undo
1276 1276
 	 * @internal  param string $label
1277 1277
 	 * @return        string
1278 1278
 	 */
1279
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1280
-		if ( $next_step === 'finalize_registration' ) {
1279
+	public function add_extra_finalize_registration_inputs($next_step) {
1280
+		if ($next_step === 'finalize_registration') {
1281 1281
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1282 1282
 		}
1283 1283
 	}
@@ -1292,18 +1292,18 @@  discard block
 block discarded – undo
1292 1292
 	 * @throws EE_Error
1293 1293
 	 */
1294 1294
 	public static function display_registration_footer() {
1295
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1296
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1297
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' );
1298
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1295
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1296
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1297
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/');
1298
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1299 1299
 			echo apply_filters(
1300 1300
 				'FHEE__EE_Front_Controller__display_registration_footer',
1301 1301
 				sprintf(
1302
-					__( '%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' ),
1303
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1302
+					__('%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'),
1303
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1304 1304
 					'" target="_blank">',
1305 1305
 					'</a>',
1306
-					'<a href="' . $url . '" title="',
1306
+					'<a href="'.$url.'" title="',
1307 1307
 					'" target="_blank">',
1308 1308
 					'</a></div>'
1309 1309
 				)
@@ -1334,12 +1334,12 @@  discard block
 block discarded – undo
1334 1334
 	 * @return 	array
1335 1335
 	 */
1336 1336
 	private function _setup_redirect() {
1337
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1337
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1338 1338
 			$this->checkout->redirect = TRUE;
1339
-			if ( empty( $this->checkout->redirect_url )) {
1339
+			if (empty($this->checkout->redirect_url)) {
1340 1340
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1341 1341
 			}
1342
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1342
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1343 1343
 		}
1344 1344
 	}
1345 1345
 
@@ -1353,9 +1353,9 @@  discard block
 block discarded – undo
1353 1353
 	 * @throws EE_Error
1354 1354
 	 */
1355 1355
 	public function go_to_next_step() {
1356
-		if ( EE_Registry::instance()->request()->ajax ) {
1356
+		if (EE_Registry::instance()->request()->ajax) {
1357 1357
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1358
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1358
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1359 1359
 		}
1360 1360
 		$this->unlock_transaction();
1361 1361
 		// just return for these conditions
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 	 */
1386 1386
 	protected function _handle_json_response() {
1387 1387
 		// if this is an ajax request
1388
-		if ( EE_Registry::instance()->request()->ajax ) {
1388
+		if (EE_Registry::instance()->request()->ajax) {
1389 1389
 			// DEBUG LOG
1390 1390
 			//$this->checkout->log(
1391 1391
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
 			$this->checkout->json_response->set_registration_time_limit(
1399 1399
 				$this->checkout->get_registration_time_limit()
1400 1400
 			);
1401
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1401
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1402 1402
 			// just send the ajax (
1403 1403
 			$json_response = apply_filters(
1404 1404
 				'FHEE__EE_Single_Page_Checkout__JSON_response',
@@ -1419,9 +1419,9 @@  discard block
 block discarded – undo
1419 1419
 	 */
1420 1420
 	protected function _handle_html_redirects() {
1421 1421
 		// going somewhere ?
1422
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1422
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1423 1423
 			// store notices in a transient
1424
-			EE_Error::get_notices( false, true, true );
1424
+			EE_Error::get_notices(false, true, true);
1425 1425
 			// DEBUG LOG
1426 1426
 			//$this->checkout->log(
1427 1427
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 			//		'headers_list'    => headers_list(),
1432 1432
 			//	)
1433 1433
 			//);
1434
-			wp_safe_redirect( $this->checkout->redirect_url );
1434
+			wp_safe_redirect($this->checkout->redirect_url);
1435 1435
 			exit();
1436 1436
 		}
1437 1437
 	}
Please login to merge, or discard this patch.
caffeinated/brewing_regular.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -25,30 +25,30 @@  discard block
 block discarded – undo
25 25
  * ------------------------------------------------------------------------
26 26
  */
27 27
 // defined some new constants related to caffeinated folder
28
-define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' );
29
-define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS);
30
-define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS);
31
-define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS );
28
+define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/');
29
+define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS);
30
+define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS);
31
+define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS);
32 32
 class EE_Brewing_Regular extends EE_Base {
33 33
 
34 34
 	public function __construct() {
35
-		if ( defined( 'EE_CAFF_PATH' )) {
35
+		if (defined('EE_CAFF_PATH')) {
36 36
 			// activation
37
-			add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' ));
37
+			add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content'));
38 38
 			// load caff init
39
-			add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' ));
39
+			add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init'));
40 40
 			// make it so the PDF receipt doesn't show our shameless plug
41
-			add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' );
41
+			add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false');
42 42
 			// add caffeinated modules
43
-			add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' ));
43
+			add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register'));
44 44
 			// load caff scripts
45
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 );
45
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10);
46 46
 
47
-			add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 );
47
+			add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10);
48 48
 
49
-			add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) );
49
+			add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods'));
50 50
 			// caffeinated constructed
51
-			do_action( 'AHEE__EE_Brewing_Regular__construct__complete' );
51
+			do_action('AHEE__EE_Brewing_Regular__construct__complete');
52 52
 		}
53 53
 	}
54 54
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 * @param array  $paths original helper paths array
59 59
 	 * @return array             new array of paths
60 60
 	 */
61
-	public function caf_helper_paths( $paths ) {
62
-		$paths[] = EE_CAF_CORE . 'helpers' . DS;
61
+	public function caf_helper_paths($paths) {
62
+		$paths[] = EE_CAF_CORE.'helpers'.DS;
63 63
 		return $paths;
64 64
 	}
65 65
 
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 	 * Right now, we ASSUME the only price types in the system are default ones
76 76
 	 * @global WPDB $wpdb
77 77
 	 */
78
-	function initialize_caf_db_content(){
78
+	function initialize_caf_db_content() {
79 79
 //		echo "initialize caf db content!";
80 80
 		global $wpdb;
81 81
 
82 82
 		//use same method of getting creator id as the version introducing the change
83
-		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id());
83
+		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id());
84 84
 
85 85
 		$price_type_table = $wpdb->prefix."esp_price_type";
86 86
 		$price_table = $wpdb->prefix."esp_price";
87 87
 
88
-		if ( EEH_Activation::table_exists( $price_type_table ) ) {
88
+		if (EEH_Activation::table_exists($price_type_table)) {
89 89
 
90
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types
91
-			$tax_price_type_count = $wpdb->get_var( $SQL );
90
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types
91
+			$tax_price_type_count = $wpdb->get_var($SQL);
92 92
 
93
-			if ( $tax_price_type_count <= 1) {
93
+			if ($tax_price_type_count <= 1) {
94 94
 				$wpdb->insert($price_type_table,
95 95
 					array(
96 96
 						'PRT_name'=>  __("Regional Tax", "event_espresso"),
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 						'PRT_wp_user' => $default_creator_id
102 102
 					),
103 103
 					array(
104
-						'%s',//PRT_name
105
-						'%d',//PBT_id
106
-						'%d',//PRT_is_percent
107
-						'%d',//PRT_order
108
-						'%d',//PRT_deleted
104
+						'%s', //PRT_name
105
+						'%d', //PBT_id
106
+						'%d', //PRT_is_percent
107
+						'%d', //PRT_order
108
+						'%d', //PRT_deleted
109 109
 						'%d', //PRT_wp_user
110 110
 					)
111 111
 				);
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
 						'PRT_wp_user' => $default_creator_id,
121 121
 					),
122 122
 					array(
123
-						'%s',//PRT_name
124
-						'%d',//PBT_id
125
-						'%d',//PRT_is_percent
126
-						'%d',//PRT_order
127
-						'%d',//PRT_deleted
123
+						'%s', //PRT_name
124
+						'%d', //PBT_id
125
+						'%d', //PRT_is_percent
126
+						'%d', //PRT_order
127
+						'%d', //PRT_deleted
128 128
 						'%d' //PRT_wp_user
129 129
 					)
130 130
 				);
131
-				if( $result){
131
+				if ($result) {
132 132
 					$wpdb->insert($price_table,
133 133
 						array(
134 134
 							'PRT_ID'=>$wpdb->insert_id,
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
 							'PRC_wp_user' => $default_creator_id
144 144
 						),
145 145
 						array(
146
-							'%d',//PRT_id
147
-							'%f',//PRC_amount
148
-							'%s',//PRC_name
149
-							'%s',//PRC_desc
150
-							'%d',//PRC_is_default
151
-							'%d',//PRC_overrides
152
-							'%d',//PRC_deleted
153
-							'%d',//PRC_order
154
-							'%d',//PRC_parent
146
+							'%d', //PRT_id
147
+							'%f', //PRC_amount
148
+							'%s', //PRC_name
149
+							'%s', //PRC_desc
150
+							'%d', //PRC_is_default
151
+							'%d', //PRC_overrides
152
+							'%d', //PRC_deleted
153
+							'%d', //PRC_order
154
+							'%d', //PRC_parent
155 155
 							'%d' //PRC_wp_user
156 156
 						)
157 157
 					);
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 	 *  	@param array $modules_to_register
173 173
 	 *  	@return array
174 174
 	 */
175
-	public function caffeinated_modules_to_register( $modules_to_register = array() ){
176
-		if ( is_readable( EE_CAFF_PATH . 'modules' )) {
177
-			$caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR );
178
-			if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) {
179
-				$modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register );
175
+	public function caffeinated_modules_to_register($modules_to_register = array()) {
176
+		if (is_readable(EE_CAFF_PATH.'modules')) {
177
+			$caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR);
178
+			if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
179
+				$modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
180 180
 			}
181 181
 		}
182 182
 		return $modules_to_register;
@@ -184,19 +184,19 @@  discard block
 block discarded – undo
184 184
 
185 185
 
186 186
 
187
-	public function caffeinated_init(){
187
+	public function caffeinated_init() {
188 188
 		// EE_Register_CPTs hooks
189
-		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 );
190
-		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 );
191
-		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 );
192
-		EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE );
189
+		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10);
190
+		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10);
191
+		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10);
192
+		EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE);
193 193
 		// caffeinated_init__complete hook
194
-		do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' );
194
+		do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete');
195 195
 	}
196 196
 
197 197
 
198 198
 
199
-	public function enqueue_caffeinated_scripts(){
199
+	public function enqueue_caffeinated_scripts() {
200 200
 		// sound of crickets...
201 201
 	}
202 202
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @param array $taxonomy_array
207 207
 	 * @return array
208 208
 	 */
209
-	public function filter_taxonomies( $taxonomy_array ) {
209
+	public function filter_taxonomies($taxonomy_array) {
210 210
 		$taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE;
211 211
 		return $taxonomy_array;
212 212
 	}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @param array $cpt_array
218 218
 	 * @return array
219 219
 	 */
220
-	public function filter_cpts( $cpt_array ) {
220
+	public function filter_cpts($cpt_array) {
221 221
 		$cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE;
222 222
 		return $cpt_array;
223 223
 	}
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 	 * @param array $menu_items
229 229
 	 * @return array
230 230
 	 */
231
-	public function nav_metabox_items( $menu_items ) {
231
+	public function nav_metabox_items($menu_items) {
232 232
 		$menu_items[] = array(
233 233
 			'title' => __('Venue List', 'event_espresso'),
234
-			'url' => get_post_type_archive_link( 'espresso_venues' ),
234
+			'url' => get_post_type_archive_link('espresso_venues'),
235 235
 			'description' => __('Archive page for all venues.', 'event_espresso')
236 236
 			);
237 237
 		return $menu_items;
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
 	 * @param array $payment_method_paths
245 245
 	 * @return array values are folder paths to payment method folders
246 246
 	 */
247
-	public function caf_payment_methods( $payment_method_paths ) {
248
-		$caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
249
-		$payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths );
247
+	public function caf_payment_methods($payment_method_paths) {
248
+		$caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
249
+		$payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths);
250 250
 		return $payment_method_paths;
251 251
 	}
252 252
 
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +544 added lines, -544 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 				'nav' => array(
449 449
 					'label' => __('REG Details', 'event_espresso'),
450 450
 					'order' => 15,
451
-					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
451
+					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
452 452
 					'persistent' => FALSE
453 453
 				),
454 454
                 'help_tabs' => array(
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 						'filename' => 'registrations_details_registrant_details'
470 470
 					)
471 471
 				),
472
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
473
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
472
+				'help_tour' => array('Registration_Details_Help_Tour'),
473
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
474 474
 				'require_nonce' => FALSE
475 475
 			),
476 476
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 					'order' => 15,
495 495
 					'persistent' => FALSE
496 496
 				),
497
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
497
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
498 498
 				'require_nonce' => FALSE
499 499
 			),
500 500
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 					'label' => __('Edit Contact', 'event_espresso'),
504 504
 					'order' => 15,
505 505
 					'persistent' => FALSE,
506
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
506
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
507 507
 				),
508 508
 				'metaboxes' => array('attendee_editor_metaboxes'),
509 509
 				'require_nonce' => FALSE
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 						'filename' => 'registrations_contact_list_other'
534 534
 					)
535 535
                 ),
536
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
536
+				'help_tour' => array('Contact_List_Help_Tour'),
537 537
 				'metaboxes' => array(),
538 538
 				'require_nonce' => FALSE
539 539
 			),
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	protected function _add_screen_options() {}
553 553
 	protected function _add_feature_pointers() {}
554 554
 	public function admin_init() {
555
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
555
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
556 556
 	}
557 557
 	public function admin_notices() {}
558 558
 	public function admin_footer_scripts() {}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 	*		@return void
571 571
 	*/
572 572
 	private function _get_registration_status_array() {
573
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
573
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
574 574
 	}
575 575
 
576 576
 
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
 	public function load_scripts_styles() {
594 594
 		//style
595 595
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
596
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
596
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
597 597
 		wp_enqueue_style('espresso_reg');
598 598
 
599 599
 		//script
600
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
600
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
601 601
 		wp_enqueue_script('espresso_reg');
602 602
 	}
603 603
 
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
 	public function load_scripts_styles_edit_attendee() {
607 607
 		//stuff to only show up on our attendee edit details page.
608 608
 		$attendee_details_translations = array(
609
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
609
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
610 610
 			);
611
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
611
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
612 612
 		wp_enqueue_script('jquery-validate');
613 613
 	}
614 614
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 		//styles
618 618
 		wp_enqueue_style('espresso-ui-theme');
619 619
 		//scripts
620
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
621
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
620
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
621
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
622 622
 	}
623 623
 
624 624
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
 	public function load_scripts_styles_contact_list() {
630 630
 		wp_deregister_style('espresso_reg');
631
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
631
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
632 632
 		wp_enqueue_style('espresso_att');
633 633
 	}
634 634
 
@@ -637,9 +637,9 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
 	public function load_scripts_styles_new_registration() {
640
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
640
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
641 641
 		wp_enqueue_script('ee-spco-for-admin');
642
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
642
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
643 643
 		EE_Form_Section_Proper::wp_enqueue_scripts();
644 644
 		EED_Ticket_Selector::load_tckt_slctr_assets();
645 645
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		//for notification related bulk actions we need to make sure only active messengers have an option.
667 667
 		EED_Messages::set_autoloaders();
668 668
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
669
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
669
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
670 670
 		$active_mts = $message_resource_manager->list_of_active_message_types();
671 671
 		//key= bulk_action_slug, value= message type.
672 672
 		$match_array = array(
@@ -679,23 +679,23 @@  discard block
 block discarded – undo
679 679
 
680 680
 		/** setup reg status bulk actions **/
681 681
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
682
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
682
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
683 683
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
684 684
 		}
685 685
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
686
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
686
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
687 687
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
688 688
 		}
689 689
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
690
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
690
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
691 691
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
692 692
 		}
693 693
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
694
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
694
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
695 695
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
696 696
 		}
697 697
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
698
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
698
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
699 699
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
700 700
 		}
701 701
 
@@ -704,29 +704,29 @@  discard block
 block discarded – undo
704 704
 				'slug' => 'all',
705 705
 				'label' => __('View All Registrations', 'event_espresso'),
706 706
 				'count' => 0,
707
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
707
+				'bulk_action' => array_merge($def_reg_status_actions, array(
708 708
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
709
-					) )
709
+					))
710 710
 				),
711 711
 			'month' => array(
712 712
 				'slug' => 'month',
713 713
 				'label' => __('This Month', 'event_espresso'),
714 714
 				'count' => 0,
715
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
715
+				'bulk_action' => array_merge($def_reg_status_actions, array(
716 716
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
717 717
 					))
718 718
 				),
719 719
 			'today' => array(
720 720
 				'slug' => 'today',
721
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
721
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
722 722
 				'count' => 0,
723
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
723
+				'bulk_action' => array_merge($def_reg_status_actions, array(
724 724
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
725 725
 					))
726 726
 				)
727 727
 			);
728 728
 
729
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
729
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
730 730
 			$this->_views['incomplete'] = array(
731 731
 				'slug' => 'incomplete',
732 732
 				'label' => __('Incomplete', 'event_espresso'),
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 				)
763 763
 			);
764 764
 
765
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
765
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
766 766
 			$this->_views['trash'] = array(
767 767
 				'slug' => 'trash',
768 768
 				'label' => __('Trash', 'event_espresso'),
@@ -801,18 +801,18 @@  discard block
 block discarded – undo
801 801
 				'desc' => __('View Transaction Invoice', 'event_espresso')
802 802
 				),
803 803
  			);
804
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
804
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
805 805
 			$fc_items['resend_registration'] = array(
806 806
 				'class' => 'dashicons dashicons-email-alt',
807 807
 				'desc' => __('Resend Registration Details', 'event_espresso')
808 808
 				);
809 809
 		} else {
810
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
810
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
811 811
 		}
812 812
 
813
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
814
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
815
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
813
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
814
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
815
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
816 816
 				$fc_items['view_related_messages'] = array(
817 817
 					'class' => $related_for_icon['css_class'],
818 818
 					'desc' => $related_for_icon['label'],
@@ -822,31 +822,31 @@  discard block
 block discarded – undo
822 822
 
823 823
 		$sc_items = array(
824 824
 			'approved_status' => array(
825
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
826
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
825
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
826
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
827 827
 				),
828 828
 			'pending_status' => array(
829
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
830
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
829
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
830
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
831 831
 				),
832 832
 			'incomplete_status' => array(
833
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
834
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
833
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
834
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
835 835
 			),
836 836
 			'not_approved' => array(
837
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
838
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
837
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
838
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
839 839
 				),
840 840
 			'declined_status' => array(
841
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
842
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
841
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
842
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
843 843
 				),
844 844
 			'cancelled_status' => array(
845
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
846
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
845
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
846
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
847 847
 				)
848 848
 			);
849
-		return array_merge( $fc_items, $sc_items );
849
+		return array_merge($fc_items, $sc_items);
850 850
 	}
851 851
 
852 852
 
@@ -859,15 +859,15 @@  discard block
 block discarded – undo
859 859
 
860 860
 
861 861
 	protected function _registrations_overview_list_table() {
862
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
863
-		if ( $EVT_ID ) {
864
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
865
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
862
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
863
+		if ($EVT_ID) {
864
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
865
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
866 866
 			}
867
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
868
-			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : '';
867
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
868
+			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : '';
869 869
 		}
870
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
870
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
871 871
 		$this->display_admin_list_table_page_with_no_sidebar();
872 872
 	}
873 873
 
@@ -882,19 +882,19 @@  discard block
 block discarded – undo
882 882
 	 */
883 883
 	private function _set_registration_object() {
884 884
 		//get out if we've already set the object
885
-		if ( is_object( $this->_registration )) {
885
+		if (is_object($this->_registration)) {
886 886
 			return TRUE;
887 887
 		}
888 888
 
889 889
 	    $REG = EEM_Registration::instance();
890 890
 
891
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
891
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
892 892
 
893
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
893
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
894 894
 			return TRUE;
895 895
 		else {
896
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
897
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
896
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
897
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
898 898
 			$this->_registration = NULL;
899 899
 			return FALSE;
900 900
 		}
@@ -912,24 +912,24 @@  discard block
 block discarded – undo
912 912
 	 * @throws \EE_Error
913 913
 	 * @return mixed (int|array)  int = count || array of registration objects
914 914
 	 */
915
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
916
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
917
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
918
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
919
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
920
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
921
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
915
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
916
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
917
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
918
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
919
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
920
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
921
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
922 922
 		$start_date = FALSE;
923 923
 		$end_date = FALSE;
924 924
 		$_where = array();
925
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
926
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
925
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
926
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
927 927
 
928 928
 		//set orderby
929 929
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
930 930
 
931 931
 
932
-		switch ( $this->_req_data['orderby'] ) {
932
+		switch ($this->_req_data['orderby']) {
933 933
 			case '_REG_ID':
934 934
 				$orderby = 'REG_ID';
935 935
 				break;
@@ -949,26 +949,26 @@  discard block
 block discarded – undo
949 949
 				$orderby = 'REG_date';
950 950
 		}
951 951
 
952
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
953
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
954
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
952
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
953
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
954
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
955 955
 
956 956
 
957
-		$offset = ($current_page-1)*$per_page;
958
-		$limit = $count  ? NULL : array( $offset, $per_page );
957
+		$offset = ($current_page - 1) * $per_page;
958
+		$limit = $count ? NULL : array($offset, $per_page);
959 959
 
960
-		if($EVT_ID){
961
-			$_where['EVT_ID']=$EVT_ID;
960
+		if ($EVT_ID) {
961
+			$_where['EVT_ID'] = $EVT_ID;
962 962
 		}
963
-		if($CAT_ID){
963
+		if ($CAT_ID) {
964 964
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
965 965
 		}
966
-		if ( $incomplete ) {
966
+		if ($incomplete) {
967 967
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
968 968
 		} else if ( ! $trash) {
969
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
969
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
970 970
 		}
971
-		if($reg_status){
971
+		if ($reg_status) {
972 972
 			$_where['STS_ID'] = $reg_status;
973 973
 		}
974 974
 
@@ -980,105 +980,105 @@  discard block
 block discarded – undo
980 980
 		$time_start = ' 00:00:00';
981 981
 		$time_end = ' 23:59:59';
982 982
 
983
-		if($today_a || $today ){
983
+		if ($today_a || $today) {
984 984
 			$curdate = date('Y-m-d', current_time('timestamp'));
985
-			$_where['REG_date']= array('BETWEEN',
985
+			$_where['REG_date'] = array('BETWEEN',
986 986
 				array(
987
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
988
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
987
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
988
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
989 989
 			));
990
-		}elseif($this_month_a || $this_month){
990
+		}elseif ($this_month_a || $this_month) {
991 991
 			$this_month_r = date('m', current_time('timestamp'));
992
-			$days_this_month = date( 't', current_time('timestamp') );
993
-			$_where['REG_date']= array('BETWEEN',
992
+			$days_this_month = date('t', current_time('timestamp'));
993
+			$_where['REG_date'] = array('BETWEEN',
994 994
 				array(
995
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
996
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
995
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
996
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
997 997
 			));
998
-		}elseif($month_range){
998
+		}elseif ($month_range) {
999 999
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1000
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1001
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1002
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1003
-			$_where['REG_date']= array('BETWEEN',
1004
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1005
-		}elseif($start_date && $end_date){
1000
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1001
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1002
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1003
+			$_where['REG_date'] = array('BETWEEN',
1004
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1005
+		}elseif ($start_date && $end_date) {
1006 1006
 			throw new EE_Error("not yet supported");
1007
-		}elseif($start_date){
1007
+		}elseif ($start_date) {
1008 1008
 			throw new EE_Error("not yet supported");
1009
-		}elseif($end_date){
1009
+		}elseif ($end_date) {
1010 1010
 			throw new EE_Error("not yet supported");
1011 1011
 		}
1012 1012
 
1013
-		if ( ! empty( $this->_req_data['s'] ) ) {
1014
-			$sstr = '%' . $this->_req_data['s'] . '%';
1013
+		if ( ! empty($this->_req_data['s'])) {
1014
+			$sstr = '%'.$this->_req_data['s'].'%';
1015 1015
 			$_where['OR'] = array(
1016
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1017
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1018
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1019
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1020
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1021
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1022
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1023
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1024
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1025
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1026
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1027
-				'REG_final_price' => array( 'LIKE', $sstr ),
1028
-				'REG_code' => array( 'LIKE', $sstr ),
1029
-				'REG_count' => array( 'LIKE' , $sstr ),
1030
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1031
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1032
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1033
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1016
+				'Event.EVT_name' => array('LIKE', $sstr),
1017
+				'Event.EVT_desc' => array('LIKE', $sstr),
1018
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1019
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1020
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1021
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1022
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1023
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1024
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1025
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1026
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1027
+				'REG_final_price' => array('LIKE', $sstr),
1028
+				'REG_code' => array('LIKE', $sstr),
1029
+				'REG_count' => array('LIKE', $sstr),
1030
+				'REG_group_size' => array('LIKE', $sstr),
1031
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1032
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1033
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1034 1034
 				);
1035 1035
 		}
1036 1036
 
1037 1037
 		//capability checks
1038
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1038
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1039 1039
 			$_where['AND'] = array(
1040 1040
 				'Event.EVT_wp_user' => get_current_user_id()
1041 1041
 				);
1042 1042
 		}
1043 1043
 
1044 1044
 
1045
-		if( $count ){
1046
-			if ( $trash ) {
1047
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1048
-			} else if ( $incomplete ) {
1049
-				return EEM_Registration::instance()->count( array( $_where ));
1045
+		if ($count) {
1046
+			if ($trash) {
1047
+				return EEM_Registration::instance()->count_deleted(array($_where));
1048
+			} else if ($incomplete) {
1049
+				return EEM_Registration::instance()->count(array($_where));
1050 1050
 			} else {
1051
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1051
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1052 1052
 			}
1053 1053
 		} else {
1054 1054
 			//make sure we remove default where conditions cause all registrations matching query are returned
1055
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1056
-			if ( $per_page !== -1 ) {
1055
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1056
+			if ($per_page !== -1) {
1057 1057
 				$query_params['limit'] = $limit;
1058 1058
 			}
1059
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1059
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1060 1060
 
1061 1061
 
1062
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1062
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1063 1063
 				$first_registration = $registrations[0];
1064 1064
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1065 1065
 				$event_name = $first_registration->event_obj()->name();
1066
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1066
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1067 1067
 				// edit event link
1068
-				if ( $event_name != '' ) {
1069
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1070
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1071
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1068
+				if ($event_name != '') {
1069
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1070
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1071
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1072 1072
 				}
1073 1073
 
1074
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1075
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1074
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1075
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1076 1076
 
1077 1077
 				$this->_template_args['before_admin_page_content'] = '
1078 1078
 			<div id="admin-page-header">
1079
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1080
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1081
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1079
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1080
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1081
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1082 1082
 			</div>
1083 1083
 			';
1084 1084
 
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 		$this->_set_registration_object();
1118 1118
 
1119
-		if ( is_object( $this->_registration )) {
1119
+		if (is_object($this->_registration)) {
1120 1120
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1121 1121
 			$this->_session = $transaction->session_data();
1122 1122
 
@@ -1124,10 +1124,10 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 
1126 1126
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1127
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1127
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1128 1128
 
1129
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1130
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1129
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1130
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1131 1131
 
1132 1132
 			$this->_template_args['grand_total'] = $transaction->total();
1133 1133
 
@@ -1135,19 +1135,19 @@  discard block
 block discarded – undo
1135 1135
 			// link back to overview
1136 1136
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1137 1137
 			$this->_template_args['registration'] = $this->_registration;
1138
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1139
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1140
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1138
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1139
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1140
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1141 1141
 
1142 1142
 			//next and previous links
1143
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1144
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1145
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1146
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1143
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1144
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1145
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1146
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1147 1147
 
1148 1148
 			// grab header
1149
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1150
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1149
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1150
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1151 1151
 
1152 1152
 		} else {
1153 1153
 
@@ -1166,17 +1166,17 @@  discard block
 block discarded – undo
1166 1166
 
1167 1167
 
1168 1168
 	protected function _registration_details_metaboxes() {
1169
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1169
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1170 1170
 		$this->_set_registration_object();
1171 1171
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1172
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1173
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1174
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1175
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1172
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1173
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1174
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1175
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1176 1176
 		}
1177
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1178
-		if ( $this->_registration->group_size() > 1 ) {
1179
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1177
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1178
+		if ($this->_registration->group_size() > 1) {
1179
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1180 1180
 		}
1181 1181
 	}
1182 1182
 
@@ -1197,23 +1197,23 @@  discard block
 block discarded – undo
1197 1197
 
1198 1198
 		//let's get an array of all possible buttons that we can just reference
1199 1199
 		$status_buttons = $this->_get_reg_status_buttons();
1200
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1201
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1200
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1201
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1202 1202
 		$template_args['attendee'] = $this->_registration->attendee();
1203
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1204
-		if ( $this->_set_registration_object() ) {
1203
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1204
+		if ($this->_set_registration_object()) {
1205 1205
 			$current_status = $this->_registration->status_ID();
1206
-			unset( $status_buttons[$current_status] );
1207
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1208
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1206
+			unset($status_buttons[$current_status]);
1207
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1208
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1209 1209
 			}
1210
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1210
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1211 1211
 		}
1212 1212
 		$template_args['form_url'] = REG_ADMIN_URL;
1213 1213
 		$template_args['REG_ID'] = $this->_registration->ID();
1214
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1214
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1215 1215
 
1216
-		EEH_Template::display_template( $template, $template_args );
1216
+		EEH_Template::display_template($template, $template_args);
1217 1217
 
1218 1218
 	}
1219 1219
 
@@ -1227,11 +1227,11 @@  discard block
 block discarded – undo
1227 1227
 	private function _get_reg_status_buttons() {
1228 1228
 
1229 1229
 		$buttons = array(
1230
-			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">',
1231
-			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">',
1232
-			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">',
1233
-			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">',
1234
-			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">',
1230
+			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">',
1231
+			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">',
1232
+			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">',
1233
+			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">',
1234
+			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">',
1235 1235
 			);
1236 1236
 		return $buttons;
1237 1237
 	}
@@ -1245,13 +1245,13 @@  discard block
 block discarded – undo
1245 1245
 	 *
1246 1246
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1247 1247
 	 */
1248
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1249
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1248
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1249
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1250 1250
 
1251
-		$success = $this->_set_registration_status( $REG_ID, $status );
1251
+		$success = $this->_set_registration_status($REG_ID, $status);
1252 1252
 
1253 1253
 		//notify?
1254
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1254
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1255 1255
 			$this->_process_resend_registration();
1256 1256
 		}
1257 1257
 
@@ -1269,19 +1269,19 @@  discard block
 block discarded – undo
1269 1269
 	 * @param bool $status
1270 1270
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1271 1271
 	 */
1272
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1272
+	protected function _set_registration_status($REG_ID, $status = false) {
1273 1273
 		$success = true;
1274 1274
 		// set default status if none is passed
1275 1275
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1276 1276
 
1277 1277
 		//typecast and sanitize reg_id
1278
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1278
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1279 1279
 
1280 1280
 		//loop through REG_ID's and change status
1281
-		foreach ( $reg_ids as $r_id ) {
1282
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1283
-			if ( $registration instanceof EE_Registration ) {
1284
-				$registration->set_status( $status );
1281
+		foreach ($reg_ids as $r_id) {
1282
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1283
+			if ($registration instanceof EE_Registration) {
1284
+				$registration->set_status($status);
1285 1285
 				$result = $registration->save();
1286 1286
 
1287 1287
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 		$this->_req_data['_REG_ID'] = $reg_ids;
1294 1294
 
1295 1295
 		//return $success and processed registrations
1296
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1296
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1297 1297
 	}
1298 1298
 
1299 1299
 
@@ -1305,37 +1305,37 @@  discard block
 block discarded – undo
1305 1305
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1306 1306
 	 * @return void
1307 1307
 	 */
1308
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1308
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1309 1309
 
1310
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1310
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1311 1311
 
1312 1312
 
1313
-		$success = isset( $result['success'] ) && $result['success'];
1313
+		$success = isset($result['success']) && $result['success'];
1314 1314
 
1315 1315
 		//setup success message
1316
-		if ( $success ) {
1317
-			$msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1  ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) :  sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ;
1318
-			EE_Error::add_success( $msg );
1316
+		if ($success) {
1317
+			$msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower'));
1318
+			EE_Error::add_success($msg);
1319 1319
 		} else {
1320
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1320
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1321 1321
 		}
1322 1322
 
1323
-		$route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' );
1323
+		$route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default');
1324 1324
 		//unset nonces
1325
-		foreach ( $this->_req_data as $ref => $value ) {
1326
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1327
-				unset( $this->_req_data[$ref] );
1325
+		foreach ($this->_req_data as $ref => $value) {
1326
+			if (strpos($ref, 'nonce') !== false) {
1327
+				unset($this->_req_data[$ref]);
1328 1328
 				continue;
1329 1329
 			}
1330 1330
 
1331
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1331
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1332 1332
 			$this->_req_data[$ref] = $value;
1333 1333
 		}
1334 1334
 
1335 1335
 		//merge request vars so that the reloaded list table contains any existing filter query params
1336
-		$route = array_merge( $this->_req_data, $route );
1336
+		$route = array_merge($this->_req_data, $route);
1337 1337
 
1338
-		$this->_redirect_after_action( false, '', '', $route, true );
1338
+		$this->_redirect_after_action(false, '', '', $route, true);
1339 1339
 	}
1340 1340
 
1341 1341
 
@@ -1347,29 +1347,29 @@  discard block
 block discarded – undo
1347 1347
 	protected function _change_reg_status() {
1348 1348
 		$this->_req_data['return'] = 'view_registration';
1349 1349
 		//set notify based on whether the send notifications toggle is set or not
1350
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1351
-		$this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';
1350
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1351
+		$this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';
1352 1352
 
1353
-		switch ( $this->_req_data['_reg_status_id'] ) {
1354
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1355
-				$this->approve_registration( $notify );
1353
+		switch ($this->_req_data['_reg_status_id']) {
1354
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1355
+				$this->approve_registration($notify);
1356 1356
 				break;
1357
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1358
-				$this->pending_registration( $notify );
1357
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1358
+				$this->pending_registration($notify);
1359 1359
 				break;
1360
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1361
-				$this->not_approve_registration( $notify );
1360
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1361
+				$this->not_approve_registration($notify);
1362 1362
 				break;
1363
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1364
-				$this->decline_registration( $notify );
1363
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1364
+				$this->decline_registration($notify);
1365 1365
 				break;
1366
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1367
-				$this->cancel_registration( $notify );
1366
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1367
+				$this->cancel_registration($notify);
1368 1368
 				break;
1369 1369
 			default :
1370 1370
 				$result['success'] = false;
1371
-				unset( $this->_req_data['return'] );
1372
-				$this->_reg_status_change_return( '', false );
1371
+				unset($this->_req_data['return']);
1372
+				$this->_reg_status_change_return('', false);
1373 1373
 				break;
1374 1374
 		}
1375 1375
 	}
@@ -1382,8 +1382,8 @@  discard block
 block discarded – undo
1382 1382
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1383 1383
 	*		@return void
1384 1384
 	*/
1385
-	protected function approve_registration( $notify = false ) {
1386
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1385
+	protected function approve_registration($notify = false) {
1386
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1387 1387
 	}
1388 1388
 
1389 1389
 
@@ -1395,8 +1395,8 @@  discard block
 block discarded – undo
1395 1395
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1396 1396
 	*		@return void
1397 1397
 	*/
1398
-	protected function decline_registration( $notify = false ) {
1399
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1398
+	protected function decline_registration($notify = false) {
1399
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1400 1400
 	}
1401 1401
 
1402 1402
 
@@ -1408,8 +1408,8 @@  discard block
 block discarded – undo
1408 1408
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1409 1409
 	*		@return void
1410 1410
 	*/
1411
-	protected function cancel_registration( $notify = false ) {
1412
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1411
+	protected function cancel_registration($notify = false) {
1412
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1413 1413
 	}
1414 1414
 
1415 1415
 
@@ -1422,8 +1422,8 @@  discard block
 block discarded – undo
1422 1422
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1423 1423
 	*		@return void
1424 1424
 	*/
1425
-	protected function not_approve_registration( $notify = false ) {
1426
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1425
+	protected function not_approve_registration($notify = false) {
1426
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1427 1427
 	}
1428 1428
 
1429 1429
 
@@ -1434,8 +1434,8 @@  discard block
 block discarded – undo
1434 1434
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1435 1435
 	*		@return void
1436 1436
 	*/
1437
-	protected function pending_registration( $notify = false ) {
1438
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1437
+	protected function pending_registration($notify = false) {
1438
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1439 1439
 	}
1440 1440
 
1441 1441
 
@@ -1449,75 +1449,75 @@  discard block
 block discarded – undo
1449 1449
 	public function _reg_details_meta_box() {
1450 1450
 		EEH_Autoloader::register_line_item_display_autoloaders();
1451 1451
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1452
-		EE_Registry::instance()->load_Helper( 'Line_Item' );
1452
+		EE_Registry::instance()->load_Helper('Line_Item');
1453 1453
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1454 1454
 		$this->_session = $transaction->session_data();
1455 1455
 
1456 1456
 		$filters = new EE_Line_Item_Filter_Collection();
1457
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1458
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1459
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1457
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1458
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1459
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1460 1460
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1461 1461
 
1462 1462
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1463
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1464
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1463
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1464
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1465 1465
 
1466 1466
 
1467 1467
 		$attendee = $this->_registration->attendee();
1468 1468
 
1469 1469
 
1470
-		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : '';
1471
-		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : '';
1470
+		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ?EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : '';
1471
+		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ?EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : '';
1472 1472
 
1473 1473
 
1474 1474
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1475
-		$payment = $transaction->get_first_related( 'Payment' );
1475
+		$payment = $transaction->get_first_related('Payment');
1476 1476
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1477
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1477
+		$payment_method = $payment->get_first_related('Payment_Method');
1478 1478
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1479
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1479
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1480 1480
 		$reg_details = array(
1481 1481
 			'payment_method' => $payment_method->name(),
1482 1482
 			'response_msg' => $payment->gateway_response(),
1483
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1483
+			'registration_id' => $this->_registration->get('REG_code'),
1484 1484
 			'registration_session' => $this->_registration->session_ID(),
1485
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1486
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1485
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1486
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1487 1487
 			);
1488 1488
 
1489 1489
 
1490
-		if ( isset( $reg_details['registration_id'] )) {
1490
+		if (isset($reg_details['registration_id'])) {
1491 1491
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1492
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1492
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1493 1493
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1494 1494
 		}
1495 1495
 
1496
-		if ( isset( $reg_details['payment_method'] ) ) {
1496
+		if (isset($reg_details['payment_method'])) {
1497 1497
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1498
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1498
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1499 1499
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1500 1500
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1501
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1501
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1502 1502
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1503 1503
 		}
1504 1504
 
1505 1505
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1506
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1506
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1507 1507
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1508 1508
 
1509 1509
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1510
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1510
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1511 1511
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1512 1512
 
1513 1513
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1514
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1514
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1515 1515
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1516 1516
 
1517
-		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL );
1517
+		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL);
1518 1518
 
1519
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1520
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1519
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1520
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1521 1521
 
1522 1522
 	}
1523 1523
 
@@ -1531,14 +1531,14 @@  discard block
 block discarded – undo
1531 1531
 	*/
1532 1532
 	public function _reg_questions_meta_box() {
1533 1533
 		//allow someone to override this method entirely
1534
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1535
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1536
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1534
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1535
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1536
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1537 1537
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1538 1538
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1539 1539
 
1540
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1541
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1540
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1541
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1542 1542
 		}
1543 1543
 	}
1544 1544
 
@@ -1552,12 +1552,12 @@  discard block
 block discarded – undo
1552 1552
 	 * @param        string $output
1553 1553
 	 * @return        string
1554 1554
 	 */
1555
-	public function form_before_question_group( $output ) {
1555
+	public function form_before_question_group($output) {
1556 1556
 		EE_Error::doing_it_wrong(
1557
-			__CLASS__ . '::' . __FUNCTION__,
1558
-			__( 'This method would have been protected but was used on a filter callback'
1557
+			__CLASS__.'::'.__FUNCTION__,
1558
+			__('This method would have been protected but was used on a filter callback'
1559 1559
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1560
-				'event_espresso' ),
1560
+				'event_espresso'),
1561 1561
 			'4.8.32.rc.000'
1562 1562
 		);
1563 1563
 		return '
@@ -1576,20 +1576,20 @@  discard block
 block discarded – undo
1576 1576
 	 * @param        string $output
1577 1577
 	 * @return        string
1578 1578
 	 */
1579
-	public function form_after_question_group( $output ) {
1579
+	public function form_after_question_group($output) {
1580 1580
 		EE_Error::doing_it_wrong(
1581
-			__CLASS__ . '::' . __FUNCTION__,
1582
-			__( 'This method would have been protected but was used on a filter callback'
1581
+			__CLASS__.'::'.__FUNCTION__,
1582
+			__('This method would have been protected but was used on a filter callback'
1583 1583
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1584
-				'event_espresso' ),
1584
+				'event_espresso'),
1585 1585
 			'4.8.32.rc.000'
1586 1586
 		);
1587 1587
 		return  '
1588 1588
 			<tr class="hide-if-no-js">
1589 1589
 				<th> </th>
1590 1590
 				<td class="reg-admin-edit-attendee-question-td">
1591
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1592
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1591
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1592
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1593 1593
 						<div class="dashicons dashicons-edit"></div>
1594 1594
 					</a>
1595 1595
 				</td>
@@ -1609,18 +1609,18 @@  discard block
 block discarded – undo
1609 1609
 	 * @param        string $label
1610 1610
 	 * @return        string
1611 1611
 	 */
1612
-	public function form_form_field_label_wrap( $label ) {
1612
+	public function form_form_field_label_wrap($label) {
1613 1613
 		EE_Error::doing_it_wrong(
1614
-			__CLASS__ . '::' . __FUNCTION__,
1615
-			__( 'This method would have been protected but was used on a filter callback'
1614
+			__CLASS__.'::'.__FUNCTION__,
1615
+			__('This method would have been protected but was used on a filter callback'
1616 1616
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1617
-				'event_espresso' ),
1617
+				'event_espresso'),
1618 1618
 			'4.8.32.rc.000'
1619 1619
 		);
1620 1620
 		return '
1621 1621
 			<tr>
1622 1622
 				<th>
1623
-					' . $label  . '
1623
+					' . $label.'
1624 1624
 				</th>';
1625 1625
 	}
1626 1626
 
@@ -1634,17 +1634,17 @@  discard block
 block discarded – undo
1634 1634
 	 * @param        string $input
1635 1635
 	 * @return        string
1636 1636
 	 */
1637
-	public function form_form_field_input__wrap( $input ) {
1637
+	public function form_form_field_input__wrap($input) {
1638 1638
 		EE_Error::doing_it_wrong(
1639
-			__CLASS__ . '::' . __FUNCTION__,
1640
-			__( 'This method would have been protected but was used on a filter callback'
1639
+			__CLASS__.'::'.__FUNCTION__,
1640
+			__('This method would have been protected but was used on a filter callback'
1641 1641
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1642
-				'event_espresso' ),
1642
+				'event_espresso'),
1643 1643
 			'4.8.32.rc.000'
1644 1644
 		);
1645 1645
 		return '
1646 1646
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1647
-					' . $input . '
1647
+					' . $input.'
1648 1648
 				</td>
1649 1649
 			</tr>';
1650 1650
 	}
@@ -1658,14 +1658,14 @@  discard block
 block discarded – undo
1658 1658
 	 * @return void
1659 1659
 	 */
1660 1660
 	protected function _update_attendee_registration_form() {
1661
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1662
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1663
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1664
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1665
-			if( $success ) {
1661
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1662
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1663
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1664
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1665
+			if ($success) {
1666 1666
 				$what = __('Registration Form', 'event_espresso');
1667
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1668
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1667
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1668
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1669 1669
 			}
1670 1670
 		}
1671 1671
 	}
@@ -1676,11 +1676,11 @@  discard block
 block discarded – undo
1676 1676
 	 * @param int $REG_ID
1677 1677
 	 * @return EE_Registration_Custom_Questions_Form
1678 1678
 	 */
1679
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1680
-		if( ! $this->_reg_custom_questions_form ) {
1681
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1682
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1683
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1679
+	protected function _get_reg_custom_questions_form($REG_ID) {
1680
+		if ( ! $this->_reg_custom_questions_form) {
1681
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1682
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1683
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1684 1684
 		}
1685 1685
 		return $this->_reg_custom_questions_form;
1686 1686
 	}
@@ -1693,17 +1693,17 @@  discard block
 block discarded – undo
1693 1693
 	 * @param bool $REG_ID
1694 1694
 	 * @return bool
1695 1695
 	 */
1696
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1696
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1697 1697
 
1698 1698
 		if ( ! $REG_ID) {
1699
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1699
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1700 1700
 		}
1701
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1702
-		$form->receive_form_submission( $this->_req_data );
1701
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1702
+		$form->receive_form_submission($this->_req_data);
1703 1703
 		$success = false;
1704
-		if( $form->is_valid() ) {
1705
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1706
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1704
+		if ($form->is_valid()) {
1705
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1706
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1707 1707
 					$where_conditions = array(
1708 1708
 							'QST_ID' => $question_id,
1709 1709
 							'REG_ID' => $REG_ID
@@ -1711,19 +1711,19 @@  discard block
 block discarded – undo
1711 1711
 					$possibly_new_values = array(
1712 1712
 							'ANS_value' => $input->normalized_value()
1713 1713
 						);
1714
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1715
-					if( $answer instanceof EE_Answer ) {
1716
-						$success = $answer->save( $possibly_new_values );
1714
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1715
+					if ($answer instanceof EE_Answer) {
1716
+						$success = $answer->save($possibly_new_values);
1717 1717
 					} else {
1718 1718
 						//insert it then
1719
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1720
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1719
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1720
+						$answer = EE_Answer::new_instance($cols_n_vals);
1721 1721
 						$success = $answer->save();
1722 1722
 					}
1723 1723
 				}
1724 1724
 			}
1725 1725
 		} else {
1726
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1726
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1727 1727
 		}
1728 1728
 		return $success;
1729 1729
 	}
@@ -1741,29 +1741,29 @@  discard block
 block discarded – undo
1741 1741
 		$registrations = $REG->get_all(array(
1742 1742
 			array(
1743 1743
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1744
-				'REG_ID'=>array('!=',$this->_registration->ID())
1744
+				'REG_ID'=>array('!=', $this->_registration->ID())
1745 1745
 			),
1746 1746
 			'force_join'=>array('Attendee')));
1747 1747
 
1748 1748
 		$this->_template_args['attendees'] = array();
1749 1749
 		$this->_template_args['attendee_notice'] = '';
1750
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1751
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1750
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1751
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1752 1752
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1753 1753
 		} else {
1754 1754
 
1755 1755
 			$att_nmbr = 1;
1756
-			foreach ( $registrations as $registration ) {
1756
+			foreach ($registrations as $registration) {
1757 1757
 				/* @var $registration EE_Registration */
1758 1758
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1759
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1760
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1761
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1762
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1759
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1760
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1761
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1762
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1763 1763
 
1764
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1764
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1765 1765
 
1766
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1766
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1767 1767
 
1768 1768
 				$att_nmbr++;
1769 1769
 			}
@@ -1775,8 +1775,8 @@  discard block
 block discarded – undo
1775 1775
 
1776 1776
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1777 1777
 		}
1778
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1779
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1778
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1779
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1780 1780
 
1781 1781
 	}
1782 1782
 
@@ -1797,11 +1797,11 @@  discard block
 block discarded – undo
1797 1797
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1798 1798
 
1799 1799
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not)
1800
-		if ( ! $this->_registration->is_primary_registrant() ) {
1800
+		if ( ! $this->_registration->is_primary_registrant()) {
1801 1801
 			$primary_registration = $this->_registration->get_primary_registration();
1802 1802
 			$primary_attendee = $primary_registration->attendee();
1803 1803
 
1804
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1804
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1805 1805
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
1806 1806
 				$primary_registration = NULL;
1807 1807
 			}
@@ -1810,27 +1810,27 @@  discard block
 block discarded – undo
1810 1810
 		}
1811 1811
 
1812 1812
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1813
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1814
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1815
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1813
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1814
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1815
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1816 1816
 		$this->_template_args['phone'] = $attendee->phone();
1817 1817
 
1818
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1818
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1819 1819
 
1820 1820
 
1821 1821
 		//edit link
1822
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1823
-		$this->_template_args['att_edit_label'] = __('View/Edit Contact' );
1822
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1823
+		$this->_template_args['att_edit_label'] = __('View/Edit Contact');
1824 1824
 
1825 1825
 		//create link
1826
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
1826
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
1827 1827
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1828 1828
 
1829 1829
 		$this->_template_args['att_check'] = $att_check;
1830 1830
 
1831 1831
 
1832
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1833
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1832
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1833
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1834 1834
 	}
1835 1835
 
1836 1836
 
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
 	 * @access protected
1844 1844
 	 * @return void
1845 1845
 	 */
1846
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1846
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1847 1847
 		$REGM = EEM_Registration::instance();
1848 1848
 
1849 1849
 		$success = 1;
@@ -1853,26 +1853,26 @@  discard block
 block discarded – undo
1853 1853
 		$dtts = array();
1854 1854
 
1855 1855
 		//if empty _REG_ID then get out because there's nothing to do
1856
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1856
+		if (empty($this->_req_data['_REG_ID'])) {
1857 1857
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
1858
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1859
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1858
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1859
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1860 1860
 		}
1861 1861
 
1862 1862
 		//Checkboxes
1863
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1863
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1864 1864
 			// if array has more than one element than success message should be plural
1865
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1865
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1866 1866
 			// cycle thru checkboxes
1867
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1867
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1868 1868
 
1869 1869
 				$REG = $REGM->get_one_by_ID($REG_ID);
1870 1870
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1871
-				if ( $payment_count > 0 ) {
1872
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1871
+				if ($payment_count > 0) {
1872
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1873 1873
 					$error = 1;
1874 1874
 					$success = 0;
1875
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
1875
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
1876 1876
 					continue; //can't trash this registration because it has payments.
1877 1877
 				}
1878 1878
 				$ticket = $REG->get_first_related('Ticket');
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 				$dtts = array_merge($dtts, $dtt);
1882 1882
 
1883 1883
 				$updated = $trash ? $REG->delete() : $REG->restore();
1884
-				if ( !$updated ) {
1884
+				if ( ! $updated) {
1885 1885
 					$success = 0;
1886 1886
 				} else {
1887 1887
 					$success = 2;
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 			$tickets[$ticket->ID()] = $ticket;
1897 1897
 			$dtts = $ticket->get_many_related('Datetime');
1898 1898
 			$updated = $trash ? $REG->delete() : $REG->restore();
1899
-			if ( ! $updated ) {
1899
+			if ( ! $updated) {
1900 1900
 				$success = 0;
1901 1901
 			}
1902 1902
 
@@ -1906,10 +1906,10 @@  discard block
 block discarded – undo
1906 1906
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1907 1907
 		EEM_Datetime::instance()->update_sold($dtts);
1908 1908
 
1909
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1910
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1909
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1910
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1911 1911
 		$overwrite_msgs = $error ? TRUE : FALSE;
1912
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1912
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1913 1913
 	}
1914 1914
 
1915 1915
 
@@ -1933,16 +1933,16 @@  discard block
 block discarded – undo
1933 1933
 		$success = 1;
1934 1934
 
1935 1935
 		//Checkboxes
1936
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1936
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1937 1937
 			// if array has more than one element than success message should be plural
1938
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1938
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1939 1939
 			// cycle thru checkboxes
1940
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1940
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1941 1941
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1942
-				if ( ! $REG instanceof EE_Registration )
1942
+				if ( ! $REG instanceof EE_Registration)
1943 1943
 					continue;
1944 1944
 				$deleted = $this->_delete_registration($REG);
1945
-				if ( !$deleted ) {
1945
+				if ( ! $deleted) {
1946 1946
 					$success = 0;
1947 1947
 				}
1948 1948
 			}
@@ -1952,15 +1952,15 @@  discard block
 block discarded – undo
1952 1952
 			$REG_ID = $this->_req_data['_REG_ID'];
1953 1953
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1954 1954
 			$deleted = $this->_delete_registration($REG);
1955
-			if ( ! $deleted ) {
1955
+			if ( ! $deleted) {
1956 1956
 				$success = 0;
1957 1957
 			}
1958 1958
 
1959 1959
 		}
1960 1960
 
1961
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1962
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1963
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1961
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1962
+		$action_desc = __('permanently deleted.', 'event_espresso');
1963
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1964 1964
 	}
1965 1965
 
1966 1966
 
@@ -1972,31 +1972,31 @@  discard block
 block discarded – undo
1972 1972
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1973 1973
 	 * @return boolean              true = successful deletion, false = fail.
1974 1974
 	 */
1975
-	protected function _delete_registration( EE_Registration $REG ) {
1975
+	protected function _delete_registration(EE_Registration $REG) {
1976 1976
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
1977 1977
 		$TXN = $REG->get_first_related('Transaction');
1978 1978
 		$REGS = $TXN->get_many_related('Registration');
1979 1979
 
1980 1980
 		$all_trashed = TRUE;
1981
-		foreach ( $REGS as $registration ) {
1982
-			if ( ! $registration->get('REG_deleted') )
1981
+		foreach ($REGS as $registration) {
1982
+			if ( ! $registration->get('REG_deleted'))
1983 1983
 				$all_trashed = FALSE;
1984 1984
 		}
1985 1985
 
1986
-		if ( ! $all_trashed ) {
1987
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1986
+		if ( ! $all_trashed) {
1987
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1988 1988
 			return false;
1989 1989
 		}
1990 1990
 
1991 1991
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
1992
-		foreach ( $REGS as $registration ) {
1992
+		foreach ($REGS as $registration) {
1993 1993
 
1994 1994
 			//delete related answers
1995 1995
 			$registration->delete_related_permanently('Answer');
1996 1996
 
1997 1997
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1998 1998
 			$attendee = $registration->get_first_related('Attendee');
1999
-			if ( $attendee instanceof EE_Attendee ) {
1999
+			if ($attendee instanceof EE_Attendee) {
2000 2000
 				$registration->_remove_relation_to($attendee, 'Attendee');
2001 2001
 			}
2002 2002
 
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
 			//now delete permanently the checkins related to this registration.
2007 2007
 			$registration->delete_related_permanently('Checkin');
2008 2008
 
2009
-			if ( $registration->ID() === $REG->ID() )
2009
+			if ($registration->ID() === $REG->ID())
2010 2010
 				continue; //we don't want to delete permanently the existing registration just yet.
2011 2011
 
2012 2012
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2039,35 +2039,35 @@  discard block
 block discarded – undo
2039 2039
 	 * @return void
2040 2040
 	 */
2041 2041
 	public function new_registration() {
2042
-		if ( ! $this->_set_reg_event() ) {
2043
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2042
+		if ( ! $this->_set_reg_event()) {
2043
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2044 2044
 		}
2045
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2045
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2046 2046
 		// gotta start with a clean slate if we're not coming here via ajax
2047 2047
 		if (
2048
-			! defined('DOING_AJAX' )
2049
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2048
+			! defined('DOING_AJAX')
2049
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2050 2050
 		) {
2051
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2051
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2052 2052
 		}
2053 2053
 
2054
-		$this->_template_args['event_name'] = '' ;
2054
+		$this->_template_args['event_name'] = '';
2055 2055
 		// event name
2056
-		if ( $this->_reg_event ) {
2056
+		if ($this->_reg_event) {
2057 2057
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2058
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2059
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2060
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2058
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2059
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2060
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2061 2061
 		}
2062 2062
 
2063 2063
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2064 2064
 
2065
-		if ( defined('DOING_AJAX' ) ) {
2065
+		if (defined('DOING_AJAX')) {
2066 2066
 			$this->_return_json();
2067 2067
 		}
2068 2068
 		// grab header
2069
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2070
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2069
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2070
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2071 2071
 
2072 2072
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2073 2073
 		// the details template wrapper
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
 	 * @return string html
2085 2085
 	 */
2086 2086
 	protected function _get_registration_step_content() {
2087
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2087
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2088 2088
 			$warning_msg = sprintf(
2089 2089
 				__(
2090 2090
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
 				'</b>'
2101 2101
 			);
2102 2102
 			return '
2103
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2103
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2104 2104
 	<script >
2105 2105
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2106 2106
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2135,16 +2135,16 @@  discard block
 block discarded – undo
2135 2135
 		$cart = EE_Registry::instance()->SSN->cart();
2136 2136
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2137 2137
 
2138
-		switch ( $step ) {
2138
+		switch ($step) {
2139 2139
 			case 'ticket' :
2140 2140
 				$hidden_fields['processing_registration']['value'] = 1;
2141 2141
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2142
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2142
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2143 2143
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2144 2144
 				$template_args['show_notification_toggle'] = FALSE;
2145 2145
 				break;
2146 2146
 			case 'questions' :
2147
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2147
+				$hidden_fields['processing_registration']['value'] = 2;
2148 2148
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2149 2149
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2150 2150
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2153,10 +2153,10 @@  discard block
 block discarded – undo
2153 2153
 				break;
2154 2154
 		}
2155 2155
 
2156
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2156
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2157 2157
 
2158 2158
 		return EEH_Template::display_template(
2159
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2159
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2160 2160
 		);
2161 2161
 	}
2162 2162
 
@@ -2171,11 +2171,11 @@  discard block
 block discarded – undo
2171 2171
 	*		@return boolean
2172 2172
 	*/
2173 2173
 	private function _set_reg_event() {
2174
-		if ( is_object( $this->_reg_event )) {
2174
+		if (is_object($this->_reg_event)) {
2175 2175
 			return TRUE;
2176 2176
 		}
2177
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2178
-		if ( ! $EVT_ID ) {
2177
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2178
+		if ( ! $EVT_ID) {
2179 2179
 			return FALSE;
2180 2180
 		}
2181 2181
 
@@ -2196,82 +2196,82 @@  discard block
 block discarded – undo
2196 2196
 	public function process_reg_step() {
2197 2197
 		EE_System::do_not_cache();
2198 2198
 		$this->_set_reg_event();
2199
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2199
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2200 2200
 
2201 2201
 		//what step are we on?
2202 2202
 		$cart = EE_Registry::instance()->SSN->cart();
2203 2203
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2204 2204
 
2205 2205
 		//if doing ajax then we need to verify the nonce
2206
-		if ( defined( 'DOING_AJAX' ) ) {
2207
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2208
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2206
+		if (defined('DOING_AJAX')) {
2207
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2208
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2209 2209
 		}
2210 2210
 
2211
-		switch ( $step ) {
2211
+		switch ($step) {
2212 2212
 
2213 2213
 			case 'ticket' :
2214 2214
 				//process ticket selection
2215 2215
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2216
-				if ( $success ) {
2217
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2216
+				if ($success) {
2217
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2218 2218
 				} else {
2219 2219
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2220 2220
 				}
2221
-				if ( defined('DOING_AJAX') ) {
2221
+				if (defined('DOING_AJAX')) {
2222 2222
 					$this->new_registration(); //display next step
2223 2223
 				} else {
2224 2224
 					$query_args['action'] = 'new_registration';
2225 2225
 					$query_args['processing_registration'] = 1;
2226 2226
 					$query_args['event_id'] = $this->_reg_event->ID();
2227
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2227
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2228 2228
 				}
2229 2229
 				break;
2230 2230
 
2231 2231
 			case 'questions' :
2232
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2233
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2232
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2233
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2234 2234
 				}
2235 2235
 				//process registration
2236 2236
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2237
-				if ( $cart instanceof EE_Cart ) {
2237
+				if ($cart instanceof EE_Cart) {
2238 2238
 					$grand_total = $cart->get_cart_grand_total();
2239
-					if ( $grand_total instanceof EE_Line_Item ) {
2239
+					if ($grand_total instanceof EE_Line_Item) {
2240 2240
 						$grand_total->save_this_and_descendants_to_txn();
2241 2241
 					}
2242 2242
 				}
2243
-				if ( ! $transaction instanceof EE_Transaction ) {
2243
+				if ( ! $transaction instanceof EE_Transaction) {
2244 2244
 					$query_args = array(
2245 2245
 						'action' => 'new_registration',
2246 2246
 						'processing_registration' => 2,
2247 2247
 						'event_id' => $this->_reg_event->ID()
2248 2248
 					);
2249 2249
 
2250
-					if ( defined('DOING_AJAX' )) {
2250
+					if (defined('DOING_AJAX')) {
2251 2251
 						//display registration form again because there are errors (maybe validation?)
2252 2252
 						$this->new_registration();
2253 2253
 						return;
2254 2254
 					} else {
2255
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2255
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2256 2256
 						return;
2257 2257
 					}
2258 2258
 				}
2259 2259
 				/** @type EE_Transaction_Payments $transaction_payments */
2260
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2260
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2261 2261
 				// maybe update status, and make sure to save transaction if not done already
2262
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2262
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2263 2263
 					$transaction->save();
2264 2264
 				}
2265
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2265
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2266 2266
 				$this->_req_data = array();
2267 2267
 				$query_args = array(
2268 2268
 					'action'        => 'redirect_to_txn',
2269 2269
 					'TXN_ID'        => $transaction->ID(),
2270 2270
 					'EVT_ID'        => $this->_reg_event->ID(),
2271
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2271
+					'event_name'    => urlencode($this->_reg_event->name()),
2272 2272
 					'redirect_from' => 'new_registration'
2273 2273
 				);
2274
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2274
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2275 2275
 				break;
2276 2276
 		}
2277 2277
 
@@ -2288,21 +2288,21 @@  discard block
 block discarded – undo
2288 2288
 	 */
2289 2289
 	public function redirect_to_txn() {
2290 2290
 		EE_System::do_not_cache();
2291
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2291
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2292 2292
 		$query_args = array(
2293 2293
 			'action' => 'view_transaction',
2294
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2294
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2295 2295
 			'page'   => 'espresso_transactions'
2296 2296
 		);
2297
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2298
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2299
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2300
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2297
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2298
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2299
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2300
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2301 2301
 		}
2302 2302
 		EE_Error::add_success(
2303
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2303
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2304 2304
 		);
2305
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2305
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2306 2306
 	}
2307 2307
 
2308 2308
 
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
 	*		@return void
2314 2314
 	*/
2315 2315
 	protected function _attendee_contact_list_table() {
2316
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2316
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2317 2317
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2318 2318
 		$this->display_admin_list_table_page_with_no_sidebar();
2319 2319
 	}
@@ -2328,10 +2328,10 @@  discard block
 block discarded – undo
2328 2328
 	*		@access public
2329 2329
 	*		@return array
2330 2330
 	*/
2331
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2331
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2332 2332
 
2333
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2334
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2333
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2334
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2335 2335
 		$ATT_MDL = EEM_Attendee::instance();
2336 2336
 
2337 2337
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2359,47 +2359,47 @@  discard block
 block discarded – undo
2359 2359
 				$orderby = 'ATT_lname';
2360 2360
 		}
2361 2361
 
2362
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2362
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2363 2363
 
2364
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2365
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2366
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2364
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2365
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2366
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2367 2367
 
2368 2368
 		$_where = array();
2369 2369
 
2370
-		if ( isset( $this->_req_data['s'] ) ) {
2371
-			$sstr = '%' . $this->_req_data['s'] . '%';
2370
+		if (isset($this->_req_data['s'])) {
2371
+			$sstr = '%'.$this->_req_data['s'].'%';
2372 2372
 			$_where['OR'] = array(
2373
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2374
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2375
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2376
-				'ATT_fname' => array( 'LIKE', $sstr ),
2377
-				'ATT_lname' => array( 'LIKE', $sstr ),
2378
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2379
-				'ATT_email' => array('LIKE', $sstr ),
2380
-				'ATT_address' => array( 'LIKE', $sstr ),
2381
-				'ATT_address2' => array( 'LIKE', $sstr ),
2382
-				'ATT_city' => array( 'LIKE', $sstr ),
2383
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2384
-				'State.STA_name' => array('LIKE', $sstr ),
2385
-				'ATT_phone' => array( 'LIKE', $sstr ),
2386
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2387
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2388
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2389
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2373
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2374
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2375
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2376
+				'ATT_fname' => array('LIKE', $sstr),
2377
+				'ATT_lname' => array('LIKE', $sstr),
2378
+				'ATT_short_bio' => array('LIKE', $sstr),
2379
+				'ATT_email' => array('LIKE', $sstr),
2380
+				'ATT_address' => array('LIKE', $sstr),
2381
+				'ATT_address2' => array('LIKE', $sstr),
2382
+				'ATT_city' => array('LIKE', $sstr),
2383
+				'Country.CNT_name' => array('LIKE', $sstr),
2384
+				'State.STA_name' => array('LIKE', $sstr),
2385
+				'ATT_phone' => array('LIKE', $sstr),
2386
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2387
+				'Registration.REG_code' => array('LIKE', $sstr),
2388
+				'Registration.REG_count' => array('LIKE', $sstr),
2389
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2390 2390
 				);
2391 2391
 		}
2392 2392
 
2393 2393
 
2394
-		$offset = ($current_page-1)*$per_page;
2395
-		$limit = $count ? NULL : array( $offset, $per_page );
2394
+		$offset = ($current_page - 1) * $per_page;
2395
+		$limit = $count ? NULL : array($offset, $per_page);
2396 2396
 
2397
-		if ( $trash ) {
2398
-			$_where['status'] = array( '!=', 'publish' );
2399
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2397
+		if ($trash) {
2398
+			$_where['status'] = array('!=', 'publish');
2399
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2400 2400
 		} else {
2401
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2402
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2401
+			$_where['status'] = array('IN', array('publish'));
2402
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2403 2403
 		}
2404 2404
 
2405 2405
 		return $all_attendees;
@@ -2416,10 +2416,10 @@  discard block
 block discarded – undo
2416 2416
 	 */
2417 2417
 	protected function _resend_registration() {
2418 2418
 		$this->_process_resend_registration();
2419
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2419
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2420 2420
 			'action' => 'default'
2421 2421
 		);
2422
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2422
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2423 2423
 	}
2424 2424
 
2425 2425
 
@@ -2427,26 +2427,26 @@  discard block
 block discarded – undo
2427 2427
 
2428 2428
 
2429 2429
 
2430
-	public function _registrations_report(){
2431
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2432
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2430
+	public function _registrations_report() {
2431
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2432
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2433 2433
 				array(
2434 2434
 					'page' => 'espresso_batch',
2435 2435
 					'batch' => 'file',
2436
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2437
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2438
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2439
-				)) );
2436
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2437
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2438
+					'return_url' => urlencode($this->_req_data['return_url']),
2439
+				)));
2440 2440
 		} else {
2441 2441
 			$new_request_args = array(
2442 2442
 				'export' => 'report',
2443 2443
 				'action' => 'registrations_report_for_event',
2444
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2444
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2445 2445
 			);
2446 2446
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2447 2447
 
2448
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2449
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2448
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2449
+				require_once(EE_CLASSES.'EE_Export.class.php');
2450 2450
 				$EE_Export = EE_Export::instance($this->_req_data);
2451 2451
 				$EE_Export->export();
2452 2452
 			}
@@ -2455,26 +2455,26 @@  discard block
 block discarded – undo
2455 2455
 
2456 2456
 
2457 2457
 
2458
-	public function _contact_list_export(){
2459
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2460
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2458
+	public function _contact_list_export() {
2459
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2460
+			require_once(EE_CLASSES.'EE_Export.class.php');
2461 2461
 			$EE_Export = EE_Export::instance($this->_req_data);
2462 2462
 			$EE_Export->export_attendees();
2463 2463
 		}
2464 2464
 	}
2465 2465
 
2466
-	public function _contact_list_report(){
2467
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2468
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2466
+	public function _contact_list_report() {
2467
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2468
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2469 2469
 				array(
2470 2470
 					'page' => 'espresso_batch',
2471 2471
 					'batch' => 'file',
2472
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2473
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2474
-				)) );
2472
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2473
+					'return_url' => urlencode($this->_req_data['return_url']),
2474
+				)));
2475 2475
 		} else {
2476
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2477
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2476
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2477
+				require_once(EE_CLASSES.'EE_Export.class.php');
2478 2478
 				$EE_Export = EE_Export::instance($this->_req_data);
2479 2479
 				$EE_Export->report_attendees();
2480 2480
 			}
@@ -2494,73 +2494,73 @@  discard block
 block discarded – undo
2494 2494
 	 * @return void
2495 2495
 	 */
2496 2496
 	protected function _duplicate_attendee() {
2497
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2497
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2498 2498
 		//verify we have necessary info
2499
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2500
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2501
-			$query_args = array( 'action' => $action );
2499
+		if (empty($this->_req_data['_REG_ID'])) {
2500
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2501
+			$query_args = array('action' => $action);
2502 2502
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2503 2503
 		}
2504 2504
 
2505 2505
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2506
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2506
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2507 2507
 		$attendee = $registration->attendee();
2508 2508
 
2509 2509
 		//remove relation of existing attendee on registration
2510
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2510
+		$registration->_remove_relation_to($attendee, 'Attendee');
2511 2511
 		//new attendee
2512 2512
 		$new_attendee = clone $attendee;
2513
-		$new_attendee->set( 'ATT_ID', 0 );
2513
+		$new_attendee->set('ATT_ID', 0);
2514 2514
 		$new_attendee->save();
2515 2515
 
2516 2516
 		//add new attendee to reg
2517
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2517
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2518 2518
 
2519
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2519
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2520 2520
 
2521 2521
 		//redirect to edit page for attendee
2522
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2522
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2523 2523
 
2524
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2524
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2525 2525
 	}
2526 2526
 
2527 2527
 
2528 2528
 	//related to cpt routes
2529 2529
 	protected function _insert_update_cpt_item($post_id, $post) {
2530 2530
 		$success = true;
2531
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2531
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2532 2532
 		//for attendee updates
2533
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2533
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2534 2534
 			//note we should only be UPDATING attendees at this point.
2535 2535
 			$updated_fields = array(
2536 2536
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2537 2537
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2538
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2538
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2539 2539
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2540 2540
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2541
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2542
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2543
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2544
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2545
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2546
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2541
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2542
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2543
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2544
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2545
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2546
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2547 2547
 				);
2548
-			foreach ( $updated_fields as $field => $value ) {
2548
+			foreach ($updated_fields as $field => $value) {
2549 2549
 				$attendee->set($field, $value);
2550 2550
 			}
2551 2551
 
2552 2552
 			$success = $attendee->save();
2553 2553
 
2554
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2555
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2556
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2557
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2554
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2555
+			foreach ($attendee_update_callbacks as $a_callback) {
2556
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2557
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2558 2558
 				}
2559 2559
 			}
2560 2560
 		}
2561 2561
 
2562
-		if ( $success === FALSE )
2563
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2562
+		if ($success === FALSE)
2563
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2564 2564
 
2565 2565
 	}
2566 2566
 
@@ -2580,17 +2580,17 @@  discard block
 block discarded – undo
2580 2580
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2581 2581
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2582 2582
 
2583
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2584
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2583
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2584
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2585 2585
 		}
2586 2586
 
2587
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2587
+		if (post_type_supports('espresso_attendees', 'comments')) {
2588 2588
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2589 2589
 		}
2590 2590
 
2591
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2592
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2593
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2591
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2592
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2593
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2594 2594
 	}
2595 2595
 
2596 2596
 
@@ -2599,10 +2599,10 @@  discard block
 block discarded – undo
2599 2599
 	 * @param  WP_Post $post wp post object
2600 2600
 	 * @return string        attendee contact info ( and form )
2601 2601
 	 */
2602
-	public function attendee_contact_info( $post ) {
2602
+	public function attendee_contact_info($post) {
2603 2603
 		//get attendee object ( should already have it )
2604 2604
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2605
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2605
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2606 2606
 		EEH_Template::display_template($template, $this->_template_args);
2607 2607
 	}
2608 2608
 
@@ -2618,12 +2618,12 @@  discard block
 block discarded – undo
2618 2618
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2619 2619
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2620 2620
 				new EE_Question_Form_Input(
2621
-				EE_Question::new_instance( array(
2621
+				EE_Question::new_instance(array(
2622 2622
 					'QST_ID' => 0,
2623 2623
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2624 2624
 					'QST_system' => 'admin-state'
2625 2625
 					)),
2626
-				EE_Answer::new_instance( array(
2626
+				EE_Answer::new_instance(array(
2627 2627
 					'ANS_ID' => 0,
2628 2628
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2629 2629
 					)),
@@ -2636,12 +2636,12 @@  discard block
 block discarded – undo
2636 2636
 			));
2637 2637
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2638 2638
 				new EE_Question_Form_Input(
2639
-				EE_Question::new_instance( array(
2639
+				EE_Question::new_instance(array(
2640 2640
 					'QST_ID' => 0,
2641 2641
 					'QST_display_text' => __('Country', 'event_espresso'),
2642 2642
 					'QST_system' => 'admin-country'
2643 2643
 					)),
2644
-				EE_Answer::new_instance( array(
2644
+				EE_Answer::new_instance(array(
2645 2645
 					'ANS_ID' => 0,
2646 2646
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2647 2647
 					)),
@@ -2652,8 +2652,8 @@  discard block
 block discarded – undo
2652 2652
 					'append_qstn_id' => FALSE
2653 2653
 					)
2654 2654
 				));
2655
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2656
-		EEH_Template::display_template($template, $this->_template_args );
2655
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2656
+		EEH_Template::display_template($template, $this->_template_args);
2657 2657
 
2658 2658
 	}
2659 2659
 
@@ -2663,11 +2663,11 @@  discard block
 block discarded – undo
2663 2663
 	*		@access protected
2664 2664
 	*		@return void
2665 2665
 	*/
2666
-	public function attendee_registrations_meta_box( $post ) {
2666
+	public function attendee_registrations_meta_box($post) {
2667 2667
 
2668 2668
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2669 2669
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2670
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2670
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2671 2671
 		EEH_Template::display_template($template, $this->_template_args);
2672 2672
 
2673 2673
 	}
@@ -2681,8 +2681,8 @@  discard block
 block discarded – undo
2681 2681
 	 * @return string        html for new form.
2682 2682
 	 */
2683 2683
 	public function after_title_form_fields($post) {
2684
-		if ( $post->post_type == 'espresso_attendees' ) {
2685
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2684
+		if ($post->post_type == 'espresso_attendees') {
2685
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2686 2686
 			$template_args['attendee'] = $this->_cpt_model_obj;
2687 2687
 			EEH_Template::display_template($template, $template_args);
2688 2688
 		}
@@ -2699,21 +2699,21 @@  discard block
 block discarded – undo
2699 2699
 	*		@access protected
2700 2700
 	*		@return void
2701 2701
 	*/
2702
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2702
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2703 2703
 
2704
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2704
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2705 2705
 
2706 2706
 		$ATT_MDL = EEM_Attendee::instance();
2707 2707
 
2708 2708
 		$success = 1;
2709 2709
 		//Checkboxes
2710
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2710
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2711 2711
 			// if array has more than one element than success message should be plural
2712
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2712
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2713 2713
 			// cycle thru checkboxes
2714
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2715
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2716
-				if ( !$updated ) {
2714
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2715
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2716
+				if ( ! $updated) {
2717 2717
 					$success = 0;
2718 2718
 				}
2719 2719
 			}
@@ -2722,18 +2722,18 @@  discard block
 block discarded – undo
2722 2722
 			// grab single id and delete
2723 2723
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2724 2724
 			//get attendee
2725
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2725
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2726 2726
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2727 2727
 			$updated = $att->save();
2728
-			if ( ! $updated ) {
2728
+			if ( ! $updated) {
2729 2729
 				$success = 0;
2730 2730
 			}
2731 2731
 
2732 2732
 		}
2733 2733
 
2734
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2735
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2736
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2734
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2735
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2736
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2737 2737
 
2738 2738
 	}
2739 2739
 
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 1 patch
Spacing   +279 added lines, -280 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
 /**
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 
43
-	public function __construct( $routing = TRUE ) {
44
-		parent::__construct( $routing );
43
+	public function __construct($routing = TRUE) {
44
+		parent::__construct($routing);
45 45
 	}
46 46
 
47 47
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 	protected function _ajax_hooks() {
60
-		add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings'));
61
-		add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states'));
62
-		add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 );
63
-		add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state'));
60
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
61
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
62
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
63
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
64 64
 	}
65 65
 
66 66
 
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 					'label' => __('Critical Pages', 'event_espresso'),
154 154
 					'order' => 50
155 155
 					),
156
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
156
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
157 157
                			'help_tabs' => array(
158 158
 					'general_settings_critical_pages_help_tab' => array(
159 159
 						'title' => __('Critical Pages', 'event_espresso'),
160 160
 						'filename' => 'general_settings_critical_pages'
161 161
 						)
162 162
 					),
163
-				'help_tour' => array( 'Critical_Pages_Help_Tour' ),
163
+				'help_tour' => array('Critical_Pages_Help_Tour'),
164 164
 				'require_nonce' => FALSE
165 165
 				),
166 166
 			'default' => array(
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 						'filename' => 'general_settings_your_organization'
175 175
 						)
176 176
 					),
177
-				'help_tour' => array( 'Your_Organization_Help_Tour' ),
178
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
177
+				'help_tour' => array('Your_Organization_Help_Tour'),
178
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
179 179
 				'require_nonce' => FALSE
180 180
 				),
181 181
 			'admin_option_settings' => array(
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 					'label' => __('Admin Options', 'event_espresso'),
184 184
 					'order' => 60
185 185
 					),
186
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
186
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
187 187
                 			'help_tabs' => array(
188 188
 					'general_settings_admin_options_help_tab' => array(
189 189
 						'title' => __('Admin Options', 'event_espresso'),
190 190
 						'filename' => 'general_settings_admin_options'
191 191
 						)
192 192
 					),
193
-				'help_tour' => array( 'Admin_Options_Help_Tour' ),
193
+				'help_tour' => array('Admin_Options_Help_Tour'),
194 194
 				'require_nonce' => FALSE
195 195
 				),
196 196
 			'country_settings' => array(
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 						'filename' => 'general_settings_countries'
205 205
 						)
206 206
 					),
207
-				'help_tour' => array( 'Countries_Help_Tour' ),
207
+				'help_tour' => array('Countries_Help_Tour'),
208 208
 				'require_nonce' => FALSE
209 209
 				)
210 210
 			);
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	public function admin_init() {
225
-		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' );
226
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
227
-		EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' );
228
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
229
-		EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol );
225
+		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');
226
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
227
+		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso');
228
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
229
+		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol);
230 230
 	}
231 231
 
232 232
 	public function admin_notices() {}
@@ -239,21 +239,21 @@  discard block
 block discarded – undo
239 239
 		//scripts
240 240
 		wp_enqueue_script('media-upload');
241 241
 		wp_enqueue_script('thickbox');
242
-		wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE );
243
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
244
-		wp_enqueue_script( 'organization_settings' );
245
-		wp_enqueue_style( 'organization-css' );
246
-		$confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
247
-		wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete );
242
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE);
243
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
244
+		wp_enqueue_script('organization_settings');
245
+		wp_enqueue_style('organization-css');
246
+		$confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
247
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
248 248
 
249 249
 	}
250 250
 
251 251
 	public function load_scripts_styles_country_settings() {
252 252
 		//scripts
253
-		wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE );
254
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
255
-		wp_enqueue_script( 'gen_settings_countries' );
256
-		wp_enqueue_style( 'organization-css' );
253
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
254
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
255
+		wp_enqueue_script('gen_settings_countries');
256
+		wp_enqueue_style('organization-css');
257 257
 
258 258
 	}
259 259
 
@@ -270,31 +270,31 @@  discard block
 block discarded – undo
270 270
 		$this->_transient_garbage_collection();
271 271
 		$this->_template_args['values'] = $this->_yes_no_values;
272 272
 
273
-		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
274
-		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE;
273
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
274
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE;
275 275
 
276 276
 		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;
277
-		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE;
277
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE;
278 278
 
279
-		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
280
-		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE;
279
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
280
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE;
281 281
 
282
-		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
283
-		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE;
282
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
283
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE;
284 284
 
285
-		$this->_set_add_edit_form_tags( 'update_espresso_page_settings' );
286
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
287
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );
285
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
286
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
287
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);
288 288
 		$this->display_admin_page_with_sidebar();
289 289
 
290 290
 	}
291 291
 
292 292
 	protected function _update_espresso_page_settings() {
293 293
 		// capture incoming request data
294
-		$reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id;
295
-		$txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id;
296
-		$thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id;
297
-		$cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id;
294
+		$reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
295
+		$txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
296
+		$thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
297
+		$cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
298 298
 		// pack critical_pages into an array
299 299
 		$critical_pages = array(
300 300
 			'reg_page_id' 				=> $reg_page_id,
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
 			'thank_you_page_id' 	=> $thank_you_page_id,
303 303
 			'cancel_page_id' 		=> $cancel_page_id
304 304
 		);
305
-		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) {
305
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
306 306
 			// has the page changed ?
307
-			if ( EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id ) {
307
+			if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) {
308 308
 				// grab post object for old page
309
-				$post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} );
309
+				$post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} );
310 310
 				// update post shortcodes for old page
311
-				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post );
311
+				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post);
312 312
 				// grab post object for new page
313
-				$post = get_post( $critical_page_id );
313
+				$post = get_post($critical_page_id);
314 314
 				// update post shortcodes for new page
315
-				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post );
315
+				EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post);
316 316
 			}
317 317
 		}
318 318
 		// set page IDs
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
322 322
 		EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
323 323
 
324
-		EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data );
324
+		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data);
325 325
 
326 326
 		$what = __('Critical Pages & Shortcodes', 'event_espresso');
327
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );
327
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
328 328
 		$query_args = array(
329 329
 			'action' => 'critical_pages'
330 330
 			);
331
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
331
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
332 332
 
333 333
 	}
334 334
 
@@ -343,34 +343,34 @@  discard block
 block discarded – undo
343 343
 
344 344
 	protected function _your_organization_settings() {
345 345
 
346
-		$this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : '';
347
-		$this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';
348
-		$this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';
349
-		$this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';
350
-		$this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';
351
-		$this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';
352
-		$this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';
353
-		$this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';
354
-		$this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';
355
-		$this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';
356
-		$this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;
357
-		$this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';
358
-		$this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';
359
-		$this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';
360
-		$this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';
361
-		$this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';
362
-		$this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';
346
+		$this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
347
+		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
348
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
349
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
350
+		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
351
+		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
352
+		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
353
+		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
354
+		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
355
+		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
356
+		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE;
357
+		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
358
+		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
359
+		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
360
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
361
+		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
362
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
363 363
 		//UXIP settings
364
-		$this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE;
364
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE;
365 365
 
366
-		$STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
366
+		$STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
367 367
 		$this->_template_args['states'] = new EE_Question_Form_Input(
368
-				EE_Question::new_instance ( array(
368
+				EE_Question::new_instance(array(
369 369
 					'QST_ID'=> 0,
370 370
 					'QST_display_text'=> __('State/Province', 'event_espresso'),
371 371
 					'QST_system'=>'admin-state'
372 372
 				)),
373
-				EE_Answer::new_instance ( array(
373
+				EE_Answer::new_instance(array(
374 374
 					'ANS_ID' => 0,
375 375
 					'ANS_value' => $STA_ID
376 376
 				)),
@@ -382,14 +382,14 @@  discard block
 block discarded – undo
382 382
 				)
383 383
 			);
384 384
 
385
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
385
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
386 386
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
387
-				EE_Question::new_instance ( array(
387
+				EE_Question::new_instance(array(
388 388
 					'QST_ID'=> 0,
389 389
 					'QST_display_text'=> __('Country', 'event_espresso'),
390 390
 					'QST_system'=>'admin-country'
391 391
 				)),
392
-				EE_Answer::new_instance ( array(
392
+				EE_Answer::new_instance(array(
393 393
 					'ANS_ID' => 0,
394 394
 					'ANS_value' => $CNT_ISO
395 395
 				)),
@@ -401,51 +401,51 @@  discard block
 block discarded – undo
401 401
 				)
402 402
 			);
403 403
 
404
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
405
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
404
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
405
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
406 406
 
407 407
 		//PUE verification stuff
408
-		$ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );
409
-		$verify_fail = get_option( $ver_option_key );
410
-		$this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
408
+		$ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
409
+		$verify_fail = get_option($ver_option_key);
410
+		$this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
411 411
 
412
-		$this->_set_add_edit_form_tags( 'update_your_organization_settings' );
413
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
414
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );
412
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
413
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
414
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);
415 415
 
416 416
 		$this->display_admin_page_with_sidebar();
417 417
 	}
418 418
 
419 419
 	protected function _update_your_organization_settings() {
420
-		if ( is_main_site() )
421
-			EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
422
-		EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;
423
-		EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;
424
-		EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;
425
-		EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city;
426
-		EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID;
427
-		EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO;
428
-		EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip;
429
-		EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email;
430
-		EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat;
431
-		EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone;
432
-		EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url;
433
-		EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook;
434
-		EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter;
435
-		EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin;
436
-		EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest;
437
-		EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google;
438
-		EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram;
439
-		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
440
-
441
-		EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );
442
-
443
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );
420
+		if (is_main_site())
421
+			EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
422
+		EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
423
+		EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
424
+		EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
425
+		EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
426
+		EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
427
+		EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
428
+		EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
429
+		EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
430
+		EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
431
+		EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
432
+		EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
433
+		EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
434
+		EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
435
+		EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
436
+		EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
437
+		EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
438
+		EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
439
+		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
440
+
441
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
442
+
443
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG);
444 444
 
445 445
 		$what = 'Your Organization Settings';
446
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
446
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
447 447
 
448
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );
448
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
449 449
 
450 450
 	}
451 451
 
@@ -456,36 +456,36 @@  discard block
 block discarded – undo
456 456
 	protected function _admin_option_settings() {
457 457
 
458 458
 		$this->_template_args['values'] = $this->_yes_no_values;
459
-		$this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE;
460
-		$this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE;
461
-		$this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30;
462
-		$this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE;
463
-		$this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE;
464
-		$this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
465
-		$this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1;
466
-
467
-		$this->_set_add_edit_form_tags( 'update_admin_option_settings' );
468
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
459
+		$this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE;
460
+		$this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE;
461
+		$this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30;
462
+		$this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE;
463
+		$this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE;
464
+		$this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
465
+		$this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1;
466
+
467
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
468
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
469 469
 		$this->_template_args['template_args'] = $this->_template_args;
470
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE );
470
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE);
471 471
 		$this->display_admin_page_with_sidebar();
472 472
 	}
473 473
 
474 474
 	protected function _update_admin_option_settings() {
475
-		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
476
-		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
477
-		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
478
-		EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones;
479
-		EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer;
480
-		EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id;
481
-		EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation;
475
+		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
476
+		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
477
+		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
478
+		EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones;
479
+		EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer;
480
+		EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id;
481
+		EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation;
482 482
 
483
-		EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin );
483
+		EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin);
484 484
 
485 485
 		$what = 'Admin Options';
486
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ );
487
-		$success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success );
488
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) );
486
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__);
487
+		$success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success);
488
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings'));
489 489
 
490 490
 	}
491 491
 
@@ -498,20 +498,20 @@  discard block
 block discarded – undo
498 498
 
499 499
 	protected function _country_settings() {
500 500
 
501
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
502
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
501
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
502
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
503 503
 
504 504
 		//load field generator helper
505 505
 
506 506
 		$this->_template_args['values'] = $this->_yes_no_values;
507 507
 
508 508
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
509
-				EE_Question::new_instance ( array(
509
+				EE_Question::new_instance(array(
510 510
 					'QST_ID'=> 0,
511 511
 					'QST_display_text'=> __('Select Country', 'event_espresso'),
512 512
 					'QST_system'=>'admin-country'
513 513
 				)),
514
-				EE_Answer::new_instance ( array(
514
+				EE_Answer::new_instance(array(
515 515
 					'ANS_ID' => 0,
516 516
 					'ANS_value' => $CNT_ISO
517 517
 				)),
@@ -524,14 +524,14 @@  discard block
 block discarded – undo
524 524
 			);
525 525
 //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
526 526
 
527
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
528
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
527
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
528
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
529 529
 		$this->_template_args['country_details_settings'] = $this->display_country_settings();
530 530
 		$this->_template_args['country_states_settings'] = $this->display_country_states();
531 531
 
532
-		$this->_set_add_edit_form_tags( 'update_country_settings' );
533
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
534
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );
532
+		$this->_set_add_edit_form_tags('update_country_settings');
533
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
534
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);
535 535
 		$this->display_admin_page_with_no_sidebar();
536 536
 	}
537 537
 
@@ -544,43 +544,43 @@  discard block
 block discarded – undo
544 544
 	 * 		@param 	string 		$CNT_ISO
545 545
 	 * 		@return 		mixed		string | array
546 546
 	 */
547
-	public function display_country_settings( $CNT_ISO = '' ) {
547
+	public function display_country_settings($CNT_ISO = '') {
548 548
 
549
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
550
-		if ( ! $CNT_ISO ) {
549
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
550
+		if ( ! $CNT_ISO) {
551 551
 			return '';
552 552
 		}
553 553
 
554 554
 		// for ajax
555
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
556
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
557
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
558
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
559
-		$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
555
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
556
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
557
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
558
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
559
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
560 560
 		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
561 561
 		$country_input_types = array(
562
-			'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  ),
563
-			'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
564
-			'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
565
-			'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
566
-			'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),
567
-			'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
568
-			'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
569
-			'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
570
-			'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),
571
-			'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),
572
-			'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))),
573
-			'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
574
-			'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
575
-			'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
576
-			'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  )
562
+			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
563
+			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
564
+			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
565
+			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
566
+			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'),
567
+			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
568
+			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
569
+			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
570
+			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE),
571
+			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
572
+			'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))),
573
+			'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
574
+			'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
575
+			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
576
+			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE)
577 577
 		);
578
-		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );
579
-		$country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );
578
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);
579
+		$country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);
580 580
 
581
-		if ( defined( 'DOING_AJAX' )) {
582
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
583
-			echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
581
+		if (defined('DOING_AJAX')) {
582
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
583
+			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
584 584
 			die();
585 585
 		} else {
586 586
 			return $country_details_settings;
@@ -598,49 +598,49 @@  discard block
 block discarded – undo
598 598
 	 * 		@param 	string 		$CNT_ISO
599 599
 	 * 		@return 		string
600 600
 	 */
601
-	public function display_country_states( $CNT_ISO = '' ) {
601
+	public function display_country_states($CNT_ISO = '') {
602 602
 
603
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;
603
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
604 604
 
605
-		if ( ! $CNT_ISO ) {
605
+		if ( ! $CNT_ISO) {
606 606
 			return '';
607 607
 		}
608 608
 		// for ajax
609
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
610
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
611
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );
612
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );
613
-		$states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));
609
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
610
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
611
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
612
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
613
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
614 614
 
615 615
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
616 616
 //			global $wpdb;
617 617
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
618 618
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
619
-		if ( $states ) {
620
-			foreach ( $states as $STA_ID => $state ) {
621
-				if ( $state instanceof EE_State ) {
619
+		if ($states) {
620
+			foreach ($states as $STA_ID => $state) {
621
+				if ($state instanceof EE_State) {
622 622
 					//STA_abbrev 	STA_name 	STA_active
623 623
 					$state_input_types = array(
624
-						'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),
625
-						'STA_name'   => array( 'type'       => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),
626
-						'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )
624
+						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'),
625
+						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'),
626
+						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true)
627 627
 					);
628
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );
629
-					$query_args = array( 'action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );
630
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );
628
+					$this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
629
+					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
630
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
631 631
 				}
632 632
 			}
633 633
 		} else {
634 634
 			$this->_template_args['states'] = FALSE;
635 635
 		}
636 636
 //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
637
-		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ),  GEN_SET_ADMIN_URL );
637
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL);
638 638
 
639
-		$state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );
639
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);
640 640
 
641
-		if ( defined( 'DOING_AJAX' )) {
642
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
643
-			echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
641
+		if (defined('DOING_AJAX')) {
642
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
643
+			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
644 644
 			die();
645 645
 		} else {
646 646
 			return $state_details_settings;
@@ -661,40 +661,39 @@  discard block
 block discarded – undo
661 661
 
662 662
 		$success = TRUE;
663 663
 
664
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
665
-		if ( ! $CNT_ISO ) {
666
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
664
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
665
+		if ( ! $CNT_ISO) {
666
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
667 667
 			$success = FALSE;
668 668
 		}
669
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
670
-		if ( ! $STA_abbrev ) {
671
-			EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
669
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
670
+		if ( ! $STA_abbrev) {
671
+			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
672 672
 			$success = FALSE;
673 673
 		}
674
-		$STA_name = isset( $this->_req_data['STA_name'] ) ?  sanitize_text_field( $this->_req_data['STA_name'] ) :
675
-			FALSE;
676
-		if ( ! $STA_name ) {
677
-			EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
674
+		$STA_name = isset($this->_req_data['STA_name']) ?  sanitize_text_field($this->_req_data['STA_name']) : FALSE;
675
+		if ( ! $STA_name) {
676
+			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
678 677
 			$success = FALSE;
679 678
 		}
680 679
 
681
-		if ( $success ) {
680
+		if ($success) {
682 681
 			$cols_n_values = array(
683 682
 				'CNT_ISO' => $CNT_ISO,
684 683
 				'STA_abbrev' => $STA_abbrev,
685 684
 				'STA_name' => $STA_name,
686 685
 				'STA_active' => TRUE
687 686
 			);
688
-			$success = EEM_State::instance()->insert ( $cols_n_values );
689
-			EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) );
687
+			$success = EEM_State::instance()->insert($cols_n_values);
688
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
690 689
 		}
691 690
 
692
-		if ( defined( 'DOING_AJAX' )) {
693
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
694
-			echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) );
691
+		if (defined('DOING_AJAX')) {
692
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
693
+			echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
695 694
 			die();
696 695
 		} else {
697
-			$this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );
696
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
698 697
 		}
699 698
 	}
700 699
 
@@ -707,25 +706,25 @@  discard block
 block discarded – undo
707 706
 	 * 		@return 		boolean | void
708 707
 	 */
709 708
 	public function delete_state() {
710
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
711
-		$STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;
712
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
713
-		if ( ! $STA_ID ) {
714
-			EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
709
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
710
+		$STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;
711
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
712
+		if ( ! $STA_ID) {
713
+			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
715 714
 			return FALSE;
716 715
 		}
717
-		$success = EEM_State::instance()->delete_by_ID( $STA_ID );
718
-		if ( $success !== FALSE ) {
719
-			do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));
720
-			EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));
716
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
717
+		if ($success !== FALSE) {
718
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev));
719
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
721 720
 		}
722
-		if ( defined( 'DOING_AJAX' )) {
723
-			$notices = EE_Error::get_notices( FALSE, FALSE );
721
+		if (defined('DOING_AJAX')) {
722
+			$notices = EE_Error::get_notices(FALSE, FALSE);
724 723
 			$notices['return_data'] = TRUE;
725
-			echo json_encode( $notices );
724
+			echo json_encode($notices);
726 725
 			die();
727 726
 		} else {
728
-			$this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );
727
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
729 728
 		}
730 729
 	}
731 730
 
@@ -741,63 +740,63 @@  discard block
 block discarded – undo
741 740
 	protected function _update_country_settings() {
742 741
 //		EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
743 742
 		// grab the country ISO code
744
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;
745
-		if ( ! $CNT_ISO ) {
746
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
743
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;
744
+		if ( ! $CNT_ISO) {
745
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
747 746
 			return;
748 747
 		}
749 748
 		$cols_n_values = array();
750
-		$cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE;
751
-		$cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;
752
-		$cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL;
753
-		$cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD';
754
-		$cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar';
755
-		$cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars';
756
-		$cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$';
757
-		$cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE;
758
-		$cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2;
759
-		$cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.';
760
-		$cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ',';
761
-		$cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL;
762
-		$cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE;
763
-		$cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;
749
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE;
750
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;
751
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL;
752
+		$cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
753
+		$cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
754
+		$cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
755
+		$cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
756
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE;
757
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
758
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
759
+		$cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
760
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL;
761
+		$cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE;
762
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;
764 763
 		// allow filtering of country data
765
-		$cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );
764
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values);
766 765
 		//EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
767 766
 		// where values
768
-		$where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));
767
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
769 768
 		// run the update
770
-		$success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );
769
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
771 770
 //		global $wpdb;
772 771
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
773 772
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
774
-		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) {
773
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) {
775 774
 			// allow filtering of states data
776
-			$states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );
775
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']);
777 776
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
778 777
 			// loop thru state data ( looks like : states[75][STA_name] )
779
-			foreach( $states as $STA_ID => $state ) {
778
+			foreach ($states as $STA_ID => $state) {
780 779
 				$cols_n_values = array(
781 780
 					'CNT_ISO' 		=> $CNT_ISO,
782
-					'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),
783
-					'STA_name' 	=> sanitize_text_field( $state['STA_name'] ),
784
-					'STA_active' 	=> (bool)absint( $state['STA_active'] )
781
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
782
+					'STA_name' 	=> sanitize_text_field($state['STA_name']),
783
+					'STA_active' 	=> (bool) absint($state['STA_active'])
785 784
 				);
786 785
 				// where values
787
-				$where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));
786
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
788 787
 				// run the update
789
-				$success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );
790
-				if ( $success !== FALSE ) {
791
-					do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );
788
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
789
+				if ($success !== FALSE) {
790
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values);
792 791
 				}
793 792
 			}
794 793
 		}
795 794
 		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
796
-		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) {
797
-			EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );
795
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
796
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
798 797
 			EE_Registry::instance()->CFG->update_espresso_config();
799 798
 		}
800
-		$this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));
799
+		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO));
801 800
 	}
802 801
 
803 802
 
@@ -811,11 +810,11 @@  discard block
 block discarded – undo
811 810
 	 * 		@param 		string 		$label
812 811
 	 * 		@return 		string
813 812
 	 */
814
-	public function country_form_field_label_wrap( $label, $required_text ) {
813
+	public function country_form_field_label_wrap($label, $required_text) {
815 814
 		return '
816 815
 			<tr>
817 816
 				<th>
818
-					' . $label  . '
817
+					' . $label.'
819 818
 				</th>';
820 819
 	}
821 820
 
@@ -829,10 +828,10 @@  discard block
 block discarded – undo
829 828
 	 * 		@param 		string 		$label
830 829
 	 * 		@return 		string
831 830
 	 */
832
-	public function country_form_field_input__wrap( $input, $label ) {
831
+	public function country_form_field_input__wrap($input, $label) {
833 832
 		return '
834 833
 				<td class="general-settings-country-input-td">
835
-					' . $input . '
834
+					' . $input.'
836 835
 				</td>
837 836
 			</tr>';
838 837
 	}
@@ -848,7 +847,7 @@  discard block
 block discarded – undo
848 847
 	 * 		@param 		string 		$required_text
849 848
 	 * 		@return 		string
850 849
 	 */
851
-	public function state_form_field_label_wrap( $label, $required_text  ) {
850
+	public function state_form_field_label_wrap($label, $required_text) {
852 851
 		return $required_text;
853 852
 	}
854 853
 
@@ -862,10 +861,10 @@  discard block
 block discarded – undo
862 861
 	 * 		@param 		string 		$label
863 862
 	 * 		@return 		string
864 863
 	 */
865
-	public function state_form_field_input__wrap( $input, $label ) {
864
+	public function state_form_field_input__wrap($input, $label) {
866 865
 		return '
867 866
 				<td class="general-settings-country-state-input-td">
868
-					' . $input . '
867
+					' . $input.'
869 868
 				</td>';
870 869
 
871 870
 	}
@@ -888,10 +887,10 @@  discard block
 block discarded – undo
888 887
 	 * @param int $ee_page_id
889 888
 	 * @return string
890 889
 	 */
891
-	public static function edit_view_links( $ee_page_id ) {
892
-		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>';
890
+	public static function edit_view_links($ee_page_id) {
891
+		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
893 892
 		$links .= ' &nbsp;|&nbsp; ';
894
-		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>';
893
+		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
895 894
 		return $links;
896 895
 	}
897 896
 
@@ -904,27 +903,27 @@  discard block
 block discarded – undo
904 903
 	 * @param WP page object $ee_page
905 904
 	 * @return string
906 905
 	 */
907
-	public static function page_and_shortcode_status( $ee_page, $shortcode ) {
906
+	public static function page_and_shortcode_status($ee_page, $shortcode) {
908 907
 
909 908
 		// page status
910
-		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') {
909
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
911 910
 			$pg_colour = 'green';
912
-			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), '&nbsp;' , '&nbsp;' );
911
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
913 912
 		 } else {
914 913
 			$pg_colour = 'red';
915
-			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;'  );
914
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
916 915
 		}
917 916
 
918 917
 		// shortcode status
919
-		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) {
918
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) {
920 919
 			$sc_colour = 'green';
921
-			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), '&nbsp;' );
920
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
922 921
 		 } else {
923 922
 			$sc_colour = 'red';
924
-			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), '&nbsp;' );
923
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
925 924
 		}
926 925
 
927
-		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
926
+		return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
928 927
 
929 928
 	}
930 929
 
@@ -939,20 +938,20 @@  discard block
 block discarded – undo
939 938
 	 * @param unknown_type $level
940 939
 	 * @return unknown
941 940
 	 */
942
-	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
941
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) {
943 942
 		global $wpdb;
944
-		$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) );
943
+		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent));
945 944
 
946
-		if ( $items ) {
947
-			foreach ( $items as $item ) {
948
-				$pad = str_repeat( '&nbsp;', $level * 3 );
949
-				if ( $item->ID == $default)
945
+		if ($items) {
946
+			foreach ($items as $item) {
947
+				$pad = str_repeat('&nbsp;', $level * 3);
948
+				if ($item->ID == $default)
950 949
 					$current = ' selected="selected"';
951 950
 				else
952 951
 					$current = '';
953 952
 
954
-				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
955
-				parent_dropdown( $default, $item->ID, $level +1 );
953
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
954
+				parent_dropdown($default, $item->ID, $level + 1);
956 955
 			}
957 956
 		} else {
958 957
 			return false;
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page.core.php 1 patch
Spacing   +402 added lines, -402 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
@@ -237,21 +237,21 @@  discard block
 block discarded – undo
237 237
 		// IF a registration was JUST added via the admin...
238 238
 		if (
239 239
 		isset(
240
-			$this->_req_data[ 'redirect_from' ],
241
-			$this->_req_data[ 'EVT_ID' ],
242
-			$this->_req_data[ 'event_name' ]
240
+			$this->_req_data['redirect_from'],
241
+			$this->_req_data['EVT_ID'],
242
+			$this->_req_data['event_name']
243 243
 		)
244 244
 		) {
245 245
 			// then set a cookie so that we can block any attempts to use
246 246
 			// the back button as a way to enter another registration.
247
-			setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' );
247
+			setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/');
248 248
 			// and update the global
249
-			$_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ];
249
+			$_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID'];
250 250
 		}
251
-		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' );
252
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
253
-		EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status;
254
-		EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status;
251
+		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');
252
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
253
+		EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status;
254
+		EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status;
255 255
 	}
256 256
 	public function admin_notices() {}
257 257
 	public function admin_footer_scripts() {}
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	public function load_scripts_styles() {
320 320
 		//enqueue style
321
-		wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION );
321
+		wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION);
322 322
 		wp_enqueue_style('espresso_txn');
323 323
 
324 324
 		//scripts
325 325
 		add_filter('FHEE_load_accounting_js', '__return_true');
326 326
 
327 327
 		//scripts
328
-		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);
328
+		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);
329 329
 		wp_enqueue_script('espresso_txn');
330 330
 
331 331
 	}
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 *	@return void
366 366
 	 */
367 367
 	protected function _set_list_table_views_default() {
368
-		$this->_views = array (
369
-			'all' => array (
368
+		$this->_views = array(
369
+			'all' => array(
370 370
 				'slug' 		=> 'all',
371 371
 				'label' 		=> __('View All Transactions', 'event_espresso'),
372 372
 				'count' 	=> 0
@@ -394,20 +394,20 @@  discard block
 block discarded – undo
394 394
 	 *	@return void
395 395
 	 */
396 396
 	private function _set_transaction_object() {
397
-		if ( is_object( $this->_transaction) )
397
+		if (is_object($this->_transaction))
398 398
 			return; //get out we've already set the object
399 399
 
400 400
 	    $TXN = EEM_Transaction::instance();
401 401
 
402
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
402
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
403 403
 
404 404
 	    //get transaction object
405 405
 	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
406
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
406
+	    $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL;
407 407
 
408
-	 	if ( empty( $this->_transaction ) ) {
409
-	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
410
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
408
+	 	if (empty($this->_transaction)) {
409
+	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso');
410
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
411 411
 	    }
412 412
 	}
413 413
 
@@ -420,12 +420,12 @@  discard block
 block discarded – undo
420 420
 	 *	@return array
421 421
 	 */
422 422
 	protected function _transaction_legend_items() {
423
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
423
+		EE_Registry::instance()->load_helper('MSG_Template');
424 424
 		$items = array();
425 425
 
426
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
427
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
428
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
426
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
427
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
428
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
429 429
 				$items['view_related_messages'] = array(
430 430
 					'class' => $related_for_icon['css_class'],
431 431
 					'desc' => $related_for_icon['label'],
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 
436 436
 		$items = apply_filters(
437 437
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__items',
438
-			array_merge( $items,
438
+			array_merge($items,
439 439
 				array(
440 440
 					'view_details' => array(
441 441
 						'class' => 'dashicons dashicons-cart',
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 					),
448 448
 					'view_receipt' => array(
449 449
 						'class' => 'dashicons dashicons-media-default',
450
-						'desc' => __('View Transaction Receipt', 'event_espresso' )
450
+						'desc' => __('View Transaction Receipt', 'event_espresso')
451 451
 					),
452 452
 					'view_registration' => array(
453 453
 						'class' => 'dashicons dashicons-clipboard',
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
 			)
458 458
 		);
459 459
 
460
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
461
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
460
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
461
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
462 462
 				$items['send_payment_reminder'] = array(
463 463
 					'class' => 'dashicons dashicons-email-alt',
464 464
 					'desc' => __('Send Payment Reminder', 'event_espresso')
@@ -479,29 +479,29 @@  discard block
 block discarded – undo
479 479
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
480 480
 			array(
481 481
 				'overpaid'   => array(
482
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
483
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
482
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
483
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
484 484
 				),
485 485
 				'complete'   => array(
486
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
487
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
486
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
487
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
488 488
 				),
489 489
 				'incomplete' => array(
490
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
491
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
490
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
491
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
492 492
 				),
493 493
 				'abandoned'  => array(
494
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
495
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
494
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
495
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
496 496
 				),
497 497
 				'failed'     => array(
498
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
499
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
498
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
499
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
500 500
 				)
501 501
 			)
502 502
 		);
503 503
 
504
-		return array_merge( $items, $more_items);
504
+		return array_merge($items, $more_items);
505 505
 	}
506 506
 
507 507
 
@@ -514,9 +514,9 @@  discard block
 block discarded – undo
514 514
 	 */
515 515
 	protected function _transactions_overview_list_table() {
516 516
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
517
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
518
-		$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>' ) : '';
519
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
517
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
518
+		$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>') : '';
519
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
520 520
 		$this->display_admin_list_table_page_with_no_sidebar();
521 521
 	}
522 522
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	*	@return void
531 531
 	*/
532 532
 	protected function _transaction_details() {
533
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
533
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
534 534
 
535 535
 		$this->_set_transaction_status_array();
536 536
 
@@ -543,14 +543,14 @@  discard block
 block discarded – undo
543 543
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
544 544
 
545 545
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
546
-		$this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' );
546
+		$this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso');
547 547
 
548 548
 		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp');
549
-		$this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' );
549
+		$this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso');
550 550
 
551
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
552
-		$this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' );
553
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
551
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
552
+		$this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso');
553
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
554 554
 
555 555
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
556 556
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 			)
564 564
 		) {
565 565
 			$this->_template_args['send_payment_reminder_button'] =
566
-				EEH_MSG_Template::is_mt_active( 'payment_reminder' )
566
+				EEH_MSG_Template::is_mt_active('payment_reminder')
567 567
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
568 568
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
569 569
 					? EEH_Template::get_button_or_link(
@@ -585,40 +585,40 @@  discard block
 block discarded – undo
585 585
 		}
586 586
 
587 587
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
588
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
589
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
590
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
588
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
589
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
590
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
591 591
 		} else {
592
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
592
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
593 593
 		}
594
-		$this->_template_args['amount_due_class'] =  '';
594
+		$this->_template_args['amount_due_class'] = '';
595 595
 
596
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
596
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
597 597
 			// paid in full
598
-			$this->_template_args['amount_due'] =  FALSE;
599
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
598
+			$this->_template_args['amount_due'] = FALSE;
599
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
600 600
 			// overpaid
601
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
602
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
601
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
602
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
603 603
 			// monies owing
604
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
605
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
604
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
605
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
606 606
 			// no payments made yet
607
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
608
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
607
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
608
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
609 609
 			// free event
610
-			$this->_template_args['amount_due'] =  FALSE;
610
+			$this->_template_args['amount_due'] = FALSE;
611 611
 		}
612 612
 
613 613
 		$payment_method = $this->_transaction->payment_method();
614 614
 
615 615
 		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method
616 616
 			? $payment_method->admin_name()
617
-			: __( 'Unknown', 'event_espresso' );
617
+			: __('Unknown', 'event_espresso');
618 618
 
619 619
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
620 620
 		// link back to overview
621
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] )
621
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER'])
622 622
 			? $_SERVER['HTTP_REFERER']
623 623
 			: TXN_ADMIN_URL;
624 624
 
@@ -626,13 +626,13 @@  discard block
 block discarded – undo
626 626
 		// next link
627 627
 		$next_txn = $this->_transaction->next(
628 628
 			null,
629
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
629
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
630 630
 			'TXN_ID'
631 631
 		);
632 632
 		$this->_template_args['next_transaction'] = $next_txn
633 633
 			? $this->_next_link(
634 634
 				EE_Admin_Page::add_query_args_and_nonce(
635
-					array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ),
635
+					array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']),
636 636
 					TXN_ADMIN_URL
637 637
 				),
638 638
 				'dashicons dashicons-arrow-right ee-icon-size-22'
@@ -641,13 +641,13 @@  discard block
 block discarded – undo
641 641
 		// previous link
642 642
 		$previous_txn = $this->_transaction->previous(
643 643
 			null,
644
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
644
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
645 645
 			'TXN_ID'
646 646
 		);
647 647
 		$this->_template_args['previous_transaction'] = $previous_txn
648 648
 			? $this->_previous_link(
649 649
 				EE_Admin_Page::add_query_args_and_nonce(
650
-					array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ),
650
+					array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']),
651 651
 					TXN_ADMIN_URL
652 652
 				),
653 653
 				'dashicons dashicons-arrow-left ee-icon-size-22'
@@ -657,16 +657,16 @@  discard block
 block discarded – undo
657 657
 		// were we just redirected here after adding a new registration ???
658 658
 		if (
659 659
 			isset(
660
-				$this->_req_data[ 'redirect_from' ],
661
-				$this->_req_data[ 'EVT_ID' ],
662
-				$this->_req_data[ 'event_name' ]
660
+				$this->_req_data['redirect_from'],
661
+				$this->_req_data['EVT_ID'],
662
+				$this->_req_data['event_name']
663 663
 			)
664 664
 		) {
665 665
 			if (
666 666
 				EE_Registry::instance()->CAP->current_user_can(
667 667
 					'ee_edit_registrations',
668 668
 					'espresso_registrations_new_registration',
669
-					$this->_req_data[ 'EVT_ID' ]
669
+					$this->_req_data['EVT_ID']
670 670
 				)
671 671
 			) {
672 672
 				$this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="';
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 						'action'   => 'new_registration',
677 677
 						'return'   => 'default',
678 678
 						'TXN_ID'   => $this->_transaction->ID(),
679
-						'event_id' => $this->_req_data[ 'EVT_ID' ],
679
+						'event_id' => $this->_req_data['EVT_ID'],
680 680
 					),
681 681
 					REG_ADMIN_URL
682 682
 				);
@@ -684,17 +684,17 @@  discard block
 block discarded – undo
684 684
 
685 685
 				$this->_admin_page_title .= sprintf(
686 686
 					__('Add Another New Registration to Event: "%1$s" ?'),
687
-					htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' )
687
+					htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8')
688 688
 				);
689 689
 				$this->_admin_page_title .= '</a>';
690 690
 			}
691
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
691
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
692 692
 		}
693 693
 		// grab messages at the last second
694 694
 		$this->_template_args['notices'] = EE_Error::get_notices();
695 695
 		// path to template
696
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
697
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
696
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
697
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
698 698
 
699 699
 		// the details template wrapper
700 700
 		$this->display_admin_page_with_sidebar();
@@ -713,18 +713,18 @@  discard block
 block discarded – undo
713 713
 
714 714
 		$this->_set_transaction_object();
715 715
 
716
-		add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
716
+		add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
717 717
 		add_meta_box(
718 718
 			'edit-txn-attendees-mbox',
719
-			__( 'Attendees Registered in this Transaction', 'event_espresso' ),
720
-			array( $this, 'txn_attendees_meta_box' ),
719
+			__('Attendees Registered in this Transaction', 'event_espresso'),
720
+			array($this, 'txn_attendees_meta_box'),
721 721
 			$this->_wp_page_slug,
722 722
 			'normal',
723 723
 			'high',
724
-			array( 'TXN_ID' => $this->_transaction->ID() )
724
+			array('TXN_ID' => $this->_transaction->ID())
725 725
 		);
726
-		add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
727
-		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' );
726
+		add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
727
+		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');
728 728
 
729 729
 	}
730 730
 
@@ -745,15 +745,15 @@  discard block
 block discarded – undo
745 745
 
746 746
 		//get line table
747 747
 		EEH_Autoloader::register_line_item_display_autoloaders();
748
-		$Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' );
749
-		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() );
748
+		$Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy');
749
+		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item());
750 750
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
751 751
 
752 752
 		// process taxes
753
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
754
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
753
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
754
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
755 755
 
756
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
756
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
757 757
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
758 758
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
759 759
 
@@ -761,63 +761,63 @@  discard block
 block discarded – undo
761 761
 
762 762
 		// process payment details
763 763
 		$payments = $this->_transaction->get_many_related('Payment');
764
-		if( ! empty(  $payments ) ) {
765
-			$this->_template_args[ 'payments' ] = $payments;
766
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
764
+		if ( ! empty($payments)) {
765
+			$this->_template_args['payments'] = $payments;
766
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
767 767
 		} else {
768
-			$this->_template_args[ 'payments' ] = false;
769
-			$this->_template_args[ 'existing_reg_payments' ] = array();
768
+			$this->_template_args['payments'] = false;
769
+			$this->_template_args['existing_reg_payments'] = array();
770 770
 		}
771 771
 
772
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
773
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
772
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
773
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
774 774
 
775
-		if ( isset( $txn_details['invoice_number'] )) {
775
+		if (isset($txn_details['invoice_number'])) {
776 776
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
777
-			$this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' );
777
+			$this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso');
778 778
 		}
779 779
 
780 780
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
781
-		$this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
781
+		$this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
782 782
 
783
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
784
-		$this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' );
783
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
784
+		$this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso');
785 785
 
786
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
787
-		$this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
786
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
787
+		$this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
788 788
 
789 789
 		$reg_steps = '<ul>';
790
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
791
-			if ( $reg_step_status === true ) {
792
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
793
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
794
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
795
-							__( '%1$s : Initiated %2$s', 'event_espresso' ),
796
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
797
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
798
-						) . '</li>';
790
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
791
+			if ($reg_step_status === true) {
792
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
793
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
794
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
795
+							__('%1$s : Initiated %2$s', 'event_espresso'),
796
+							ucwords(str_replace('_', ' ', $reg_step)),
797
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
798
+						).'</li>';
799 799
 				} else {
800
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
800
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
801 801
 			}
802 802
 		}
803 803
 		$reg_steps .= '</ul>';
804 804
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
805
-		$this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' );
805
+		$this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso');
806 806
 
807 807
 
808 808
 		$this->_get_registrations_to_apply_payment_to();
809
-		$this->_get_payment_methods( $payments );
809
+		$this->_get_payment_methods($payments);
810 810
 		$this->_get_payment_status_array();
811 811
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
812 812
 
813
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
814
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
815
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
813
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
814
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
815
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
816 816
 
817 817
 		// 'espresso_delete_payment_nonce'
818 818
 
819
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
820
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
819
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
820
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
821 821
 
822 822
 	}
823 823
 
@@ -832,27 +832,27 @@  discard block
 block discarded – undo
832 832
 	 * @param EE_Payment[] $payments
833 833
 	 * @return array
834 834
 	 */
835
-	protected function _get_registration_payment_IDs( $payments = array() ) {
835
+	protected function _get_registration_payment_IDs($payments = array()) {
836 836
 		$existing_reg_payments = array();
837 837
 		// get all reg payments for these payments
838
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
838
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
839 839
 			array(
840 840
 				'PAY_ID' => array(
841 841
 					'IN',
842
-					array_keys( $payments )
842
+					array_keys($payments)
843 843
 				)
844 844
 			)
845
-		) );
846
-		if ( ! empty( $reg_payments ) ) {
847
-			foreach ( $payments as $payment ) {
848
-				if ( ! $payment instanceof EE_Payment ) {
845
+		));
846
+		if ( ! empty($reg_payments)) {
847
+			foreach ($payments as $payment) {
848
+				if ( ! $payment instanceof EE_Payment) {
849 849
 					continue;
850
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
851
-					$existing_reg_payments[ $payment->ID() ] = array();
850
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
851
+					$existing_reg_payments[$payment->ID()] = array();
852 852
 				}
853
-				foreach ( $reg_payments as $reg_payment ) {
854
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
855
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
853
+				foreach ($reg_payments as $reg_payment) {
854
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
855
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
856 856
 					}
857 857
 				}
858 858
 			}
@@ -889,39 +889,39 @@  discard block
 block discarded – undo
889 889
 		$registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">';
890 890
 		$registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">';
891 891
 		$registrations_to_apply_payment_to .= '<thead><tr>';
892
-		$registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>';
893
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>';
894
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>';
895
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>';
896
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>';
897
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>';
898
-		$registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>';
892
+		$registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>';
893
+		$registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>';
894
+		$registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>';
895
+		$registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>';
896
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>';
897
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>';
898
+		$registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>';
899 899
 		$registrations_to_apply_payment_to .= '</tr></thead><tbody>';
900 900
 		// get registrations for TXN
901
-		$registrations = $this->_transaction->registrations( $query_params );
902
-		foreach ( $registrations as $registration ) {
903
-			if ( $registration instanceof EE_Registration ) {
901
+		$registrations = $this->_transaction->registrations($query_params);
902
+		foreach ($registrations as $registration) {
903
+			if ($registration instanceof EE_Registration) {
904 904
 				$owing = $registration->final_price() - $registration->paid();
905
-				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : '';
906
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : '';
907
-				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">';
905
+				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : '';
906
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : '';
907
+				$registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">';
908 908
 				// add html for checkbox input and label
909
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>';
910
-				$registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>';
911
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>';
912
-				$registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>';
913
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>';
914
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>';
909
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>';
910
+				$registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>';
911
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>';
912
+				$registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>';
913
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>';
914
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>';
915 915
 				$registrations_to_apply_payment_to .= '<td class="jst-cntr">';
916 916
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
917
-				$registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>';
917
+				$registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>';
918 918
 				$registrations_to_apply_payment_to .= '</td>';
919 919
 				$registrations_to_apply_payment_to .= '</tr>';
920 920
 			}
921 921
 		}
922 922
 		$registrations_to_apply_payment_to .= '</tbody></table></div>';
923
-		$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>';
924
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
923
+		$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>';
924
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
925 925
 	}
926 926
 
927 927
 
@@ -938,9 +938,9 @@  discard block
 block discarded – undo
938 938
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
939 939
 		//let's add a "don't change" option.
940 940
 		$status_array['NAN'] = __('Leave the Same', 'event_espresso');
941
-		$status_array = array_merge( $status_array, $statuses );
942
-		$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' );
943
-		$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' );
941
+		$status_array = array_merge($status_array, $statuses);
942
+		$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');
943
+		$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');
944 944
 
945 945
 	}
946 946
 
@@ -955,21 +955,21 @@  discard block
 block discarded – undo
955 955
 	 * @param EE_Payment[] to show on this page
956 956
 	 *	@return void
957 957
 	 */
958
-	private function _get_payment_methods( $payments = array() ) {
958
+	private function _get_payment_methods($payments = array()) {
959 959
 		$payment_methods_of_payments = array();
960
-		foreach( $payments as $payment ){
961
-			if( $payment instanceof EE_Payment ){
962
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
960
+		foreach ($payments as $payment) {
961
+			if ($payment instanceof EE_Payment) {
962
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
963 963
 			}
964 964
 		}
965
-		if( $payment_methods_of_payments ){
966
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
967
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
968
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
969
-		}else{
970
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
965
+		if ($payment_methods_of_payments) {
966
+			$query_args = array(array('OR*payment_method_for_payment' => array(
967
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
968
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
969
+		} else {
970
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
971 971
 		}
972
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
972
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
973 973
 	}
974 974
 
975 975
 
@@ -983,46 +983,46 @@  discard block
 block discarded – undo
983 983
 	 * @param array $metabox
984 984
 	 * @return void
985 985
 	 */
986
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
986
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
987 987
 
988
-		extract( $metabox['args'] );
988
+		extract($metabox['args']);
989 989
 		$this->_template_args['post'] = $post;
990 990
 		$this->_template_args['event_attendees'] = array();
991 991
 		// process items in cart
992
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
993
-		if ( ! empty( $line_items )) {
994
-			foreach ( $line_items as $item ) {
995
-				if ( $item instanceof EE_Line_Item ) {
996
-					switch( $item->OBJ_type() ) {
992
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
993
+		if ( ! empty($line_items)) {
994
+			foreach ($line_items as $item) {
995
+				if ($item instanceof EE_Line_Item) {
996
+					switch ($item->OBJ_type()) {
997 997
 
998 998
 						case 'Event' :
999 999
 							break;
1000 1000
 
1001 1001
 						case 'Ticket' :
1002 1002
 							$ticket = $item->ticket();
1003
-							if ( empty( $ticket )) {
1003
+							if (empty($ticket)) {
1004 1004
 								continue; //right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
1005 1005
 							}
1006
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ));
1006
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
1007 1007
 							$event = $ticket->get_first_related('Registration')->get_first_related('Event');
1008
-							$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
1008
+							$event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : '';
1009 1009
 
1010
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
1011
-							foreach( $registrations as $registration ) {
1012
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 						= $registration->get('REG_count');
1013
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
1014
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 				= $ticket_price;
1010
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
1011
+							foreach ($registrations as $registration) {
1012
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
1013
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
1014
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
1015 1015
 								// attendee info
1016 1016
 								$attendee = $registration->get_first_related('Attendee');
1017
-								if ( $attendee instanceof EE_Attendee ) {
1017
+								if ($attendee instanceof EE_Attendee) {
1018 1018
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= $attendee->ID();
1019 1019
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
1020
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
1021
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		=  implode(',<br>', $attendee->full_address_as_array() );
1020
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
1021
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= implode(',<br>', $attendee->full_address_as_array());
1022 1022
 								} else {
1023 1023
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= '';
1024 1024
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
1025
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '';
1025
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
1026 1026
 									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= '';
1027 1027
 								}
1028 1028
 							}
@@ -1032,12 +1032,12 @@  discard block
 block discarded – undo
1032 1032
 				}
1033 1033
 			}
1034 1034
 
1035
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
1036
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
1035
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
1036
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
1037 1037
 
1038 1038
 		} else {
1039 1039
 			echo sprintf(
1040
-				__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
1040
+				__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
1041 1041
 				'<p class="important-notice">',
1042 1042
 				'</p>'
1043 1043
 			);
@@ -1056,19 +1056,19 @@  discard block
 block discarded – undo
1056 1056
 	 */
1057 1057
 	public function txn_registrant_side_meta_box() {
1058 1058
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
1059
-		if ( ! $primary_att instanceof EE_Attendee ) {
1059
+		if ( ! $primary_att instanceof EE_Attendee) {
1060 1060
 			$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');
1061 1061
 			$primary_att = EEM_Attendee::instance()->create_default_object();
1062 1062
 		}
1063
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
1063
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
1064 1064
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
1065 1065
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
1066
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
1066
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
1067 1067
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
1068
-		$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 );
1068
+		$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);
1069 1069
 		// get formatted address for registrant
1070
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
1071
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
1070
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
1071
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
1072 1072
 	}
1073 1073
 
1074 1074
 
@@ -1084,12 +1084,12 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
1086 1086
 		$this->_template_args['billing_form_url'] = add_query_arg(
1087
-			array( 'action' => 'edit_transaction', 'process' => 'billing'  ),
1087
+			array('action' => 'edit_transaction', 'process' => 'billing'),
1088 1088
 			TXN_ADMIN_URL
1089 1089
 		);
1090 1090
 
1091
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
1092
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
1091
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
1092
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
1093 1093
 	}
1094 1094
 
1095 1095
 
@@ -1102,42 +1102,42 @@  discard block
 block discarded – undo
1102 1102
 	*	@return void
1103 1103
 	*/
1104 1104
 	public function apply_payments_or_refunds() {
1105
-		$json_response_data = array( 'return_data' => FALSE );
1105
+		$json_response_data = array('return_data' => FALSE);
1106 1106
 		$valid_data = $this->_validate_payment_request_data();
1107
-		if ( ! empty( $valid_data ) ) {
1108
-			$PAY_ID = $valid_data[ 'PAY_ID' ];
1107
+		if ( ! empty($valid_data)) {
1108
+			$PAY_ID = $valid_data['PAY_ID'];
1109 1109
 			//save  the new payment
1110
-			$payment = $this->_create_payment_from_request_data( $valid_data );
1110
+			$payment = $this->_create_payment_from_request_data($valid_data);
1111 1111
 			// get the TXN for this payment
1112 1112
 			$transaction = $payment->transaction();
1113 1113
 			// verify transaction
1114
-			if ( $transaction instanceof EE_Transaction ) {
1114
+			if ($transaction instanceof EE_Transaction) {
1115 1115
 				// calculate_total_payments_and_update_status
1116
-				$this->_process_transaction_payments( $transaction );
1117
-				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment );
1118
-				$this->_remove_existing_registration_payments( $payment, $PAY_ID );
1116
+				$this->_process_transaction_payments($transaction);
1117
+				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment);
1118
+				$this->_remove_existing_registration_payments($payment, $PAY_ID);
1119 1119
 				// apply payment to registrations (if applicable)
1120
-				if ( ! empty( $REG_IDs ) ) {
1121
-					$this->_update_registration_payments( $transaction, $payment, $REG_IDs );
1120
+				if ( ! empty($REG_IDs)) {
1121
+					$this->_update_registration_payments($transaction, $payment, $REG_IDs);
1122 1122
 					$this->_maybe_send_notifications();
1123 1123
 					// now process status changes for the same registrations
1124
-					$this->_process_registration_status_change( $transaction, $REG_IDs );
1124
+					$this->_process_registration_status_change($transaction, $REG_IDs);
1125 1125
 				}
1126
-				$this->_maybe_send_notifications( $payment );
1126
+				$this->_maybe_send_notifications($payment);
1127 1127
 				//prepare to render page
1128
-				$json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs );
1129
-				do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment );
1128
+				$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs);
1129
+				do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment);
1130 1130
 			} else {
1131 1131
 				EE_Error::add_error(
1132
-					__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ),
1132
+					__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'),
1133 1133
 					__FILE__, __FUNCTION__, __LINE__
1134 1134
 				);
1135 1135
 			}
1136 1136
 		} else {
1137
-			EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1137
+			EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1138 1138
 		}
1139 1139
 
1140
-		$notices = EE_Error::get_notices( false, false, false );
1140
+		$notices = EE_Error::get_notices(false, false, false);
1141 1141
 		$this->_template_args = array(
1142 1142
 			'data' => $json_response_data,
1143 1143
 			'error' => $notices['errors'],
@@ -1154,30 +1154,30 @@  discard block
 block discarded – undo
1154 1154
 	 * @return array
1155 1155
 	 */
1156 1156
 	protected function _validate_payment_request_data() {
1157
-		if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) {
1157
+		if ( ! isset($this->_req_data['txn_admin_payment'])) {
1158 1158
 			return false;
1159 1159
 		}
1160 1160
 		$payment_form = $this->_generate_payment_form_section();
1161 1161
 		try {
1162
-			if ( $payment_form->was_submitted() ) {
1162
+			if ($payment_form->was_submitted()) {
1163 1163
 				$payment_form->receive_form_submission();
1164
-				if ( ! $payment_form->is_valid() ) {
1164
+				if ( ! $payment_form->is_valid()) {
1165 1165
 					$submission_error_messages = array();
1166
-					foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) {
1167
-						if ( $validation_error instanceof EE_Validation_Error ) {
1166
+					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) {
1167
+						if ($validation_error instanceof EE_Validation_Error) {
1168 1168
 							$submission_error_messages[] = sprintf(
1169
-								_x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ),
1169
+								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'),
1170 1170
 								$validation_error->get_form_section()->html_label_text(),
1171 1171
 								$validation_error->getMessage()
1172 1172
 							);
1173 1173
 						}
1174 1174
 					}
1175
-					EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1175
+					EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1176 1176
 					return array();
1177 1177
 				}
1178 1178
 			}
1179
-		} catch ( EE_Error $e ) {
1180
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1179
+		} catch (EE_Error $e) {
1180
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1181 1181
 			return array();
1182 1182
 		}
1183 1183
 		return $payment_form->valid_data();
@@ -1199,63 +1199,63 @@  discard block
 block discarded – undo
1199 1199
 						array(
1200 1200
 							'default' => 0,
1201 1201
 							'required' => false,
1202
-							'html_label_text' => __( 'Payment ID', 'event_espresso' ),
1203
-							'validation_strategies' => array( new EE_Int_Normalization() )
1202
+							'html_label_text' => __('Payment ID', 'event_espresso'),
1203
+							'validation_strategies' => array(new EE_Int_Normalization())
1204 1204
 						)
1205 1205
 					),
1206 1206
 					'TXN_ID' => new EE_Text_Input(
1207 1207
 						array(
1208 1208
 							'default' => 0,
1209 1209
 							'required' => true,
1210
-							'html_label_text' => __( 'Transaction ID', 'event_espresso' ),
1211
-							'validation_strategies' => array( new EE_Int_Normalization() )
1210
+							'html_label_text' => __('Transaction ID', 'event_espresso'),
1211
+							'validation_strategies' => array(new EE_Int_Normalization())
1212 1212
 						)
1213 1213
 					),
1214 1214
 					'type' => new EE_Text_Input(
1215 1215
 						array(
1216 1216
 							'default' => 1,
1217 1217
 							'required' => true,
1218
-							'html_label_text' => __( 'Payment or Refund', 'event_espresso' ),
1219
-							'validation_strategies' => array( new EE_Int_Normalization() )
1218
+							'html_label_text' => __('Payment or Refund', 'event_espresso'),
1219
+							'validation_strategies' => array(new EE_Int_Normalization())
1220 1220
 						)
1221 1221
 					),
1222 1222
 					'amount' => new EE_Text_Input(
1223 1223
 						array(
1224 1224
 							'default' => 0,
1225 1225
 							'required' => true,
1226
-							'html_label_text' => __( 'Payment amount', 'event_espresso' ),
1227
-							'validation_strategies' => array( new EE_Float_Normalization() )
1226
+							'html_label_text' => __('Payment amount', 'event_espresso'),
1227
+							'validation_strategies' => array(new EE_Float_Normalization())
1228 1228
 						)
1229 1229
 					),
1230 1230
 					'status' => new EE_Text_Input(
1231 1231
 						array(
1232 1232
 							'default' => EEM_Payment::status_id_approved,
1233 1233
 							'required' => true,
1234
-							'html_label_text' => __( 'Payment status', 'event_espresso' ),
1234
+							'html_label_text' => __('Payment status', 'event_espresso'),
1235 1235
 						)
1236 1236
 					),
1237 1237
 					'PMD_ID' => new EE_Text_Input(
1238 1238
 						array(
1239 1239
 							'default' => 2,
1240 1240
 							'required' => true,
1241
-							'html_label_text' => __( 'Payment Method', 'event_espresso' ),
1242
-							'validation_strategies' => array( new EE_Int_Normalization() )
1241
+							'html_label_text' => __('Payment Method', 'event_espresso'),
1242
+							'validation_strategies' => array(new EE_Int_Normalization())
1243 1243
 						)
1244 1244
 					),
1245 1245
 					'date' => new EE_Text_Input(
1246 1246
 						array(
1247 1247
 							'default' => time(),
1248 1248
 							'required' => true,
1249
-							'html_label_text' => __( 'Payment date', 'event_espresso' ),
1249
+							'html_label_text' => __('Payment date', 'event_espresso'),
1250 1250
 						)
1251 1251
 					),
1252 1252
 					'txn_id_chq_nmbr' => new EE_Text_Input(
1253 1253
 						array(
1254 1254
 							'default' => '',
1255 1255
 							'required' => false,
1256
-							'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ),
1256
+							'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'),
1257 1257
                                                         'validation_strategies' => array(
1258
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1258
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1259 1259
                                                         )
1260 1260
 						)
1261 1261
 					),
@@ -1263,9 +1263,9 @@  discard block
 block discarded – undo
1263 1263
 						array(
1264 1264
 							'default' => '',
1265 1265
 							'required' => false,
1266
-							'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ),
1266
+							'html_label_text' => __('Purchase Order Number', 'event_espresso'),
1267 1267
                                                         'validation_strategies' => array(
1268
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1268
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1269 1269
                                                         )
1270 1270
 						)
1271 1271
 					),
@@ -1273,9 +1273,9 @@  discard block
 block discarded – undo
1273 1273
 						array(
1274 1274
 							'default' => '',
1275 1275
 							'required' => false,
1276
-							'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ),
1276
+							'html_label_text' => __('Extra Field for Accounting', 'event_espresso'),
1277 1277
                                                         'validation_strategies' => array(
1278
-                                                            new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ),
1278
+                                                            new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100),
1279 1279
                                                         )
1280 1280
 						)
1281 1281
 					),
@@ -1292,37 +1292,37 @@  discard block
 block discarded – undo
1292 1292
 	 * @param array $valid_data
1293 1293
 	 * @return EE_Payment
1294 1294
 	 */
1295
-	protected function _create_payment_from_request_data( $valid_data ) {
1296
-		$PAY_ID = $valid_data[ 'PAY_ID' ];
1295
+	protected function _create_payment_from_request_data($valid_data) {
1296
+		$PAY_ID = $valid_data['PAY_ID'];
1297 1297
 		// get payment amount
1298
-		$amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0;
1298
+		$amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0;
1299 1299
 		// payments have a type value of 1 and refunds have a type value of -1
1300 1300
 		// so multiplying amount by type will give a positive value for payments, and negative values for refunds
1301
-		$amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount;
1301
+		$amount = $valid_data['type'] < 0 ? $amount * -1 : $amount;
1302 1302
 		// for some reason the date string coming in has extra spaces between the date and time.  This fixes that.
1303
-		$date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) );
1303
+		$date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp'));
1304 1304
 		$payment = EE_Payment::new_instance(
1305 1305
 			array(
1306
-				'TXN_ID' 								=> $valid_data[ 'TXN_ID' ],
1307
-				'STS_ID' 								=> $valid_data[ 'status' ],
1306
+				'TXN_ID' 								=> $valid_data['TXN_ID'],
1307
+				'STS_ID' 								=> $valid_data['status'],
1308 1308
 				'PAY_timestamp' 				=> $date,
1309 1309
 				'PAY_source'           			=> EEM_Payment_Method::scope_admin,
1310
-				'PMD_ID'               				=> $valid_data[ 'PMD_ID' ],
1310
+				'PMD_ID'               				=> $valid_data['PMD_ID'],
1311 1311
 				'PAY_amount'           			=> $amount,
1312
-				'PAY_txn_id_chq_nmbr'  	=> $valid_data[ 'txn_id_chq_nmbr' ],
1313
-				'PAY_po_number'        		=> $valid_data[ 'po_number' ],
1314
-				'PAY_extra_accntng'    		=> $valid_data[ 'accounting' ],
1312
+				'PAY_txn_id_chq_nmbr'  	=> $valid_data['txn_id_chq_nmbr'],
1313
+				'PAY_po_number'        		=> $valid_data['po_number'],
1314
+				'PAY_extra_accntng'    		=> $valid_data['accounting'],
1315 1315
 				'PAY_details'          				=> $valid_data,
1316 1316
 				'PAY_ID'               				=> $PAY_ID
1317 1317
 			),
1318 1318
 			'',
1319
-			array( 'Y-m-d', 'g:i a' )
1319
+			array('Y-m-d', 'g:i a')
1320 1320
 		);
1321 1321
 
1322
-		if ( ! $payment->save() ) {
1322
+		if ( ! $payment->save()) {
1323 1323
 			EE_Error::add_error(
1324 1324
 				sprintf(
1325
-					__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ),
1325
+					__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'),
1326 1326
 					$payment->ID()
1327 1327
 				),
1328 1328
 				__FILE__, __FUNCTION__, __LINE__
@@ -1339,15 +1339,15 @@  discard block
 block discarded – undo
1339 1339
 	 * @param \EE_Transaction $transaction
1340 1340
 	 * @return array
1341 1341
 	 */
1342
-	protected function _process_transaction_payments( EE_Transaction $transaction ) {
1342
+	protected function _process_transaction_payments(EE_Transaction $transaction) {
1343 1343
 		/** @type EE_Transaction_Payments $transaction_payments */
1344
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1344
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1345 1345
 		//update the transaction with this payment
1346
-		if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) {
1347
-			EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1346
+		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1347
+			EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1348 1348
 		} else {
1349 1349
 			EE_Error::add_error(
1350
-				__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' )
1350
+				__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso')
1351 1351
 				, __FILE__, __FUNCTION__, __LINE__
1352 1352
 			);
1353 1353
 		}
@@ -1363,19 +1363,19 @@  discard block
 block discarded – undo
1363 1363
 	 * @param \EE_Payment $payment
1364 1364
 	 * @return array
1365 1365
 	 */
1366
-	protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) {
1366
+	protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) {
1367 1367
 		$REG_IDs = array();
1368 1368
 		// grab array of IDs for specific registrations to apply changes to
1369
-		if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1370
-			$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1369
+		if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1370
+			$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1371 1371
 		}
1372 1372
 		//nothing specified ? then get all reg IDs
1373
-		if ( empty( $REG_IDs ) ) {
1373
+		if (empty($REG_IDs)) {
1374 1374
 			$registrations = $payment->transaction()->registrations();
1375
-			$REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment );
1375
+			$REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment);
1376 1376
 		}
1377 1377
 		// ensure that REG_IDs are integers and NOT strings
1378
-		return array_map( 'intval', $REG_IDs );
1378
+		return array_map('intval', $REG_IDs);
1379 1379
 	}
1380 1380
 
1381 1381
 
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 	/**
1393 1393
 	 * @param array $existing_reg_payment_REG_IDs
1394 1394
 	 */
1395
-	public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) {
1395
+	public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) {
1396 1396
 		$this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs;
1397 1397
 	}
1398 1398
 
@@ -1407,13 +1407,13 @@  discard block
 block discarded – undo
1407 1407
 	 * @param \EE_Payment $payment
1408 1408
 	 * @return array
1409 1409
 	 */
1410
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1411
-		if ( $this->existing_reg_payment_REG_IDs() === null ) {
1410
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1411
+		if ($this->existing_reg_payment_REG_IDs() === null) {
1412 1412
 			// let's get any existing reg payment records for this payment
1413
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1413
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1414 1414
 			// but we only want the REG IDs, so grab the array keys
1415
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1416
-			$this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs );
1415
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1416
+			$this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs);
1417 1417
 		}
1418 1418
 		return $this->existing_reg_payment_REG_IDs();
1419 1419
 	}
@@ -1432,23 +1432,23 @@  discard block
 block discarded – undo
1432 1432
 	 * @param int         $PAY_ID
1433 1433
 	 * @return bool;
1434 1434
 	 */
1435
-	protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) {
1435
+	protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) {
1436 1436
 		// newly created payments will have nothing recorded for $PAY_ID
1437
-		if ( $PAY_ID == 0 ) {
1437
+		if ($PAY_ID == 0) {
1438 1438
 			return false;
1439 1439
 		}
1440
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1441
-		if ( empty( $existing_reg_payment_REG_IDs )) {
1440
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1441
+		if (empty($existing_reg_payment_REG_IDs)) {
1442 1442
 			return false;
1443 1443
 		}
1444 1444
 		/** @type EE_Transaction_Payments $transaction_payments */
1445
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1445
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1446 1446
 		return $transaction_payments->delete_registration_payments_and_update_registrations(
1447 1447
 			$payment,
1448 1448
 			array(
1449 1449
 				array(
1450 1450
 					'PAY_ID' => $payment->ID(),
1451
-					'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ),
1451
+					'REG_ID' => array('IN', $existing_reg_payment_REG_IDs),
1452 1452
 				)
1453 1453
 			)
1454 1454
 		);
@@ -1467,25 +1467,25 @@  discard block
 block discarded – undo
1467 1467
 	 * @param array $REG_IDs
1468 1468
 	 * @return bool
1469 1469
 	 */
1470
-	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1470
+	protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) {
1471 1471
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1472 1472
 		// so let's do that using our set of REG_IDs from the form
1473 1473
 		$registration_query_where_params = array(
1474
-			'REG_ID' => array( 'IN', $REG_IDs )
1474
+			'REG_ID' => array('IN', $REG_IDs)
1475 1475
 		);
1476 1476
 		// but add in some conditions regarding payment,
1477 1477
 		// so that we don't apply payments to registrations that are free or have already been paid for
1478 1478
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1479
-		if ( ! $payment->is_a_refund() ) {
1480
-			$registration_query_where_params[ 'REG_final_price' ]  = array( '!=', 0 );
1481
-			$registration_query_where_params[ 'REG_final_price*' ]  = array( '!=', 'REG_paid', true );
1479
+		if ( ! $payment->is_a_refund()) {
1480
+			$registration_query_where_params['REG_final_price'] = array('!=', 0);
1481
+			$registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true);
1482 1482
 		}
1483 1483
 		//EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ );
1484
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1485
-		if ( ! empty( $registrations ) ) {
1484
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1485
+		if ( ! empty($registrations)) {
1486 1486
 			/** @type EE_Payment_Processor $payment_processor */
1487
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1488
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1487
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1488
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1489 1489
 		}
1490 1490
 	}
1491 1491
 
@@ -1501,22 +1501,22 @@  discard block
 block discarded – undo
1501 1501
 	 * @param array $REG_IDs
1502 1502
 	 * @return bool
1503 1503
 	 */
1504
-	protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) {
1504
+	protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) {
1505 1505
 		// first if there is no change in status then we get out.
1506 1506
 		if (
1507
-			! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] )
1507
+			! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status'])
1508 1508
 			|| $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN'
1509 1509
 		) {
1510 1510
 			//no error message, no change requested, just nothing to do man.
1511 1511
 			return FALSE;
1512 1512
 		}
1513 1513
 		/** @type EE_Transaction_Processor $transaction_processor */
1514
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1514
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1515 1515
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1516 1516
 		return $transaction_processor->manually_update_registration_statuses(
1517 1517
 			$transaction,
1518
-			sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ),
1519
-			array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) )
1518
+			sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']),
1519
+			array(array('REG_ID' => array('IN', $REG_IDs)))
1520 1520
 		);
1521 1521
 	}
1522 1522
 
@@ -1531,16 +1531,16 @@  discard block
 block discarded – undo
1531 1531
 	 * @param bool | null        $delete_txn_reg_status_change
1532 1532
 	 * @return array
1533 1533
 	 */
1534
-	protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) {
1534
+	protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) {
1535 1535
 		// was the payment deleted ?
1536
-		if ( is_bool( $delete_txn_reg_status_change )) {
1536
+		if (is_bool($delete_txn_reg_status_change)) {
1537 1537
 			return array(
1538 1538
 				'PAY_ID' 				=> $payment->ID(),
1539 1539
 				'amount' 			=> $payment->amount(),
1540 1540
 				'total_paid' 			=> $payment->transaction()->paid(),
1541 1541
 				'txn_status' 			=> $payment->transaction()->status_ID(),
1542 1542
 				'pay_status' 		=> $payment->STS_ID(),
1543
-				'registrations' 	=> $this->_registration_payment_data_array( $REG_IDs ),
1543
+				'registrations' 	=> $this->_registration_payment_data_array($REG_IDs),
1544 1544
 				'delete_txn_reg_status_change' => $delete_txn_reg_status_change,
1545 1545
 			);
1546 1546
 		} else {
@@ -1552,16 +1552,16 @@  discard block
 block discarded – undo
1552 1552
 				'pay_status' 	=> $payment->STS_ID(),
1553 1553
 				'PAY_ID'           => $payment->ID(),
1554 1554
 				'STS_ID' 			=> $payment->STS_ID(),
1555
-				'status' 			=> self::$_pay_status[ $payment->STS_ID() ],
1556
-				'date' 				=> $payment->timestamp( 'Y-m-d', 'h:i a' ),
1557
-				'method' 		=> strtoupper( $payment->source() ),
1555
+				'status' 			=> self::$_pay_status[$payment->STS_ID()],
1556
+				'date' 				=> $payment->timestamp('Y-m-d', 'h:i a'),
1557
+				'method' 		=> strtoupper($payment->source()),
1558 1558
 				'PM_ID' 			=> $payment->payment_method() ? $payment->payment_method()->ID() : 1,
1559
-				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ),
1559
+				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'),
1560 1560
 				'gateway_response' 	=> $payment->gateway_response(),
1561 1561
 				'txn_id_chq_nmbr'  	=> $payment->txn_id_chq_nmbr(),
1562 1562
 				'po_number'        		=> $payment->po_number(),
1563 1563
 				'extra_accntng'    		=> $payment->extra_accntng(),
1564
-				'registrations'    			=> $this->_registration_payment_data_array( $REG_IDs ),
1564
+				'registrations'    			=> $this->_registration_payment_data_array($REG_IDs),
1565 1565
 			);
1566 1566
 		}
1567 1567
 	}
@@ -1576,39 +1576,39 @@  discard block
 block discarded – undo
1576 1576
 	*	@return void
1577 1577
 	*/
1578 1578
 	public function delete_payment() {
1579
-		$json_response_data = array( 'return_data' => FALSE );
1580
-		$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;
1581
-		if ( $PAY_ID ) {
1582
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1583
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1584
-			if ( $payment instanceof EE_Payment ) {
1585
-				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1579
+		$json_response_data = array('return_data' => FALSE);
1580
+		$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;
1581
+		if ($PAY_ID) {
1582
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1583
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1584
+			if ($payment instanceof EE_Payment) {
1585
+				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1586 1586
 				/** @type EE_Transaction_Payments $transaction_payments */
1587
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1588
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1589
-					$json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change );
1590
-					if ( $delete_txn_reg_status_change ) {
1587
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1588
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1589
+					$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change);
1590
+					if ($delete_txn_reg_status_change) {
1591 1591
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1592 1592
 						//MAKE sure we also add the delete_txn_req_status_change to the
1593 1593
 						//$_REQUEST global because that's how messages will be looking for it.
1594 1594
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1595 1595
 						$this->_maybe_send_notifications();
1596
-						$this->_process_registration_status_change( $payment->transaction(), $REG_IDs );
1596
+						$this->_process_registration_status_change($payment->transaction(), $REG_IDs);
1597 1597
 					}
1598 1598
 				}
1599 1599
 			} else {
1600 1600
 				EE_Error::add_error(
1601
-					__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ),
1601
+					__('Valid Payment data could not be retrieved from the database.', 'event_espresso'),
1602 1602
 					__FILE__, __FUNCTION__, __LINE__
1603 1603
 				);
1604 1604
 			}
1605 1605
 		} else {
1606 1606
 			EE_Error::add_error(
1607
-				__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ),
1607
+				__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'),
1608 1608
 				__FILE__, __FUNCTION__, __LINE__
1609 1609
 			);
1610 1610
 		}
1611
-		$notices = EE_Error::get_notices( false, false, false);
1611
+		$notices = EE_Error::get_notices(false, false, false);
1612 1612
 		$this->_template_args = array(
1613 1613
 			'data' => $json_response_data,
1614 1614
 			'success' => $notices['success'],
@@ -1628,16 +1628,16 @@  discard block
 block discarded – undo
1628 1628
 	 * @param array $REG_IDs
1629 1629
 	 * @return array
1630 1630
 	 */
1631
-	protected function _registration_payment_data_array( $REG_IDs ) {
1631
+	protected function _registration_payment_data_array($REG_IDs) {
1632 1632
 		$registration_payment_data = array();
1633 1633
 		//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
1634
-		if ( ! empty( $REG_IDs ) ) {
1635
-			$registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) );
1636
-			foreach ( $registrations as $registration ) {
1637
-				if ( $registration instanceof EE_Registration ) {
1638
-					$registration_payment_data[ $registration->ID() ] = array(
1634
+		if ( ! empty($REG_IDs)) {
1635
+			$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
1636
+			foreach ($registrations as $registration) {
1637
+				if ($registration instanceof EE_Registration) {
1638
+					$registration_payment_data[$registration->ID()] = array(
1639 1639
 						'paid' => $registration->pretty_paid(),
1640
-						'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ),
1640
+						'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()),
1641 1641
 					);
1642 1642
 				}
1643 1643
 			}
@@ -1657,30 +1657,30 @@  discard block
 block discarded – undo
1657 1657
 	 * @access protected
1658 1658
 	 * @param \EE_Payment | null $payment
1659 1659
 	 */
1660
-	protected function _maybe_send_notifications( $payment = null ) {
1661
-		switch ( $payment instanceof EE_Payment ) {
1660
+	protected function _maybe_send_notifications($payment = null) {
1661
+		switch ($payment instanceof EE_Payment) {
1662 1662
 			// payment notifications
1663 1663
 			case true :
1664 1664
 				if (
1665 1665
 					isset(
1666
-						$this->_req_data[ 'txn_payments' ],
1667
-						$this->_req_data[ 'txn_payments' ][ 'send_notifications' ]
1666
+						$this->_req_data['txn_payments'],
1667
+						$this->_req_data['txn_payments']['send_notifications']
1668 1668
 					) &&
1669
-					filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1669
+					filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1670 1670
 				) {
1671
-					$this->_process_payment_notification( $payment );
1671
+					$this->_process_payment_notification($payment);
1672 1672
 				}
1673 1673
 				break;
1674 1674
 			// registration notifications
1675 1675
 			case false :
1676 1676
 				if (
1677 1677
 					isset(
1678
-						$this->_req_data[ 'txn_reg_status_change' ],
1679
-						$this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ]
1678
+						$this->_req_data['txn_reg_status_change'],
1679
+						$this->_req_data['txn_reg_status_change']['send_notifications']
1680 1680
 					) &&
1681
-					filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1681
+					filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1682 1682
 				) {
1683
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
1683
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
1684 1684
 				}
1685 1685
 				break;
1686 1686
 		}
@@ -1696,11 +1696,11 @@  discard block
 block discarded – undo
1696 1696
 	*	@return void
1697 1697
 	*/
1698 1698
 	protected function _send_payment_reminder() {
1699
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1700
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1701
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1702
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1703
-		$this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE );
1699
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1700
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1701
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1702
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1703
+		$this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE);
1704 1704
 	}
1705 1705
 
1706 1706
 
@@ -1714,36 +1714,36 @@  discard block
 block discarded – undo
1714 1714
 	 * @param string   $view
1715 1715
 	 * @return mixed int = count || array of transaction objects
1716 1716
 	 */
1717
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1717
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1718 1718
 
1719 1719
 		$TXN = EEM_Transaction::instance();
1720 1720
 
1721
-	    $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' ));
1722
-	    $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' );
1721
+	    $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'));
1722
+	    $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');
1723 1723
 
1724 1724
 	    //make sure our timestamps start and end right at the boundaries for each day
1725
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1726
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1725
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1726
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1727 1727
 
1728 1728
 
1729 1729
 	    //convert to timestamps
1730
-	    $start_date = strtotime( $start_date );
1731
-	    $end_date = strtotime( $end_date );
1730
+	    $start_date = strtotime($start_date);
1731
+	    $end_date = strtotime($end_date);
1732 1732
 
1733 1733
 	    //makes sure start date is the lowest value and vice versa
1734
-	    $start_date = min( $start_date, $end_date );
1735
-	    $end_date = max( $start_date, $end_date );
1734
+	    $start_date = min($start_date, $end_date);
1735
+	    $end_date = max($start_date, $end_date);
1736 1736
 
1737 1737
 	    //convert to correct format for query
1738
-	$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' );
1739
-	$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' );
1738
+	$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');
1739
+	$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');
1740 1740
 
1741 1741
 
1742 1742
 
1743 1743
 	    //set orderby
1744 1744
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1745 1745
 
1746
-		switch ( $this->_req_data['orderby'] ) {
1746
+		switch ($this->_req_data['orderby']) {
1747 1747
 			case 'TXN_ID':
1748 1748
 				$orderby = 'TXN_ID';
1749 1749
 				break;
@@ -1757,66 +1757,66 @@  discard block
 block discarded – undo
1757 1757
 				$orderby = 'TXN_timestamp';
1758 1758
 		}
1759 1759
 
1760
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1761
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1762
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1763
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1760
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1761
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1762
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1763
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1764 1764
 
1765
-		$offset = ($current_page-1)*$per_page;
1766
-		$limit = array( $offset, $per_page );
1765
+		$offset = ($current_page - 1) * $per_page;
1766
+		$limit = array($offset, $per_page);
1767 1767
 
1768 1768
 		$_where = array(
1769
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1769
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1770 1770
 			'Registration.REG_count' => 1
1771 1771
 		);
1772 1772
 
1773
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1773
+		if (isset($this->_req_data['EVT_ID'])) {
1774 1774
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1775 1775
 		}
1776 1776
 
1777
-		if ( isset( $this->_req_data['s'] ) ) {
1778
-			$search_string = '%' . $this->_req_data['s'] . '%';
1777
+		if (isset($this->_req_data['s'])) {
1778
+			$search_string = '%'.$this->_req_data['s'].'%';
1779 1779
 			$_where['OR'] = array(
1780
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1781
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1782
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1783
-				'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ),
1784
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1785
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1786
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1787
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1788
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1789
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1790
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1791
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1792
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1793
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1794
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1795
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1796
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1797
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1798
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1799
-				'TXN_session_data' => array( 'LIKE', $search_string ),
1800
-				'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string )
1780
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1781
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1782
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1783
+				'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string),
1784
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1785
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1786
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1787
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1788
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1789
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1790
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1791
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1792
+				'Registration.REG_code' => array('LIKE', $search_string),
1793
+				'Registration.REG_count' => array('LIKE', $search_string),
1794
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1795
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1796
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1797
+				'Payment.PAY_source' => array('LIKE', $search_string),
1798
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1799
+				'TXN_session_data' => array('LIKE', $search_string),
1800
+				'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string)
1801 1801
 				);
1802 1802
 		}
1803 1803
 
1804 1804
 		//failed transactions
1805
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1806
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1805
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE: FALSE;
1806
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE: FALSE;
1807 1807
 
1808
-		if ( $failed ) {
1809
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1810
-		} else if ( $abandoned ) {
1808
+		if ($failed) {
1809
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1810
+		} else if ($abandoned) {
1811 1811
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1812 1812
 		} else {
1813
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1814
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1813
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1814
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1815 1815
 		}
1816 1816
 
1817
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1817
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1818 1818
 
1819
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1819
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1820 1820
 
1821 1821
 
1822 1822
 		return $transactions;
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 1 patch
Spacing   +603 added lines, -603 removed lines patch added patch discarded remove patch
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
155 155
 	 * 		@access public
156 156
 	 */
157
-	public function __construct( $routing = TRUE ) {
157
+	public function __construct($routing = TRUE) {
158 158
 
159
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
159
+		if (strpos($this->_get_dir(), 'caffeinated') !== false)
160 160
 			$this->_is_caf = TRUE;
161 161
 
162 162
 		$this->_yes_no_values = array(
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 
169 169
 		//set the _req_data property.
170
-		$this->_req_data = array_merge( $_GET, $_POST );
170
+		$this->_req_data = array_merge($_GET, $_POST);
171 171
 
172 172
 
173 173
 		//routing enabled?
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$this->_do_other_page_hooks();
189 189
 
190 190
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
191
-		if ( method_exists( $this, '_before_page_setup' ) )
191
+		if (method_exists($this, '_before_page_setup'))
192 192
 			$this->_before_page_setup();
193 193
 
194 194
 		//set up page dependencies
@@ -458,16 +458,16 @@  discard block
 block discarded – undo
458 458
 	 */
459 459
 	protected function _global_ajax_hooks() {
460 460
 		//for lazy loading of metabox content
461
-		add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 );
461
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
462 462
 	}
463 463
 
464 464
 
465 465
 
466 466
 	public function ajax_metabox_content() {
467
-		$contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : '';
468
-		$url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : '';
467
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
468
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
469 469
 
470
-		self::cached_rss_display( $contentid, $url );
470
+		self::cached_rss_display($contentid, $url);
471 471
 		wp_die();
472 472
 	}
473 473
 
@@ -486,87 +486,87 @@  discard block
 block discarded – undo
486 486
 		//requires?
487 487
 
488 488
 		//admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can.  But keep in mind, not everything is available from the EE_Admin Page object at this point.
489
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
489
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
490 490
 
491 491
 
492 492
 		//next verify if we need to load anything...
493
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE;
494
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
493
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE;
494
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
495 495
 
496 496
 		global $ee_menu_slugs;
497 497
 		$ee_menu_slugs = (array) $ee_menu_slugs;
498 498
 
499
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
499
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
500 500
 
501 501
 
502 502
 		// becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
503
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
504
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
503
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
504
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
505 505
 		}
506 506
 		// then set blank or -1 action values to 'default'
507
-		$this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default';
507
+		$this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default';
508 508
 
509 509
 		//if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.  This covers cases where we're coming in from a list table that isn't on the default route.
510
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
510
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
511 511
 
512 512
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
513 513
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
514 514
 
515 515
 		$this->_current_view = $this->_req_action;
516
-		$this->_req_nonce = $this->_req_action . '_nonce';
516
+		$this->_req_nonce = $this->_req_action.'_nonce';
517 517
 		$this->_define_page_props();
518 518
 
519
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
519
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
520 520
 
521 521
 		//default things
522
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
522
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
523 523
 
524 524
 		//set page configs
525 525
 		$this->_set_page_routes();
526 526
 		$this->_set_page_config();
527 527
 
528 528
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
529
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
529
+		if (isset($this->_req_data['wp_referer'])) {
530 530
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
531 531
 		}
532 532
 
533 533
 		//for caffeinated and other extended functionality.  If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays
534
-		if ( method_exists( $this, '_extend_page_config' ) )
534
+		if (method_exists($this, '_extend_page_config'))
535 535
 			$this->_extend_page_config();
536 536
 
537 537
 		//for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays.
538
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
538
+		if (method_exists($this, '_extend_page_config_for_cpt'))
539 539
 			$this->_extend_page_config_for_cpt();
540 540
 
541 541
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
542
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
543
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
542
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
543
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
544 544
 
545 545
 
546 546
 		//if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
547
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
548
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
547
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
548
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
549 549
 		}
550 550
 
551 551
 
552 552
 		//next route only if routing enabled
553
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
553
+		if ($this->_routing && ! defined('DOING_AJAX')) {
554 554
 
555 555
 			$this->_verify_routes();
556 556
 
557 557
 			//next let's just check user_access and kill if no access
558 558
 			$this->check_user_access();
559 559
 
560
-			if ( $this->_is_UI_request ) {
560
+			if ($this->_is_UI_request) {
561 561
 				//admin_init stuff - global, all views for this page class, specific view
562
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
563
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
564
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
562
+				add_action('admin_init', array($this, 'admin_init'), 10);
563
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
564
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
565 565
 				}
566 566
 
567 567
 			} else {
568 568
 				//hijack regular WP loading and route admin request immediately
569
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
569
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
570 570
 				$this->route_admin_request();
571 571
 			}
572 572
 		}
@@ -583,18 +583,18 @@  discard block
 block discarded – undo
583 583
 	 * @return void
584 584
 	 */
585 585
 	private function _do_other_page_hooks() {
586
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
586
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
587 587
 
588
-		foreach ( $registered_pages as $page ) {
588
+		foreach ($registered_pages as $page) {
589 589
 
590 590
 			//now let's setup the file name and class that should be present
591 591
 			$classname = str_replace('.class.php', '', $page);
592 592
 
593 593
 			//autoloaders should take care of loading file
594
-			if ( !class_exists( $classname ) ) {
595
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
596
-				$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname );
597
-				throw new EE_Error( implode( '||', $error_msg ));
594
+			if ( ! class_exists($classname)) {
595
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
596
+				$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname);
597
+				throw new EE_Error(implode('||', $error_msg));
598 598
 			}
599 599
 
600 600
 			$a = new ReflectionClass($classname);
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	public function load_page_dependencies() {
610 610
 		try {
611 611
 			$this->_load_page_dependencies();
612
-		} catch ( EE_Error $e ) {
612
+		} catch (EE_Error $e) {
613 613
 			$e->get_error();
614 614
 		}
615 615
 	}
@@ -627,16 +627,16 @@  discard block
 block discarded – undo
627 627
 		$this->_current_screen = get_current_screen();
628 628
 
629 629
 		//load admin_notices - global, page class, and view specific
630
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
631
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
632
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
633
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
630
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
631
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
632
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
633
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
634 634
 		}
635 635
 
636 636
 		//load network admin_notices - global, page class, and view specific
637
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
638
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
639
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
637
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
638
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
639
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
640 640
 		}
641 641
 
642 642
 		//this will save any per_page screen options if they are present
@@ -652,8 +652,8 @@  discard block
 block discarded – undo
652 652
 		//add screen options - global, page child class, and view specific
653 653
 		$this->_add_global_screen_options();
654 654
 		$this->_add_screen_options();
655
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
656
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
655
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
656
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
657 657
 
658 658
 
659 659
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -664,33 +664,33 @@  discard block
 block discarded – undo
664 664
 		//add feature_pointers - global, page child class, and view specific
665 665
 		$this->_add_feature_pointers();
666 666
 		$this->_add_global_feature_pointers();
667
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
668
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
667
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
668
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
669 669
 
670 670
 		//enqueue scripts/styles - global, page class, and view specific
671
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
672
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
673
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
674
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
671
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
672
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
673
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
674
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
675 675
 
676
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
676
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
677 677
 
678 678
 		//admin_print_footer_scripts - global, page child class, and view specific.  NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.  In most cases that's doing_it_wrong().  But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these
679
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
680
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
681
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
682
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
679
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
680
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
681
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
682
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
683 683
 
684 684
 		//admin footer scripts
685
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
686
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
687
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
688
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
685
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
686
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
687
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
688
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
689 689
 
690 690
 
691
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
691
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
692 692
 		//targeted hook
693
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
693
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
694 694
 
695 695
 	}
696 696
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	private function _set_defaults() {
706 706
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
707 707
 
708
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
708
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
709 709
 
710 710
 		$this->default_nav_tab_name = 'overview';
711 711
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	public function route_admin_request() {
733 733
 		try {
734 734
 			$this->_route_admin_request();
735
-		} catch ( EE_Error $e ) {
735
+		} catch (EE_Error $e) {
736 736
 			$e->get_error();
737 737
 		}
738 738
 	}
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 		$this->_wp_page_slug = $wp_page_slug;
744 744
 
745 745
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
746
-		if ( is_network_admin() ) {
746
+		if (is_network_admin()) {
747 747
 			$this->_wp_page_slug .= '-network';
748 748
 		}
749 749
 	}
@@ -756,53 +756,53 @@  discard block
 block discarded – undo
756 756
 	 * @return void
757 757
 	 */
758 758
 	protected function _verify_routes() {
759
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
759
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
760 760
 
761
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
761
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
762 762
 
763 763
 		$this->_route = FALSE;
764 764
 		$func = FALSE;
765 765
 		$args = array();
766 766
 
767 767
 		// check that the page_routes array is not empty
768
-		if ( empty( $this->_page_routes )) {
768
+		if (empty($this->_page_routes)) {
769 769
 			// user error msg
770
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
770
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
771 771
 			// developer error msg
772
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
773
-			throw new EE_Error( $error_msg );
772
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
773
+			throw new EE_Error($error_msg);
774 774
 		}
775 775
 
776 776
 		// and that the requested page route exists
777
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
778
-			$this->_route = $this->_page_routes[ $this->_req_action ];
777
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
778
+			$this->_route = $this->_page_routes[$this->_req_action];
779 779
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
780 780
 		} else {
781 781
 			// user error msg
782
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
782
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
783 783
 			// developer error msg
784
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action );
785
-			throw new EE_Error( $error_msg );
784
+			$error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action);
785
+			throw new EE_Error($error_msg);
786 786
 		}
787 787
 
788 788
 		// and that a default route exists
789
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
789
+		if ( ! array_key_exists('default', $this->_page_routes)) {
790 790
 			// user error msg
791
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
791
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
792 792
 			// developer error msg
793
-			$error_msg .=  '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' );
794
-			throw new EE_Error( $error_msg );
793
+			$error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso');
794
+			throw new EE_Error($error_msg);
795 795
 		}
796 796
 
797 797
 
798 798
 		//first lets' catch if the UI request has EVER been set.
799
-		if ( $this->_is_UI_request === NULL ) {
799
+		if ($this->_is_UI_request === NULL) {
800 800
 			//lets set if this is a UI request or not.
801
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
801
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
802 802
 
803 803
 
804 804
 			//wait a minute... we might have a noheader in the route array
805
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
805
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
806 806
 		}
807 807
 
808 808
 		$this->_set_current_labels();
@@ -817,15 +817,15 @@  discard block
 block discarded – undo
817 817
 	 * @param  string $route the route name we're verifying
818 818
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
819 819
 	 */
820
-	protected function _verify_route( $route ) {
821
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
820
+	protected function _verify_route($route) {
821
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
822 822
 			return true;
823 823
 		} else {
824 824
 			// user error msg
825
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
825
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
826 826
 			// developer error msg
827
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route );
828
-			throw new EE_Error( $error_msg );
827
+			$error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route);
828
+			throw new EE_Error($error_msg);
829 829
 		}
830 830
 	}
831 831
 
@@ -839,18 +839,18 @@  discard block
 block discarded – undo
839 839
 	 * @param  string $nonce_ref The nonce reference string (name0)
840 840
 	 * @return mixed (bool|die)
841 841
 	 */
842
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
842
+	protected function _verify_nonce($nonce, $nonce_ref) {
843 843
 		// verify nonce against expected value
844
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
844
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
845 845
 			// these are not the droids you are looking for !!!
846
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
847
-			if ( WP_DEBUG ) {
848
-				$msg .= "\n  " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__  );
846
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
847
+			if (WP_DEBUG) {
848
+				$msg .= "\n  ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__);
849 849
 			}
850
-			if ( ! defined( 'DOING_AJAX' )) {
851
-				wp_die( $msg );
850
+			if ( ! defined('DOING_AJAX')) {
851
+				wp_die($msg);
852 852
 			} else {
853
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
853
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
854 854
 				$this->_return_json();
855 855
 			}
856 856
 		}
@@ -868,63 +868,63 @@  discard block
 block discarded – undo
868 868
 	 * @return void
869 869
 	 */
870 870
 	protected function _route_admin_request() {
871
-		if (  ! $this->_is_UI_request )
871
+		if ( ! $this->_is_UI_request)
872 872
 			$this->_verify_routes();
873 873
 
874
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
874
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
875 875
 
876
-		if ( $this->_req_action != 'default' && $nonce_check ) {
876
+		if ($this->_req_action != 'default' && $nonce_check) {
877 877
 			// set nonce from post data
878
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
879
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
878
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
879
+			$this->_verify_nonce($nonce, $this->_req_nonce);
880 880
 		}
881 881
 		//set the nav_tabs array but ONLY if this is  UI_request
882
-		if ( $this->_is_UI_request )
882
+		if ($this->_is_UI_request)
883 883
 			$this->_set_nav_tabs();
884 884
 
885 885
 		// grab callback function
886
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
886
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
887 887
 
888 888
 		// check if callback has args
889
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
889
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
890 890
 
891 891
 		$error_msg = '';
892 892
 
893 893
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
894
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
895
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
894
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
895
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
896 896
 		}
897 897
 
898 898
 		//right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
899
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
899
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
900 900
 
901
-		if ( ! empty( $func )) {
901
+		if ( ! empty($func)) {
902 902
 			$base_call = $addon_call = FALSE;
903 903
 			//try to access page route via this class
904
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
904
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
905 905
 				// user error msg
906
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
906
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
907 907
 				// developer error msg
908
-				$error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func );
908
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func);
909 909
 			}
910 910
 
911 911
 			//for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method)
912 912
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
913 913
 
914
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
915
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
916
-				$error_msg .= '||' . sprintf( __('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func );
914
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
915
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
916
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func);
917 917
 			}
918 918
 
919 919
 
920
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
921
-				throw new EE_Error( $error_msg );
920
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
921
+				throw new EE_Error($error_msg);
922 922
 		}
923 923
 
924 924
 		//if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route.
925 925
 		//now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
926
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
927
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
926
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
927
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
928 928
 		}
929 929
 	}
930 930
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 * @param  string    $new_route   New (non header) route to redirect to.
941 941
 	 * @return   void
942 942
 	 */
943
-	protected function _reset_routing_properties( $new_route ) {
943
+	protected function _reset_routing_properties($new_route) {
944 944
 		$this->_is_UI_request = TRUE;
945 945
 		//now we set the current route to whatever the headers_sent_route is set at
946 946
 		$this->_req_data['action'] = $new_route;
@@ -986,23 +986,23 @@  discard block
 block discarded – undo
986 986
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
987 987
 	 * 	@return string
988 988
 	 */
989
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
989
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
990 990
 
991 991
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
992
-		if ( $sticky ) {
992
+		if ($sticky) {
993 993
 			$request = $_REQUEST;
994
-			unset( $request['_wp_http_referer'] );
995
-			unset( $request['wp_referer'] );
996
-			foreach ( $request as $key => $value ) {
994
+			unset($request['_wp_http_referer']);
995
+			unset($request['wp_referer']);
996
+			foreach ($request as $key => $value) {
997 997
 				//do not add nonces
998
-				if ( strpos( $key, 'nonce' ) !== false ) {
998
+				if (strpos($key, 'nonce') !== false) {
999 999
 					continue;
1000 1000
 				}
1001
-				$args['wp_referer[' . $key . ']'] = $value;
1001
+				$args['wp_referer['.$key.']'] = $value;
1002 1002
 			}
1003 1003
 		}
1004 1004
 
1005
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1005
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1006 1006
 	}
1007 1007
 
1008 1008
 
@@ -1018,8 +1018,8 @@  discard block
 block discarded – undo
1018 1018
 	 * @uses EEH_Template::get_help_tab_link()
1019 1019
 	 * @return string              generated link
1020 1020
 	 */
1021
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1022
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1021
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1022
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1023 1023
 	}
1024 1024
 
1025 1025
 
@@ -1036,30 +1036,30 @@  discard block
 block discarded – undo
1036 1036
 	 */
1037 1037
 	protected function _add_help_tabs() {
1038 1038
 		$tour_buttons = '';
1039
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1039
+		if (isset($this->_page_config[$this->_req_action])) {
1040 1040
 			$config = $this->_page_config[$this->_req_action];
1041 1041
 
1042 1042
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1043
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1043
+			if (isset($this->_help_tour[$this->_req_action])) {
1044 1044
 				$tb = array();
1045 1045
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1046
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1046
+				foreach ($this->_help_tour['tours'] as $tour) {
1047 1047
 					//if this is the end tour then we don't need to setup a button
1048
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1048
+					if ($tour instanceof EE_Help_Tour_final_stop)
1049 1049
 						continue;
1050
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1050
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1051 1051
 				}
1052 1052
 				$tour_buttons .= implode('<br />', $tb);
1053 1053
 				$tour_buttons .= '</div></div>';
1054 1054
 			}
1055 1055
 
1056 1056
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1057
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1057
+			if (is_array($config) && isset($config['help_sidebar'])) {
1058 1058
 				//check that the callback given is valid
1059
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1060
-					throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1059
+				if ( ! method_exists($this, $config['help_sidebar']))
1060
+					throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this)));
1061 1061
 
1062
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1062
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1063 1063
 
1064 1064
 				$content .= $tour_buttons; //add help tour buttons.
1065 1065
 
@@ -1068,49 +1068,49 @@  discard block
 block discarded – undo
1068 1068
 			}
1069 1069
 
1070 1070
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1071
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1071
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1072 1072
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1073 1073
 			}
1074 1074
 
1075 1075
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1076
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1076
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1077 1077
 				$_ht['id'] = $this->page_slug;
1078 1078
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1079
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1079
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1080 1080
 				$this->_current_screen->add_help_tab($_ht);
1081 1081
 				}/**/
1082 1082
 
1083 1083
 
1084
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1084
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1085 1085
 
1086
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1086
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1087 1087
 				//we're here so there ARE help tabs!
1088 1088
 
1089 1089
 				//make sure we've got what we need
1090
-				if ( !isset( $cfg['title'] ) )
1091
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1090
+				if ( ! isset($cfg['title']))
1091
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1092 1092
 
1093 1093
 
1094
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1095
-					throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1094
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1095
+					throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso'));
1096 1096
 
1097 1097
 
1098 1098
 
1099 1099
 				//first priority goes to content.
1100
-				if ( !empty($cfg['content'] ) ) {
1101
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1100
+				if ( ! empty($cfg['content'])) {
1101
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1102 1102
 
1103 1103
 				//second priority goes to filename
1104
-				} else if ( !empty($cfg['filename'] ) ) {
1105
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1104
+				} else if ( ! empty($cfg['filename'])) {
1105
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1106 1106
 
1107 1107
 
1108 1108
 					//it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1109
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1109
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1110 1110
 
1111 1111
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1112
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1113
-						EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ );
1112
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1113
+						EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__);
1114 1114
 						return;
1115 1115
 					}
1116 1116
 					$template_args['admin_page_obj'] = $this;
@@ -1121,21 +1121,21 @@  discard block
 block discarded – undo
1121 1121
 
1122 1122
 
1123 1123
 				//check if callback is valid
1124
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1125
-					EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ );
1124
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1125
+					EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__);
1126 1126
 					return;
1127 1127
 				}
1128 1128
 
1129 1129
 				//setup config array for help tab method
1130
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1130
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1131 1131
 				$_ht = array(
1132 1132
 					'id' => $id,
1133 1133
 					'title' => $cfg['title'],
1134
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1134
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1135 1135
 					'content' => $content
1136 1136
 					);
1137 1137
 
1138
-				$this->_current_screen->add_help_tab( $_ht );
1138
+				$this->_current_screen->add_help_tab($_ht);
1139 1139
 			}
1140 1140
 		}
1141 1141
 	}
@@ -1155,49 +1155,49 @@  discard block
 block discarded – undo
1155 1155
 		$this->_help_tour = array();
1156 1156
 
1157 1157
 		//exit early if help tours are turned off globally
1158
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1158
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1159 1159
 			return;
1160 1160
 
1161 1161
 		//loop through _page_config to find any help_tour defined
1162
-		foreach ( $this->_page_config as $route => $config ) {
1162
+		foreach ($this->_page_config as $route => $config) {
1163 1163
 			//we're only going to set things up for this route
1164
-			if ( $route !== $this->_req_action )
1164
+			if ($route !== $this->_req_action)
1165 1165
 				continue;
1166 1166
 
1167
-			if ( isset( $config['help_tour'] ) ) {
1167
+			if (isset($config['help_tour'])) {
1168 1168
 
1169
-				foreach( $config['help_tour'] as $tour ) {
1170
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1169
+				foreach ($config['help_tour'] as $tour) {
1170
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1171 1171
 					//let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent
1172
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1172
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1173 1173
 
1174 1174
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1175
-					if ( !is_readable($file_path) ) {
1176
-						EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ );
1175
+					if ( ! is_readable($file_path)) {
1176
+						EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__);
1177 1177
 						return;
1178 1178
 					}
1179 1179
 
1180 1180
 					require_once $file_path;
1181
-					if ( !class_exists( $tour ) ) {
1182
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1183
-						$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) );
1184
-						throw new EE_Error( implode( '||', $error_msg ));
1181
+					if ( ! class_exists($tour)) {
1182
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1183
+						$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this));
1184
+						throw new EE_Error(implode('||', $error_msg));
1185 1185
 					}
1186 1186
 					$a = new ReflectionClass($tour);
1187 1187
 					$tour_obj = $a->newInstance($this->_is_caf);
1188 1188
 
1189 1189
 					$tours[] = $tour_obj;
1190
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1190
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1191 1191
 				}
1192 1192
 
1193 1193
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1194 1194
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1195 1195
 				$tours[] = $end_stop_tour;
1196
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1196
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1197 1197
 			}
1198 1198
 		}
1199 1199
 
1200
-		if ( !empty( $tours ) )
1200
+		if ( ! empty($tours))
1201 1201
 			$this->_help_tour['tours'] = $tours;
1202 1202
 
1203 1203
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1213,12 +1213,12 @@  discard block
 block discarded – undo
1213 1213
 	 * @return void
1214 1214
 	 */
1215 1215
 	protected function _add_qtips() {
1216
-		if ( isset( $this->_route_config['qtips'] ) ) {
1216
+		if (isset($this->_route_config['qtips'])) {
1217 1217
 			$qtips = (array) $this->_route_config['qtips'];
1218 1218
 			//load qtip loader
1219 1219
 			$path = array(
1220
-				$this->_get_dir() . '/qtips/',
1221
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1220
+				$this->_get_dir().'/qtips/',
1221
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1222 1222
 				);
1223 1223
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1224 1224
 		}
@@ -1235,41 +1235,41 @@  discard block
 block discarded – undo
1235 1235
 	 * @return void
1236 1236
 	 */
1237 1237
 	protected function _set_nav_tabs() {
1238
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1238
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1239 1239
 		$i = 0;
1240
-		foreach ( $this->_page_config as $slug => $config ) {
1241
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1240
+		foreach ($this->_page_config as $slug => $config) {
1241
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1242 1242
 				continue; //no nav tab for this config
1243 1243
 
1244 1244
 			//check for persistent flag
1245
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1245
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1246 1246
 				continue; //nav tab is only to appear when route requested.
1247 1247
 
1248
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1248
+			if ( ! $this->check_user_access($slug, TRUE))
1249 1249
 				continue; //no nav tab becasue current user does not have access.
1250 1250
 
1251
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1251
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1252 1252
 			$this->_nav_tabs[$slug] = array(
1253
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1254
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1255
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1256
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1253
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1254
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1255
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1256
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1257 1257
 				);
1258 1258
 			$i++;
1259 1259
 		}
1260 1260
 
1261 1261
 		//if $this->_nav_tabs is empty then lets set the default
1262
-		if ( empty( $this->_nav_tabs ) ) {
1262
+		if (empty($this->_nav_tabs)) {
1263 1263
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1264 1264
 				'url' => $this->admin_base_url,
1265
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1265
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1266 1266
 				'css_class' => 'nav-tab-active',
1267 1267
 				'order' => 10
1268 1268
 				);
1269 1269
 		}
1270 1270
 
1271 1271
 		//now let's sort the tabs according to order
1272
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1272
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1273 1273
 
1274 1274
 	}
1275 1275
 
@@ -1285,10 +1285,10 @@  discard block
 block discarded – undo
1285 1285
 	 * @return void
1286 1286
 	 */
1287 1287
 	private function _set_current_labels() {
1288
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1289
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1290
-				if ( is_array($text) ) {
1291
-					foreach ( $text as $sublabel => $subtext ) {
1288
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1289
+			foreach ($this->_route_config['labels'] as $label => $text) {
1290
+				if (is_array($text)) {
1291
+					foreach ($text as $sublabel => $subtext) {
1292 1292
 						$this->_labels[$label][$sublabel] = $subtext;
1293 1293
 					}
1294 1294
 				} else {
@@ -1309,24 +1309,24 @@  discard block
 block discarded – undo
1309 1309
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1310 1310
 	*		@return 		BOOL|wp_die()
1311 1311
 	*/
1312
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1313
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1314
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1315
-		$capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1312
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1313
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1314
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1315
+		$capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1316 1316
 
1317
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1318
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1317
+		if (empty($capability) && empty($route_to_check)) {
1318
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1319 1319
 		} else {
1320
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1320
+			$capability = empty($capability) ? 'manage_options' : $capability;
1321 1321
 		}
1322 1322
 
1323
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1323
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1324 1324
 
1325
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1326
-			if ( $verify_only ) {
1325
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1326
+			if ($verify_only) {
1327 1327
 				return FALSE;
1328 1328
 			} else {
1329
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1329
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1330 1330
 			}
1331 1331
 		}
1332 1332
 		return TRUE;
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 		$this->_add_admin_page_overlay();
1404 1404
 
1405 1405
 		//if metaboxes are present we need to add the nonce field
1406
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1406
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1407 1407
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1408 1408
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1409 1409
 		}
@@ -1422,19 +1422,19 @@  discard block
 block discarded – undo
1422 1422
 	 */
1423 1423
 	public function admin_footer_global() {
1424 1424
 		//dialog container for dialog helper
1425
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1425
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1426 1426
 		$d_cont .= '<div class="ee-notices"></div>';
1427 1427
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1428 1428
 		$d_cont .= '</div>';
1429 1429
 		echo $d_cont;
1430 1430
 
1431 1431
 		//help tour stuff?
1432
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1432
+		if (isset($this->_help_tour[$this->_req_action])) {
1433 1433
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1434 1434
 		}
1435 1435
 
1436 1436
 		//current set timezone for timezone js
1437
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1437
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1438 1438
 	}
1439 1439
 
1440 1440
 
@@ -1458,18 +1458,18 @@  discard block
 block discarded – undo
1458 1458
 	 * @access protected
1459 1459
 	 * @return string content
1460 1460
 	 */
1461
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1461
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1462 1462
 		$content = '';
1463 1463
 
1464
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1465
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1464
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1465
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1466 1466
 
1467 1467
 
1468 1468
 		//loop through the array and setup content
1469
-		foreach ( $help_array as $trigger => $help ) {
1469
+		foreach ($help_array as $trigger => $help) {
1470 1470
 			//make sure the array is setup properly
1471
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1472
-				throw new EE_Error( __('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') );
1471
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1472
+				throw new EE_Error(__('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso'));
1473 1473
 			}
1474 1474
 
1475 1475
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1479,10 +1479,10 @@  discard block
 block discarded – undo
1479 1479
 				'help_popup_content' => $help['content']
1480 1480
 				);
1481 1481
 
1482
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1482
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1483 1483
 		}
1484 1484
 
1485
-		if ( $display )
1485
+		if ($display)
1486 1486
 			echo $content;
1487 1487
 		else
1488 1488
 			return $content;
@@ -1499,18 +1499,18 @@  discard block
 block discarded – undo
1499 1499
 	 */
1500 1500
 	private function _get_help_content() {
1501 1501
 		//what is the method we're looking for?
1502
-		$method_name = '_help_popup_content_' . $this->_req_action;
1502
+		$method_name = '_help_popup_content_'.$this->_req_action;
1503 1503
 
1504 1504
 		//if method doesn't exist let's get out.
1505
-		if ( !method_exists( $this, $method_name ) )
1505
+		if ( ! method_exists($this, $method_name))
1506 1506
 			return array();
1507 1507
 
1508 1508
 		//k we're good to go let's retrieve the help array
1509
-		$help_array = call_user_func( array( $this, $method_name ) );
1509
+		$help_array = call_user_func(array($this, $method_name));
1510 1510
 
1511 1511
 		//make sure we've got an array!
1512
-		if ( !is_array($help_array) ) {
1513
-			throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) );
1512
+		if ( ! is_array($help_array)) {
1513
+			throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso'));
1514 1514
 		}
1515 1515
 
1516 1516
 		return $help_array;
@@ -1532,27 +1532,27 @@  discard block
 block discarded – undo
1532 1532
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1533 1533
 	 * @return string
1534 1534
 	 */
1535
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1535
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1536 1536
 
1537
-		if ( defined('DOING_AJAX') ) return;
1537
+		if (defined('DOING_AJAX')) return;
1538 1538
 
1539 1539
 		//let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1540 1540
 		$help_array = $this->_get_help_content();
1541 1541
 		$help_content = '';
1542 1542
 
1543
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1543
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1544 1544
 			$help_array[$trigger_id] = array(
1545 1545
 				'title' => __('Missing Content', 'event_espresso'),
1546 1546
 				'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso')
1547 1547
 				);
1548
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1548
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1549 1549
 		}
1550 1550
 
1551 1551
 		//let's setup the trigger
1552
-		$content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1553
-		$content = $content . $help_content;
1552
+		$content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1553
+		$content = $content.$help_content;
1554 1554
 
1555
-		if ( $display )
1555
+		if ($display)
1556 1556
 			echo $content;
1557 1557
 		else
1558 1558
 			return $content;
@@ -1609,15 +1609,15 @@  discard block
 block discarded – undo
1609 1609
 	public function load_global_scripts_styles() {
1610 1610
 		/** STYLES **/
1611 1611
 		// add debugging styles
1612
-		if ( WP_DEBUG ) {
1613
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1612
+		if (WP_DEBUG) {
1613
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1614 1614
 		}
1615 1615
 
1616 1616
 		//register all styles
1617
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION );
1618
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1617
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1618
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1619 1619
 		//helpers styles
1620
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1620
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1621 1621
 		//enqueue global styles
1622 1622
 		wp_enqueue_style('ee-admin-css');
1623 1623
 
@@ -1625,66 +1625,66 @@  discard block
 block discarded – undo
1625 1625
 		/** SCRIPTS **/
1626 1626
 
1627 1627
 		//register all scripts
1628
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1629
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1630
-		wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true );
1628
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1629
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1630
+		wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1631 1631
 
1632
-		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true );
1632
+		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true);
1633 1633
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1634
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1634
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1635 1635
 		add_filter('FHEE_load_joyride', '__return_true');
1636 1636
 
1637 1637
 		//script for sorting tables
1638
-		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1638
+		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1639 1639
 		//script for parsing uri's
1640
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1640
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1641 1641
 		//and parsing associative serialized form elements
1642
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1642
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1643 1643
 		//helpers scripts
1644
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1645
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1646
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1647
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1644
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1645
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1646
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1647
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1648 1648
 
1649 1649
 		//google charts
1650
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1650
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1651 1651
 
1652 1652
 		//enqueue global scripts
1653 1653
 
1654 1654
 		//taking care of metaboxes
1655
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1655
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1656 1656
 			wp_enqueue_script('dashboard');
1657 1657
 		}
1658 1658
 
1659 1659
 		//enqueue thickbox for ee help popups.  default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups
1660
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1660
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1661 1661
 			wp_enqueue_script('ee_admin_js');
1662 1662
 			wp_enqueue_style('ee-admin-css');
1663 1663
 		}
1664 1664
 
1665 1665
 
1666 1666
 		//localize script for ajax lazy loading
1667
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1668
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1667
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1668
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1669 1669
 
1670 1670
 
1671 1671
 		/**
1672 1672
 		 * help tour stuff
1673 1673
 		 */
1674
-		if ( !empty( $this->_help_tour ) ) {
1674
+		if ( ! empty($this->_help_tour)) {
1675 1675
 
1676 1676
 			//register the js for kicking things off
1677
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1677
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1678 1678
 
1679 1679
 			//setup tours for the js tour object
1680
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1680
+			foreach ($this->_help_tour['tours'] as $tour) {
1681 1681
 				$tours[] = array(
1682 1682
 					'id' => $tour->get_slug(),
1683 1683
 					'options' => $tour->get_options()
1684 1684
 					);
1685 1685
 			}
1686 1686
 
1687
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1687
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1688 1688
 
1689 1689
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1690 1690
 		}
@@ -1702,52 +1702,52 @@  discard block
 block discarded – undo
1702 1702
 	public function admin_footer_scripts_eei18n_js_strings() {
1703 1703
 
1704 1704
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1705
-		EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' );
1706
-
1707
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1708
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1709
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1710
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1711
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1712
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1713
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1731
-
1732
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1735
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1736
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1737
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1742
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1743
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1744
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1745
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1705
+		EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso');
1706
+
1707
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1708
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1709
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1710
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1711
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1712
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1713
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1731
+
1732
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1735
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1736
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1737
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1742
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1743
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1744
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1745
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1746 1746
 
1747 1747
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1748 1748
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1749 1749
 		//espresso_core is listed as a dependency of ee_admin_js.
1750
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1750
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1751 1751
 
1752 1752
 	}
1753 1753
 
@@ -1781,23 +1781,23 @@  discard block
 block discarded – undo
1781 1781
 	protected function _set_list_table() {
1782 1782
 
1783 1783
 		//first is this a list_table view?
1784
-		if ( !isset($this->_route_config['list_table']) )
1784
+		if ( ! isset($this->_route_config['list_table']))
1785 1785
 			return; //not a list_table view so get out.
1786 1786
 
1787 1787
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1788 1788
 
1789
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1789
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1790 1790
 			//user error msg
1791
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1791
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1792 1792
 			//developer error msg
1793
-			$error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action );
1794
-			throw new EE_Error( $error_msg );
1793
+			$error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action);
1794
+			throw new EE_Error($error_msg);
1795 1795
 		}
1796 1796
 
1797 1797
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1798
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1799
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1800
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1798
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1799
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1800
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1801 1801
 
1802 1802
 		$this->_set_list_table_view();
1803 1803
 		$this->_set_list_table_object();
@@ -1819,14 +1819,14 @@  discard block
 block discarded – undo
1819 1819
 	*		@return array
1820 1820
 	*/
1821 1821
 	protected function _set_list_table_view() {
1822
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1822
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1823 1823
 
1824 1824
 
1825 1825
 		// looking at active items or dumpster diving ?
1826
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1827
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1826
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1827
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1828 1828
 		} else {
1829
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1829
+			$this->_view = sanitize_key($this->_req_data['status']);
1830 1830
 		}
1831 1831
 	}
1832 1832
 
@@ -1837,9 +1837,9 @@  discard block
 block discarded – undo
1837 1837
 	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
1838 1838
 	 */
1839 1839
 	protected function _set_list_table_object() {
1840
-		if ( isset($this->_route_config['list_table'] ) ) {
1841
-			if ( !class_exists( $this->_route_config['list_table'] ) )
1842
-				throw new EE_Error( sprintf( __('The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this) ) );
1840
+		if (isset($this->_route_config['list_table'])) {
1841
+			if ( ! class_exists($this->_route_config['list_table']))
1842
+				throw new EE_Error(sprintf(__('The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this)));
1843 1843
 			$a = new ReflectionClass($this->_route_config['list_table']);
1844 1844
 			$this->_list_table_object = $a->newInstance($this);
1845 1845
 		}
@@ -1858,27 +1858,27 @@  discard block
 block discarded – undo
1858 1858
 	 *
1859 1859
 	 * @return array
1860 1860
 	 */
1861
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1861
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1862 1862
 
1863
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1863
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1864 1864
 
1865
-		if ( empty( $this->_views )) {
1865
+		if (empty($this->_views)) {
1866 1866
 			$this->_views = array();
1867 1867
 		}
1868 1868
 
1869 1869
 		// cycle thru views
1870
-		foreach ( $this->_views as $key => $view ) {
1870
+		foreach ($this->_views as $key => $view) {
1871 1871
 			$query_args = array();
1872 1872
 			// check for current view
1873
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1873
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1874 1874
 			$query_args['action'] = $this->_req_action;
1875
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1875
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1876 1876
 			$query_args['status'] = $view['slug'];
1877 1877
 			//merge any other arguments sent in.
1878
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1879
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1878
+			if (isset($extra_query_args[$view['slug']])) {
1879
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1880 1880
 			}
1881
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1881
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1882 1882
 		}
1883 1883
 
1884 1884
 		return $this->_views;
@@ -1895,15 +1895,15 @@  discard block
 block discarded – undo
1895 1895
 	 * @param int $max_entries total number of rows in the table
1896 1896
 	 * @return string
1897 1897
 	*/
1898
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1898
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1899 1899
 
1900
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1901
-		$values = array( 10, 25, 50, 100 );
1902
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1900
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1901
+		$values = array(10, 25, 50, 100);
1902
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1903 1903
 
1904
-		if ( $max_entries ) {
1904
+		if ($max_entries) {
1905 1905
 			$values[] = $max_entries;
1906
-			sort( $values );
1906
+			sort($values);
1907 1907
 		}
1908 1908
 
1909 1909
 		$entries_per_page_dropdown = '
@@ -1912,15 +1912,15 @@  discard block
 block discarded – undo
1912 1912
 					Show
1913 1913
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1914 1914
 
1915
-		foreach ( $values as $value ) {
1916
-			if ( $value < $max_entries ) {
1917
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1915
+		foreach ($values as $value) {
1916
+			if ($value < $max_entries) {
1917
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1918 1918
 				$entries_per_page_dropdown .= '
1919 1919
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1920 1920
 			}
1921 1921
 		}
1922 1922
 
1923
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1923
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1924 1924
 		$entries_per_page_dropdown .= '
1925 1925
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1926 1926
 
@@ -1943,8 +1943,8 @@  discard block
 block discarded – undo
1943 1943
 	*		@return 		void
1944 1944
 	*/
1945 1945
 	public function _set_search_attributes() {
1946
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1947
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1946
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1947
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1948 1948
 	}
1949 1949
 
1950 1950
 	/*** END LIST TABLE METHODS **/
@@ -1963,20 +1963,20 @@  discard block
 block discarded – undo
1963 1963
 	 * @return void
1964 1964
 	*/
1965 1965
 	private function _add_registered_meta_boxes() {
1966
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1966
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1967 1967
 
1968 1968
 		//we only add meta boxes if the page_route calls for it
1969
-		if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) {
1969
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) {
1970 1970
 
1971 1971
 
1972 1972
 			//this simply loops through the callbacks provided and checks if there is a corresponding callback registered by the child - if there is then we go ahead and process the metabox loader.
1973
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1974
-				if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) {
1973
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1974
+				if (call_user_func(array($this, &$metabox_callback)) === FALSE) {
1975 1975
 					// user error msg
1976
-				$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
1976
+				$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
1977 1977
 				// developer error msg
1978
-				$error_msg .= '||' . sprintf( __( 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso' ), $metabox_callback );
1979
-				throw new EE_Error( $error_msg );
1978
+				$error_msg .= '||'.sprintf(__('The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso'), $metabox_callback);
1979
+				throw new EE_Error($error_msg);
1980 1980
 				}
1981 1981
 			}
1982 1982
 		}
@@ -1993,17 +1993,17 @@  discard block
 block discarded – undo
1993 1993
 	 * @return void
1994 1994
 	 */
1995 1995
 	private function _add_screen_columns() {
1996
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
1996
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
1997 1997
 
1998
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
1998
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
1999 1999
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2000 2000
 			$screen_id = $this->_current_screen->id;
2001 2001
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2002
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2003
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2002
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2003
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2004 2004
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2005 2005
 			$this->_template_args['screen'] = $this->_current_screen;
2006
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2006
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2007 2007
 
2008 2008
 			//finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2009 2009
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2020,11 +2020,11 @@  discard block
 block discarded – undo
2020 2020
 	 */
2021 2021
 
2022 2022
 	private function _espresso_news_post_box() {
2023
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2024
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2023
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2024
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2025 2025
 			$this,
2026 2026
 			'espresso_news_post_box'
2027
-		), $this->_wp_page_slug, 'side' );
2027
+		), $this->_wp_page_slug, 'side');
2028 2028
 	}
2029 2029
 
2030 2030
 
@@ -2032,14 +2032,14 @@  discard block
 block discarded – undo
2032 2032
 	 * Code for setting up espresso ratings request metabox.
2033 2033
 	 */
2034 2034
 	protected function _espresso_ratings_request() {
2035
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2035
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2036 2036
 			return '';
2037 2037
 		}
2038
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2039
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2038
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2039
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2040 2040
 			$this,
2041 2041
 			'espresso_ratings_request'
2042
-		), $this->_wp_page_slug, 'side' );
2042
+		), $this->_wp_page_slug, 'side');
2043 2043
 	}
2044 2044
 
2045 2045
 
@@ -2047,34 +2047,34 @@  discard block
 block discarded – undo
2047 2047
 	 * Code for setting up espresso ratings request metabox content.
2048 2048
 	 */
2049 2049
 	public function espresso_ratings_request() {
2050
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2051
-		EEH_Template::display_template( $template_path, array() );
2050
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2051
+		EEH_Template::display_template($template_path, array());
2052 2052
 	}
2053 2053
 
2054 2054
 
2055 2055
 
2056 2056
 
2057
-	public static function cached_rss_display( $rss_id, $url ) {
2058
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2059
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2060
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2061
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2062
-		$post = '</div>' . "\n";
2057
+	public static function cached_rss_display($rss_id, $url) {
2058
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2059
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2060
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2061
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2062
+		$post = '</div>'."\n";
2063 2063
 
2064
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2065
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2066
-			echo $pre . $output . $post;
2064
+		$cache_key = 'ee_rss_'.md5($rss_id);
2065
+		if (FALSE != ($output = get_transient($cache_key))) {
2066
+			echo $pre.$output.$post;
2067 2067
 			return TRUE;
2068 2068
 		}
2069 2069
 
2070
-		if ( ! $doing_ajax ) {
2071
-			echo $pre . $loading . $post;
2070
+		if ( ! $doing_ajax) {
2071
+			echo $pre.$loading.$post;
2072 2072
 			return FALSE;
2073 2073
 		}
2074 2074
 
2075 2075
 		ob_start();
2076
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2077
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2076
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2077
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2078 2078
 		return TRUE;
2079 2079
 
2080 2080
 	}
@@ -2086,13 +2086,13 @@  discard block
 block discarded – undo
2086 2086
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2087 2087
 	  		<?php
2088 2088
 	  		// Get RSS Feed(s)
2089
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2089
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2090 2090
 	  		$url = urlencode($feed_url);
2091
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2091
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2092 2092
 
2093 2093
 	  		?>
2094 2094
 	  	</div>
2095
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2095
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2096 2096
 	  </div>
2097 2097
 		<?php
2098 2098
 	}
@@ -2113,32 +2113,32 @@  discard block
 block discarded – undo
2113 2113
 
2114 2114
 	protected function _espresso_sponsors_post_box() {
2115 2115
 
2116
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2117
-		if ( $show_sponsors )
2118
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2116
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2117
+		if ($show_sponsors)
2118
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2119 2119
 	}
2120 2120
 
2121 2121
 
2122 2122
 	public function espresso_sponsors_post_box() {
2123
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2124
-		EEH_Template::display_template( $templatepath );
2123
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2124
+		EEH_Template::display_template($templatepath);
2125 2125
 	}
2126 2126
 
2127 2127
 
2128 2128
 
2129 2129
 	private function _publish_post_box() {
2130
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2130
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2131 2131
 
2132 2132
 		//if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label.  Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2133
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2134
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2133
+		if ( ! empty($this->_labels['publishbox'])) {
2134
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2135 2135
 		} else {
2136 2136
 			$box_label = __('Publish', 'event_espresso');
2137 2137
 		}
2138 2138
 
2139
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2139
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2140 2140
 
2141
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2141
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2142 2142
 
2143 2143
 	}
2144 2144
 
@@ -2146,9 +2146,9 @@  discard block
 block discarded – undo
2146 2146
 
2147 2147
 	public function editor_overview() {
2148 2148
 		//if we have extra content set let's add it in if not make sure its empty
2149
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2150
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2151
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2149
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2150
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2151
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2152 2152
 	}
2153 2153
 
2154 2154
 
@@ -2164,8 +2164,8 @@  discard block
 block discarded – undo
2164 2164
 	 * @see $this->_set_publish_post_box_vars for param details
2165 2165
 	 * @since 4.6.0
2166 2166
 	 */
2167
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2168
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2167
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2168
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2169 2169
 	}
2170 2170
 
2171 2171
 
@@ -2184,24 +2184,24 @@  discard block
 block discarded – undo
2184 2184
 	 * @param	string	$post_save_redirect_URL	custom URL to redirect to after Save & Close has been completed
2185 2185
 	 * @param	boolean	$both_btns	whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button
2186 2186
 	 */
2187
-	protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) {
2187
+	protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) {
2188 2188
 
2189 2189
 		// if Save & Close, use a custom redirect URL or default to the main page?
2190
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2190
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2191 2191
 		// create the Save & Close and Save buttons
2192
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2192
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2193 2193
 		//if we have extra content set let's add it in if not make sure its empty
2194
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2194
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2195 2195
 
2196 2196
 
2197
-		if ( $delete && ! empty( $id )  ) {
2197
+		if ($delete && ! empty($id)) {
2198 2198
 			$delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent.
2199
-			$delete_link_args = array( $name => $id );
2200
-			$delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion');
2199
+			$delete_link_args = array($name => $id);
2200
+			$delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion');
2201 2201
 		}
2202 2202
 
2203
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2204
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2203
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2204
+		if ( ! empty($name) && ! empty($id)) {
2205 2205
 			$hidden_field_arr[$name] = array(
2206 2206
 				'type' => 'hidden',
2207 2207
 				'value' => $id
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 			$hf = '';
2212 2212
 		}
2213 2213
 		// add hidden field
2214
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2214
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2215 2215
 
2216 2216
 	}
2217 2217
 
@@ -2228,8 +2228,8 @@  discard block
 block discarded – undo
2228 2228
 		<noscript>
2229 2229
 			<div id="no-js-message" class="error">
2230 2230
 				<p style="font-size:1.3em;">
2231
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2232
-					<?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?>
2231
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2232
+					<?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?>
2233 2233
 				</p>
2234 2234
 			</div>
2235 2235
 		</noscript>
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
 	*		@return 		string
2250 2250
 	*/
2251 2251
 	private function _display_espresso_notices() {
2252
-		$notices = $this->_get_transient( TRUE );
2252
+		$notices = $this->_get_transient(TRUE);
2253 2253
 		echo stripslashes($notices);
2254 2254
 	}
2255 2255
 
@@ -2301,11 +2301,11 @@  discard block
 block discarded – undo
2301 2301
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2302 2302
 	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box.
2303 2303
 	 */
2304
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2305
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2304
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2305
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2306 2306
 
2307 2307
 		//if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2308
-		if ( empty( $callback_args ) && $create_func ) {
2308
+		if (empty($callback_args) && $create_func) {
2309 2309
 			$callback_args = array(
2310 2310
 				'template_path' => $this->_template_path,
2311 2311
 				'template_args' => $this->_template_args,
@@ -2315,7 +2315,7 @@  discard block
 block discarded – undo
2315 2315
 		//if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2316 2316
 		$call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback;
2317 2317
 
2318
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2318
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2319 2319
 	}
2320 2320
 
2321 2321
 
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
 	 */
2329 2329
 	public function display_admin_page_with_metabox_columns() {
2330 2330
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2331
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2331
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2332 2332
 
2333 2333
 		//the final wrapper
2334 2334
 		$this->admin_page_wrapper();
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
 	 * @return void
2372 2372
 	 */
2373 2373
 	public function display_about_admin_page() {
2374
-		$this->_display_admin_page( FALSE, TRUE );
2374
+		$this->_display_admin_page(FALSE, TRUE);
2375 2375
 	}
2376 2376
 
2377 2377
 
@@ -2387,26 +2387,26 @@  discard block
 block discarded – undo
2387 2387
 	 * @return html           admin_page
2388 2388
 	 */
2389 2389
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2390
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2390
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2391 2391
 
2392 2392
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2393
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2393
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2394 2394
 
2395 2395
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2396 2396
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2397 2397
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2398 2398
 
2399
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2399
+		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2400 2400
 
2401
-		if ( defined('DOING_AJAX' ) )
2402
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2401
+		if (defined('DOING_AJAX'))
2402
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2403 2403
 
2404
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2404
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2405 2405
 
2406
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2406
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2407 2407
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2408 2408
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2409
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2409
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2410 2410
 
2411 2411
 
2412 2412
 		// the final template wrapper
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
 	 * @param bool   $display_sidebar whether to use the sidebar template or the full template for the page.  TRUE = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2427 2427
 	 * @return void
2428 2428
 	 */
2429
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2429
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2430 2430
 		//let's generate a default preview action button if there isn't one already present.
2431 2431
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2432 2432
 		$buy_now_url = add_query_arg(
@@ -2439,10 +2439,10 @@  discard block
 block discarded – undo
2439 2439
 			),
2440 2440
 		'http://eventespresso.com/pricing/'
2441 2441
 		);
2442
-		$this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) ? $this->get_action_link_or_button( '', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true ) : $this->_template_args['preview_action_button'];
2443
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2444
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2445
-		$this->_display_admin_page( $display_sidebar );
2442
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) ? $this->get_action_link_or_button('', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true) : $this->_template_args['preview_action_button'];
2443
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2444
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2445
+		$this->_display_admin_page($display_sidebar);
2446 2446
 	}
2447 2447
 
2448 2448
 
@@ -2476,41 +2476,41 @@  discard block
 block discarded – undo
2476 2476
 	 * @param boolean $sidebar whether to display with sidebar or not.
2477 2477
 	 * @return html
2478 2478
 	 */
2479
-	private function _display_admin_list_table_page( $sidebar = false ) {
2479
+	private function _display_admin_list_table_page($sidebar = false) {
2480 2480
 		//setup search attributes
2481 2481
 		$this->_set_search_attributes();
2482 2482
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2483
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2483
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2484 2484
 
2485
-		$this->_template_args['table_url'] = defined( 'DOING_AJAX') ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url);
2485
+		$this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2486 2486
 		$this->_template_args['list_table'] = $this->_list_table_object;
2487 2487
 		$this->_template_args['current_route'] = $this->_req_action;
2488
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2488
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2489 2489
 
2490 2490
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2491
-		if( ! empty( $ajax_sorting_callback )) {
2492
-			$sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE );
2491
+		if ( ! empty($ajax_sorting_callback)) {
2492
+			$sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE);
2493 2493
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2494 2494
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2495
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2496
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2495
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2496
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2497 2497
 		} else {
2498 2498
 			$sortable_list_table_form_fields = '';
2499 2499
 		}
2500 2500
 
2501 2501
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2502
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2503
-		$nonce_ref = $this->_req_action . '_nonce';
2504
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2502
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2503
+		$nonce_ref = $this->_req_action.'_nonce';
2504
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2505 2505
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2506 2506
 
2507 2507
 		//display message about search results?
2508
-		$this->_template_args['before_list_table'] .= apply_filters( 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', !empty( $this->_req_data['s'] ) ? '<p class="ee-search-results">' . sprintf( __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%') ) . '</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action );
2508
+		$this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action);
2509 2509
 
2510
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2510
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2511 2511
 
2512 2512
 		// the final template wrapper
2513
-		if ( $sidebar )
2513
+		if ($sidebar)
2514 2514
 			$this->display_admin_page_with_sidebar();
2515 2515
 		else
2516 2516
 			$this->display_admin_page_with_no_sidebar();
@@ -2533,9 +2533,9 @@  discard block
 block discarded – undo
2533 2533
 	 * @param  array $items  see above for format of array
2534 2534
 	 * @return string        html string of legend
2535 2535
 	 */
2536
-	protected function _display_legend( $items ) {
2537
-		$this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2538
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2536
+	protected function _display_legend($items) {
2537
+		$this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2538
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2539 2539
 		return EEH_Template::display_template($legend_template, $this->_template_args, TRUE);
2540 2540
 	}
2541 2541
 
@@ -2560,33 +2560,33 @@  discard block
 block discarded – undo
2560 2560
 	 *
2561 2561
 	 * @return string json object
2562 2562
 	 */
2563
-	protected function _return_json( $sticky_notices = false ) {
2563
+	protected function _return_json($sticky_notices = false) {
2564 2564
 
2565 2565
 		//make sure any EE_Error notices have been handled.
2566
-		$this->_process_notices( array(), true, $sticky_notices );
2566
+		$this->_process_notices(array(), true, $sticky_notices);
2567 2567
 
2568 2568
 
2569
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2569
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2570 2570
 		unset($this->_template_args['data']);
2571 2571
 		$json = array(
2572
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false,
2573
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false,
2574
-			'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false,
2575
-			'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false,
2572
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2573
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2574
+			'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2575
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2576 2576
 			'notices' => EE_Error::get_notices(),
2577
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2578
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2577
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2578
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2579 2579
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2580 2580
 			);
2581 2581
 
2582 2582
 
2583 2583
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2584
-		if ( NULL === error_get_last() || ! headers_sent() )
2584
+		if (NULL === error_get_last() || ! headers_sent())
2585 2585
 			header('Content-Type: application/json; charset=UTF-8');
2586
-                if( function_exists( 'wp_json_encode' ) ) {
2587
-                    echo wp_json_encode( $json );
2586
+                if (function_exists('wp_json_encode')) {
2587
+                    echo wp_json_encode($json);
2588 2588
                 } else {
2589
-                    echo json_encode( $json );
2589
+                    echo json_encode($json);
2590 2590
                 }
2591 2591
 		exit();
2592 2592
 	}
@@ -2598,11 +2598,11 @@  discard block
 block discarded – undo
2598 2598
 	 * @return json_obj|EE_Error
2599 2599
 	 */
2600 2600
 	public function return_json() {
2601
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2601
+		if (defined('DOING_AJAX') && DOING_AJAX)
2602 2602
 			$this->_return_json();
2603 2603
 
2604 2604
 		else {
2605
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2605
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2606 2606
 		}
2607 2607
 	}
2608 2608
 
@@ -2617,7 +2617,7 @@  discard block
 block discarded – undo
2617 2617
 	 * @access public
2618 2618
 	 * @return void
2619 2619
 	 */
2620
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2620
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2621 2621
 		$this->_hook_obj = $hook_obj;
2622 2622
 	}
2623 2623
 
@@ -2633,33 +2633,33 @@  discard block
 block discarded – undo
2633 2633
 	*/
2634 2634
 	public function admin_page_wrapper($about = FALSE) {
2635 2635
 
2636
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2636
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2637 2637
 
2638 2638
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2639 2639
 
2640 2640
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2641 2641
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2642 2642
 
2643
-		$this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : '');
2644
-		$this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : '');
2643
+		$this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '');
2644
+		$this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '');
2645 2645
 
2646 2646
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2647 2647
 
2648 2648
 
2649 2649
 
2650 2650
 		// load settings page wrapper template
2651
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2651
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2652 2652
 
2653 2653
 		//about page?
2654 2654
 		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2655 2655
 
2656 2656
 
2657
-		if ( defined( 'DOING_AJAX' ) ) {
2658
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2657
+		if (defined('DOING_AJAX')) {
2658
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2659 2659
 
2660 2660
 			$this->_return_json();
2661 2661
 		} else {
2662
-			EEH_Template::display_template( $template_path, $this->_template_args );
2662
+			EEH_Template::display_template($template_path, $this->_template_args);
2663 2663
 		}
2664 2664
 
2665 2665
 	}
@@ -2687,7 +2687,7 @@  discard block
 block discarded – undo
2687 2687
 	*		@access public
2688 2688
 	*		@return void
2689 2689
 	*/
2690
-	private function _sort_nav_tabs( $a, $b ) {
2690
+	private function _sort_nav_tabs($a, $b) {
2691 2691
 		if ($a['order'] == $b['order']) {
2692 2692
 	        return 0;
2693 2693
 	    }
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2709 2709
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2710 2710
 	 */
2711
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2711
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2712 2712
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2713 2713
 		return $content;
2714 2714
 	}
@@ -2730,25 +2730,25 @@  discard block
 block discarded – undo
2730 2730
 	 * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button).  We can also use this to just dump default actions by submitting some other value.
2731 2731
 	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling).
2732 2732
 	 */
2733
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2733
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2734 2734
 		//make sure $text and $actions are in an array
2735 2735
 		$text = (array) $text;
2736 2736
 		$actions = (array) $actions;
2737 2737
 		$referrer_url = empty($referrer) ? '' : $referrer;
2738
-		$referrer_url = !$referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />';
2738
+		$referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />';
2739 2739
 
2740
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2741
-		$default_names = array( 'save', 'save_and_close' );
2740
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2741
+		$default_names = array('save', 'save_and_close');
2742 2742
 
2743 2743
 		//add in a hidden index for the current page (so save and close redirects properly)
2744 2744
 		$this->_template_args['save_buttons'] = $referrer_url;
2745 2745
 
2746
-		foreach ( $button_text as $key => $button ) {
2746
+		foreach ($button_text as $key => $button) {
2747 2747
 			$ref = $default_names[$key];
2748
-			$id = $this->_current_view . '_' . $ref;
2749
-			$name = !empty($actions) ? $actions[$key] : $ref;
2750
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2751
-			if ( !$both ) break;
2748
+			$id = $this->_current_view.'_'.$ref;
2749
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2750
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2751
+			if ( ! $both) break;
2752 2752
 		}
2753 2753
 
2754 2754
 	}
@@ -2761,8 +2761,8 @@  discard block
 block discarded – undo
2761 2761
 	 * @since 4.6.0
2762 2762
 	 *
2763 2763
 	 */
2764
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2765
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2764
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2765
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2766 2766
 	}
2767 2767
 
2768 2768
 
@@ -2775,30 +2775,30 @@  discard block
 block discarded – undo
2775 2775
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2776 2776
 	 * @return void
2777 2777
 	 */
2778
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2778
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2779 2779
 
2780
-		if ( empty( $route )) {
2780
+		if (empty($route)) {
2781 2781
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2782
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2783
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2782
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2783
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2784 2784
 		}
2785 2785
 		// open form
2786
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2786
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2787 2787
 		// add nonce
2788
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2788
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2789 2789
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2790
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2790
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2791 2791
 		// add REQUIRED form action
2792 2792
 		$hidden_fields = array(
2793
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2793
+				'action' => array('type' => 'hidden', 'value' => $route),
2794 2794
 			);
2795 2795
 		// merge arrays
2796
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2796
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2797 2797
 		// generate form fields
2798
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2798
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2799 2799
 		// add fields to form
2800
-		foreach ( $form_fields as $field_name => $form_field ) {
2801
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2800
+		foreach ($form_fields as $field_name => $form_field) {
2801
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2802 2802
 		}
2803 2803
 
2804 2804
 		// close form
@@ -2815,8 +2815,8 @@  discard block
 block discarded – undo
2815 2815
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2816 2816
 	 * @since 4.5.0
2817 2817
 	 */
2818
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2819
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2818
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2819
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2820 2820
 	}
2821 2821
 
2822 2822
 
@@ -2832,32 +2832,32 @@  discard block
 block discarded – undo
2832 2832
 	 *	@access protected
2833 2833
 	 *	@return void
2834 2834
 	 */
2835
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2835
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2836 2836
 
2837
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2837
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2838 2838
 
2839 2839
 		//class name for actions/filters.
2840 2840
 		$classname = get_class($this);
2841 2841
 
2842 2842
 		//set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url
2843
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2844
-		$notices = EE_Error::get_notices( FALSE );
2843
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2844
+		$notices = EE_Error::get_notices(FALSE);
2845 2845
 
2846 2846
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2847
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2847
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2848 2848
 			EE_Error::overwrite_success();
2849 2849
 		}
2850 2850
 		// how many records affected ? more than one record ? or just one ?
2851
-		if ( $success > 1 && empty( $notices['errors'] )) {
2851
+		if ($success > 1 && empty($notices['errors'])) {
2852 2852
 			// set plural msg
2853
-			EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__);
2854
-		} else if ( $success == 1 && empty( $notices['errors'] )) {
2853
+			EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2854
+		} else if ($success == 1 && empty($notices['errors'])) {
2855 2855
 			// set singular msg
2856
-			EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ );
2856
+			EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2857 2857
 		}
2858 2858
 
2859 2859
 		// check that $query_args isn't something crazy
2860
-		if ( ! is_array( $query_args )) {
2860
+		if ( ! is_array($query_args)) {
2861 2861
 			$query_args = array();
2862 2862
 		}
2863 2863
 
@@ -2870,36 +2870,36 @@  discard block
 block discarded – undo
2870 2870
 		 * @param array $query_args   The original query_args array coming into the
2871 2871
 		 *                          		method.
2872 2872
 		 */
2873
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2873
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2874 2874
 
2875 2875
 		//calculate where we're going (if we have a "save and close" button pushed)
2876
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2876
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2877 2877
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2878
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2878
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2879 2879
 			// regenerate query args array from refferer URL
2880
-			parse_str( $parsed_url['query'], $query_args );
2880
+			parse_str($parsed_url['query'], $query_args);
2881 2881
 			// correct page and action will be in the query args now
2882
-			$redirect_url = admin_url( 'admin.php' );
2882
+			$redirect_url = admin_url('admin.php');
2883 2883
 		}
2884 2884
 
2885 2885
 		//merge any default query_args set in _default_route_query_args property
2886
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2886
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2887 2887
 			$args_to_merge = array();
2888
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2888
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2889 2889
 				//is there a wp_referer array in our _default_route_query_args property?
2890
-				if ( $query_param == 'wp_referer'  ) {
2890
+				if ($query_param == 'wp_referer') {
2891 2891
 					$query_value = (array) $query_value;
2892
-					foreach ( $query_value as $reference => $value ) {
2893
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2892
+					foreach ($query_value as $reference => $value) {
2893
+						if (strpos($reference, 'nonce') !== false) {
2894 2894
 							continue;
2895 2895
 						}
2896 2896
 
2897 2897
 						//finally we will override any arguments in the referer with
2898 2898
 						//what might be set on the _default_route_query_args array.
2899
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2900
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2899
+						if (isset($this->_default_route_query_args[$reference])) {
2900
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2901 2901
 						} else {
2902
-							$args_to_merge[$reference] = urlencode( $value );
2902
+							$args_to_merge[$reference] = urlencode($value);
2903 2903
 						}
2904 2904
 					}
2905 2905
 					continue;
@@ -2910,7 +2910,7 @@  discard block
 block discarded – undo
2910 2910
 
2911 2911
 			//now let's merge these arguments but override with what was specifically sent in to the
2912 2912
 			//redirect.
2913
-			$query_args = array_merge( $args_to_merge, $query_args );
2913
+			$query_args = array_merge($args_to_merge, $query_args);
2914 2914
 		}
2915 2915
 
2916 2916
 		$this->_process_notices($query_args);
@@ -2919,19 +2919,19 @@  discard block
 block discarded – undo
2919 2919
 		// generate redirect url
2920 2920
 
2921 2921
 		// if redirecting to anything other than the main page, add a nonce
2922
-		if ( isset( $query_args['action'] )) {
2922
+		if (isset($query_args['action'])) {
2923 2923
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
2924
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
2924
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
2925 2925
 		}
2926 2926
 
2927 2927
 		//we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that).
2928
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
2928
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
2929 2929
 
2930
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
2930
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
2931 2931
 
2932 2932
 
2933 2933
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
2934
-		if ( defined('DOING_AJAX' ) ) {
2934
+		if (defined('DOING_AJAX')) {
2935 2935
 			$default_data = array(
2936 2936
 				'close' => TRUE,
2937 2937
 				'redirect_url' => $redirect_url,
@@ -2940,11 +2940,11 @@  discard block
 block discarded – undo
2940 2940
 				);
2941 2941
 
2942 2942
 			$this->_template_args['success'] = $success;
2943
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
2943
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
2944 2944
 			$this->_return_json();
2945 2945
 		}
2946 2946
 
2947
-		wp_safe_redirect( $redirect_url );
2947
+		wp_safe_redirect($redirect_url);
2948 2948
 		exit();
2949 2949
 	}
2950 2950
 
@@ -2960,30 +2960,30 @@  discard block
 block discarded – undo
2960 2960
 	 * @param bool    $sticky_notices      This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice.
2961 2961
 	 * @return void
2962 2962
 	 */
2963
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
2963
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
2964 2964
 
2965 2965
 		//first let's set individual error properties if doing_ajax and the properties aren't already set.
2966
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
2967
-			$notices = EE_Error::get_notices( false );
2968
-			if ( empty( $this->_template_args['success'] ) ) {
2969
-				$this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false;
2966
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2967
+			$notices = EE_Error::get_notices(false);
2968
+			if (empty($this->_template_args['success'])) {
2969
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
2970 2970
 			}
2971 2971
 
2972
-			if ( empty( $this->_template_args['errors'] ) ) {
2973
-				$this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false;
2972
+			if (empty($this->_template_args['errors'])) {
2973
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
2974 2974
 			}
2975 2975
 
2976
-			if ( empty( $this->_template_args['attention'] ) ) {
2977
-				$this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false;
2976
+			if (empty($this->_template_args['attention'])) {
2977
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
2978 2978
 			}
2979 2979
 		}
2980 2980
 
2981 2981
 		$this->_template_args['notices'] = EE_Error::get_notices();
2982 2982
 
2983 2983
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
2984
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
2985
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
2986
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
2984
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
2985
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
2986
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
2987 2987
 		}
2988 2988
 	}
2989 2989
 
@@ -3005,32 +3005,32 @@  discard block
 block discarded – undo
3005 3005
 	 *
3006 3006
 	 * @return string html for button
3007 3007
 	 */
3008
-	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
3008
+	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) {
3009 3009
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3010
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
3011
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3010
+		if ( ! isset($this->_page_routes[$action]) && ! $base_url)
3011
+			throw new EE_Error(sprintf(__('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action));
3012 3012
 
3013
-		if ( !isset( $this->_labels['buttons'][$type] ) )
3014
-			throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) );
3013
+		if ( ! isset($this->_labels['buttons'][$type]))
3014
+			throw new EE_Error(sprintf(__('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type));
3015 3015
 
3016 3016
 		//finally check user access for this button.
3017
-		$has_access = $this->check_user_access( $action, TRUE );
3018
-		if ( ! $has_access ) {
3017
+		$has_access = $this->check_user_access($action, TRUE);
3018
+		if ( ! $has_access) {
3019 3019
 			return '';
3020 3020
 		}
3021 3021
 
3022
-		$_base_url = !$base_url ? $this->_admin_base_url : $base_url;
3022
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3023 3023
 
3024 3024
 		$query_args = array(
3025 3025
 			'action' => $action  );
3026 3026
 
3027 3027
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3028
-		if ( !empty($extra_request) )
3029
-			$query_args = array_merge( $extra_request, $query_args );
3028
+		if ( ! empty($extra_request))
3029
+			$query_args = array_merge($extra_request, $query_args);
3030 3030
 
3031
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3031
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3032 3032
 
3033
-		$button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class );
3033
+		$button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3034 3034
 
3035 3035
 		return $button;
3036 3036
 	}
@@ -3050,11 +3050,11 @@  discard block
 block discarded – undo
3050 3050
 		$args = array(
3051 3051
 			'label' => $this->_admin_page_title,
3052 3052
 			'default' => 10,
3053
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3053
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3054 3054
 			);
3055 3055
 		//ONLY add the screen option if the user has access to it.
3056
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3057
-			add_screen_option( $option, $args );
3056
+		if ($this->check_user_access($this->_current_view, true)) {
3057
+			add_screen_option($option, $args);
3058 3058
 		}
3059 3059
 	}
3060 3060
 
@@ -3070,36 +3070,36 @@  discard block
 block discarded – undo
3070 3070
 	 * @return void
3071 3071
 	 */
3072 3072
 	private function _set_per_page_screen_options() {
3073
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3074
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3073
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3074
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3075 3075
 
3076
-			if ( !$user = wp_get_current_user() )
3076
+			if ( ! $user = wp_get_current_user())
3077 3077
 			return;
3078 3078
 			$option = $_POST['wp_screen_options']['option'];
3079 3079
 			$value = $_POST['wp_screen_options']['value'];
3080 3080
 
3081
-			if ( $option != sanitize_key( $option ) )
3081
+			if ($option != sanitize_key($option))
3082 3082
 				return;
3083 3083
 
3084 3084
 			$map_option = $option;
3085 3085
 
3086 3086
 			$option = str_replace('-', '_', $option);
3087 3087
 
3088
-			switch ( $map_option ) {
3089
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3088
+			switch ($map_option) {
3089
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3090 3090
 					$value = (int) $value;
3091
-					if ( $value < 1 || $value > 999 )
3091
+					if ($value < 1 || $value > 999)
3092 3092
 						return;
3093 3093
 					break;
3094 3094
 				default:
3095
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3096
-					if ( false === $value )
3095
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3096
+					if (false === $value)
3097 3097
 						return;
3098 3098
 					break;
3099 3099
 			}
3100 3100
 
3101 3101
 			update_user_meta($user->ID, $option, $value);
3102
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3102
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3103 3103
 			exit;
3104 3104
 		}
3105 3105
 	}
@@ -3110,8 +3110,8 @@  discard block
 block discarded – undo
3110 3110
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3111 3111
 	 * @param array $data array that will be assigned to template args.
3112 3112
 	 */
3113
-	public function set_template_args( $data ) {
3114
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3113
+	public function set_template_args($data) {
3114
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3115 3115
 	}
3116 3116
 
3117 3117
 
@@ -3127,26 +3127,26 @@  discard block
 block discarded – undo
3127 3127
 	 * @param bool $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used when we are adding a transient before page_routes have been defined.
3128 3128
 	 * @return void
3129 3129
 	 */
3130
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3130
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3131 3131
 		$user_id = get_current_user_id();
3132 3132
 
3133
-		if ( !$skip_route_verify )
3133
+		if ( ! $skip_route_verify)
3134 3134
 			$this->_verify_route($route);
3135 3135
 
3136 3136
 
3137 3137
 		//now let's set the string for what kind of transient we're setting
3138
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3139
-		$data = $notices ? array( 'notices' => $data ) : $data;
3138
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3139
+		$data = $notices ? array('notices' => $data) : $data;
3140 3140
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3141
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3142
-		if ( $existing ) {
3143
-			$data = array_merge( (array) $data, (array) $existing );
3141
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3142
+		if ($existing) {
3143
+			$data = array_merge((array) $data, (array) $existing);
3144 3144
 		}
3145 3145
 
3146
-		if ( is_multisite() && is_network_admin() ) {
3147
-			set_site_transient( $transient, $data, 8 );
3146
+		if (is_multisite() && is_network_admin()) {
3147
+			set_site_transient($transient, $data, 8);
3148 3148
 		} else {
3149
-			set_transient( $transient, $data, 8 );
3149
+			set_transient($transient, $data, 8);
3150 3150
 		}
3151 3151
 	}
3152 3152
 
@@ -3158,18 +3158,18 @@  discard block
 block discarded – undo
3158 3158
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3159 3159
 	 * @return mixed data
3160 3160
 	 */
3161
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3161
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3162 3162
 		$user_id = get_current_user_id();
3163
-		$route = !$route ? $this->_req_action : $route;
3164
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3165
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3163
+		$route = ! $route ? $this->_req_action : $route;
3164
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3165
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3166 3166
 		//delete transient after retrieval (just in case it hasn't expired);
3167
-		if ( is_multisite() && is_network_admin() ) {
3168
-			delete_site_transient( $transient );
3167
+		if (is_multisite() && is_network_admin()) {
3168
+			delete_site_transient($transient);
3169 3169
 		} else {
3170
-			delete_transient( $transient );
3170
+			delete_transient($transient);
3171 3171
 		}
3172
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3172
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3173 3173
 	}
3174 3174
 
3175 3175
 
@@ -3186,12 +3186,12 @@  discard block
 block discarded – undo
3186 3186
 
3187 3187
 		//retrieve all existing transients
3188 3188
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3189
-		if ( $results = $wpdb->get_results( $query ) ) {
3190
-			foreach ( $results as $result ) {
3191
-				$transient = str_replace( '_transient_', '', $result->option_name );
3192
-				get_transient( $transient );
3193
-				if ( is_multisite() && is_network_admin() ) {
3194
-					get_site_transient( $transient );
3189
+		if ($results = $wpdb->get_results($query)) {
3190
+			foreach ($results as $result) {
3191
+				$transient = str_replace('_transient_', '', $result->option_name);
3192
+				get_transient($transient);
3193
+				if (is_multisite() && is_network_admin()) {
3194
+					get_site_transient($transient);
3195 3195
 				}
3196 3196
 			}
3197 3197
 		}
@@ -3315,23 +3315,23 @@  discard block
 block discarded – undo
3315 3315
 	 * @param string $line	line no where error occurred
3316 3316
 	 * @return boolean
3317 3317
 	 */
3318
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3318
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3319 3319
 
3320 3320
 		//remove any options that are NOT going to be saved with the config settings.
3321
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3321
+		if (isset($config->core->ee_ueip_optin)) {
3322 3322
 			$config->core->ee_ueip_has_notified = TRUE;
3323 3323
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3324
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3325
-			update_option( 'ee_ueip_has_notified', TRUE );
3324
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3325
+			update_option('ee_ueip_has_notified', TRUE);
3326 3326
 		}
3327 3327
 		// and save it (note we're also doing the network save here)
3328
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3329
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3330
-		if ( $config_saved && $net_saved ) {
3331
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3328
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3329
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3330
+		if ($config_saved && $net_saved) {
3331
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3332 3332
 			return TRUE;
3333 3333
 		} else {
3334
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3334
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3335 3335
 			return FALSE;
3336 3336
 		}
3337 3337
 	}
@@ -3344,7 +3344,7 @@  discard block
 block discarded – undo
3344 3344
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3345 3345
 	 * @return array
3346 3346
 	 */
3347
-	public function get_yes_no_values(){
3347
+	public function get_yes_no_values() {
3348 3348
 		return $this->_yes_no_values;
3349 3349
 	}
3350 3350
 
@@ -3366,8 +3366,8 @@  discard block
 block discarded – undo
3366 3366
 	 *
3367 3367
 	 * @return string
3368 3368
 	 */
3369
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3370
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3369
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3370
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3371 3371
 	}
3372 3372
 
3373 3373
 
@@ -3381,8 +3381,8 @@  discard block
 block discarded – undo
3381 3381
 	 *
3382 3382
 	 * @return string
3383 3383
 	 */
3384
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3385
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3384
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3385
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3386 3386
 	}
3387 3387
 
3388 3388
 
@@ -3401,8 +3401,8 @@  discard block
 block discarded – undo
3401 3401
 	 * @return bool success/fail
3402 3402
 	 */
3403 3403
 	protected function _process_resend_registration() {
3404
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3405
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3404
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3405
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3406 3406
 		return $this->_template_args['success'];
3407 3407
 	}
3408 3408
 
@@ -3415,11 +3415,11 @@  discard block
 block discarded – undo
3415 3415
 	 * @param \EE_Payment $payment
3416 3416
 	 * @return bool success/fail
3417 3417
 	 */
3418
-	protected function _process_payment_notification( EE_Payment $payment ) {
3419
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3420
-		do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment );
3421
-		$this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment );
3422
-		return $this->_template_args[ 'success' ];
3418
+	protected function _process_payment_notification(EE_Payment $payment) {
3419
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3420
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3421
+		$this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment);
3422
+		return $this->_template_args['success'];
3423 3423
 	}
3424 3424
 
3425 3425
 
Please login to merge, or discard this patch.